/*** 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() {










      return cli.interaction.promptIfNotGiven($("Profile name: "), name, __cb(_, __frame, 5, 26, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 6, 35, function ___(__0, __2) { resourceGroup = __2;




          subscription = profile.current.getSubscription(options.subscription);

          client = utils.createCdnManagementClient(subscription);

          progress = cli.interaction.progress(util.format($("Get cdn profile %s ..."), name));

          callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() {


                      return client.profiles.get(name, resourceGroup, __cb(_, __frame, 20, 39, function ___(__0, __3) { callbackArgs = __3;
                        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."), name); }
                 else {
                  log.data("");
                  log.data($("Profile name :"), result.name);
                  log.data("");
                  log.data($("Resource Group     :"), 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(""); } ; }); _(); }); }); }, true)); }, true)); }); });





  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: 157 }; return __func(_, this, arguments, __3, 5, __frame, function __$__3() {















      log.verbose(("arguments: " + JSON.stringify({
        profileName: name,
        options: options })));


      return cli.interaction.promptIfNotGiven($("Profile name: "), name, __cb(_, __frame, 11, 26, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 12, 35, function ___(__0, __2) { resourceGroup = __2;
          return cli.interaction.promptIfNotGiven($("Profile location: "), location, __cb(_, __frame, 13, 30, function ___(__0, __3) { location = __3;
            return cli.interaction.promptIfNotGiven($("Profile skuName name: "), skuName, __cb(_, __frame, 14, 29, function ___(__0, __4) { skuName = __4;

              tags = { };
              tags = tagUtils.buildTagsParameter(tags, options);





              subscription = profile.current.getSubscription(options.subscription);
              client = utils.createCdnManagementClient(subscription);




              creationParameter = {
                location: location,
                sku: {
                  name: skuName },

                tags: tags };


              progress = cli.interaction.progress(util.format($("Attempting to create cdn profile %s ..."), name));

              callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() {


                          return client.profiles.create(name, creationParameter, resourceGroup, __cb(_, __frame, 42, 39, function ___(__0, __5) { callbackArgs = __5;
                            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     :"), 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 " + name) + " is getting created...")); }
                   else {
                    log.info(("Failed in creating profile " + name)); } ; _(); }); }); }, true)); }, true)); }, true)); }, true)); }); });




  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: 240 }; return __func(_, this, arguments, __4, 3, __frame, function __$__4() {











      log.verbose(("arguments: " + JSON.stringify({
        profileName: name,
        options: options })));


      return cli.interaction.promptIfNotGiven($("Profile name: "), name, __cb(_, __frame, 11, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 12, 35, function ___(__0, __2) { resourceGroup = __2;





          subscription = profile.current.getSubscription();
          client = utils.createCdnManagementClient(subscription);





          progress = cli.interaction.progress(util.format($("Deleting Cdn Profile %s"), name));
          callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() {


                return client.profiles.deleteIfExists(name, resourceGroup, __cb(_, __frame, 29, 39, function ___(__0, __3) { callbackArgs = __3;
                  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 " + name)); } else {
                if ((response.statusCode == 204)) {
                  log.info((("Delete sucess, but no profile named " + name) + " was found")); }
                 else {
                  log.info(("Error in deleting profile " + name)); } ; } ; _(); }); }); }, true)); }, true)); }); });




  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: 294 }; return __func(_, this, arguments, __5, 3, __frame, function __$__5() {












      return cli.interaction.promptIfNotGiven($("Profile name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 6, 35, function ___(__0, __2) { resourceGroup = __2;

          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 ..."), name));

          callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() {


                      return client.profiles.update(name, resourceGroup, tags, __cb(_, __frame, 23, 39, function ___(__0, __3) { callbackArgs = __3;
                        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     :"), 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) || (response.statusCode == 200))) {
                log.info(("Successfully updated tags of profile " + name)); }
               else {
                log.info(("Failed in updating tags of profile " + name)); } ; _(); }); }); }, true)); }, true)); }); });





  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: 363 }; return __func(_, this, arguments, __6, 3, __frame, function __$__6() {











      return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __1) { profileName = __1;
        return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __2) { resourceGroup = __2;





          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(profileName, resourceGroup, __cb(_, __frame, 21, 39, function ___(__0, __3) { callbackArgs = __3;
                        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 " + profileName) + " is:\n ") + result.ssoUriValue))); _(); }); }); }, true)); }, true)); }); });




  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: 408 }; return __func(_, this, arguments, __7, 3, __frame, function __$__7() {










      return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 5, 36, function ___(__0, __1) { profileName = __1;
        return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 6, 35, function ___(__0, __2) { resourceGroup = __2;





          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(profileName, resourceGroup, __cb(_, __frame, 20, 40, function ___(__0, __3) { callbackArgs = __3;
                        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"), profileName);
                    row.cell($("ResourceGroup"), resourceGroup);
                    row.cell($("Subscription"), subscription.id);
                    row.cell($("Location"), endpoint.location);
                    row.cell($("Tags"), tagUtils.getTagsInfo(endpoint.tags)); }); } ; }); _(); }); }); }, true)); }, true)); }); });






  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: 461 }; return __func(_, this, arguments, __8, 4, __frame, function __$__8() {











      return cli.interaction.promptIfNotGiven($("Endpoint name: "), name, __cb(_, __frame, 5, 26, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __2) { profileName = __2;
          return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __3) { resourceGroup = __3;





            subscription = profile.current.getSubscription();
            client = utils.createCdnManagementClient(subscription);

            progress = cli.interaction.progress(util.format($(("Getting endpoint named " + name))));

            callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__8() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__8() {


                        return client.endpoints.get(name, profileName, resourceGroup, __cb(_, __frame, 21, 40, function ___(__0, __4) { callbackArgs = __4;
                          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."), profileName); }
                   else {
                    log.data("");
                    log.data($("Endpoint name                  :"), result.name);
                    log.data("");
                    log.data($("Profile name                   :"), profileName);
                    log.data($("Resource Group                 :"), 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(""); } ; }); _(); }); }); }, true)); }, true)); }, true)); }); });





  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: 539 }; return __func(_, this, arguments, __9, 7, __frame, function __$__9() {
























      return cli.interaction.promptIfNotGiven($("Endpoint name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __2) { profileName = __2;
          return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __3) { resourceGroup = __3;
            return cli.interaction.promptIfNotGiven($("Endpoint location: "), location, __cb(_, __frame, 8, 30, function ___(__0, __4) { location = __4;
              return cli.interaction.promptIfNotGiven($("Origin name: "), originName, __cb(_, __frame, 9, 35, function ___(__0, __5) { originName = __5;
                return cli.interaction.promptIfNotGiven($("Origin host name: "), originHostName, __cb(_, __frame, 10, 36, function ___(__0, __6) { originHostName = __6;





                  subscription = profile.current.getSubscription();
                  client = utils.createCdnManagementClient(subscription);

                  tags = { };
                  tags = tagUtils.buildTagsParameter(tags, options);

                  contentTypesToCompress = (options.contentTypesToCompress ? options.contentTypesToCompress.split(",") : []);

                  endpointCreateParameters = {
                    contentTypesToCompress: contentTypesToCompress,
                    location: location,
                    originHostHeader: options.originHostHeader,
                    originPath: options.originPath,
                    origins: [{
                      name: originName,
                      hostName: originHostName,
                      httpPort: parseInt(options.httpPort),
                      httpsPort: parseInt(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 " + name))));

                  callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__9() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__9() {


                              return client.endpoints.create(name, endpointCreateParameters, profileName, resourceGroup, __cb(_, __frame, 54, 40, function ___(__0, __7) { callbackArgs = __7;
                                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                   :"), profileName);
                          log.data($("Resource Group                 :"), 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(""); } ; }); _(); }); }); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }); });





  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: 645 }; return __func(_, this, arguments, __10, 4, __frame, function __$__10() {



















      return cli.interaction.promptIfNotGiven($("Endpoint name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __2) { profileName = __2;
          return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __3) { resourceGroup = __3;





            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 " + name))));

            callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__10() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__10() {


                        return client.endpoints.update(name, endpointUpdateParameters, profileName, resourceGroup, __cb(_, __frame, 54, 40, function ___(__0, __4) { callbackArgs = __4;
                          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                   :"), profileName);
                    log.data($("Resource Group                 :"), 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(""); } ; }); _(); }); }); }, true)); }, true)); }, true)); }); });






  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: 746 }; return __func(_, this, arguments, __11, 4, __frame, function __$__11() {











      return cli.interaction.promptIfNotGiven($("Endpoint name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __2) { profileName = __2;
          return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __3) { resourceGroup = __3;





            subscription = profile.current.getSubscription();
            client = utils.createCdnManagementClient(subscription);

            progress = cli.interaction.progress(util.format($(("Deleting endpoint named " + name))));

            callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__11() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__11() {


                        return client.endpoints.deleteIfExists(name, profileName, resourceGroup, __cb(_, __frame, 21, 40, function ___(__0, __4) { callbackArgs = __4;
                          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 " + name)); } else {
                  if ((response.statusCode == 204)) {
                    log.info((("Delete sucess, but no endpoint named " + name) + " was found")); }
                   else {
                    log.info(("Error in deleting endpoint " + name)); } ; } ; _(); }); }); }, true)); }, true)); }, true)); }); });




  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: 793 }; return __func(_, this, arguments, __12, 4, __frame, function __$__12() {











      return cli.interaction.promptIfNotGiven($("Endpoint name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __2) { profileName = __2;
          return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __3) { resourceGroup = __3;





            subscription = profile.current.getSubscription();
            client = utils.createCdnManagementClient(subscription);

            progress = cli.interaction.progress(util.format($(("Starting endpoint named " + name))));

            callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__12() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__12() {


                        return client.endpoints.start(name, profileName, resourceGroup, __cb(_, __frame, 21, 40, function ___(__0, __4) { callbackArgs = __4;
                          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 " + name) + " and it is now running")); }
                 else {
                  log.info(("Error in starting endpoint " + name)); } ; _(); }); }); }, true)); }, true)); }, true)); }); });




  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: 838 }; return __func(_, this, arguments, __13, 4, __frame, function __$__13() {











      return cli.interaction.promptIfNotGiven($("Endpoint name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __2) { profileName = __2;
          return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __3) { resourceGroup = __3;





            subscription = profile.current.getSubscription();
            client = utils.createCdnManagementClient(subscription);

            progress = cli.interaction.progress(util.format($(("Stopping endpoint named " + name))));

            callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__13() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__13() {


                        return client.endpoints.stop(name, profileName, resourceGroup, __cb(_, __frame, 21, 40, function ___(__0, __4) { callbackArgs = __4;
                          result = callbackArgs[0];
                          response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__13() { if (e) {

                          return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__13() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__13() {

                    progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__13() {


                if ((response.statusCode == 200)) {
                  log.info((("Command successfully invoked for endpoint " + name) + " and it is now stopped")); }
                 else {
                  log.info(("Error in stopping endpoint " + name)); } ; _(); }); }); }, true)); }, true)); }, true)); }); });




  endpoint.command("purge [name] [profile-name] [resource-group] [content-paths]").description($("Purge the content of the given paths in the endpoint")).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("-c, --content-paths <content-paths>", $("Content paths to be purged")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __14(name, profileName, resourceGroup, contentPaths, options, _) { var subscription, client, parsedContentPaths, progress, callbackArgs, result, response; var __frame = { name: "__14", line: 884 }; return __func(_, this, arguments, __14, 5, __frame, function __$__14() {












      return cli.interaction.promptIfNotGiven($("Endpoint name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __2) { profileName = __2;
          return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __3) { resourceGroup = __3;
            return cli.interaction.promptIfNotGiven($("Content paths: "), contentPaths, __cb(_, __frame, 8, 34, function ___(__0, __4) { contentPaths = __4;





              subscription = profile.current.getSubscription();
              client = utils.createCdnManagementClient(subscription);

              parsedContentPaths = (contentPaths ? contentPaths.split(",") : []);

              progress = cli.interaction.progress(util.format($(("Purging content for endpoint named " + name))));

              callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__14() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__14() {


                          return client.endpoints.purgeContent(name, profileName, resourceGroup, parsedContentPaths, __cb(_, __frame, 24, 40, function ___(__0, __5) { callbackArgs = __5;
                            result = callbackArgs[0];
                            response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__14() { if (e) {

                            return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__14() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__14() {

                      progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__14() { _(); }); }); }, true)); }, true)); }, true)); }, true)); }); });




  endpoint.command("load [name] [profile-name] [resource-group] [content-paths]").description($("Load the content of the given paths in the endpoint")).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("-c, --content-paths <content-paths>", $("Content paths to be purged")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __15(name, profileName, resourceGroup, contentPaths, options, _) { var subscription, client, parsedContentPaths, progress, callbackArgs, result, response; var __frame = { name: "__15", line: 927 }; return __func(_, this, arguments, __15, 5, __frame, function __$__15() {












      return cli.interaction.promptIfNotGiven($("Endpoint name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __2) { profileName = __2;
          return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __3) { resourceGroup = __3;
            return cli.interaction.promptIfNotGiven($("Content paths: "), contentPaths, __cb(_, __frame, 8, 34, function ___(__0, __4) { contentPaths = __4;





              subscription = profile.current.getSubscription();
              client = utils.createCdnManagementClient(subscription);

              parsedContentPaths = (contentPaths ? contentPaths.split(",") : []);

              progress = cli.interaction.progress(util.format($(("Loading content for endpoint named " + name))));

              callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__15() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__15() {


                          return client.endpoints.loadContent(name, profileName, resourceGroup, parsedContentPaths, __cb(_, __frame, 24, 40, function ___(__0, __5) { callbackArgs = __5;
                            result = callbackArgs[0];
                            response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__15() { if (e) {

                            return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__15() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__15() {

                      progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__15() { _(); }); }); }, true)); }, true)); }, true)); }, true)); }); });




  endpoint.command("check [endpoint-name]").description($("Check if the endpoint name has been used or not")).usage("[options] <endpoint-name>").option("-n, --endpoint-name <endpoint-name>", $("Endpoint name")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __16(endpointName, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__16", line: 967 }; return __func(_, this, arguments, __16, 2, __frame, function __$__16() {










      return cli.interaction.promptIfNotGiven($("Endpoint name: "), endpointName, __cb(_, __frame, 6, 37, function ___(__0, __1) { endpointName = __1;





        subscription = profile.current.getSubscription();
        client = utils.createCdnManagementClient(subscription);

        progress = cli.interaction.progress(util.format($(("Checking name availability for " + endpointName))));

        callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__16() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__16() {


                    return client.nameAvailability.checkNameAvailability(endpointName, "Microsoft.Cdn/Profiles/Endpoints", __cb(_, __frame, 20, 47, function ___(__0, __2) { callbackArgs = __2;
                      result = callbackArgs[0];
                      response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__16() { if (e) {

                      return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__16() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__16() {

                progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__16() {


            if ((response.statusCode != 200)) {
              log.info("Command invoke failed, please retry"); } else {
              if (result.nameAvailable) {
                log.info((endpointName + " is valid to use")); }
               else {
                log.info((endpointName + " is already in use")); } ; } ; _(); }); }); }, true)); }); });





  var origin = cdn.category("origin").description($("Commands to manage Azure cdn profile endpoint origin"));



  origin.command("show [name] [endpoint-name] [profile-name] [resource-group]").description($("Get origin by origin name, endpoint name, profile name, and resource group")).usage("[options] <name> <endpoint-name> <profile-name> <resource-group>").option("-n, --name <name>", $("Name of the origin")).option("-e, --endpoint-name <endpoint-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 __17(name, endpointName, profileName, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__17", line: 1019 }; return __func(_, this, arguments, __17, 5, __frame, function __$__17() {












      return cli.interaction.promptIfNotGiven($("Origin name: "), name, __cb(_, __frame, 5, 26, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Endpoint name: "), endpointName, __cb(_, __frame, 6, 37, function ___(__0, __2) { endpointName = __2;
          return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 7, 36, function ___(__0, __3) { profileName = __3;
            return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 8, 35, function ___(__0, __4) { resourceGroup = __4;





              subscription = profile.current.getSubscription();
              client = utils.createCdnManagementClient(subscription);

              progress = cli.interaction.progress(util.format($(("Getting origin named " + name))));

              callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__17() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__17() {


                          return client.origins.get(name, endpointName, profileName, resourceGroup, __cb(_, __frame, 22, 38, function ___(__0, __5) { callbackArgs = __5;
                            result = callbackArgs[0];
                            response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__17() { if (e) {

                            return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__17() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__17() {

                      progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__17() {


                  cli.interaction.formatOutput(result, function(data) {
                    if (!data) {
                      log.info($("No origin named %s found."), profileName); }
                     else {
                      log.data("");
                      log.data($("origin name                  :"), result.name);
                      log.data("");
                      log.data($("endpoint name                  :"), endpointName);
                      log.data($("profile name                   :"), profileName);
                      log.data($("resource group                 :"), resourceGroup);
                      log.data($("type                           :"), result.type);
                      log.data($("host name                      :"), result.hostName);
                      log.data($("http port                      :"), result.httpPort);
                      log.data($("https port                     :"), result.httpsPort);
                      log.data($("resource state                 :"), result.resourceState);
                      log.data($("provisioning state             :"), result.provisioningState);
                      log.data(""); } ; }); _(); }); }); }, true)); }, true)); }, true)); }, true)); }); });





  origin.command("set [name] [endpoint-name] [profile-name] [resource-group]").description($("Update origin of the given origin name, endpoint name, profile name, and resource group")).usage("[options] <name> <endpoint-name> <profile-name> <resource-group> [host-name] [http-port] [https-port]").option("-n, --name <name>", $("Name of the origin")).option("-e, --endpoint-name <endpoint-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("-o, --host-name [host-name]", $("Host name")).option("-r, --http-port [http-port]", $("Http port")).option("-w, --https-port [https-port]", $("Https port")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __18(name, endpointName, profileName, resourceGroup, options, _) { var subscription, client, originUpdateParameter, progress, callbackArgs, result, response; var __frame = { name: "__18", line: 1083 }; return __func(_, this, arguments, __18, 5, __frame, function __$__18() {















      return cli.interaction.promptIfNotGiven($("Origin name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Endpoint name: "), endpointName, __cb(_, __frame, 6, 37, function ___(__0, __2) { endpointName = __2;
          return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 7, 36, function ___(__0, __3) { profileName = __3;
            return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 8, 35, function ___(__0, __4) { resourceGroup = __4;





              subscription = profile.current.getSubscription();
              client = utils.createCdnManagementClient(subscription);

              originUpdateParameter = { };
              if (options.hostName) {
                originUpdateParameter.hostName = options.hostName; } ;

              if (options.httpPort) {
                originUpdateParameter.httpPort = parseInt(options.httpPort); } ;

              if (options.httpsPort) {
                originUpdateParameter.httpsPort = parseInt(options.httpsPort); } ;



              progress = cli.interaction.progress(util.format($(("Updating origin named " + name))));

              callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__18() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__18() {


                          return client.origins.update(name, originUpdateParameter, endpointName, profileName, resourceGroup, __cb(_, __frame, 34, 38, function ___(__0, __5) { callbackArgs = __5;
                            result = callbackArgs[0];
                            response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__18() { if (e) {

                            return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__18() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__18() {

                      progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__18() {


                  cli.interaction.formatOutput(result, function(data) {
                    if (!data) {
                      log.info($("No origin named %s found to update."), profileName); }
                     else {
                      log.data("");
                      log.data($("origin name                  :"), result.name);
                      log.data("");
                      log.data($("endpoint name                  :"), endpointName);
                      log.data($("profile name                   :"), profileName);
                      log.data($("resource group                 :"), resourceGroup);
                      log.data($("type                           :"), result.type);
                      log.data($("host name                      :"), result.hostName);
                      log.data($("http port                      :"), result.httpPort);
                      log.data($("https port                     :"), result.httpsPort);
                      log.data($("resource state                 :"), result.resourceState);
                      log.data($("provisioning state             :"), result.provisioningState);
                      log.data(""); } ; }); _(); }); }); }, true)); }, true)); }, true)); }, true)); }); });







  var customDomain = cdn.category("customDomain").description($("Commands to manage Azure cdn profile endpoint custom domain"));



  customDomain.command("list [endpoint-name] [profile-name] [resource-group]").description($("List custom domains by endpoint name, profile name, and resource group")).usage("[options] <endpoint-name> <profile-name> <resource-group>").option("-e, --endpoint-name <endpoint-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 __19(endpointName, profileName, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__19", line: 1161 }; return __func(_, this, arguments, __19, 4, __frame, function __$__19() {











      return cli.interaction.promptIfNotGiven($("Endpoint name: "), endpointName, __cb(_, __frame, 5, 37, function ___(__0, __1) { endpointName = __1;
        return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __2) { profileName = __2;
          return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __3) { resourceGroup = __3;





            subscription = profile.current.getSubscription();
            client = utils.createCdnManagementClient(subscription);

            progress = cli.interaction.progress(util.format($(("Listing custom domain under " + endpointName))));

            callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__19() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__19() {


                        return client.customDomains.listByEndpoint(endpointName, profileName, resourceGroup, __cb(_, __frame, 21, 44, function ___(__0, __4) { callbackArgs = __4;
                          result = callbackArgs[0];
                          response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__19() { if (e) {

                          return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__19() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__19() {

                    progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__19() {


                cli.interaction.formatOutput(result, function() {
                  if ((!result || (result.length === 0))) {
                    log.info($(("No custom domains found under " + endpointName))); }
                   else {
                    log.table(result, function(row, cd) {
                      row.cell($("Name"), cd.name);
                      row.cell($("Endpoint"), endpointName);
                      row.cell($("HostName"), cd.hostName);
                      row.cell($("ProvisioningState"), cd.provisioningState);
                      row.cell($("ResourceState"), cd.resourceState); }); } ; }); _(); }); }); }, true)); }, true)); }, true)); }); });






  customDomain.command("show [name] [endpoint-name] [profile-name] [resource-group]").description($("Get custom domains by custom domain name, endpoint name, profile name, and resource group")).usage("[options] <name> <profile-name> <resource-group>").option("-n, --name <name>", $("Name of the custom domain")).option("-e, --endpoint-name <endpoint-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 __20(name, endpointName, profileName, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__20", line: 1215 }; return __func(_, this, arguments, __20, 5, __frame, function __$__20() {












      return cli.interaction.promptIfNotGiven($("Custom domain name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Endpoint name: "), endpointName, __cb(_, __frame, 6, 37, function ___(__0, __2) { endpointName = __2;
          return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 7, 36, function ___(__0, __3) { profileName = __3;
            return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 8, 35, function ___(__0, __4) { resourceGroup = __4;





              subscription = profile.current.getSubscription();
              client = utils.createCdnManagementClient(subscription);

              progress = cli.interaction.progress(util.format($(("Getting custom domain named " + name))));

              callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__20() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__20() {


                          return client.customDomains.get(name, endpointName, profileName, resourceGroup, __cb(_, __frame, 22, 44, function ___(__0, __5) { callbackArgs = __5;
                            result = callbackArgs[0];
                            response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__20() { if (e) {

                            return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__20() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__20() {

                      progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__20() {



                  cli.interaction.formatOutput(result, function(data) {
                    if (!data) {
                      log.info($("No custom domain named %s found."), name); }
                     else {
                      log.data("");
                      log.data($("custom domain name             :"), result.name);
                      log.data("");
                      log.data($("endpoint name                  :"), endpointName);
                      log.data($("profile name                   :"), profileName);
                      log.data($("resource group                 :"), resourceGroup);
                      log.data($("type                           :"), result.type);
                      log.data($("host name                      :"), result.hostName);
                      log.data($("resource state                 :"), result.resourceState);
                      log.data($("provisioning state             :"), result.provisioningState);
                      log.data($("id                             :"), result.id);
                      log.data(""); } ; }); _(); }); }); }, true)); }, true)); }, true)); }, true)); }); });





  customDomain.command("create [name] [endpoint-name] [profile-name] [resource-group] [custom-domain-host-name]").description($("Create a custom domain of a perticular custom domain host name")).usage("[options] <name> <endpoint-name> <profile-name> <resource-group> <custom-domain-host-name>").option("-n, --name <name>", $("Name of the custom domain")).option("-e, --endpoint-name <endpoint-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("-d, --custom-domain-host-name <custom-domain-host-name>", $("The host name of the custom domain")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __21(name, endpointName, profileName, resourceGroup, customDomainHostName, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__21", line: 1277 }; return __func(_, this, arguments, __21, 6, __frame, function __$__21() {













      return cli.interaction.promptIfNotGiven($("Custom domain name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Endpoint name: "), endpointName, __cb(_, __frame, 6, 37, function ___(__0, __2) { endpointName = __2;
          return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 7, 36, function ___(__0, __3) { profileName = __3;
            return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 8, 35, function ___(__0, __4) { resourceGroup = __4;
              return cli.interaction.promptIfNotGiven($("Custom domain host name: "), customDomainHostName, __cb(_, __frame, 9, 42, function ___(__0, __5) { customDomainHostName = __5;





                subscription = profile.current.getSubscription();
                client = utils.createCdnManagementClient(subscription);

                progress = cli.interaction.progress(util.format($(("Creating custom domain named " + name))));

                callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__21() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__21() {


                            return client.customDomains.create(name, endpointName, profileName, resourceGroup, customDomainHostName, __cb(_, __frame, 23, 44, function ___(__0, __6) { callbackArgs = __6;
                              result = callbackArgs[0];
                              response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__21() { if (e) {

                              return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__21() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__21() {

                        progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__21() {


                    cli.interaction.formatOutput(result, function() {
                      log.data("");
                      log.data($("custom domain name             :"), result.name);
                      log.data("");
                      log.data($("endpoint name                  :"), endpointName);
                      log.data($("profile name                   :"), profileName);
                      log.data($("resource group                 :"), resourceGroup);
                      log.data($("type                           :"), result.type);
                      log.data($("host name                      :"), result.hostName);
                      log.data($("resource state                 :"), result.resourceState);
                      log.data($("provisioning state             :"), result.provisioningState);
                      log.data($("id                             :"), result.id);
                      log.data(""); }); _(); }); }); }, true)); }, true)); }, true)); }, true)); }, true)); }); });




  customDomain.command("delete [name] [endpoint-name] [profile-name] [resource-group]").description($("Delete a custom domain of a perticular custom domain host name")).usage("[options] <name> <endpoint-name> <profile-name> <resource-group>").option("-n, --name <name>", $("Name of the custom domain")).option("-e, --endpoint-name <endpoint-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 __22(name, endpointName, profileName, resourceGroup, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__22", line: 1334 }; return __func(_, this, arguments, __22, 5, __frame, function __$__22() {












      return cli.interaction.promptIfNotGiven($("Custom domain name: "), name, __cb(_, __frame, 5, 29, function ___(__0, __1) { name = __1;
        return cli.interaction.promptIfNotGiven($("Endpoint name: "), endpointName, __cb(_, __frame, 6, 37, function ___(__0, __2) { endpointName = __2;
          return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 7, 36, function ___(__0, __3) { profileName = __3;
            return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 8, 35, function ___(__0, __4) { resourceGroup = __4;





              subscription = profile.current.getSubscription();
              client = utils.createCdnManagementClient(subscription);

              progress = cli.interaction.progress(util.format($(("Updating custom domain named " + name))));

              callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__22() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__22() {


                          return client.customDomains.deleteIfExists(name, endpointName, profileName, resourceGroup, __cb(_, __frame, 22, 44, function ___(__0, __5) { callbackArgs = __5;
                            result = callbackArgs[0];
                            response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__22() { if (e) {

                            return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__22() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__22() {

                      progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__22() {


                  if ((response.statusCode == 200)) {
                    log.info(("Delete command successfully invoked for custom domain " + name)); } else {
                    if ((response.statusCode == 204)) {
                      log.info((("Delete success, but no custom domain named " + name) + " was found")); }
                     else {
                      log.info(("Error in deleting custom domain " + name)); } ; } ; _(); }); }); }, true)); }, true)); }, true)); }, true)); }); });




  customDomain.command("validate [endpoint-name] [profile-name] [resource-group] [custom-domain-host-name]").description($("Check to see if a custom domain host name is registered for cname mapping to the endpoint ")).usage("[options] <endpoint-name> <profile-name> <resource-group> <custom-domain-host-name>").option("-e, --endpoint-name <endpoint-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("-d, --custom-domain-host-name <custom-domain-host-name>", $("The host name of the custom domain")).option("--subscription <subscription>", $("the subscription identifier")).execute(function __23(endpointName, profileName, resourceGroup, customDomainHostName, options, _) { var subscription, client, progress, callbackArgs, result, response; var __frame = { name: "__23", line: 1383 }; return __func(_, this, arguments, __23, 5, __frame, function __$__23() {












      return cli.interaction.promptIfNotGiven($("Endpoint name: "), endpointName, __cb(_, __frame, 5, 37, function ___(__0, __1) { endpointName = __1;
        return cli.interaction.promptIfNotGiven($("Profile name: "), profileName, __cb(_, __frame, 6, 36, function ___(__0, __2) { profileName = __2;
          return cli.interaction.promptIfNotGiven($("Resource group name: "), resourceGroup, __cb(_, __frame, 7, 35, function ___(__0, __3) { resourceGroup = __3;
            return cli.interaction.promptIfNotGiven($("Custom domain host name: "), customDomainHostName, __cb(_, __frame, 8, 42, function ___(__0, __4) { customDomainHostName = __4;





              subscription = profile.current.getSubscription();
              client = utils.createCdnManagementClient(subscription);

              progress = cli.interaction.progress(util.format($(("Validating custom domain host name: " + customDomainHostName))));

              callbackArgs = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__23() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__23() {


                          return client.endpoints.validateCustomDomain(endpointName, profileName, resourceGroup, customDomainHostName, __cb(_, __frame, 22, 40, function ___(__0, __5) { callbackArgs = __5;
                            result = callbackArgs[0];
                            response = callbackArgs[2]; __then(); }, true, true)); }); })(function ___(e, __result) { __catch(function __$__23() { if (e) {

                            return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__23() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$__23() {

                      progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$__23() {

                  cli.interaction.formatOutput(result, function() {
                    if ((response.statusCode != 200)) {
                      log.info("Command invoke failed, please retry"); }
                     else if (result.customDomainValidated) {
                      log.info((("Validate host name " + customDomainHostName) + " success")); }
                     else {
                      log.info((("Validate host name " + customDomainHostName) + " failed"));
                      log.info(("Reason: " + result.reason));
                      log.info(("Message: " + result.message)); }  ; }); _(); }); }); }, true)); }, true)); }, true)); }, true)); }); });};
