UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

746 lines (400 loc) 48.5 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,__tryCatch=__rt.__tryCatch; var profile = require("../../../util/profile"); var utils = require("../../../util/utils"); var webappUtils = require("./webappUtils"); var $ = utils.getLocaleString; exports.init = function(cli) { var log = cli.output; var webapp = cli.category("webapp").description($("Commands to manage your Azure webapps")); var config = webapp.category("config").description($("Commands to manage your Azure webapps configurations")); var appsettings = config.category("appsettings").description($("Commands to manage your Azure webapps app setting configurations")); var container = config.category("container").description($("Commands to manage your Azure webapps container configurations")); var publish = webapp.category("publishingprofile").description($("Command to get your Azure webapps publishing profile")); var hostnames = config.category("hostnames").description($("Commands to manage your Azure webapps hostnames")); config.command("show [resource-group] [name]").description($("Get webapp configuration \nexample: webapp config show RGName WebAppName")).usage("[options] <resource-group> <name>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the webapp to show")).option("--slot <slot>", $("the name of the slot")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __1(resourceGroup, name, options, _) { var subscription, client, progress, resultConfig, resultSite, resultAppSvc, publishingResult, appSettingsResult, serverFarmIdArr, serverFarmId; var __frame = { name: "__1", line: 52 }; return __func(_, this, arguments, __1, 3, __frame, function __$__1() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Getting webapp configuration")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { return (function __$__1(__then) { if (options.slot) { return client.sites.getSiteConfigSlot(resourceGroup, name, options.slot, __cb(_, __frame, 15, 38, function ___(__0, __1) { resultConfig = __1; return client.sites.listSitePublishingCredentialsSlot(resourceGroup, name, options.slot, __cb(_, __frame, 16, 42, function ___(__0, __2) { publishingResult = __2; return client.sites.listSiteAppSettingsSlot(resourceGroup, name, options.slot, __cb(_, __frame, 17, 43, function ___(__0, __3) { appSettingsResult = __3; return client.sites.getSiteSlot(resourceGroup, name, options.slot, options, __cb(_, __frame, 18, 36, function ___(__0, __4) { resultSite = __4; __then(); }, true)); }, true)); }, true)); }, true)); } else { return client.sites.getSiteConfig(resourceGroup, name, __cb(_, __frame, 20, 38, function ___(__0, __5) { resultConfig = __5; return client.sites.listSitePublishingCredentials(resourceGroup, name, __cb(_, __frame, 21, 42, function ___(__0, __6) { publishingResult = __6; return client.sites.listSiteAppSettings(resourceGroup, name, __cb(_, __frame, 22, 43, function ___(__0, __7) { appSettingsResult = __7; return client.sites.getSite(resourceGroup, name, options, __cb(_, __frame, 23, 36, function ___(__0, __8) { resultSite = __8; __then(); }, true)); }, true)); }, true)); }, true)); } ; })(function __$__1() { serverFarmIdArr = (resultSite.serverFarmId).split("/"); serverFarmId = serverFarmIdArr[(serverFarmIdArr.length - 1)]; return client.serverFarms.getServerFarm(resourceGroup, serverFarmId, __cb(_, __frame, 27, 42, function ___(__0, __9) { resultAppSvc = __9; _(null, null, true); }, true)); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__1() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__1() { cli.interaction.formatOutput(resultConfig, function(data) { if (!data) { log.info($("No webapp information available")); } else { log.data($("Properties")); log.data($("--------------------------------")); log.data($("Web app Name :"), data.name); log.data($("Location :"), data.location); log.data($("Php version :"), data.phpVersion); log.data($("Python version :"), data.pythonVersion); log.data($("Node version :"), data.nodeVersion); log.data($("Linux Enabled :"), resultAppSvc.reserved); log.data($("App Command Line :"), data.appCommandLine); log.data($("Number Of Workers :"), data.numberOfWorkers); log.data($("Net Framework Version :"), data.netFrameworkVersion); log.data($("Java version :"), data.javaVersion); log.data($("Java Container :"), data.javaContainer); log.data($("Java Container Version :"), data.javaContainerVersion); log.data($("Scm Type :"), data.scmType); log.data($("Http Logging Enabled :"), data.httpLoggingEnabled); log.data($("Detailed Error Logging Enabled :"), data.detailedErrorLoggingEnabled); log.data($("Web Socket Enabled :"), data.webSocketEnabled); log.data($("Always On :"), data.alwaysOn); log.data($("Use 32bit Worker Process :"), data.use32BitWorkerProcess); log.data($("Auto Heal Enabled :"), data.autoHealEnabled); log.data($("Remote Debugging Enabled :"), data.remoteDebuggingEnabled); log.data($("Remote Debugging Version :"), data.remoteDebuggingVersion); log.data($("Logs Directory Size Limit :"), data.logsDirectorySizeLimit); log.data($("Load Balancing :"), data.loadBalancing); log.data($("Managed Pipeline Mode :"), data.managedPipelineMode); log.data($("Virtual Applications :"), data.virtualApplications); log.data($("Request Tracing Expiration Time:"), data.requestTracingExpirationTime); log.data($("Request Tracing Enabled :"), data.requestTracingEnabled); log.data($("Document Root :"), data.documentRoot); log.data($("Handler Mappings :"), data.handlerMappings); log.data($("Metadata :"), data.Metadata); log.data($("Default Documents :"), data.defaultDocuments); } ; }); cli.interaction.formatOutput(publishingResult, function(data) { if (!data) { log.info($("No webapp publishing profile information available")); } else { log.data($("Publish Profile Username :"), data.publishingUserName); log.data($("Publish Profile Password :"), data.publishingPassword); log.data(""); } ; }); cli.interaction.formatOutput(appSettingsResult.properties, function(data) { if (((appSettingsResult.properties !== null) && (appSettingsResult.properties !== undefined))) { log.data($("App Settings (use webapp config appsettings to change)")); log.data($("--------------------------------")); log.data(data); log.data($("")); } ; }); _(); }); }); }); }); config.command("set [resource-group] [name]").description($("Set webapp configuration\nexample: webapp config set RGName WebAppName --alwayson true --numberofworkers 1")).usage("[options] <resource-group> <name>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the webapp to update")).option("-j --jsonInput <jsonInput>", $("the json config object string")).option("--phpversion <phpversion>", $("php version of webapp")).option("--pythonversion <pythonversion>", $("python version of webapp")).option("--nodeversion <nodeversion>", $("node version of webapp")).option("--numberofworkers <numberofworkers>", $("number of workers")).option("--appcommandline <appcommandline>", $("app command line")).option("--netframeworkversion <netframeworkversion>", $("net framwork version of webapp")).option("--requesttracingenabled <requesttracingenabled>", $("request tracing enabled option")).option("--remotedebuggingenabled <remotedebuggingenabled>", $("remote debugging enabled option")).option("--httploggingenabled <httploggingenabled>", $("http logging enabled option")).option("--detailederrorloggingenabled <detailederrorloggingenabled>", $("detailed error logging enabled option")).option("--websocketenabled <websocketenabled>", $("web socket enabled option")).option("--use32bitworkerprocess <use32bitworkerprocess>", $("use 32 bit process option")).option("--alwayson <alwayson>", $("always on option")).option("--autohealenabled <autohealenabled>", $("auto heal enabled option")).option("--javaversion <javaversion>", $("java version of webapp")).option("--javacontainer <javacontainer>", $("java container of webapp")).option("--javacontainerversion <javacontainerversion>", $("java container version of webapp")).option("--scmtype <scmtype>", $("scm type of webapp")).option("--slot <slot>", $("the name of the slot")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __2(resourceGroup, name, options, _) { var webSiteSlotName, subscription, client, progress, jsonObj, result; var __frame = { name: "__2", line: 167 }; return __func(_, this, arguments, __2, 3, __frame, function __$__2() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; webSiteSlotName = name; if (options.slot) { webSiteSlotName = name.concat("/", options.slot); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Updating webapp configuration\n")); jsonObj = { }; if (((options.jsonInput !== null) && (options.jsonInput !== undefined))) { jsonObj = JSON.parse(options.jsonInput); } ; if (((options.phpversion !== null) && (options.phpversion !== undefined))) { jsonObj["phpVersion"] = options.phpversion; } ; if (((options.pythonversion !== null) && (options.pythonversion !== undefined))) { jsonObj["pythonVersion"] = options.pythonversion; } ; if (((options.nodeversion !== null) && (options.nodeversion !== undefined))) { jsonObj["nodeVersion"] = options.nodeversion; } ; if (((options.numberofworkers !== null) && (options.numberofworkers !== undefined))) { jsonObj["numberOfWorkers"] = Number(options.numberofworkers); } ; if (((options.appcommandline !== null) && (options.appcommandline !== undefined))) { jsonObj["appCommandLine"] = options.appcommandline; } ; if (((options.netframeworkversion !== null) && (options.netframeworkversion !== undefined))) { jsonObj["netFrameworkVersion"] = options.netframeworkversion; } ; if (((options.requesttracingenabled !== null) && (options.requesttracingenabled !== undefined))) { jsonObj["requestTracingEnabled"] = toBool(options.requesttracingenabled); } ; if (((options.remotedebuggingenabled !== null) && (options.remotedebuggingenabled !== undefined))) { jsonObj["remoteDebuggingEnabled"] = toBool(options.remotedebuggingenabled); } ; if (((options.httploggingenabled !== null) && (options.httploggingenabled !== undefined))) { jsonObj["httpLoggingEnabled"] = toBool(options.httploggingenabled); } ; if (((options.detailederrorloggingenabled !== null) && (options.detailederrorloggingenabled !== undefined))) { jsonObj["detailedErrorLoggingEnabled"] = toBool(options.detailederrorloggingenabled); } ; if (((options.publishingusername !== null) && (options.publishingusername !== undefined))) { jsonObj["publishingUsername"] = options.publishingusername; } ; if (((options.publishingpassword !== null) && (options.publishingpassword !== undefined))) { jsonObj["publishingPassword"] = options.publishingpassword; } ; if (((options.websocketenabled !== null) && (options.websocketenabled !== undefined))) { jsonObj["webSocketEnabled"] = toBool(options.websocketenabled); } ; if (((options.use32bitworkerprocess !== null) && (options.use32bitworkerprocess !== undefined))) { jsonObj["use32BitWorkerProcess"] = toBool(options.use32bitworkerprocess); } ; if (((options.alwayson !== null) && (options.alwayson !== undefined))) { jsonObj["alwaysOn"] = toBool(options.alwayson); } ; if (((options.autohealenabled !== null) && (options.autohealenabled !== undefined))) { jsonObj["autoHealEnabled"] = toBool(options.autohealenabled); } ; if (((options.javaversion !== null) && (options.javaversion !== undefined))) { jsonObj["javaVersion"] = options.javaversion; } ; if (((options.javacontainer !== null) && (options.javacontainer !== undefined))) { jsonObj["javaContainer"] = options.javacontainer; } ; if (((options.javacontainerversion !== null) && (options.javacontainerversion !== undefined))) { jsonObj["javaContainerVersion"] = options.javacontainerversion; } ; if (((options.scmtype !== null) && (options.scmtype !== undefined))) { jsonObj["scmType"] = options.scmtype; } ; return (function __$__2(__then) { if ((Object.keys(jsonObj).length !== 0)) { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return (function __$__2(__then) { if (options.slot) { return client.sites.getSiteSlot(resourceGroup, name, options.slot, __cb(_, __frame, 82, 34, function ___(__0, __1) { result = __1; jsonObj["location"] = result.location; return client.sites.createOrUpdateSiteConfigSlot(resourceGroup, name, jsonObj, options.slot, __cb(_, __frame, 84, 34, function ___(__0, __2) { result = __2; log.info((((("Webapp slot " + name) + "/") + options.slot) + " configuration has been updated ")); __then(); }, true)); }, true)); } else { return client.sites.getSite(resourceGroup, name, __cb(_, __frame, 88, 34, function ___(__0, __3) { result = __3; jsonObj["location"] = result.location; return client.sites.createOrUpdateSiteConfig(resourceGroup, name, jsonObj, __cb(_, __frame, 90, 34, function ___(__0, __4) { result = __4; log.info((("Webapp " + name) + " configuration has been updated ")); __then(); }, true)); }, true)); } ; })(function __$__2() { cli.interaction.formatOutput(result, function() { if ((!result || (result.length === 0))) { log.error($("API call did not return a valid result")); }; }); _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__2() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, __then); }); } else { log.info("No options selected"); progress.end(); __then(); } ; })(_); }); }); function toBool(stringToParse) { var str = stringToParse.toUpperCase(); if ((str == "TRUE")) { return true }; if ((str == "FALSE")) { return false }; if ((str == "ON")) { return true }; if ((str == "OFF")) { return false }; return stringToParse; }; appsettings.command("set [resource-group] [name] [appsettings]").description($("Set webapp app settings (using comma seperated key value pairs)\nexample: webapp config appsettings set RGName WebAppName KEY1=val1,KEY2=val2,KEY3=val3")).usage("[options] <resource-group> <name> <appsettings>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the webapp to show")).option("-a --appsettings <appsettings>", $("the appsettings of the webapp to add")).option("--slot <slot>", $("the name of the slot")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __3(resourceGroup, name, appsettings, options, _) { var subscription, client, progress, currentAppSettings, appSettingsToAdd, appSettingsToAddSplit, settingSplit, result, i, firstEqual; var __frame = { name: "__3", line: 292 }; return __func(_, this, arguments, __3, 4, __frame, function __$__3() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; if (!appsettings) { return _(null, cli.missingArgument("appsettings")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Getting webapp appsettings")); appSettingsToAdd = appsettings; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return (function __$__3(__then) { if (options.slot) { return client.sites.listSiteAppSettingsSlot(resourceGroup, name, options.slot, __cb(_, __frame, 20, 44, function ___(__0, __1) { currentAppSettings = __1; __then(); }, true)); } else { return client.sites.listSiteAppSettings(resourceGroup, name, __cb(_, __frame, 22, 44, function ___(__0, __2) { currentAppSettings = __2; __then(); }, true)); } ; })(function __$__3() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__3() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__3() { appSettingsToAddSplit = appSettingsToAdd.toString().split(","); settingSplit = []; for (i = 0; (i < appSettingsToAddSplit.length); i++) { firstEqual = appSettingsToAddSplit[i].indexOf("="); if ((firstEqual !== -1)) { settingSplit = [appSettingsToAddSplit[i].substr(0, firstEqual),appSettingsToAddSplit[i].substr((firstEqual + 1)),]; currentAppSettings.properties[settingSplit[0]] = settingSplit[1]; } else { log.info($((appSettingsToAddSplit[i] + " does not contain an '='"))); } ; }; progress = cli.interaction.progress($("Modifying webapp appsettings")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return (function __$__3(__then) { if (options.slot) { return client.sites.updateSiteAppSettingsSlot(resourceGroup, name, currentAppSettings, options.slot, __cb(_, __frame, 42, 32, function ___(__0, __3) { result = __3; __then(); }, true)); } else { return client.sites.updateSiteAppSettings(resourceGroup, name, currentAppSettings, __cb(_, __frame, 44, 32, function ___(__0, __4) { result = __4; __then(); }, true)); } ; })(function __$__3() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__3() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__3() { log.data($("Final App Settings")); log.data($("--------------------------------")); log.data(result.properties); log.data($("")); _(); }); }); }); }); }); }); appsettings.command("delete [resource-group] [name] [appsettings]").description($("Delete webapp app settings (using comma seperated keys)\nexample: webapp config appsettings delete RGName WebAppName KEY1,KEY2,KEY3")).usage("[options] <resource-group> <name> <appsettings>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the webapp to show")).option("-a --appsettings <appsettings>", $("the appsettings of the webapp to delete")).option("--slot <slot>", $("the name of the slot")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __4(resourceGroup, name, appsettings, options, _) { var subscription, client, progress, currentAppSettings, appSettingsToDelete, appSettingsToDeleteSplit, result, appSettingsToDeleteProperties, i, attrname; var __frame = { name: "__4", line: 355 }; return __func(_, this, arguments, __4, 4, __frame, function __$__4() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; if (!appsettings) { return _(null, cli.missingArgument("appsettings")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Getting webapp appsettings")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return (function __$__4(__then) { if (options.slot) { return client.sites.listSiteAppSettingsSlot(resourceGroup, name, options.slot, __cb(_, __frame, 16, 44, function ___(__0, __1) { currentAppSettings = __1; __then(); }, true)); } else { return client.sites.listSiteAppSettings(resourceGroup, name, __cb(_, __frame, 18, 44, function ___(__0, __2) { currentAppSettings = __2; __then(); }, true)); } ; })(function __$__4() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__4() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__4() { appSettingsToDelete = appsettings; appSettingsToDeleteProperties = { }; appSettingsToDeleteSplit = appSettingsToDelete.toString().split(","); for (i = 0; (i < appSettingsToDeleteSplit.length); i++) { appSettingsToDeleteProperties[appSettingsToDeleteSplit[i]] = ""; }; for (attrname in appSettingsToDeleteProperties) { if (currentAppSettings.properties.hasOwnProperty(attrname)) { delete currentAppSettings.properties[attrname]; } else { log.data((attrname + " does not exist in current appsettings!")); } ; }; progress = cli.interaction.progress($("Deleting webapp appsettings")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return (function __$__4(__then) { if (options.slot) { return client.sites.updateSiteAppSettingsSlot(resourceGroup, name, currentAppSettings, options.slot, __cb(_, __frame, 42, 32, function ___(__0, __3) { result = __3; __then(); }, true)); } else { return client.sites.updateSiteAppSettings(resourceGroup, name, currentAppSettings, __cb(_, __frame, 44, 32, function ___(__0, __4) { result = __4; __then(); }, true)); } ; })(function __$__4() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__4() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__4() { log.data($("Final App Settings")); log.data($("--------------------------------")); log.data(result.properties); log.data($("")); _(); }); }); }); }); }); }); appsettings.command("list [resource-group] [name]").description($("Get webapp app settings")).usage("[options] <resource-group> <name>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the webapp to list")).option("--slot <slot>", $("the name of the slot")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __5(resourceGroup, name, options, _) { var subscription, client, progress, result; var __frame = { name: "__5", line: 417 }; return __func(_, this, arguments, __5, 3, __frame, function __$__5() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Getting webapp appsettings")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return (function __$__5(__then) { if (options.slot) { return client.sites.listSiteAppSettingsSlot(resourceGroup, name, options.slot, __cb(_, __frame, 13, 32, function ___(__0, __1) { result = __1; __then(); }, true)); } else { return client.sites.listSiteAppSettings(resourceGroup, name, __cb(_, __frame, 15, 32, function ___(__0, __2) { result = __2; __then(); }, true)); } ; })(function __$__5() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__5() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__5() { cli.interaction.formatOutput(result.properties, function(data) { if (((result.properties !== null) && (result.properties !== undefined))) { log.data($("App Settings")); log.data($("--------------------------------")); log.data(data); log.data($("")); } else { log.data($("No app setting set")); } ; }); _(); }); }); }); }); publish.command("show [resource-group] [name]").description($("Get webapp publish profile")).usage("[options] <resource-group> <name>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the webapp to show")).option("--slot <slot>", $("the name of the slot")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __6(resourceGroup, name, options, _) { var subscription, client, progress, result; var __frame = { name: "__6", line: 457 }; return __func(_, this, arguments, __6, 3, __frame, function __$__6() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Getting webapp configuration")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() { return (function __$__6(__then) { if (options.slot) { return client.sites.listSitePublishingCredentialsSlot(resourceGroup, name, options.slot, __cb(_, __frame, 13, 32, function ___(__0, __1) { result = __1; __then(); }, true)); } else { return client.sites.listSitePublishingCredentials(resourceGroup, name, options, __cb(_, __frame, 15, 32, function ___(__0, __2) { result = __2; __then(); }, true)); } ; })(function __$__6() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__6() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__6() { cli.interaction.formatOutput(result, function(data) { if (!data) { log.info($("No webapp publishing profile information available")); } else { log.data(""); log.data(data); log.data(""); } ; }); _(); }); }); }); }); hostnames.command("add [resource-group] [name] [hostnames]").description($("Add a hostname bindings for a webapp (using comma seperated names)\nexample: webapp config hostnames add RGName WebAppName www.site1.com,www.site2.co.uk")).usage("[options] <resource-group> <name> <hostnames>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the web app")).option("-o --hostnames <hostname>", $("the list of hostnames to bind")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __7(resourceGroup, name, hostnames, options, _) { var subscription, client, progress, result, hostnamesToAddSplit, i, bindingOptions; var __frame = { name: "__7", line: 495 }; return __func(_, this, arguments, __7, 4, __frame, function __$__7() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; if (!hostnames) { return _(null, cli.missingArgument("hostnames")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Getting webapp hostnames")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__7() { return (function __$__7(__then) { if (options.slot) { return client.sites.getSiteSlot(resourceGroup, name, options.slot, __cb(_, __frame, 16, 32, function ___(__0, __1) { result = __1; __then(); }, true)); } else { return client.sites.getSite(resourceGroup, name, __cb(_, __frame, 18, 32, function ___(__0, __2) { result = __2; __then(); }, true)); } ; })(function __$__7() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__7() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__7() { hostnamesToAddSplit = hostnames.toString().split(","); i = 0; var __8 = false; return (function ___(__break) { var __more; var __loop = __cb(_, __frame, 0, 0, function __$__7() { __more = false; if (__8) { i++; } else { __8 = true; } ; var __7 = (i < hostnamesToAddSplit.length); if (__7) { bindingOptions = { location: result.location, siteName: name, hostNameBindingName: hostnamesToAddSplit[i] }; progress = cli.interaction.progress($("Adding hostname:"), hostnamesToAddSplit[i]); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__7() { return (function __$__7(__then) { if (options.slot) { return client.sites.createOrUpdateSiteHostNameBindingSlot(resourceGroup, name, hostnamesToAddSplit[i], bindingOptions, options.slot, __cb(_, __frame, 33, 34, function ___(__0, __3) { result = __3; __then(); }, true)); } else { return client.sites.createOrUpdateSiteHostNameBinding(resourceGroup, name, hostnamesToAddSplit[i], bindingOptions, __cb(_, __frame, 35, 34, function ___(__0, __4) { result = __4; __then(); }, true)); } ; })(function __$__7() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__7() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__7() { while (__more) { __loop(); }; __more = true; }); }); } else { __break(); } ; }); do { __loop(); } while (__more); __more = true; })(_); }); }); }); }); hostnames.command("delete [resource-group] [name] [hostnames]").description($("Delete a hostname binding for a webapp(using comma seperated names)\nexample: webapp config hostnames delete RGName WebAppName www.site1.com,www.site2.co.uk")).usage("[options] <resource-group> <name> <hostnames>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the web app")).option("-o --hostnames <hostname>", $("the list of hostnames to unbind")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __8(resourceGroup, name, hostnames, options, _) { var subscription, client, progress, hostnamesToDeleteSplit, i; var __frame = { name: "__8", line: 545 }; return __func(_, this, arguments, __8, 4, __frame, function __$__8() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; if (!hostnames) { return _(null, cli.missingArgument("hostnames")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Getting webapp hostnames")); hostnamesToDeleteSplit = hostnames.toString().split(","); i = 0; var __2 = false; return (function ___(__break) { var __more; var __loop = __cb(_, __frame, 0, 0, function __$__8() { __more = false; if (__2) { i++; } else { __2 = true; } ; var __1 = (i < hostnamesToDeleteSplit.length); if (__1) { progress = cli.interaction.progress($("Deleting hostname:"), hostnamesToDeleteSplit[i]); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__8() { return (function __$__8(__then) { if (options.slot) { return client.sites.deleteSiteHostNameBindingSlot(resourceGroup, name, options.slot, hostnamesToDeleteSplit[i], __cb(_, __frame, 19, 25, __then, true)); } else { return client.sites.deleteSiteHostNameBinding(resourceGroup, name, hostnamesToDeleteSplit[i], __cb(_, __frame, 21, 25, __then, true)); } ; })(function __$__8() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__8() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__8() { while (__more) { __loop(); }; __more = true; }); }); } else { __break(); } ; }); do { __loop(); } while (__more); __more = true; })(_); }); }); hostnames.command("list [resource-group] [name]").description($("List hostname bindings under a webapp")).usage("[options] <resource-group> <name>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the web app")).option("--slot <slot>", $("the name of the slot")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __9(resourceGroup, name, options, _) { var subscription, client, progress, result; var __frame = { name: "__9", line: 581 }; return __func(_, this, arguments, __9, 3, __frame, function __$__9() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Getting webapp hostnames")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__9() { return (function __$__9(__then) { if (options.slot) { return client.sites.getSiteHostNameBindingsSlot(resourceGroup, name, options.slot, __cb(_, __frame, 13, 32, function ___(__0, __1) { result = __1; __then(); }, true)); } else { return client.sites.getSiteHostNameBindings(resourceGroup, name, __cb(_, __frame, 15, 32, function ___(__0, __2) { result = __2; __then(); }, true)); } ; })(function __$__9() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__9() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__9() { cli.interaction.formatOutput(result, function(data) { data = data.value; if ((((data === undefined) || (data.length <= 0)) || !data)) { log.info($("No web app hostname bindings defined.")); } else { log.table(data, function(row, item) { var hostnameIdArr = (item.name).split("/"); row.cell($("HostName "), hostnameIdArr[1]); row.cell($("Type "), item.hostNameType); }); } ; }); _(); }); }); }); }); container.command("set [resource-group] [name]").description($("Set webapp Container configurations (available only for linux webapps)")).usage("[options] <resource-group> <name>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the webapp")).option("-r --url <url>", $("the container registry server url")).option("-u --username <username>", $("the container registry server username")).option("-p --password <password>", $("the container registry server password")).option("-c --custom-image-name <custom-image-name>", $("the container custom image name and optionally the tag name")).option("--slot <slot>", $("the name of the slot")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __10(resourceGroup, name, options, _) { var subscription, client, progress, currentAppSettings, result; var __frame = { name: "__10", line: 626 }; return __func(_, this, arguments, __10, 3, __frame, function __$__10() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); if (!((((options.url || options.username) || options.password) || options["customImageName"]))) { return _(new Error("User did not specify any container options")); } ; progress = cli.interaction.progress($("Setting webapp container settings")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__10() { return (function __$__10(__then) { if (options.slot) { return client.sites.listSiteAppSettingsSlot(resourceGroup, name, options.slot, __cb(_, __frame, 16, 44, function ___(__0, __1) { currentAppSettings = __1; __then(); }, true)); } else { return client.sites.listSiteAppSettings(resourceGroup, name, __cb(_, __frame, 18, 44, function ___(__0, __2) { currentAppSettings = __2; __then(); }, true)); } ; })(function __$__10() { if (options.url) { currentAppSettings.properties["DOCKER_REGISTRY_SERVER_URL"] = options.url; } ; if (options.username) { currentAppSettings.properties["DOCKER_REGISTRY_SERVER_USERNAME"] = options.username; } ; if (options.password) { currentAppSettings.properties["DOCKER_REGISTRY_SERVER_PASSWORD"] = options.password; } ; if (options["customImageName"]) { currentAppSettings.properties["DOCKER_CUSTOM_IMAGE_NAME"] = options["customImageName"]; } ; return (function __$__10(__then) { if (options.slot) { return client.sites.updateSiteAppSettingsSlot(resourceGroup, name, currentAppSettings, options.slot, __cb(_, __frame, 29, 32, function ___(__0, __3) { result = __3; __then(); }, true)); } else { return client.sites.updateSiteAppSettings(resourceGroup, name, currentAppSettings, __cb(_, __frame, 31, 32, function ___(__0, __4) { result = __4; __then(); }, true)); } ; })(function __$__10() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__10() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__10() { log.data($("Final Container Settings")); log.data($("--------------------------------")); cli.interaction.formatOutput(result.properties, function(data) { log.data($("Container Registry Server URL :"), data["DOCKER_REGISTRY_SERVER_URL"]); log.data($("Container Registry Server Username :"), data["DOCKER_REGISTRY_SERVER_USERNAME"]); log.data($("Container Registry Server Password :"), data["DOCKER_REGISTRY_SERVER_PASSWORD"]); log.data($("Container Custom Image Name :"), data["DOCKER_CUSTOM_IMAGE_NAME"]); log.data($("")); }); _(); }); }); }); }); container.command("list [resource-group] [name]").description($("List Container configurations (available only for linux webapps)")).usage("[options] <resource-group> <name>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the webapp")).option("--slot <slot>", $("the name of the slot")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __11(resourceGroup, name, options, _) { var subscription, client, progress, result; var __frame = { name: "__11", line: 680 }; return __func(_, this, arguments, __11, 3, __frame, function __$__11() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Getting webapp container settings")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__11() { return (function __$__11(__then) { if (options.slot) { return client.sites.listSiteAppSettingsSlot(resourceGroup, name, options.slot, __cb(_, __frame, 13, 32, function ___(__0, __1) { result = __1; __then(); }, true)); } else { return client.sites.listSiteAppSettings(resourceGroup, name, __cb(_, __frame, 15, 32, function ___(__0, __2) { result = __2; __then(); }, true)); } ; })(function __$__11() { _(null, null, true); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__11() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__11() { log.data($("Final Container Settings")); log.data($("--------------------------------")); cli.interaction.formatOutput(result.properties, function(data) { log.data($("Container Registry Server URL :"), data["DOCKER_REGISTRY_SERVER_URL"]); log.data($("Container Registry Server Username :"), data["DOCKER_REGISTRY_SERVER_USERNAME"]); log.data($("Container Registry Server Password :"), data["DOCKER_REGISTRY_SERVER_PASSWORD"]); log.data($("Container Custom Image Name :"), data["DOCKER_CUSTOM_IMAGE_NAME"]); log.data($("")); }); _(); }); }); }); }); container.command("delete [resource-group] [name]").description($("Delete all webapp Container configurations (available only for linux webapps)")).usage("[options] <resource-group> <name>").option("-g --resource-group <resource-group>", $("the name of the resource group")).option("-n --name <name>", $("the name of the webapp")).option("--slot <slot>", $("the name of the slot")).option("-s --subscription <subscription>", $("the subscription identifier")).execute(function __12(resourceGroup, name, options, _) { var subscription, client, progress, currentAppSettings; var __frame = { name: "__12", line: 718 }; return __func(_, this, arguments, __12, 3, __frame, function __$__12() { if (!resourceGroup) { cli.missingArgument("resource-group"); } ; if (!name) { return _(null, cli.missingArgument("name")); } ; subscription = profile.current.getSubscription(options.subscription); client = webappUtils.createWebappManagementClient(subscription); progress = cli.interaction.progress($("Deleting webapp container settings")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__12() { return (function __$__12(__then) { if (options.slot) { return client.sites.listSiteAppSettingsSlot(resourceGroup, name, options.slot, __cb(_, __frame, 13, 44, function ___(__0, __1) { currentAppSettings = __1; __then(); }, true)); } else { return client.sites.listSiteAppSettings(resourceGroup, name, __cb(_, __frame, 15, 44, function ___(__0, __2) { currentAppSettings = __2; __then(); }, true)); } ; })(function __$__12() { delete currentAppSettings.properties["DOCKER_REGISTRY_SERVER_URL"]; delete currentAppSettings.properties["DOCKER_REGISTRY_SERVER_USERNAME"]; delete currentAppSettings.properties["DOCKER_REGISTRY_SERVER_PASSWORD"]; delete currentAppSettings.properties["DOCKER_CUSTOM_IMAGE_NAME"]; return (function __$__12(__then) { if (options.slot) { return client.sites.updateSiteAppSettingsSlot(resourceGroup, name, currentAppSettings, options.slot, __cb(_, __frame, 22, 23, __then, true)); } else { return client.sites.updateSiteAppSettings(resourceGroup, name, currentAppSettings, __cb(_, __frame, 24, 23, __then, true)); } ; })(function __$__12() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__12() { progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__12() { _(); }); }); }); });};