azure-cli
Version:
Microsoft Azure Cross Platform Command Line tool
880 lines (436 loc) • 117 kB
JavaScript
/*** Generated by streamline 0.10.17 (callbacks) - DO NOT EDIT ***/ "use strict"; var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename, false),__func=__rt.__func,__cb=__rt.__cb; var fs = require("fs");
var jsonpatch = require("fast-json-patch");
var profile = require("../../../util/profile");
var utils = require("../../../util/utils");
var $ = utils.getLocaleString;
function beautify(jsonText) {
var obj = JSON.parse(jsonText);
return JSON.stringify(obj, null, 2);};
function capitalize(str) {
if ((str && (str.length >= 1))) {
return (str.charAt(0).toUpperCase() + str.slice(1)); }
else {
return str; } ;};
function makeTuple(k, v, d) {
return { key: k, value: v, depth: d };};
function displayImpl(o, key, depth, arr) {
if (((!!o) && (((o.constructor === Object) || (o.constructor === Array))))) {
arr.push(makeTuple(key, "", depth));
var len = 0;
Object.keys(o).forEach(function(k1) {
var v1 = o[k1];
var p1 = ((o.constructor === Array) ? "#" : "");
var w = displayImpl(v1, (p1 + k1), (depth + 1), arr);
if ((w > len)) {
len = w; } ; });
return len; }
else {
arr.push(makeTuple(key, (o ? o.toString() : ""), depth));
return ((depth * 2) + ((key ? key.toString().length : 0))); } ;};
function display(cli, o) {
var arr = [];
var width = displayImpl(o, "", 0, arr);
for (var t in arr) {
var prebuf = new Array((arr[t].depth * 2)).join(" ");
var key = (arr[t].key ? arr[t].key : "");
var postLen = (width - ((prebuf.length + key.length)));
var postbuf = new Array(((postLen > 0) ? postLen : 0)).join(" ");
var str = ((prebuf + capitalize(key)) + postbuf);
if (arr[t].value) {
str += (" : " + arr[t].value); } ;
cli.output.data(str); };};
exports.init = function(cli) {
var imagesCreateOrUpdate = cli.category("managed-image").description($("Commands to manage your images. "));
imagesCreateOrUpdate.command("create [resource-group] [name] [parameters]").description($("Create or update an image.")).usage("[options] <resource-group> <name> <parameters>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("-p, --parameters <parameters>", $("A string of parameters in JSON format")).option("--parameter-file <parameter-file>", $("The text file that contains input parameter object in JSON format")).option("-s, --subscription <subscription>", $("The subscription identifier")).execute(function __1(resourceGroup, name, parameters, options, _) { var parametersObj, fileContent, subscription, computeManagementClient, result; var __frame = { name: "__1", line: 306 }; return __func(_, this, arguments, __1, 4, __frame, function __$__1() { return (function __$__1(__then) {
if (!resourceGroup) {
return cli.interaction.promptIfNotGiven($("resource-group : "), resourceGroup, __cb(_, __frame, 2, 38, function ___(__0, __1) { resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__1() {
cli.output.verbose(("resourceGroup = " + resourceGroup)); return (function __$__1(__then) {
if (!name) {
return cli.interaction.promptIfNotGiven($("name : "), name, __cb(_, __frame, 7, 29, function ___(__0, __2) { name = __2; __then(); }, true)); } else { __then(); } ; })(function __$__1() {
cli.output.verbose(("name = " + name));
cli.output.verbose(("parameters = " + parameters));
parametersObj = null;
if (options.parameterFile) {
cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\""));
fileContent = fs.readFileSync(options.parameterFile, "utf8");
parametersObj = JSON.parse(fileContent); }
else {
parametersObj = JSON.parse(parameters); } ;
cli.output.verbose(("parametersObj = " + JSON.stringify(parametersObj)));
subscription = profile.current.getSubscription(options.subscription);
computeManagementClient = utils.createComputeManagementClient(subscription);
return computeManagementClient.images.createOrUpdate(resourceGroup, name, parametersObj, __cb(_, __frame, 24, 48, function ___(__0, __3) { result = __3;
if (result) {
cli.output.json(result); } ; _(); }, true)); }); }); }); });
var imagesCreateOrUpdatecreateOrUpdateParameters2 = imagesCreateOrUpdate.category("config").description($("Commands to manage configuration of images in the parameter file."));
imagesCreateOrUpdatecreateOrUpdateParameters2.command("create").description($("Generate imagesCreateOrUpdate parameter string or files.")).usage("[options]").option("--parameter-file <parameter-file>", $("The parameter file path.")).execute(function __2(options, _) { var filePath; var __frame = { name: "__2", line: 341 }; return __func(_, this, arguments, __2, 1, __frame, function __$__2() {
return cli.output.verbose("{\"sourceVirtualMachine\":{\"id\":\"\"},\"storageProfile\":{\"osDisk\":{\"osType\":\"\",\"osState\":\"\",\"snapshot\":{\"id\":\"\"},\"managedDisk\":{\"id\":\"\"},\"blobUri\":\"\",\"caching\":null,\"diskSizeGB\":null,\"storageAccountType\":null},\"dataDisks\":[{\"lun\":\"\",\"snapshot\":{\"id\":\"\"},\"managedDisk\":{\"id\":\"\"},\"blobUri\":\"\",\"caching\":null,\"diskSizeGB\":null,\"storageAccountType\":null}]},\"provisioningState\":\"\",\"id\":null,\"name\":null,\"type\":null,\"location\":\"\",\"tags\":{}}", __cb(_, __frame, 1, 15, function __$__2() {
filePath = "imagesCreateOrUpdate_createOrUpdate.json";
if (options.parameterFile) {
filePath = options.parameterFile; } ;
fs.writeFileSync(filePath, beautify("{\r\n\"sourceVirtualMachine\":{\r\n\"id\":\"\"\r\n},\r\n\"storageProfile\":{\r\n\"osDisk\":{\r\n\"osType\":\"\",\r\n\"osState\":\"\",\r\n\"snapshot\":{\r\n\"id\":\"\"\r\n},\r\n\"managedDisk\":{\r\n\"id\":\"\"\r\n},\r\n\"blobUri\":\"\",\r\n\"caching\":null,\r\n\"diskSizeGB\":null,\r\n\"storageAccountType\":null\r\n},\r\n\"dataDisks\":[\r\n{\r\n\"lun\":\"\",\r\n\"snapshot\":{\r\n\"id\":\"\"\r\n},\r\n\"managedDisk\":{\r\n\"id\":\"\"\r\n},\r\n\"blobUri\":\"\",\r\n\"caching\":null,\r\n\"diskSizeGB\":null,\r\n\"storageAccountType\":null\r\n}\r\n]\r\n},\r\n\"provisioningState\":\"\",\r\n\"id\":null,\r\n\"name\":null,\r\n\"type\":null,\r\n\"location\":\"\",\r\n\"tags\":{\r\n}\r\n}"));
cli.output.verbose("=====================================");
cli.output.verbose(("Parameter file output to: " + filePath));
cli.output.verbose("====================================="); _(); }, true)); }); });
imagesCreateOrUpdatecreateOrUpdateParameters2.command("patch").description($("Command to patch imagesCreateOrUpdate parameter JSON file.")).usage("[options]").option("--parameter-file <parameter-file>", $("The parameter file path.")).option("--operation <operation>", $("The JSON patch operation: add, remove, or replace.")).option("--path <path>", $("The JSON data path, e.g.: \"foo/1\".")).option("--value <value>", $("The JSON value.")).option("--parse", $("Parse the JSON value to object.")).execute(function __3(options, _) { var fileContent, parametersObj, updatedContent; var __frame = { name: "__3", line: 361 }; return __func(_, this, arguments, __3, 1, __frame, function __$__3() {
return cli.output.verbose(options.parameterFile, __cb(_, __frame, 1, 15, function __$__3() {
cli.output.verbose(options.operation);
cli.output.verbose(options.path);
cli.output.verbose(options.value);
cli.output.verbose(options.parse);
if (options.parse) {
options.value = JSON.parse(options.value); } ;
cli.output.verbose(options.value);
cli.output.verbose("=====================================");
cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\""));
cli.output.verbose("=====================================");
fileContent = fs.readFileSync(options.parameterFile, "utf8");
parametersObj = JSON.parse(fileContent);
cli.output.verbose("JSON object:");
cli.output.verbose(JSON.stringify(parametersObj));
if ((options.operation == "add")) {
jsonpatch.apply(parametersObj, [{ op: options.operation, path: options.path, value: options.value },]); } else {
if ((options.operation == "remove")) {
jsonpatch.apply(parametersObj, [{ op: options.operation, path: options.path },]); } else {
if ((options.operation == "replace")) {
jsonpatch.apply(parametersObj, [{ op: options.operation, path: options.path, value: options.value },]); } ; } ; } ;
updatedContent = JSON.stringify(parametersObj);
cli.output.verbose("=====================================");
cli.output.verbose("JSON object (updated):");
cli.output.verbose(JSON.stringify(parametersObj));
cli.output.verbose("=====================================");
fs.writeFileSync(options.parameterFile, beautify(updatedContent));
cli.output.verbose("=====================================");
cli.output.verbose(("Parameter file updated at: " + options.parameterFile));
cli.output.verbose("====================================="); _(); }, true)); }); });
var catparametersCreateOrUpdateImagesImage01 = cli.category("managed-image");
var parametersCreateOrUpdateImagesImage01 = catparametersCreateOrUpdateImagesImage01.category("config").description($("Commands to manage configuration of images in the parameter file."));
var setparametersCreateOrUpdateImagesImage01 = parametersCreateOrUpdateImagesImage01.category("image").description($("Commands to configure image of managed-image in config file."));
setparametersCreateOrUpdateImagesImage01.command("set").description($("Set image in config string or files, e.g. \r\n{\r\n \"sourceVirtualMachine\":{\r\n \"id\":\"\"\r\n },\r\n \"storageProfile\":{\r\n \"osDisk\":{\r\n \"osType\":\"\",\r\n \"osState\":\"\",\r\n \"snapshot\":{\r\n \"id\":\"\"\r\n },\r\n \"managedDisk\":{\r\n \"id\":\"\"\r\n },\r\n \"blobUri\":\"\",\r\n \"caching\":null,\r\n \"diskSizeGB\":null,\r\n \"storageAccountType\":null\r\n },\r\n \"dataDisks\":[\r\n {\r\n \"lun\":\"\",\r\n \"snapshot\":{\r\n \"id\":\"\"\r\n },\r\n \"managedDisk\":{\r\n \"id\":\"\"\r\n },\r\n \"blobUri\":\"\",\r\n \"caching\":null,\r\n \"diskSizeGB\":null,\r\n \"storageAccountType\":null\r\n }\r\n ]\r\n },\r\n \"provisioningState\":\"\",\r\n \"id\":null,\r\n \"name\":null,\r\n \"type\":null,\r\n \"location\":\"\",\r\n \"tags\":{\r\n }\r\n}\r\n There are two sets of commands:\r\n 1) function commands that are used to manage Azure resources in the cloud, and \r\n 2) parameter commands that generate & edit input files for the other set of commands.\r\n For example, 'vmss show/list/stop' are the function commands that call get, list and stop operations of \r\n virtual machine scale set, whereas 'vmss config * generate/create/set/delete/add' commands \r\n are used to configure the input parameter file. The 'vmss config' command takes a parameter \r\n file as for the VM scale set configuration, and creates it online.")).usage("[options]").option("--parameter-file <parameter-file>", $("The parameter file path.")).option("--parse", $("Parse the input string, i.e. str, for parameters to a JSON object, e.g. JSON.parse(str).")).option("--source-virtual-machine <sourceVirtualMachine>", $("Set the source-virtual-machine value.")).option("--storage-profile <storageProfile>", $("Set the storage-profile value.")).option("--provisioning-state <provisioningState>", $("Set the provisioning-state value.")).option("--id <id>", $("Set the id value.")).option("--name <name>", $("Set the name value.")).option("--type <type>", $("Set the type value.")).option("--location <location>", $("Set the location value.")).option("--tags <tags>", $("Set the tags value.")).execute(function __4(options, _) { var fileContent, parametersObj, error, paramPath, updatedContent; var __frame = { name: "__4", line: 417 }; return __func(_, this, arguments, __4, 1, __frame, function __$__4() {
return cli.output.verbose(JSON.stringify(options), __cb(_, __frame, 1, 15, function __$__4() { return (function __$__4(__then) {
if (!options.parameterFile) {
return cli.interaction.promptIfNotGiven($("parameter-file : "), options.parameterFile, __cb(_, __frame, 3, 46, function ___(__0, __1) { options.parameterFile = __1; __then(); }, true)); } else { __then(); } ; })(function __$__4() {
cli.output.verbose("=====================================");
cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\""));
cli.output.verbose("=====================================");
fileContent = fs.readFileSync(options.parameterFile, "utf8");
parametersObj = JSON.parse(fileContent);
cli.output.verbose("JSON object:");
cli.output.verbose(JSON.stringify(parametersObj));
options.operation = "replace";
options.path = "";
error = jsonpatch.validate([{ op: "remove", path: options.path },], parametersObj);
if ((typeof error !== "undefined")) {
jsonpatch.apply(parametersObj, [{ op: "add", path: options.path, value: { } },]); } ;
paramPath = ((options.path + "/") + "sourceVirtualMachine");
if (options.sourceVirtualMachine) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.sourceVirtualMachine));
cli.output.verbose("================================================");
if ((options.parse && options.sourceVirtualMachine)) {
options.sourceVirtualMachine = JSON.parse(options.sourceVirtualMachine); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.sourceVirtualMachine },]); } ;
paramPath = ((options.path + "/") + "storageProfile");
if (options.storageProfile) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.storageProfile));
cli.output.verbose("================================================");
if ((options.parse && options.storageProfile)) {
options.storageProfile = JSON.parse(options.storageProfile); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.storageProfile },]); } ;
paramPath = ((options.path + "/") + "provisioningState");
if (options.provisioningState) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.provisioningState));
cli.output.verbose("================================================");
if ((options.parse && options.provisioningState)) {
options.provisioningState = JSON.parse(options.provisioningState); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.provisioningState },]); } ;
paramPath = ((options.path + "/") + "id");
if (options.id) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.id));
cli.output.verbose("================================================");
if ((options.parse && options.id)) {
options.id = JSON.parse(options.id); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.id },]); } ;
paramPath = ((options.path + "/") + "name");
if (options.name) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.name));
cli.output.verbose("================================================");
if ((options.parse && options.name)) {
options.name = JSON.parse(options.name); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.name },]); } ;
paramPath = ((options.path + "/") + "type");
if (options.type) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.type));
cli.output.verbose("================================================");
if ((options.parse && options.type)) {
options.type = JSON.parse(options.type); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.type },]); } ;
paramPath = ((options.path + "/") + "location");
if (options.location) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.location));
cli.output.verbose("================================================");
if ((options.parse && options.location)) {
options.location = JSON.parse(options.location); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.location },]); } ;
paramPath = ((options.path + "/") + "tags");
if (options.tags) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.tags));
cli.output.verbose("================================================");
if ((options.parse && options.tags)) {
options.tags = JSON.parse(options.tags); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.tags },]); } ;
updatedContent = JSON.stringify(parametersObj);
cli.output.verbose("=====================================");
cli.output.verbose("JSON object (updated):");
cli.output.verbose(JSON.stringify(parametersObj));
cli.output.verbose("=====================================");
fs.writeFileSync(options.parameterFile, beautify(updatedContent));
cli.output.verbose("=====================================");
cli.output.verbose(("Parameter file updated at: " + options.parameterFile));
cli.output.verbose("====================================="); _(); }); }, true)); }); });
var catparametersCreateOrUpdateImagesImage11 = cli.category("managed-image");
var parametersCreateOrUpdateImagesImage11 = catparametersCreateOrUpdateImagesImage11.category("config").description($("Commands to manage configuration of images in the parameter file."));
var deleteparametersCreateOrUpdateImagesImage11 = parametersCreateOrUpdateImagesImage11.category("image").description($("Commands to configure image of managed-image in config file."));
deleteparametersCreateOrUpdateImagesImage11.command("delete").description($("Remove image in config string or files, e.g. \r\n{\r\n \"sourceVirtualMachine\":{\r\n \"id\":\"\"\r\n },\r\n \"storageProfile\":{\r\n \"osDisk\":{\r\n \"osType\":\"\",\r\n \"osState\":\"\",\r\n \"snapshot\":{\r\n \"id\":\"\"\r\n },\r\n \"managedDisk\":{\r\n \"id\":\"\"\r\n },\r\n \"blobUri\":\"\",\r\n \"caching\":null,\r\n \"diskSizeGB\":null,\r\n \"storageAccountType\":null\r\n },\r\n \"dataDisks\":[\r\n {\r\n \"lun\":\"\",\r\n \"snapshot\":{\r\n \"id\":\"\"\r\n },\r\n \"managedDisk\":{\r\n \"id\":\"\"\r\n },\r\n \"blobUri\":\"\",\r\n \"caching\":null,\r\n \"diskSizeGB\":null,\r\n \"storageAccountType\":null\r\n }\r\n ]\r\n },\r\n \"provisioningState\":\"\",\r\n \"id\":null,\r\n \"name\":null,\r\n \"type\":null,\r\n \"location\":\"\",\r\n \"tags\":{\r\n }\r\n}\r\n There are two sets of commands:\r\n 1) function commands that are used to manage Azure resources in the cloud, and \r\n 2) parameter commands that generate & edit input files for the other set of commands.\r\n For example, 'vmss show/list/stop' are the function commands that call get, list and stop operations of \r\n virtual machine scale set, whereas 'vmss config * generate/create/set/delete/add' commands \r\n are used to configure the input parameter file. The 'vmss config' command takes a parameter \r\n file as for the VM scale set configuration, and creates it online.")).usage("[options]").option("--parameter-file <parameter-file>", $("The parameter file path.")).option("--source-virtual-machine", $("Remove the source-virtual-machine value.")).option("--storage-profile", $("Remove the storage-profile value.")).option("--provisioning-state", $("Remove the provisioning-state value.")).option("--id", $("Remove the id value.")).option("--name", $("Remove the name value.")).option("--type", $("Remove the type value.")).option("--location", $("Remove the location value.")).option("--tags", $("Remove the tags value.")).execute(function __5(options, _) { var fileContent, parametersObj, anySubItem, subItemPath, updatedContent; var __frame = { name: "__5", line: 553 }; return __func(_, this, arguments, __5, 1, __frame, function __$__5() {
return cli.output.verbose(JSON.stringify(options), __cb(_, __frame, 1, 15, function __$__5() { return (function __$__5(__then) {
if (!options.parameterFile) {
return cli.interaction.promptIfNotGiven($("parameter-file : "), options.parameterFile, __cb(_, __frame, 3, 46, function ___(__0, __1) { options.parameterFile = __1; __then(); }, true)); } else { __then(); } ; })(function __$__5() {
cli.output.verbose("=====================================");
cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\""));
cli.output.verbose("=====================================");
fileContent = fs.readFileSync(options.parameterFile, "utf8");
parametersObj = JSON.parse(fileContent);
cli.output.verbose("JSON object:");
cli.output.verbose(JSON.stringify(parametersObj));
options.operation = "remove";
options.path = "";
anySubItem = ((((((((false || options.sourceVirtualMachine) || options.storageProfile) || options.provisioningState) || options.id) || options.name) || options.type) || options.location) || options.tags);
if (anySubItem) {
subItemPath = null;
if (options.sourceVirtualMachine) {
subItemPath = (options.path + "/sourceVirtualMachine");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.storageProfile) {
subItemPath = (options.path + "/storageProfile");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.provisioningState) {
subItemPath = (options.path + "/provisioningState");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.id) {
subItemPath = (options.path + "/id");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.name) {
subItemPath = (options.path + "/name");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.type) {
subItemPath = (options.path + "/type");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.location) {
subItemPath = (options.path + "/location");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.tags) {
subItemPath = (options.path + "/tags");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ; }
else {
jsonpatch.apply(parametersObj, [{ op: options.operation, path: options.path },]); } ;
updatedContent = JSON.stringify(parametersObj);
cli.output.verbose("=====================================");
cli.output.verbose("JSON object (updated):");
cli.output.verbose(JSON.stringify(parametersObj));
cli.output.verbose("=====================================");
fs.writeFileSync(options.parameterFile, beautify(updatedContent));
cli.output.verbose("=====================================");
cli.output.verbose(("Parameter file updated at: " + options.parameterFile));
cli.output.verbose("====================================="); _(); }); }, true)); }); });
var catparametersCreateOrUpdateImagesSourceVirtualMachine0SVM1 = cli.category("managed-image");
var parametersCreateOrUpdateImagesSourceVirtualMachine0SVM1 = catparametersCreateOrUpdateImagesSourceVirtualMachine0SVM1.category("config").description($("Commands to manage configuration of images in the parameter file."));
var setparametersCreateOrUpdateImagesSourceVirtualMachine0SVM1 = parametersCreateOrUpdateImagesSourceVirtualMachine0SVM1.category("source-virtual-machine").description($("Commands to configure source-virtual-machine of managed-image in config file."));
setparametersCreateOrUpdateImagesSourceVirtualMachine0SVM1.command("set").description($("Set source-virtual-machine in config string or files, e.g. \r\n {\r\n ...\r\n \"sourceVirtualMachine\" : {\r\n \"id\":\"\"\r\n }\r\n ...\r\n }\r\n\r\n There are two sets of commands:\r\n 1) function commands that are used to manage Azure resources in the cloud, and \r\n 2) parameter commands that generate & edit input files for the other set of commands.\r\n For example, 'vmss show/list/stop' are the function commands that call get, list and stop operations of \r\n virtual machine scale set, whereas 'vmss config * generate/create/set/delete/add' commands \r\n are used to configure the input parameter file. The 'vmss config' command takes a parameter \r\n file as for the VM scale set configuration, and creates it online.")).usage("[options]").option("--parameter-file <parameter-file>", $("The parameter file path.")).option("--parse", $("Parse the input string, i.e. str, for parameters to a JSON object, e.g. JSON.parse(str).")).option("--id <id>", $("Set the id value.")).execute(function __6(options, _) { var fileContent, parametersObj, error, paramPath, updatedContent; var __frame = { name: "__6", line: 630 }; return __func(_, this, arguments, __6, 1, __frame, function __$__6() {
return cli.output.verbose(JSON.stringify(options), __cb(_, __frame, 1, 15, function __$__6() { return (function __$__6(__then) {
if (!options.parameterFile) {
return cli.interaction.promptIfNotGiven($("parameter-file : "), options.parameterFile, __cb(_, __frame, 3, 46, function ___(__0, __1) { options.parameterFile = __1; __then(); }, true)); } else { __then(); } ; })(function __$__6() {
cli.output.verbose("=====================================");
cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\""));
cli.output.verbose("=====================================");
fileContent = fs.readFileSync(options.parameterFile, "utf8");
parametersObj = JSON.parse(fileContent);
cli.output.verbose("JSON object:");
cli.output.verbose(JSON.stringify(parametersObj));
options.operation = "replace";
options.path = "/sourceVirtualMachine";
error = jsonpatch.validate([{ op: "remove", path: options.path },], parametersObj);
if ((typeof error !== "undefined")) {
jsonpatch.apply(parametersObj, [{ op: "add", path: options.path, value: { } },]); } ;
paramPath = ((options.path + "/") + "id");
if (options.id) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.id));
cli.output.verbose("================================================");
if ((options.parse && options.id)) {
options.id = JSON.parse(options.id); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.id },]); } ;
updatedContent = JSON.stringify(parametersObj);
cli.output.verbose("=====================================");
cli.output.verbose("JSON object (updated):");
cli.output.verbose(JSON.stringify(parametersObj));
cli.output.verbose("=====================================");
fs.writeFileSync(options.parameterFile, beautify(updatedContent));
cli.output.verbose("=====================================");
cli.output.verbose(("Parameter file updated at: " + options.parameterFile));
cli.output.verbose("====================================="); _(); }); }, true)); }); });
var catparametersCreateOrUpdateImagesSourceVirtualMachine1SVM1 = cli.category("managed-image");
var parametersCreateOrUpdateImagesSourceVirtualMachine1SVM1 = catparametersCreateOrUpdateImagesSourceVirtualMachine1SVM1.category("config").description($("Commands to manage configuration of images in the parameter file."));
var deleteparametersCreateOrUpdateImagesSourceVirtualMachine1SVM1 = parametersCreateOrUpdateImagesSourceVirtualMachine1SVM1.category("source-virtual-machine").description($("Commands to configure source-virtual-machine of managed-image in config file."));
deleteparametersCreateOrUpdateImagesSourceVirtualMachine1SVM1.command("delete").description($("Remove source-virtual-machine in config string or files, e.g. \r\n {\r\n ...\r\n \"sourceVirtualMachine\" : {\r\n \"id\":\"\"\r\n }\r\n ...\r\n }\r\n\r\n There are two sets of commands:\r\n 1) function commands that are used to manage Azure resources in the cloud, and \r\n 2) parameter commands that generate & edit input files for the other set of commands.\r\n For example, 'vmss show/list/stop' are the function commands that call get, list and stop operations of \r\n virtual machine scale set, whereas 'vmss config * generate/create/set/delete/add' commands \r\n are used to configure the input parameter file. The 'vmss config' command takes a parameter \r\n file as for the VM scale set configuration, and creates it online.")).usage("[options]").option("--parameter-file <parameter-file>", $("The parameter file path.")).option("--id", $("Remove the id value.")).execute(function __7(options, _) { var fileContent, parametersObj, anySubItem, subItemPath, updatedContent; var __frame = { name: "__7", line: 682 }; return __func(_, this, arguments, __7, 1, __frame, function __$__7() {
return cli.output.verbose(JSON.stringify(options), __cb(_, __frame, 1, 15, function __$__7() { return (function __$__7(__then) {
if (!options.parameterFile) {
return cli.interaction.promptIfNotGiven($("parameter-file : "), options.parameterFile, __cb(_, __frame, 3, 46, function ___(__0, __1) { options.parameterFile = __1; __then(); }, true)); } else { __then(); } ; })(function __$__7() {
cli.output.verbose("=====================================");
cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\""));
cli.output.verbose("=====================================");
fileContent = fs.readFileSync(options.parameterFile, "utf8");
parametersObj = JSON.parse(fileContent);
cli.output.verbose("JSON object:");
cli.output.verbose(JSON.stringify(parametersObj));
options.operation = "remove";
options.path = "/sourceVirtualMachine";
anySubItem = (false || options.id);
if (anySubItem) {
subItemPath = null;
if (options.id) {
subItemPath = (options.path + "/id");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ; }
else {
jsonpatch.apply(parametersObj, [{ op: options.operation, path: options.path },]); } ;
updatedContent = JSON.stringify(parametersObj);
cli.output.verbose("=====================================");
cli.output.verbose("JSON object (updated):");
cli.output.verbose(JSON.stringify(parametersObj));
cli.output.verbose("=====================================");
fs.writeFileSync(options.parameterFile, beautify(updatedContent));
cli.output.verbose("=====================================");
cli.output.verbose(("Parameter file updated at: " + options.parameterFile));
cli.output.verbose("====================================="); _(); }); }, true)); }); });
var catparametersCreateOrUpdateImagesStorageProfile0SP1 = cli.category("managed-image");
var parametersCreateOrUpdateImagesStorageProfile0SP1 = catparametersCreateOrUpdateImagesStorageProfile0SP1.category("config").description($("Commands to manage configuration of images in the parameter file."));
var setparametersCreateOrUpdateImagesStorageProfile0SP1 = parametersCreateOrUpdateImagesStorageProfile0SP1.category("storage-profile").description($("Commands to configure storage-profile of managed-image in config file."));
setparametersCreateOrUpdateImagesStorageProfile0SP1.command("set").description($("Set storage-profile in config string or files, e.g. \r\n {\r\n ...\r\n \"storageProfile\" : {\r\n \"osDisk\":{\r\n \"osType\":\"\",\r\n \"osState\":\"\",\r\n \"snapshot\":{\r\n \"id\":\"\"\r\n },\r\n \"managedDisk\":{\r\n \"id\":\"\"\r\n },\r\n \"blobUri\":\"\",\r\n \"caching\":null,\r\n \"diskSizeGB\":null,\r\n \"storageAccountType\":null\r\n },\r\n \"dataDisks\":[\r\n {\r\n \"lun\":\"\",\r\n \"snapshot\":{\r\n \"id\":\"\"\r\n },\r\n \"managedDisk\":{\r\n \"id\":\"\"\r\n },\r\n \"blobUri\":\"\",\r\n \"caching\":null,\r\n \"diskSizeGB\":null,\r\n \"storageAccountType\":null\r\n }\r\n ]\r\n }\r\n ...\r\n }\r\n\r\n There are two sets of commands:\r\n 1) function commands that are used to manage Azure resources in the cloud, and \r\n 2) parameter commands that generate & edit input files for the other set of commands.\r\n For example, 'vmss show/list/stop' are the function commands that call get, list and stop operations of \r\n virtual machine scale set, whereas 'vmss config * generate/create/set/delete/add' commands \r\n are used to configure the input parameter file. The 'vmss config' command takes a parameter \r\n file as for the VM scale set configuration, and creates it online.")).usage("[options]").option("--parameter-file <parameter-file>", $("The parameter file path.")).option("--parse", $("Parse the input string, i.e. str, for parameters to a JSON object, e.g. JSON.parse(str).")).option("--os-disk <osDisk>", $("Set the os-disk value.")).option("--data-disks <dataDisks>", $("Set the data-disks value.")).execute(function __8(options, _) { var fileContent, parametersObj, error, paramPath, updatedContent; var __frame = { name: "__8", line: 732 }; return __func(_, this, arguments, __8, 1, __frame, function __$__8() {
return cli.output.verbose(JSON.stringify(options), __cb(_, __frame, 1, 15, function __$__8() { return (function __$__8(__then) {
if (!options.parameterFile) {
return cli.interaction.promptIfNotGiven($("parameter-file : "), options.parameterFile, __cb(_, __frame, 3, 46, function ___(__0, __1) { options.parameterFile = __1; __then(); }, true)); } else { __then(); } ; })(function __$__8() {
cli.output.verbose("=====================================");
cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\""));
cli.output.verbose("=====================================");
fileContent = fs.readFileSync(options.parameterFile, "utf8");
parametersObj = JSON.parse(fileContent);
cli.output.verbose("JSON object:");
cli.output.verbose(JSON.stringify(parametersObj));
options.operation = "replace";
options.path = "/storageProfile";
error = jsonpatch.validate([{ op: "remove", path: options.path },], parametersObj);
if ((typeof error !== "undefined")) {
jsonpatch.apply(parametersObj, [{ op: "add", path: options.path, value: { } },]); } ;
paramPath = ((options.path + "/") + "osDisk");
if (options.osDisk) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.osDisk));
cli.output.verbose("================================================");
if ((options.parse && options.osDisk)) {
options.osDisk = JSON.parse(options.osDisk); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.osDisk },]); } ;
paramPath = ((options.path + "/") + "dataDisks");
if (options.dataDisks) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.dataDisks));
cli.output.verbose("================================================");
if ((options.parse && options.dataDisks)) {
options.dataDisks = JSON.parse(options.dataDisks); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.dataDisks },]); } ;
updatedContent = JSON.stringify(parametersObj);
cli.output.verbose("=====================================");
cli.output.verbose("JSON object (updated):");
cli.output.verbose(JSON.stringify(parametersObj));
cli.output.verbose("=====================================");
fs.writeFileSync(options.parameterFile, beautify(updatedContent));
cli.output.verbose("=====================================");
cli.output.verbose(("Parameter file updated at: " + options.parameterFile));
cli.output.verbose("====================================="); _(); }); }, true)); }); });
var catparametersCreateOrUpdateImagesStorageProfile1SP1 = cli.category("managed-image");
var parametersCreateOrUpdateImagesStorageProfile1SP1 = catparametersCreateOrUpdateImagesStorageProfile1SP1.category("config").description($("Commands to manage configuration of images in the parameter file."));
var deleteparametersCreateOrUpdateImagesStorageProfile1SP1 = parametersCreateOrUpdateImagesStorageProfile1SP1.category("storage-profile").description($("Commands to configure storage-profile of managed-image in config file."));
deleteparametersCreateOrUpdateImagesStorageProfile1SP1.command("delete").description($("Remove storage-profile in config string or files, e.g. \r\n {\r\n ...\r\n \"storageProfile\" : {\r\n \"osDisk\":{\r\n \"osType\":\"\",\r\n \"osState\":\"\",\r\n \"snapshot\":{\r\n \"id\":\"\"\r\n },\r\n \"managedDisk\":{\r\n \"id\":\"\"\r\n },\r\n \"blobUri\":\"\",\r\n \"caching\":null,\r\n \"diskSizeGB\":null,\r\n \"storageAccountType\":null\r\n },\r\n \"dataDisks\":[\r\n {\r\n \"lun\":\"\",\r\n \"snapshot\":{\r\n \"id\":\"\"\r\n },\r\n \"managedDisk\":{\r\n \"id\":\"\"\r\n },\r\n \"blobUri\":\"\",\r\n \"caching\":null,\r\n \"diskSizeGB\":null,\r\n \"storageAccountType\":null\r\n }\r\n ]\r\n }\r\n ...\r\n }\r\n\r\n There are two sets of commands:\r\n 1) function commands that are used to manage Azure resources in the cloud, and \r\n 2) parameter commands that generate & edit input files for the other set of commands.\r\n For example, 'vmss show/list/stop' are the function commands that call get, list and stop operations of \r\n virtual machine scale set, whereas 'vmss config * generate/create/set/delete/add' commands \r\n are used to configure the input parameter file. The 'vmss config' command takes a parameter \r\n file as for the VM scale set configuration, and creates it online.")).usage("[options]").option("--parameter-file <parameter-file>", $("The parameter file path.")).option("--os-disk", $("Remove the os-disk value.")).option("--data-disks", $("Remove the data-disks value.")).execute(function __9(options, _) { var fileContent, parametersObj, anySubItem, subItemPath, updatedContent; var __frame = { name: "__9", line: 796 }; return __func(_, this, arguments, __9, 1, __frame, function __$__9() {
return cli.output.verbose(JSON.stringify(options), __cb(_, __frame, 1, 15, function __$__9() { return (function __$__9(__then) {
if (!options.parameterFile) {
return cli.interaction.promptIfNotGiven($("parameter-file : "), options.parameterFile, __cb(_, __frame, 3, 46, function ___(__0, __1) { options.parameterFile = __1; __then(); }, true)); } else { __then(); } ; })(function __$__9() {
cli.output.verbose("=====================================");
cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\""));
cli.output.verbose("=====================================");
fileContent = fs.readFileSync(options.parameterFile, "utf8");
parametersObj = JSON.parse(fileContent);
cli.output.verbose("JSON object:");
cli.output.verbose(JSON.stringify(parametersObj));
options.operation = "remove";
options.path = "/storageProfile";
anySubItem = ((false || options.osDisk) || options.dataDisks);
if (anySubItem) {
subItemPath = null;
if (options.osDisk) {
subItemPath = (options.path + "/osDisk");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.dataDisks) {
subItemPath = (options.path + "/dataDisks");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ; }
else {
jsonpatch.apply(parametersObj, [{ op: options.operation, path: options.path },]); } ;
updatedContent = JSON.stringify(parametersObj);
cli.output.verbose("=====================================");
cli.output.verbose("JSON object (updated):");
cli.output.verbose(JSON.stringify(parametersObj));
cli.output.verbose("=====================================");
fs.writeFileSync(options.parameterFile, beautify(updatedContent));
cli.output.verbose("=====================================");
cli.output.verbose(("Parameter file updated at: " + options.parameterFile));
cli.output.verbose("====================================="); _(); }); }, true)); }); });
var catparametersCreateOrUpdateImagesOsDisk0SPoD1 = cli.category("managed-image");
var parametersCreateOrUpdateImagesOsDisk0SPoD1 = catparametersCreateOrUpdateImagesOsDisk0SPoD1.category("config").description($("Commands to manage configuration of images in the parameter file."));
var setparametersCreateOrUpdateImagesOsDisk0SPoD1 = parametersCreateOrUpdateImagesOsDisk0SPoD1.category("os-disk").description($("Commands to configure os-disk of managed-image in config file."));
setparametersCreateOrUpdateImagesOsDisk0SPoD1.command("set").description($("Set os-disk in config string or files, e.g. \r\n {\r\n ...\r\n \"osDisk\" : {\r\n \"osType\":\"\",\r\n \"osState\":\"\",\r\n \"snapshot\":{\r\n \"id\":\"\"\r\n },\r\n \"managedDisk\":{\r\n \"id\":\"\"\r\n },\r\n \"blobUri\":\"\",\r\n \"caching\":null,\r\n \"diskSizeGB\":null,\r\n \"storageAccountType\":null\r\n }\r\n ...\r\n }\r\n\r\n There are two sets of commands:\r\n 1) function commands that are used to manage Azure resources in the cloud, and \r\n 2) parameter commands that generate & edit input files for the other set of commands.\r\n For example, 'vmss show/list/stop' are the function commands that call get, list and stop operations of \r\n virtual machine scale set, whereas 'vmss config * generate/create/set/delete/add' commands \r\n are used to configure the input parameter file. The 'vmss config' command takes a parameter \r\n file as for the VM scale set configuration, and creates it online.")).usage("[options]").option("--parameter-file <parameter-file>", $("The parameter file path.")).option("--parse", $("Parse the input string, i.e. str, for parameters to a JSON object, e.g. JSON.parse(str).")).option("--os-type <osType>", $("Set the os-type value.")).option("--os-state <osState>", $("Set the os-state value.")).option("--snapshot <snapshot>", $("Set the snapshot value.")).option("--managed-disk <managedDisk>", $("Set the managed-disk value.")).option("--blob-uri <blobUri>", $("Set the blob-uri value.")).option("--caching <caching>", $("Set the caching value.")).option("--disk-size-g-b <diskSizeGB>", $("Set the disk-size-g-b value.")).option("--storage-account-type <storageAccountType>", $("Set the storage-account-type value.")).execute(function __10(options, _) { var fileContent, parametersObj, error, paramPath, updatedContent; var __frame = { name: "__10", line: 856 }; return __func(_, this, arguments, __10, 1, __frame, function __$__10() {
return cli.output.verbose(JSON.stringify(options), __cb(_, __frame, 1, 15, function __$__10() { return (function __$__10(__then) {
if (!options.parameterFile) {
return cli.interaction.promptIfNotGiven($("parameter-file : "), options.parameterFile, __cb(_, __frame, 3, 46, function ___(__0, __1) { options.parameterFile = __1; __then(); }, true)); } else { __then(); } ; })(function __$__10() {
cli.output.verbose("=====================================");
cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\""));
cli.output.verbose("=====================================");
fileContent = fs.readFileSync(options.parameterFile, "utf8");
parametersObj = JSON.parse(fileContent);
cli.output.verbose("JSON object:");
cli.output.verbose(JSON.stringify(parametersObj));
options.operation = "replace";
options.path = "/storageProfile/osDisk";
error = jsonpatch.validate([{ op: "remove", path: options.path },], parametersObj);
if ((typeof error !== "undefined")) {
jsonpatch.apply(parametersObj, [{ op: "add", path: options.path, value: { } },]); } ;
paramPath = ((options.path + "/") + "osType");
if (options.osType) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.osType));
cli.output.verbose("=============================