azure-cli
Version:
Microsoft Azure Cross Platform Command Line tool
1,057 lines (474 loc) • 218 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 disksCreateOrUpdate = cli.category("managed-disk").description($("Commands to manage your disks. "));
disksCreateOrUpdate.command("create [resource-group] [name] [disk]").description($("Creates or updates a disk.")).usage("[options] <resource-group> <name> <disk>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("--disk <disk>", $("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, disk, options, _) { var diskObj, fileContent, subscription, computeManagementClient, result; var __frame = { name: "__1", line: 434 }; 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(("disk = " + disk));
diskObj = null;
if (options.parameterFile) {
cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\""));
fileContent = fs.readFileSync(options.parameterFile, "utf8");
diskObj = JSON.parse(fileContent); }
else {
diskObj = JSON.parse(disk); } ;
cli.output.verbose(("diskObj = " + JSON.stringify(diskObj)));
subscription = profile.current.getSubscription(options.subscription);
computeManagementClient = utils.createComputeManagementClient(subscription);
return computeManagementClient.disks.createOrUpdate(resourceGroup, name, diskObj, __cb(_, __frame, 24, 47, function ___(__0, __3) { result = __3;
if (result) {
cli.output.json(result); } ; _(); }, true)); }); }); }); });
var disksCreateOrUpdatecreateOrUpdateParameters2 = disksCreateOrUpdate.category("config").description($("Commands to manage configuration of disks in the parameter file."));
disksCreateOrUpdatecreateOrUpdateParameters2.command("create").description($("Generate disksCreateOrUpdate 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: 469 }; return __func(_, this, arguments, __2, 1, __frame, function __$__2() {
return cli.output.verbose("{\"managedBy\":\"\",\"sku\":{\"name\":null,\"tier\":\"\"},\"zones\":[\"\"],\"timeCreated\":null,\"osType\":null,\"creationData\":{\"createOption\":\"\",\"storageAccountId\":\"\",\"imageReference\":{\"id\":\"\",\"lun\":null},\"sourceUri\":\"\",\"sourceResourceId\":\"\"},\"diskSizeGB\":null,\"encryptionSettings\":{\"enabled\":null,\"diskEncryptionKey\":{\"sourceVault\":{\"id\":\"\"},\"secretUrl\":\"\"},\"keyEncryptionKey\":{\"sourceVault\":{\"id\":\"\"},\"keyUrl\":\"\"}},\"provisioningState\":\"\",\"id\":null,\"name\":null,\"type\":null,\"location\":\"\",\"tags\":{}}", __cb(_, __frame, 1, 15, function __$__2() {
filePath = "disksCreateOrUpdate_createOrUpdate.json";
if (options.parameterFile) {
filePath = options.parameterFile; } ;
fs.writeFileSync(filePath, beautify("{\r\n\"managedBy\":\"\",\r\n\"sku\":{\r\n\"name\":null,\r\n\"tier\":\"\"\r\n},\r\n\"zones\":[\r\n\"\"\r\n],\r\n\"timeCreated\":null,\r\n\"osType\":null,\r\n\"creationData\":{\r\n\"createOption\":\"\",\r\n\"storageAccountId\":\"\",\r\n\"imageReference\":{\r\n\"id\":\"\",\r\n\"lun\":null\r\n},\r\n\"sourceUri\":\"\",\r\n\"sourceResourceId\":\"\"\r\n},\r\n\"diskSizeGB\":null,\r\n\"encryptionSettings\":{\r\n\"enabled\":null,\r\n\"diskEncryptionKey\":{\r\n\"sourceVault\":{\r\n\"id\":\"\"\r\n},\r\n\"secretUrl\":\"\"\r\n},\r\n\"keyEncryptionKey\":{\r\n\"sourceVault\":{\r\n\"id\":\"\"\r\n},\r\n\"keyUrl\":\"\"\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)); }); });
disksCreateOrUpdatecreateOrUpdateParameters2.command("patch").description($("Command to patch disksCreateOrUpdate 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, diskObj, updatedContent; var __frame = { name: "__3", line: 489 }; 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");
diskObj = JSON.parse(fileContent);
cli.output.verbose("JSON object:");
cli.output.verbose(JSON.stringify(diskObj));
if ((options.operation == "add")) {
jsonpatch.apply(diskObj, [{ op: options.operation, path: options.path, value: options.value },]); } else {
if ((options.operation == "remove")) {
jsonpatch.apply(diskObj, [{ op: options.operation, path: options.path },]); } else {
if ((options.operation == "replace")) {
jsonpatch.apply(diskObj, [{ op: options.operation, path: options.path, value: options.value },]); } ; } ; } ;
updatedContent = JSON.stringify(diskObj);
cli.output.verbose("=====================================");
cli.output.verbose("JSON object (updated):");
cli.output.verbose(JSON.stringify(diskObj));
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 catparametersCreateOrUpdateDisksDisk01 = cli.category("managed-disk");
var parametersCreateOrUpdateDisksDisk01 = catparametersCreateOrUpdateDisksDisk01.category("config").description($("Commands to manage configuration of disks in the parameter file."));
var setparametersCreateOrUpdateDisksDisk01 = parametersCreateOrUpdateDisksDisk01.category("disk").description($("Commands to configure disk of managed-disk in config file."));
setparametersCreateOrUpdateDisksDisk01.command("set").description($("Set disk in config string or files, e.g. \r\n{\r\n \"managedBy\":\"\",\r\n \"sku\":{\r\n \"name\":null,\r\n \"tier\":\"\"\r\n },\r\n \"zones\":[\r\n \"\"\r\n ],\r\n \"timeCreated\":null,\r\n \"osType\":null,\r\n \"creationData\":{\r\n \"createOption\":\"\",\r\n \"storageAccountId\":\"\",\r\n \"imageReference\":{\r\n \"id\":\"\",\r\n \"lun\":null\r\n },\r\n \"sourceUri\":\"\",\r\n \"sourceResourceId\":\"\"\r\n },\r\n \"diskSizeGB\":null,\r\n \"encryptionSettings\":{\r\n \"enabled\":null,\r\n \"diskEncryptionKey\":{\r\n \"sourceVault\":{\r\n \"id\":\"\"\r\n },\r\n \"secretUrl\":\"\"\r\n },\r\n \"keyEncryptionKey\":{\r\n \"sourceVault\":{\r\n \"id\":\"\"\r\n },\r\n \"keyUrl\":\"\"\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("--managed-by <managedBy>", $("Set the managed-by value.")).option("--sku <sku>", $("Set the sku value.")).option("--zones <zones>", $("Set the zones value.")).option("--time-created <timeCreated>", $("Set the time-created value.")).option("--os-type <osType>", $("Set the os-type value.")).option("--creation-data <creationData>", $("Set the creation-data value.")).option("--disk-size-g-b <diskSizeGB>", $("Set the disk-size-g-b value.")).option("--encryption-settings <encryptionSettings>", $("Set the encryption-settings 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: 551 }; 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 + "/") + "managedBy");
if (options.managedBy) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.managedBy));
cli.output.verbose("================================================");
if ((options.parse && options.managedBy)) {
options.managedBy = JSON.parse(options.managedBy); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.managedBy },]); } ;
paramPath = ((options.path + "/") + "sku");
if (options.sku) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.sku));
cli.output.verbose("================================================");
if ((options.parse && options.sku)) {
options.sku = JSON.parse(options.sku); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.sku },]); } ;
paramPath = ((options.path + "/") + "zones");
if (options.zones) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.zones));
cli.output.verbose("================================================");
if ((options.parse && options.zones)) {
options.zones = JSON.parse(options.zones); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.zones },]); } ;
paramPath = ((options.path + "/") + "timeCreated");
if (options.timeCreated) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.timeCreated));
cli.output.verbose("================================================");
if ((options.parse && options.timeCreated)) {
options.timeCreated = JSON.parse(options.timeCreated); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.timeCreated },]); } ;
paramPath = ((options.path + "/") + "osType");
if (options.osType) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.osType));
cli.output.verbose("================================================");
if ((options.parse && options.osType)) {
options.osType = JSON.parse(options.osType); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.osType },]); } ;
paramPath = ((options.path + "/") + "creationData");
if (options.creationData) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.creationData));
cli.output.verbose("================================================");
if ((options.parse && options.creationData)) {
options.creationData = JSON.parse(options.creationData); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.creationData },]); } ;
paramPath = ((options.path + "/") + "diskSizeGB");
if (options.diskSizeGB) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.diskSizeGB));
cli.output.verbose("================================================");
if ((options.parse && options.diskSizeGB)) {
options.diskSizeGB = JSON.parse(options.diskSizeGB); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.diskSizeGB },]); } ;
paramPath = ((options.path + "/") + "encryptionSettings");
if (options.encryptionSettings) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.encryptionSettings));
cli.output.verbose("================================================");
if ((options.parse && options.encryptionSettings)) {
options.encryptionSettings = JSON.parse(options.encryptionSettings); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.encryptionSettings },]); } ;
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 catparametersCreateOrUpdateDisksDisk11 = cli.category("managed-disk");
var parametersCreateOrUpdateDisksDisk11 = catparametersCreateOrUpdateDisksDisk11.category("config").description($("Commands to manage configuration of disks in the parameter file."));
var deleteparametersCreateOrUpdateDisksDisk11 = parametersCreateOrUpdateDisksDisk11.category("disk").description($("Commands to configure disk of managed-disk in config file."));
deleteparametersCreateOrUpdateDisksDisk11.command("delete").description($("Remove disk in config string or files, e.g. \r\n{\r\n \"managedBy\":\"\",\r\n \"sku\":{\r\n \"name\":null,\r\n \"tier\":\"\"\r\n },\r\n \"zones\":[\r\n \"\"\r\n ],\r\n \"timeCreated\":null,\r\n \"osType\":null,\r\n \"creationData\":{\r\n \"createOption\":\"\",\r\n \"storageAccountId\":\"\",\r\n \"imageReference\":{\r\n \"id\":\"\",\r\n \"lun\":null\r\n },\r\n \"sourceUri\":\"\",\r\n \"sourceResourceId\":\"\"\r\n },\r\n \"diskSizeGB\":null,\r\n \"encryptionSettings\":{\r\n \"enabled\":null,\r\n \"diskEncryptionKey\":{\r\n \"sourceVault\":{\r\n \"id\":\"\"\r\n },\r\n \"secretUrl\":\"\"\r\n },\r\n \"keyEncryptionKey\":{\r\n \"sourceVault\":{\r\n \"id\":\"\"\r\n },\r\n \"keyUrl\":\"\"\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("--managed-by", $("Remove the managed-by value.")).option("--sku", $("Remove the sku value.")).option("--zones", $("Remove the zones value.")).option("--time-created", $("Remove the time-created value.")).option("--os-type", $("Remove the os-type value.")).option("--creation-data", $("Remove the creation-data value.")).option("--disk-size-g-b", $("Remove the disk-size-g-b value.")).option("--encryption-settings", $("Remove the encryption-settings 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: 759 }; 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.managedBy) || options.sku) || options.zones) || options.timeCreated) || options.osType) || options.creationData) || options.diskSizeGB) || options.encryptionSettings) || options.provisioningState) || options.id) || options.name) || options.type) || options.location) || options.tags);
if (anySubItem) {
subItemPath = null;
if (options.managedBy) {
subItemPath = (options.path + "/managedBy");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.sku) {
subItemPath = (options.path + "/sku");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.zones) {
subItemPath = (options.path + "/zones");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.timeCreated) {
subItemPath = (options.path + "/timeCreated");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.osType) {
subItemPath = (options.path + "/osType");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.creationData) {
subItemPath = (options.path + "/creationData");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.diskSizeGB) {
subItemPath = (options.path + "/diskSizeGB");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.encryptionSettings) {
subItemPath = (options.path + "/encryptionSettings");
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 catparametersCreateOrUpdateDisksSku0S1 = cli.category("managed-disk");
var parametersCreateOrUpdateDisksSku0S1 = catparametersCreateOrUpdateDisksSku0S1.category("config").description($("Commands to manage configuration of disks in the parameter file."));
var setparametersCreateOrUpdateDisksSku0S1 = parametersCreateOrUpdateDisksSku0S1.category("sku").description($("Commands to configure sku of managed-disk in config file."));
setparametersCreateOrUpdateDisksSku0S1.command("set").description($("Set sku in config string or files, e.g. \r\n {\r\n ...\r\n \"sku\" : {\r\n \"name\":null,\r\n \"tier\":\"\"\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("--name <name>", $("Set the name value.")).option("--tier <tier>", $("Set the tier value.")).execute(function __6(options, _) { var fileContent, parametersObj, error, paramPath, updatedContent; var __frame = { name: "__6", line: 861 }; 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 = "/sku";
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 + "/") + "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 + "/") + "tier");
if (options.tier) {
cli.output.verbose("================================================");
cli.output.verbose(("Path : " + paramPath));
cli.output.verbose(("Value : " + options.tier));
cli.output.verbose("================================================");
if ((options.parse && options.tier)) {
options.tier = JSON.parse(options.tier); } ;
jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.tier },]); } ;
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 catparametersCreateOrUpdateDisksSku1S1 = cli.category("managed-disk");
var parametersCreateOrUpdateDisksSku1S1 = catparametersCreateOrUpdateDisksSku1S1.category("config").description($("Commands to manage configuration of disks in the parameter file."));
var deleteparametersCreateOrUpdateDisksSku1S1 = parametersCreateOrUpdateDisksSku1S1.category("sku").description($("Commands to configure sku of managed-disk in config file."));
deleteparametersCreateOrUpdateDisksSku1S1.command("delete").description($("Remove sku in config string or files, e.g. \r\n {\r\n ...\r\n \"sku\" : {\r\n \"name\":null,\r\n \"tier\":\"\"\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("--name", $("Remove the name value.")).option("--tier", $("Remove the tier value.")).execute(function __7(options, _) { var fileContent, parametersObj, anySubItem, subItemPath, updatedContent; var __frame = { name: "__7", line: 925 }; 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 = "/sku";
anySubItem = ((false || options.name) || options.tier);
if (anySubItem) {
subItemPath = null;
if (options.name) {
subItemPath = (options.path + "/name");
jsonpatch.apply(parametersObj, [{ op: options.operation, path: subItemPath },]); } ;
if (options.tier) {
subItemPath = (options.path + "/tier");
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 catparametersCreateOrUpdateDisksZones0Z1 = cli.category("managed-disk");
var parametersCreateOrUpdateDisksZones0Z1 = catparametersCreateOrUpdateDisksZones0Z1.category("config").description($("Commands to manage configuration of disks in the parameter file."));
var setparametersCreateOrUpdateDisksZones0Z1 = parametersCreateOrUpdateDisksZones0Z1.category("zones").description($("Commands to configure zones of managed-disk in config file."));
setparametersCreateOrUpdateDisksZones0Z1.command("set").description($("Set zones in config string or files, e.g. \r\n {\r\n ...\r\n \"zones\" : \"\"\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("--index <index>", $("Indexer: index.")).option("--value <value>", $("The input string value for the indexed item.")).option("--parse", $("Parse the input string, i.e. str, for parameters to a JSON object, e.g. JSON.parse(str).")).execute(function __8(options, _) { var fileContent, parametersObj, error, updatedContent; var __frame = { name: "__8", line: 979 }; 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 = ("/zones" + ((options.index ? (("/" + options.index)) : "")));
error = jsonpatch.validate([{ op: "remove", path: options.path },], parametersObj);
if ((typeof error !== "undefined")) {
jsonpatch.apply(parametersObj, [{ op: "add", path: options.path, value: { } },]); } ;
if (options.value) {
cli.output.verbose(options.value);
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 catparametersCreateOrUpdateDisksZones1Z1 = cli.category("managed-disk");
var parametersCreateOrUpdateDisksZones1Z1 = catparametersCreateOrUpdateDisksZones1Z1.category("config").description($("Commands to manage configuration of disks in the parameter file."));
var deleteparametersCreateOrUpdateDisksZones1Z1 = parametersCreateOrUpdateDisksZones1Z1.category("zones").description($("Commands to configure zones of managed-disk in config file."));
deleteparametersCreateOrUpdateDisksZones1Z1.command("delete").description($("Remove zones in config string or files, e.g. \r\n {\r\n ...\r\n \"zones\" : \"\"\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("--index <index>", $("Indexer: index.")).execute(function __9(options, _) { var fileContent, parametersObj, updatedContent; var __frame = { name: "__9", line: 1024 }; 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 = ("/zones" + ((options.index ? (("/" + options.index)) : "")));
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 catparametersCreateOrUpdateDisksCreationData0CD1 = cli.category("managed-disk");
var parametersCreateOrUpdateDisksCreationData0CD1 = catparametersCreateOrUpdateDisksCreationData0CD1.category("config").description($("Commands to manage configuration of disks in the parameter file."));
var setparametersCreateOrUpdateDisksCreationData0CD1 = parametersCreateOrUpdateDisksCreationData0CD1.category("creation-data").description($("Commands to configure creation-data of managed-disk in config file."));
setparametersCreateOrUpdateDisksCreationData0CD1.command("set").description($("Set creation-data in config string or files, e.g. \r\n {\r\n ...\r\n \"creationData\" : {\r\n \"createOption\":\"\",\r\n \"storageAccountId\":\"\",\r\n \"imageReference\":{\r\n \"id\":\"\",\r\n \"lun\":null\r\n },\r\n \"sourceUri\":\"\",\r\n \"sourceResourceId\":\"\"\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]").opt