UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

132 lines (60 loc) 5.9 kB
/*** Generated by streamline 0.10.17 (callbacks) - DO NOT EDIT ***/ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename, false),__func=__rt.__func,__cb=__rt.__cb; var util = require("util"); var profile = require("../../util/profile"); var utils = require("../../util/utils"); var WebsitesClient = require("./websites/websitesclient"); var $ = utils.getLocaleString; exports.init = function(cli) { var log = cli.output; var site = cli.category("site"); var siteDomain = site.category("domain").description($("Commands to manage your Web Site domains")); siteDomain.command("list [name]").usage("[options] [name]").description($("Show your site domains")).option("--slot <slot>", $("the name of the slot")).option("-s, --subscription <id>", $("the subscription id")).execute(function __1(name, options, _) { var parsedSiteName, context, siteConfigurations; var __frame = { name: "__1", line: 36 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() { parsedSiteName = WebsitesClient.parseSiteName(name); context = { subscription: profile.current.getSubscription(options.subscription).id, site: { name: parsedSiteName.name, slot: (options.slot ? options.slot : parsedSiteName.slot) } }; return site.lookupSiteNameAndWebSpace(context, __cb(_, __frame, 10, 11, function __$__1() { return site.doSiteGet(context, __cb(_, __frame, 12, 36, function ___(__0, __1) { siteConfigurations = __1; cli.interaction.formatOutput(siteConfigurations.hostNames, function(data) { if ((data.length > 0)) { log.table(data, function(row, item) { row.cell($("Name"), item); }); } else { log.info($("No host names defined yet")); } ; }); _(); }, true)); }, true)); }); }); siteDomain.command("add [domain] [name]").usage("[options] <dn> [name]").description($("Add a site domain")).option("-d, --dn <dn>", $("the new domain name")).option("--slot <slot>", $("the name of the slot")).option("-s, --subscription <id>", $("the subscription id")).execute(function __2(dn, name, options, _) { var parsedSiteName, context, siteConfigurations; var __frame = { name: "__2", line: 66 }; return __func(_, this, arguments, __2, 3, __frame, function __$__2() { return cli.interaction.promptIfNotGiven($("Domain name: "), dn, __cb(_, __frame, 1, 27, function ___(__0, __1) { dn = __1; parsedSiteName = WebsitesClient.parseSiteName(name); context = { subscription: profile.current.getSubscription(options.subscription).id, site: { name: parsedSiteName.name, slot: (options.slot ? options.slot : parsedSiteName.slot) } }; return site.lookupSiteNameAndWebSpace(context, __cb(_, __frame, 12, 11, function __$__2() { return site.doSiteGet(context, __cb(_, __frame, 14, 36, function ___(__0, __2) { siteConfigurations = __2; siteConfigurations.hostNames.push(dn); return site.doSitePUT(context, { hostNames: siteConfigurations.hostNames }, __cb(_, __frame, 16, 11, function __$__2() { _(); }, true)); }, true)); }, true)); }, true)); }); }); siteDomain.command("delete [dn] [name]").usage("[options] <dn> [name]").description($("Delete a site domain")).option("-d, --dn <dn>", $("the domain name")).option("-q, --quiet", $("quiet mode, do not ask for delete confirmation")).option("--slot <slot>", $("the name of the slot")).option("-s, --subscription <id>", $("the subscription id")).execute(function __3(dn, name, options, _) { var parsedSiteName, context, siteConfigurations, found, i; var __frame = { name: "__3", line: 94 }; return __func(_, this, arguments, __3, 3, __frame, function __$__3() { return cli.interaction.promptIfNotGiven($("Domain name: "), dn, __cb(_, __frame, 1, 27, function ___(__0, __2) { dn = __2; return (function __$__3(_) { var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Delete domain name %s? [y/n] "), dn), __cb(_, __frame, 3, 45, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -93, 18, function ___(__0, __3) { return (function __$__3(__then) { if (__3) { return _(null); } else { __then(); } ; })(function __$__3() { parsedSiteName = WebsitesClient.parseSiteName(name); context = { subscription: profile.current.getSubscription(options.subscription).id, site: { name: parsedSiteName.name, slot: (options.slot ? options.slot : parsedSiteName.slot) } }; return site.lookupSiteNameAndWebSpace(context, __cb(_, __frame, 16, 11, function __$__3() { return site.doSiteGet(context, __cb(_, __frame, 18, 36, function ___(__0, __4) { siteConfigurations = __4; found = false; return (function __$__3(__then) { if (siteConfigurations.hostNames) { for (i = 0; (i < siteConfigurations.hostNames.length); i++) { if (utils.ignoreCaseEquals(siteConfigurations.hostNames[i], dn)) { siteConfigurations.hostNames.splice(i, 1); found = true; i--; } ; }; return (function __$__3(__then) { if (found) { return site.doSitePUT(context, { hostNames: siteConfigurations.hostNames }, __cb(_, __frame, 30, 15, __then, true)); } else { __then(); } ; })(__then); } else { __then(); } ; })(function __$__3() { if (!found) { return _(new Error(util.format($("Domain \"%s\" does not exist"), dn))); } ; _(); }); }, true)); }, true)); }); }, true)); }, true)); }); });};