UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

1,041 lines (478 loc) 211 kB
/*** 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 snapshotsCreateOrUpdate = cli.category("managed-snapshot").description($("Commands to manage your snapshots. ")); snapshotsCreateOrUpdate.command("create [resource-group] [name] [snapshot]").description($("Creates or updates a snapshot.")).usage("[options] <resource-group> <name> <snapshot>").option("-g, --resource-group <resource-group>", $("resource-group")).option("-n, --name <name>", $("name")).option("--snapshot <snapshot>", $("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, snapshot, options, _) { var snapshotObj, fileContent, subscription, computeManagementClient, result; var __frame = { name: "__1", line: 419 }; 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(("snapshot = " + snapshot)); snapshotObj = null; if (options.parameterFile) { cli.output.verbose((("Reading file content from: \"" + options.parameterFile) + "\"")); fileContent = fs.readFileSync(options.parameterFile, "utf8"); snapshotObj = JSON.parse(fileContent); } else { snapshotObj = JSON.parse(snapshot); } ; cli.output.verbose(("snapshotObj = " + JSON.stringify(snapshotObj))); subscription = profile.current.getSubscription(options.subscription); computeManagementClient = utils.createComputeManagementClient(subscription); return computeManagementClient.snapshots.createOrUpdate(resourceGroup, name, snapshotObj, __cb(_, __frame, 24, 51, function ___(__0, __3) { result = __3; if (result) { cli.output.json(result); } ; _(); }, true)); }); }); }); }); var snapshotsCreateOrUpdatecreateOrUpdateParameters2 = snapshotsCreateOrUpdate.category("config").description($("Commands to manage configuration of snapshots in the parameter file.")); snapshotsCreateOrUpdatecreateOrUpdateParameters2.command("create").description($("Generate snapshotsCreateOrUpdate 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: 454 }; return __func(_, this, arguments, __2, 1, __frame, function __$__2() { return cli.output.verbose("{\"managedBy\":\"\",\"sku\":{\"name\":null,\"tier\":\"\"},\"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 = "snapshotsCreateOrUpdate_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\"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)); }); }); snapshotsCreateOrUpdatecreateOrUpdateParameters2.command("patch").description($("Command to patch snapshotsCreateOrUpdate 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, snapshotObj, updatedContent; var __frame = { name: "__3", line: 474 }; 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"); snapshotObj = JSON.parse(fileContent); cli.output.verbose("JSON object:"); cli.output.verbose(JSON.stringify(snapshotObj)); if ((options.operation == "add")) { jsonpatch.apply(snapshotObj, [{ op: options.operation, path: options.path, value: options.value },]); } else { if ((options.operation == "remove")) { jsonpatch.apply(snapshotObj, [{ op: options.operation, path: options.path },]); } else { if ((options.operation == "replace")) { jsonpatch.apply(snapshotObj, [{ op: options.operation, path: options.path, value: options.value },]); } ; } ; } ; updatedContent = JSON.stringify(snapshotObj); cli.output.verbose("====================================="); cli.output.verbose("JSON object (updated):"); cli.output.verbose(JSON.stringify(snapshotObj)); 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 catparametersCreateOrUpdateSnapshotsSnapshot01 = cli.category("managed-snapshot"); var parametersCreateOrUpdateSnapshotsSnapshot01 = catparametersCreateOrUpdateSnapshotsSnapshot01.category("config").description($("Commands to manage configuration of snapshots in the parameter file.")); var setparametersCreateOrUpdateSnapshotsSnapshot01 = parametersCreateOrUpdateSnapshotsSnapshot01.category("snapshot").description($("Commands to configure snapshot of managed-snapshot in config file.")); setparametersCreateOrUpdateSnapshotsSnapshot01.command("set").description($("Set snapshot 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 \"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("--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: 535 }; 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 + "/") + "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 catparametersCreateOrUpdateSnapshotsSnapshot11 = cli.category("managed-snapshot"); var parametersCreateOrUpdateSnapshotsSnapshot11 = catparametersCreateOrUpdateSnapshotsSnapshot11.category("config").description($("Commands to manage configuration of snapshots in the parameter file.")); var deleteparametersCreateOrUpdateSnapshotsSnapshot11 = parametersCreateOrUpdateSnapshotsSnapshot11.category("snapshot").description($("Commands to configure snapshot of managed-snapshot in config file.")); deleteparametersCreateOrUpdateSnapshotsSnapshot11.command("delete").description($("Remove snapshot 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 \"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("--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: 731 }; 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.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.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 catparametersCreateOrUpdateSnapshotsSku0S1 = cli.category("managed-snapshot"); var parametersCreateOrUpdateSnapshotsSku0S1 = catparametersCreateOrUpdateSnapshotsSku0S1.category("config").description($("Commands to manage configuration of snapshots in the parameter file.")); var setparametersCreateOrUpdateSnapshotsSku0S1 = parametersCreateOrUpdateSnapshotsSku0S1.category("sku").description($("Commands to configure sku of managed-snapshot in config file.")); setparametersCreateOrUpdateSnapshotsSku0S1.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: 829 }; 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 catparametersCreateOrUpdateSnapshotsSku1S1 = cli.category("managed-snapshot"); var parametersCreateOrUpdateSnapshotsSku1S1 = catparametersCreateOrUpdateSnapshotsSku1S1.category("config").description($("Commands to manage configuration of snapshots in the parameter file.")); var deleteparametersCreateOrUpdateSnapshotsSku1S1 = parametersCreateOrUpdateSnapshotsSku1S1.category("sku").description($("Commands to configure sku of managed-snapshot in config file.")); deleteparametersCreateOrUpdateSnapshotsSku1S1.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: 893 }; 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 catparametersCreateOrUpdateSnapshotsCreationData0CD1 = cli.category("managed-snapshot"); var parametersCreateOrUpdateSnapshotsCreationData0CD1 = catparametersCreateOrUpdateSnapshotsCreationData0CD1.category("config").description($("Commands to manage configuration of snapshots in the parameter file.")); var setparametersCreateOrUpdateSnapshotsCreationData0CD1 = parametersCreateOrUpdateSnapshotsCreationData0CD1.category("creation-data").description($("Commands to configure creation-data of managed-snapshot in config file.")); setparametersCreateOrUpdateSnapshotsCreationData0CD1.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]").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("--create-option <createOption>", $("Set the create-option value.")).option("--storage-account-id <storageAccountId>", $("Set the storage-account-id value.")).option("--image-reference <imageReference>", $("Set the image-reference value.")).option("--source-uri <sourceUri>", $("Set the source-uri value.")).option("--source-resource-id <sourceResourceId>", $("Set the source-resource-id value.")).execute(function __8(options, _) { var fileContent, parametersObj, error, paramPath, updatedContent; var __frame = { name: "__8", line: 950 }; 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 = "/creationData"; 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 + "/") + "createOption"); if (options.createOption) { cli.output.verbose("================================================"); cli.output.verbose(("Path : " + paramPath)); cli.output.verbose(("Value : " + options.createOption)); cli.output.verbose("================================================"); if ((options.parse && options.createOption)) { options.createOption = JSON.parse(options.createOption); } ; jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.createOption },]); } ; paramPath = ((options.path + "/") + "storageAccountId"); if (options.storageAccountId) { cli.output.verbose("================================================"); cli.output.verbose(("Path : " + paramPath)); cli.output.verbose(("Value : " + options.storageAccountId)); cli.output.verbose("================================================"); if ((options.parse && options.storageAccountId)) { options.storageAccountId = JSON.parse(options.storageAccountId); } ; jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.storageAccountId },]); } ; paramPath = ((options.path + "/") + "imageReference"); if (options.imageReference) { cli.output.verbose("================================================"); cli.output.verbose(("Path : " + paramPath)); cli.output.verbose(("Value : " + options.imageReference)); cli.output.verbose("================================================"); if ((options.parse && options.imageReference)) { options.imageReference = JSON.parse(options.imageReference); } ; jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.imageReference },]); } ; paramPath = ((options.path + "/") + "sourceUri"); if (options.sourceUri) { cli.output.verbose("================================================"); cli.output.verbose(("Path : " + paramPath)); cli.output.verbose(("Value : " + options.sourceUri)); cli.output.verbose("================================================"); if ((options.parse && options.sourceUri)) { options.sourceUri = JSON.parse(options.sourceUri); } ; jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.sourceUri },]); } ; paramPath = ((options.path + "/") + "sourceResourceId"); if (options.sourceResourceId) { cli.output.verbose("================================================"); cli.output.verbose(("Path : " + paramPath)); cli.output.verbose(("Value : " + options.sourceResourceId)); cli.output.verbose("================================================"); if ((options.parse && options.sourceResourceId)) { options.sourceResourceId = JSON.parse(options.sourceResourceId); } ; jsonpatch.apply(parametersObj, [{ op: options.operation, path: paramPath, value: options.sourceResourceId },]); } ; 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 catparametersCreateOrUpdateSnapshotsCreationData1CD1 = cli.category("managed-snapshot"); var parametersCreateOrUpdateSnapshotsCreationData1CD1 = catparametersCreateOrUpdateSnapshotsCreationData1CD1.category("config").description($("Commands to manage configuration of snapshots in the parameter file.")); var deleteparametersCreateOrUpdateSnapshotsCreationData1CD1 = parametersCreateOrUpdateSnapshotsCreationData1CD1.category("creation-data").description($("Commands to configure creation-data of managed-snapshot in config file.")); deleteparametersCreateOrUpdateSnapshotsCreationData1CD1.command("delete").description($("Remove 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]").option("--parameter-file <parameter-file>", $("The parameter file path.")).option("--create-option", $("Remove the create-option value.")).option("--storage-account-id", $("Remove the storage-account-id value.")).option("--image-reference", $("Remove the image-reference value.")).option("--sourc