UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

1,002 lines (489 loc) 87.7 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,__catch=__rt.__catch,__tryCatch=__rt.__tryCatch; var util = require("util"); var cdnManagementUtil = require("./cdnmanagement.utils"); var profile = require("../../../util/profile"); var utils = require("../../../util/utils"); var tagUtils = require("../tag/tagUtils"); var $ = utils.getLocaleString; exports.init = function(cli) { var log = cli.output; var cdn = cli.category("cdn").description($("Commands to manage Azure Content Delivery Network (CDN)")); var profiles = cdn.category("profile").description($("Commands to manage your Azure cdn profiles")); profiles.command("list").description($("List all profiles under the current subscription")).usage("[options] [resource-group]").option("-g, --resource-group [resource-group]", $("Name of the Resource Group")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __1(options, _) { var subscription, client, operation, progress, result; var __frame = { name: "__1", line: 50 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() { subscription = profile.current.getSubscription(options.subscription); client = utils.createCdnManagementClient(subscription); return (function __$__1(__then) { if (options.resourceGroup) { return client.profiles.listByResourceGroup(options.resourceGroup, __cb(_, __frame, 10, 36, function ___(__0, __1) { operation = __1; __then(); }, true)); } else { return client.profiles.listBySubscriptionId(__cb(_, __frame, 12, 36, function ___(__0, __2) { operation = __2; __then(); }, true)); } ; })(function __$__1() { progress = cli.interaction.progress(util.format($("Listing Cdn profile(s)"))); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() { result = operation; _(null, null, 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(result, function() { if ((!result || (result.length === 0))) { log.info($("No profiles found.")); } else { log.table(result, function(row, profile) { row.cell($("Name"), profile.name); row.cell($("ResourceGroup"), cdnManagementUtil.getResourceGroupFromProfileId(profile.id)); row.cell($("Location"), profile.location); row.cell($("Tags"), tagUtils.getTagsInfo(profile.tags)); row.cell($("ProvisioningState"), profile.provisioningState); row.cell($("ResourceState"), profile.resourceState); row.cell($("Sku"), profile.sku.name); row.cell($("Subscription"), subscription.id); }); } ; }); _(); }); }); }); }); }); profiles.command("show <name> <resource-group>").description($("Show the infomation of a specific cdn profile")).usage("[options] <name> <resource-group>").option("-n, --name [name]", $("Name of the Cdn Profile")).option("-g, --resource-group [resource-group]", $("Name of the Resource Group")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __2(name, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__2", line: 98 }; return __func(_, this, arguments, __2, 3, __frame, function __$__2() { options.name = (options.name || name); options.resourceGroup = (options.resourceGroup || resourceGroup); if (!options.name) { return _(null, cli.missingArgument("profile-name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } ; } ; subscription = profile.current.getSubscription(options.subscription); client = utils.createCdnManagementClient(subscription); progress = cli.interaction.progress(util.format($("Get cdn profile %s ..."), options.name)); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return client.profiles.get(options.name, options.resourceGroup, __cb(_, __frame, 25, 39, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__2() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__2() { _(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(_, function __$__2() { cli.interaction.formatOutput(result, function(data) { if (!data) { log.info($("No profile named %s found."), options.name); } else { log.data(""); log.data($("Profile name :"), result.name); log.data(""); log.data($("Resource Group :"), options.resourceGroup); log.data($("Location :"), result.location); log.data($("ResourceState :"), result.resourceState); log.data($("ProvisioningState :"), result.provisioningState); log.data($("Sku :"), result.sku.name); log.data($("Tags :"), tagUtils.getTagsInfo(result.tags)); log.data($("Id :"), result.id); log.data(""); } ; }); _(); }); }); }); }); profiles.command("create <name> <resource-group> <location> <sku-name>").description($("Create a profile under given resource group and subscription")).usage("[options] <name> <resource-group> <location> <sku-name> [tags]").option("-n, --name <name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile will be created in")).option("-l, --location <location>", $("The location in which to create the Cdn Profile")).option("-k, --sku-name <sku-name>", $("The pricing sku name of the Azure Cdn Profile")).option("-t, --tags [tags]", $(("Tags to set to the profile. Can be multiple. " + "In the format of 'name=value'. Name is required and value is optional."))).option("--subscription <subscription>", $("the subscription identifier")).execute(function __3(name, resourceGroup, location, skuName, options, _) { var tags, subscription, client, creationParameter, progress, callbackArgs, result, response; var __frame = { name: "__3", line: 162 }; return __func(_, this, arguments, __3, 5, __frame, function __$__3() { log.verbose(("arguments: " + JSON.stringify({ profileName: name, options: options }))); options.name = (options.name || name); options.resourceGroup = (options.resourceGroup || resourceGroup); options.location = (options.location || location); options.skuName = (options.skuName || skuName); if (!options.name) { return _(null, cli.missingArgument("name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } else { if (!options.location) { return _(null, cli.missingArgument("location")); } else { if (!options.skuName) { return _(null, cli.missingArgument("sku-name")); } ; } ; } ; } ; tags = { }; tags = tagUtils.buildTagsParameter(tags, options); subscription = profile.current.getSubscription(options.subscription); client = utils.createCdnManagementClient(subscription); creationParameter = { location: options.location, sku: { name: options.skuName }, tags: tags }; progress = cli.interaction.progress(util.format($("Attempting to create cdn profile %s ..."), options.name)); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return client.profiles.create(options.name, creationParameter, options.resourceGroup, __cb(_, __frame, 52, 39, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__3() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, 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() { cli.interaction.formatOutput(result, function(data) { if (!data) { log.info($("No profile information available")); } else { log.data(""); log.data($("Profile name :"), result.name); log.data(""); log.data($("Resource Group :"), options.resourceGroup); log.data($("Location :"), result.location); log.data($("ResourceState :"), result.resourceState); log.data($("ProvisioningState :"), result.provisioningState); log.data($("Sku :"), result.sku.name); log.data($("Tags :"), tagUtils.getTagsInfo(result.tags)); log.data($("Id :"), result.id); log.data(""); } ; }); if ((response.statusCode == 200)) { log.info((("Cdn profile " + options.name) + " is getting created...")); } else { log.info(("Failed in creating profile " + options.name)); } ; _(); }); }); }); }); profiles.command("delete [name] [resource-group]").description($("Delete a profile under given resource group and subscription")).usage("[options] <profile-name> <resource-group>").option("-n, --name <name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile will be delete in")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __4(name, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__4", line: 255 }; return __func(_, this, arguments, __4, 3, __frame, function __$__4() { log.verbose(("arguments: " + JSON.stringify({ profileName: name, options: options }))); options.name = (options.name || name); options.resourceGroup = (options.resourceGroup || resourceGroup); if (!options.name) { return _(null, cli.missingArgument("name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } ; } ; subscription = profile.current.getSubscription(); client = utils.createCdnManagementClient(subscription); progress = cli.interaction.progress(util.format($("Deleting Cdn Profile %s"), options.name)); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() { return client.profiles.deleteIfExists(options.name, options.resourceGroup, __cb(_, __frame, 35, 39, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; _(null, null, true); }, true, 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() { if ((response.statusCode == 200)) { log.info(("Delete command successfully invoked for Cdn Profile " + options.name)); } else { if ((response.statusCode == 204)) { log.info((("Delete sucess, but no profile named " + options.name) + " was found")); } else { log.info(("Error in deleting profile " + options.name)); } ; } ; _(); }); }); }); }); profiles.command("set <name> <resource-group>").description($("Update a profile's tags")).usage("[options] <name> <resource-group> [tags]").option("-n, --name <name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile will be created in")).option("-t, --tags [tags]", $(("Tags to set to the profile. Can be multiple. " + "In the format of 'name=value'. Name is required and value is optional."))).option("--subscription <subscription>", $("the subscription identifier")).execute(function __5(name, resourceGroup, options, _) { var tags, subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__5", line: 315 }; return __func(_, this, arguments, __5, 3, __frame, function __$__5() { log.verbose(("arguments: " + JSON.stringify({ profileName: name, options: options }))); options.name = (options.name || name); options.resourceGroup = (options.resourceGroup || resourceGroup); if (!options.name) { return _(null, cli.missingArgument("name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } ; } ; tags = { }; tags = tagUtils.buildTagsParameter(tags, options); subscription = profile.current.getSubscription(options.subscription); client = utils.createCdnManagementClient(subscription); progress = cli.interaction.progress(util.format($("Attempting to update tags for cdn profile %s ..."), options.name)); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return client.profiles.update(options.name, options.resourceGroup, tags, __cb(_, __frame, 34, 39, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__5() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, 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, function(data) { if (!data) { log.info($("No profile information available")); } else { log.data(""); log.data($("Profile name :"), result.name); log.data(""); log.data($("Resource Group :"), options.resourceGroup); log.data($("Location :"), result.location); log.data($("ResourceState :"), result.resourceState); log.data($("ProvisioningState :"), result.provisioningState); log.data($("Sku :"), result.sku.name); log.data($("Tags :"), tagUtils.getTagsInfo(result.tags)); log.data($("Id :"), result.id); log.data(""); } ; }); if ((response.statusCode == 202)) { log.info(("Successfully updated tags of profile " + options.name)); } else { log.info(("Failed in updating tags of profile " + options.name)); } ; _(); }); }); }); }); var ssoUri = cdn.category("ssouri").description($("Commands to generate sso uri of your Azure cdn profiles")); ssoUri.command("create <profile-name> <resource-group>").description($("Create sso uri of the profile")).usage("[options] <profile-name> <resource-group>").option("-n, --profile-name <profile-name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __6(profileName, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__6", line: 395 }; return __func(_, this, arguments, __6, 3, __frame, function __$__6() { log.verbose(("arguments: " + JSON.stringify({ profileName: profileName, options: options }))); options.profileName = (options.profileName || profileName); options.resourceGroup = (options.resourceGroup || resourceGroup); if (!options.profileName) { return _(null, cli.missingArgument("profile-name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } ; } ; subscription = profile.current.getSubscription(); client = utils.createCdnManagementClient(subscription); progress = cli.interaction.progress(util.format($("Generating Cdn profile(s) sso uri"))); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() { return client.profiles.generateSsoUri(options.profileName, options.resourceGroup, __cb(_, __frame, 32, 39, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__6() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, 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() { log.info($(((("Sso uri of profile " + options.profileName) + " is:\n ") + result.ssoUriValue))); _(); }); }); }); }); var endpoint = cdn.category("endpoint").description($("Commands to manage Azure cdn profile endpoints")); endpoint.command("list <profile-name> <resource-group>").description($("List endpoints by profile and resource group")).usage("[options] <profile-name> <resource-group>").option("-n, --profile-name <profile-name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __7(profileName, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__7", line: 451 }; return __func(_, this, arguments, __7, 3, __frame, function __$__7() { log.verbose(("arguments: " + JSON.stringify({ profileName: profileName, options: options }))); options.profileName = (options.profileName || profileName); options.resourceGroup = (options.resourceGroup || resourceGroup); if (!options.profileName) { return _(null, cli.missingArgument("profile-name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } ; } ; subscription = profile.current.getSubscription(); client = utils.createCdnManagementClient(subscription); progress = cli.interaction.progress(util.format($("Listing endpoints..."))); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__7() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__7() { return client.endpoints.listByProfile(options.profileName, options.resourceGroup, __cb(_, __frame, 31, 40, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__7() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, 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() { cli.interaction.formatOutput(result, function() { if ((!result || (result.length === 0))) { log.info($("No endpoints found.")); } else { log.table(result, function(row, endpoint) { row.cell($("Name"), endpoint.name); row.cell($("ProfileName"), options.profileName); row.cell($("ResourceGroup"), options.resourceGroup); row.cell($("Subscription"), subscription.id); row.cell($("Location"), endpoint.location); row.cell($("Tags"), tagUtils.getTagsInfo(endpoint.tags)); }); } ; }); _(); }); }); }); }); endpoint.command("show <name> <profile-name> <resource-group>").description($("Get endpoint by endpoint name, profile name, and resource group")).usage("[options] <name> <profile-name> <resource-group>").option("-n, --name <name>", $("Name of the endpoint")).option("-p, --profile-name <profile-name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __8(name, profileName, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__8", line: 515 }; return __func(_, this, arguments, __8, 4, __frame, function __$__8() { log.verbose(("arguments: " + JSON.stringify({ profileName: profileName, options: options }))); options.name = (options.name || name); options.profileName = (options.profileName || profileName); options.resourceGroup = (options.resourceGroup || resourceGroup); if (!options.name) { return _(null, cli.missingArgument("name")); } else { if (!options.profileName) { return _(null, cli.missingArgument("profile-name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } ; } ; } ; subscription = profile.current.getSubscription(); client = utils.createCdnManagementClient(subscription); progress = cli.interaction.progress(util.format($(("Getting endpoint named " + options.name)))); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__8() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__8() { return client.endpoints.get(options.name, options.profileName, options.resourceGroup, __cb(_, __frame, 34, 40, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__8() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, 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() { cli.interaction.formatOutput(result, function(data) { if (!data) { log.info($("No endpoint named %s found."), options.profileName); } else { log.data(""); log.data($("Endpoint name :"), result.name); log.data(""); log.data($("Profile name :"), options.profileName); log.data($("Resource Group :"), options.resourceGroup); log.data($("Location :"), result.location); log.data($("Tags :"), tagUtils.getTagsInfo(result.tags)); log.data($("Host Name :"), result.hostName); log.data($("Origin Host Header :"), result.originHostHeader); log.data($("Origin Path :"), result.originPath); log.data($("Content Types To Compress :"), result.contentTypesToCompress.join(",")); log.data($("Is Compression Enabled :"), result.isCompressionEnabled); log.data($("Is Http Allowed :"), result.isHttpAllowed); log.data($("Is Https Allowed :"), result.isHttpsAllowed); log.data($("Query String Caching Behavior :"), result.queryStringCachingBehavior); log.data($("Origin Names :"), cdnManagementUtil.getOriginNamesString(result.origins)); log.data($("Resource State :"), result.resourceState); log.data($("Provisioning State :"), result.provisioningState); log.data(""); } ; }); _(); }); }); }); }); endpoint.command("create <name> <profile-name> <resource-group> <location> <origin-name> <origin-host-name>").description($("Create endpoint with given name and properties.")).usage("[options] <name> <profile-name> <resource-group> <location> <origin-name> <origin-host-name> [origin-host-header] [origin-path] [content-type-to-compress] [is-compression-enabled] [is-http-allowed] [is-https-allowed] [query-string-caching-behavior] [http-port] [https-port] [tags]").option("-n, --name <name>", $("Name of the endpoint")).option("-p, --profile-name <profile-name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile")).option("-l, --location <location>", $("The location of the Cdn endpoint")).option("-o, --origin-name <origin-name>", $("The name of the origin used to identify the origin")).option("-r, --origin-host-name <origin-host-name>", $("The host name of the origin")).option("-e, --origin-host-header [origin-host-header]", $("The origin host header of the Azure Cdn Endpoint")).option("-i, --origin-path [origin-path]", $("The origin path Azure Cdn Endpoint")).option("-c, --content-types-to-compress [content-types-to-compress]", $("The list of mime types that need to be compressed by Cdn edge nodes")).option("-d, --is-compression-enabled [is-compression-enabled]", $("Is the compression enabled for the Cdn. Valid input: -d [true|false]")).option("-w, --is-http-allowed [is-http-allowed]", $("Is the http traffic allowed for the Cdn. Valid input: -w [true|false]")).option("-a, --is-https-allowed [is-https-allowed]", $("Is the https traffic allowed for the Cdn. Valid input: -a [true|false]")).option("-q, --query-string-caching-behavior [query-string-caching-behavior]", $("The way Cdn handles requests with query string")).option("-u, --http-port [http-port]", $("The port http traffic used on the origin server")).option("-w, --https-port [https-port]", $("The port https traffic used on the origin server")).option("-t, --tags [tags]", $("The tags to associate with the Azure Cdn Endpoint")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __9(name, profileName, resourceGroup, location, originName, originHostName, options, _) { var subscription, client, tags, contentTypesToCompress, endpointCreateParameters, progress, callbackArgs, result, response; var __frame = { name: "__9", line: 606 }; return __func(_, this, arguments, __9, 7, __frame, function __$__9() { log.verbose(("arguments: " + JSON.stringify({ profileName: profileName, options: options }))); options.name = (options.name || name); options.profileName = (options.profileName || profileName); options.resourceGroup = (options.resourceGroup || resourceGroup); options.location = (options.location || location); options.originName = (options.originName || originName); options.originHostName = (options.originHostName || originHostName); if (!options.name) { return _(null, cli.missingArgument("name")); } else { if (!options.profileName) { return _(null, cli.missingArgument("profile-name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } else { if (!options.location) { return _(null, cli.missingArgument("location")); } else { if (!options.originName) { return _(null, cli.missingArgument("origin-name")); } else { if (!options.originHostName) { return _(null, cli.missingArgument("origin-host-name")); } ; } ; } ; } ; } ; } ; subscription = profile.current.getSubscription(); client = utils.createCdnManagementClient(subscription); tags = { }; tags = tagUtils.buildTagsParameter(tags, options); contentTypesToCompress = (options.contentTypesToCompress ? options.contentTypesToCompress.split(",") : []); endpointCreateParameters = { contentTypesToCompress: contentTypesToCompress, location: options.location, originHostHeader: options.originHostHeader, originPath: options.originPath, origins: [{ name: originName, hostName: originHostName, httpPort: options.httpPort, httpsPort: options.httpsPort },], queryStringCachingBehavior: options.queryStringCachingBehavior, tags: tags }; if (options.isCompressionEnabled) { endpointCreateParameters.isCompressionEnabled = cdnManagementUtil.getBooleanFromString(options.isCompressionEnabled); } ; if (options.isHttpAllowed) { endpointCreateParameters.isHttpAllowed = cdnManagementUtil.getBooleanFromString(options.isHttpAllowed); } ; if (options.isHttpsAllowed) { endpointCreateParameters.isHttpsAllowed = cdnManagementUtil.getBooleanFromString(options.isHttpsAllowed); } ; progress = cli.interaction.progress(util.format($(("Creating endpoint named " + options.name)))); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__9() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__9() { return client.endpoints.create(options.name, endpointCreateParameters, options.profileName, options.resourceGroup, __cb(_, __frame, 74, 40, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__9() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, 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) { if (!data) { log.info($("Error creating endpoint %s.")); } else { log.data(""); log.data($("Endpoint name :"), result.name); log.data(""); log.data($("Profile name :"), options.profileName); log.data($("Resource Group :"), options.resourceGroup); log.data($("Location :"), result.location); log.data($("Tags :"), tagUtils.getTagsInfo(result.tags)); log.data($("Host Name :"), result.hostName); log.data($("Origin Host Header :"), result.originHostHeader); log.data($("Origin Path :"), result.originPath); log.data($("Content Types To Compress :"), result.contentTypesToCompress.join(",")); log.data($("Is Compression Enabled :"), result.isCompressionEnabled); log.data($("Is Http Allowed :"), result.isHttpAllowed); log.data($("Is Https Allowed :"), result.isHttpsAllowed); log.data($("Query String Caching Behavior :"), result.queryStringCachingBehavior); log.data($("Origin Names :"), cdnManagementUtil.getOriginNamesString(result.origins)); log.data($("Resource State :"), result.resourceState); log.data($("Provisioning State :"), result.provisioningState); log.data(""); } ; }); _(); }); }); }); }); endpoint.command("set <name> <profile-name> <resource-group>").description($("Update endpoint with given properties.")).usage("[options] <name> <profile-name> <resource-group> [origin-host-header] [origin-path] [content-type-to-compress] [is-compression-enabled] [is-http-allowed] [is-https-allowed] [query-string-caching-behavior] [tags]").option("-n, --name <name>", $("Name of the endpoint")).option("-p, --profile-name <profile-name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile")).option("-e, --origin-host-header [origin-host-header]", $("The origin host header of the Azure Cdn Endpoint")).option("-i, --origin-path [origin-path]", $("The origin path Azure Cdn Endpoint")).option("-c, --content-types-to-compress [content-types-to-compress]", $("The list of mime types that need to be compressed by Cdn edge nodes")).option("-d, --is-compression-enabled [is-compression-enabled]", $("Is the compression enabled for the Cdn. Valid input: -d [true|false]")).option("-u, --is-http-allowed [is-http-allowed]", $("Is the http traffic allowed for the Cdn. Valid input: -u [true|false]")).option("-w, --is-https-allowed [is-https-allowed]", $("Is the https traffic allowed for the Cdn. Valid input: -w [true|false]")).option("-q, --query-string-caching-behavior [query-string-caching-behavior]", $("The way Cdn handles requests with query string")).option("-t, --tags [tags]", $("The tags to associate with the Azure Cdn Endpoint")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __10(name, profileName, resourceGroup, options, _) { var subscription, client, endpointUpdateParameters, tags, progress, callbackArgs, result, response; var __frame = { name: "__10", line: 732 }; return __func(_, this, arguments, __10, 4, __frame, function __$__10() { log.verbose(("arguments: " + JSON.stringify({ profileName: profileName, options: options }))); options.name = (options.name || name); options.profileName = (options.profileName || profileName); options.resourceGroup = (options.resourceGroup || resourceGroup); if (!options.name) { return _(null, cli.missingArgument("name")); } else { if (!options.profileName) { return _(null, cli.missingArgument("profile-name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } ; } ; } ; subscription = profile.current.getSubscription(); client = utils.createCdnManagementClient(subscription); endpointUpdateParameters = { }; if (options.originHostHeader) { endpointUpdateParameters.originHostHeader = options.originHostHeader; } ; if (options.originPath) { endpointUpdateParameters.originPath = options.originPath; } ; if (options.isCompressionEnabled) { endpointUpdateParameters.isCompressionEnabled = cdnManagementUtil.getBooleanFromString(options.isCompressionEnabled); } ; if (options.contentTypesToCompress) { endpointUpdateParameters.contentTypesToCompress = options.contentTypesToCompress.split(","); } ; if (options.isHttpAllowed) { endpointUpdateParameters.isHttpAllowed = cdnManagementUtil.getBooleanFromString(options.isHttpAllowed); } ; if (options.isHttpsAllowed) { endpointUpdateParameters.isHttpsAllowed = cdnManagementUtil.getBooleanFromString(options.isHttpsAllowed); } ; if (options.queryStringCachingBehavior) { endpointUpdateParameters.queryStringCachingBehavior = options.queryStringCachingBehavior; } ; if (options.tags) { tags = { }; tags = tagUtils.buildTagsParameter(tags, options); endpointUpdateParameters.tags = tags; } ; progress = cli.interaction.progress(util.format($(("Updating endpoint named " + options.name)))); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__10() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__10() { return client.endpoints.update(options.name, endpointUpdateParameters, options.profileName, options.resourceGroup, __cb(_, __frame, 67, 40, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__10() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, 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() { cli.interaction.formatOutput(result, function(data) { if (!data) { log.info($("Error updating endpoint %s.")); } else { log.data(""); log.data($("Endpoint name :"), result.name); log.data(""); log.data($("Profile name :"), options.profileName); log.data($("Resource Group :"), options.resourceGroup); log.data($("Location :"), result.location); log.data($("Tags :"), tagUtils.getTagsInfo(result.tags)); log.data($("Host Name :"), result.hostName); log.data($("Origin Host Header :"), result.originHostHeader); log.data($("Origin Path :"), result.originPath); log.data($("Content Types To Compress :"), result.contentTypesToCompress.join(",")); log.data($("Is Compression Enabled :"), result.isCompressionEnabled); log.data($("Is Http Allowed :"), result.isHttpAllowed); log.data($("Is Https Allowed :"), result.isHttpsAllowed); log.data($("Query String Caching Behavior :"), result.queryStringCachingBehavior); log.data($("Origin Names :"), cdnManagementUtil.getOriginNamesString(result.origins)); log.data($("Resource State :"), result.resourceState); log.data($("Provisioning State :"), result.provisioningState); log.data(""); } ; }); _(); }); }); }); }); endpoint.command("delete <name> <profile-name> <resource-group>").description($("Delete an endpoint by endpoint name, profile name, and resource group")).usage("[options] <ename> <profile-name> <resource-group>").option("-n, --name <name>", $("Name of the endpoint")).option("-p, --profile-name <profile-name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __11(name, profileName, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__11", line: 846 }; return __func(_, this, arguments, __11, 4, __frame, function __$__11() { log.verbose(("arguments: " + JSON.stringify({ profileName: profileName, options: options }))); options.name = (options.name || name); options.profileName = (options.profileName || profileName); options.resourceGroup = (options.resourceGroup || resourceGroup); if (!options.name) { return _(null, cli.missingArgument("name")); } else { if (!options.profileName) { return _(null, cli.missingArgument("profile-name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } ; } ; } ; subscription = profile.current.getSubscription(); client = utils.createCdnManagementClient(subscription); progress = cli.interaction.progress(util.format($(("Deleting endpoint named " + options.name)))); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__11() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__11() { return client.endpoints.deleteIfExists(options.name, options.profileName, options.resourceGroup, __cb(_, __frame, 34, 40, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__11() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, 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() { if ((response.statusCode == 200)) { log.info(("Delete command successfully invoked for endpoint " + options.name)); } else { if ((response.statusCode == 204)) { log.info((("Delete sucess, but no endpoint named " + options.name) + " was found")); } else { log.info(("Error in deleting endpoint " + options.name)); } ; } ; _(); }); }); }); }); endpoint.command("start <name> <profile-name> <resource-group>").description($("Start an endpoint by endpoint name, profile name, and resource group")).usage("[options] <name> <profile-name> <resource-group>").option("-n, --name <name>", $("Name of the endpoint")).option("-p, --profile-name <profile-name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __12(name, profileName, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__12", line: 906 }; return __func(_, this, arguments, __12, 4, __frame, function __$__12() { log.verbose(("arguments: " + JSON.stringify({ profileName: profileName, options: options }))); options.name = (options.name || name); options.profileName = (options.profileName || profileName); options.resourceGroup = (options.resourceGroup || resourceGroup); if (!options.name) { return _(null, cli.missingArgument("name")); } else { if (!options.profileName) { return _(null, cli.missingArgument("profile-name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } ; } ; } ; subscription = profile.current.getSubscription(); client = utils.createCdnManagementClient(subscription); progress = cli.interaction.progress(util.format($(("Starting endpoint named " + options.name)))); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__12() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__12() { return client.endpoints.start(options.name, options.profileName, options.resourceGroup, __cb(_, __frame, 34, 40, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__12() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, 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() { if ((response.statusCode == 200)) { log.info((("Command successfully invoked for endpoint " + options.name) + " and it is now running")); } else { log.info(("Error in starting endpoint " + options.name)); } ; _(); }); }); }); }); endpoint.command("stop <name> <profile-name> <resource-group>").description($("Stop an endpoint by endpoint name, profile name, and resource group")).usage("[options] <name> <profile-name> <resource-group>").option("-n, --name <name>", $("Name of the endpoint")).option("-p, --profile-name <profile-name>", $("Name of the profile")).option("-g, --resource-group <resource-group>", $("The resource group of the Azure Cdn Profile")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __13(name, profileName, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__13", line: 964 }; return __func(_, this, arguments, __13, 4, __frame, function __$__13() { log.verbose(("arguments: " + JSON.stringify({ profileName: profileName, options: options }))); options.name = (options.name || name); options.profileName = (options.profileName || profileName); options.resourceGroup = (options.resourceGroup || resourceGroup); if (!options.name) { return _(null, cli.missingArgument("name")); } else { if (!options.profileName) { return _(null, cli.missingArgument("profile-name")); } else { if (!options.resourceGroup) { return _(null, cli.missingArgument("resource-group")); } ; } ; } ; subscription = profile.current.getSubscription(); client = utils.createCdnManagementClient(subscription); progress = cli.interaction.progress(util.format($(("Stopping endpoint named " + options.name)))); callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__13() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__13() { return client.endpoints.stop(options.name, options.profileName, options.resourceGroup, __cb(_, __frame, 34, 40, function ___(__0, __1) { callbackArgs = __1; result = callbackArgs[0]; response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__13() { if (e) { return _(e); } else { _(null, __result); } ; }, _); }