azure-cli
Version:
Microsoft Azure Cross Platform Command Line tool
804 lines (330 loc) • 70.2 kB
JavaScript
/*** 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 profile = require("../../../util/profile");
var utils = require("../../../util/utils");
var dataLakeAnalyticsUtils = require("./datalakeanalytics.utils");
var tagUtils = require("../tag/tagUtils");
var path = require("path");
var fs = require("fs");
var $ = utils.getLocaleString;
exports.init = function(cli) {
var log = cli.output;
var withProgress = cli.interaction.withProgress.bind(cli.interaction);
var dataLakeCommands = cli.category("datalake").description($("Commands to manage your Data Lake objects"));
var dataLakeAnalyticsCommands = dataLakeCommands.category("analytics").description($("Commands to manage your Data Lake Analytics objects"));
var dataLakeAnalyticsJob = dataLakeAnalyticsCommands.category("job").description($("Commands to manage your Data Lake Analytics Jobs"));
dataLakeAnalyticsJob.command("create [accountName] [jobName] [script]").description($("Submits a job to the specified Data Lake Analytics account.")).usage("[options] <accountName> <jobName> <script>").option("-n --accountName <accountName>", $("the Data Lake Analytics account name to execute the action on")).option("-j --jobName <jobName>", $("the name for this job submission")).option("-t --script <script>", $("the script to run. This can be either the script contents, a relative path or the full path to a UTF-8 encoded script file")).option("-r --runtime <runtime>", $(("optionally indicates the runtime to use. The default runtime is the currently deployed production runtime." + "Use this if you have uploaded a custom runtime to your account and want job execution to go through that one instead of the one deployed by Microsoft."))).option("-m --compileMode <compileMode>", $("optionally specify the type of compilation to do. Valid values are 'Semantic', 'Full', and 'SingleBox' Default is Full.")).option("-c --compileOnly", $("optionally indicates that this job should only be compiled and not run.")).option("-d --degreeOfParallelism <degreeOfParallelism>", $("optionally specify the degree of parallelism for the job in a range from 1 to 50. Default value is 1.")).option("-p --priority <priority>", $("optionally specify the priority for the job. Default value is 1000, with lower, positive, non-zero values having higher priority. 1 is the highest priority and int.maxValue is the lowest.")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __1(accountName, jobName, script, options, _) { var subscription, client, scriptAsPath, scriptContents, normalPath, degreeOfParallelism, priority, jobId, job, properties, jobResponse; var __frame = { name: "__1", line: 58 }; return __func(_, this, arguments, __1, 4, __frame, function __$__1() {
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsJobManagementClient(subscription);
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
if (!jobName) {
return _(null, cli.missingArgument("jobName")); } ;
if (!script) {
return _(null, cli.missingArgument("script")); } ;
scriptAsPath = true; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() {
normalPath = path.normalize(script);
return fs.readFile(normalPath, "utf8", __cb(_, __frame, 21, 26, function ___(__0, __1) { scriptContents = __1; __then(); }, true)); }); })(function ___(err, __result) { __catch(function __$__1() { if (err) {
scriptAsPath = false; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__1() {
if (!scriptAsPath) {
scriptContents = script; } ;
degreeOfParallelism = 1;
if (options.degreeOfParallelism) {
degreeOfParallelism = parseInt(options.degreeOfParallelism); } ;
priority = 1000;
if (options.priority) {
priority = parseInt(options.priority); } ;
if ((priority < 1)) {
return _(new Error(("priority (-p or --priority) must be >= 1. Priority passed in: " + priority))); } ;
jobId = utils.uuidGen();
job = {
name: jobName,
type: "USql",
degreeOfParallelism: degreeOfParallelism,
priority: priority };
properties = {
type: "USql",
script: scriptContents };
if (options.compileMode) {
properties.compileMode = options.compileMode; } ;
if (options.runtime) {
properties.runtimeVersion = options.runtime; } ;
job.properties = properties;
jobResponse = { }; return (function __$__1(__then) {
if (options.compileOnly) {
return client.job.build(accountName, job, __cb(_, __frame, 71, 31, function ___(__0, __2) { jobResponse = __2; __then(); }, true)); } else {
return client.job.create(accountName, jobId, job, __cb(_, __frame, 74, 31, function ___(__0, __3) { jobResponse = __3; __then(); }, true)); } ; })(function __$__1() {
dataLakeAnalyticsUtils.formatOutput(cli, log, options, jobResponse); _(); }); }); }); }); });
dataLakeAnalyticsJob.command("show [accountName] [jobId]").description($("shows the specified job and additional data if desired.")).usage("[options] <accountName> <jobId>").option("-n --accountName <accountName>", $("the Data Lake Analytics account name to execute the action on")).option("-j --jobId <jobId>", $("the job ID of the job to retrieve.")).option("-d --includeDebugInfo", $("optionally indicates that debug info should be output for the job as well.")).option("-t --includeStatistics", $("optionally indicates that statistics for the job should be output as well.")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __2(accountName, jobId, options, _) { var subscription, client, jobResponse, statistics, debugData; var __frame = { name: "__2", line: 146 }; return __func(_, this, arguments, __2, 3, __frame, function __$__2() {
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsJobManagementClient(subscription);
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
if (!jobId) {
return _(null, cli.missingArgument("jobId")); } ;
return client.job.get(accountName, jobId, __cb(_, __frame, 12, 33, function ___(__0, __1) { jobResponse = __1; return (function __$__2(__then) {
if (options.includeStatistics) { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() {
return client.job.getStatistics(accountName, jobId, __cb(_, __frame, 16, 36, function ___(__0, __2) { statistics = __2;
jobResponse.properties.statistics = statistics; __then(); }, true)); }); })(function ___(err, __result) { __catch(function __$__2() { if (err) {
log.info(("Could not recover statistics info for the job. This happens if the job failed to start. Error reported: " + err)); __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, __then); }); } else { __then(); } ; })(function __$__2() { return (function __$__2(__then) {
if (options.includeDebugInfo) { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() {
return client.job.getDebugDataPath(accountName, jobId, __cb(_, __frame, 26, 35, function ___(__0, __3) { debugData = __3.paths;
jobResponse.properties.debugData = debugData; __then(); }, true)); }); })(function ___(err, __result) { __catch(function __$__2() { if (err) {
log.info("Could not recover debug info for the job. This happens if the job completed successfully. If the job did not complete successfully, please run with verbose output for more details."); __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, __then); }); } else { __then(); } ; })(function __$__2() {
dataLakeAnalyticsUtils.formatOutput(cli, log, options, jobResponse); _(); }); }); }, true)); }); });
dataLakeAnalyticsJob.command("cancel [accountName] [jobId]").description($("cancels the specified job.")).usage("[options] <accountName> <jobId>").option("-n --accountName <accountName>", $("the Data Lake Analytics account name to execute the action on")).option("-j --jobId <jobId>", $("the job ID of the job to cancel.")).option("-q, --quiet", $("quiet mode (do not ask for cancel confirmation)")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __3(accountName, jobId, options, _) { var subscription, client; var __frame = { name: "__3", line: 190 }; return __func(_, this, arguments, __3, 3, __frame, function __$__3() {
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsJobManagementClient(subscription);
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
if (!jobId) {
return _(null, cli.missingArgument("jobId")); } ; return (function __$__3(_) {
var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Cancel Job with id %s in account %s? [y/n] "), jobId, accountName), __cb(_, __frame, 12, 43, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -189, 17, function ___(__0, __2) { return (function __$__3(__then) { if (__2) { return _(null); } else { __then(); } ; })(function __$__3() {
return client.job.cancel(accountName, jobId, __cb(_, __frame, 16, 15, function __$__3() {
log.data($(("Successfully canceled the job with ID: " + jobId))); _(); }, true)); }); }, true)); }); });
dataLakeAnalyticsJob.command("wait [accountName] [jobId]").description($("waits for the specified job to complete and outputs the finished job result.")).usage("[options] <accountName> <jobId>").option("-n --accountName <accountName>", $("the Data Lake Analytics account name to execute the action on")).option("-j --jobId <jobId>", $("the job identifier of the job to wait for completion.")).option("-w --waitInterval <wait in seconds>", $("the optional amount of time to wait between each poll of the job, in seconds. Default is five seconds.")).option("-t --timeout <max time to wait in seconds>", $("the optional maximum amount of time to wait for the job to complete, in seconds. Default is to never timeout.")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function(accountName, jobId, options) {
var subscription = profile.current.getSubscription(options.subscription);
var client = utils.createDataLakeAnalyticsJobManagementClient(subscription);
if (!accountName) {
return cli.missingArgument("accountName"); } ;
if (!jobId) {
return cli.missingArgument("jobId"); } ;
var maxAttempts = -1;
var waitInterval = 5;
if (options.waitInterval) {
waitInterval = parseInt(options.waitInterval); } ;
if ((options.timeout && (parseInt(options.timeout) > 0))) {
maxAttempts = Math.ceil((parseInt(options.timeout) / waitInterval)); } ;
listPoll(client, accountName, jobId, waitInterval, maxAttempts, maxAttempts, function(jobToCheck) {
dataLakeAnalyticsUtils.formatOutput(cli, log, options, jobToCheck); }); });
dataLakeAnalyticsJob.command("list [accountName]").description($("lists the jobs in the specified account given the specified filters and criteria.")).usage("[options] <accountName>").option("-n --accountName <accountName>", $("the Data Lake Analytics account name to execute the action on")).option("-j --jobName <jobName>", $("An optional filter which returns jobs with only the specified friendly name.")).option("-u, --submitter <submitter>", $("An optional filter which returns jobs only by the specified submitter in the format user@domain")).option("-a, --submittedAfter <submittedAfter>", $("An optional filter which returns jobs only submitted after the specified time (as a date time offset).")).option("-b, --submittedBefore <submittedAfter>", $("An optional filter which returns jobs only submitted before the specified time (as a date time offset).")).option("-t, --state <comma delmited string of states>", $(("An optional filter which returns jobs with only the specified states (as comma delmited string). Valid states are: " + "accepted, compiling, ended, new, queued, running, scheduling, starting and paused"))).option("-r, --result <comma delmited string of results>", $(("An optional filter which returns jobs with only the specified results (as comma delmited string). Valid results are: " + "none, succeeded, cancelled and failed"))).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __4(accountName, options, _) { var subscription, client, filter, intermediateStateArray, stateString, stateArray, i, intermediateResultArray, resultString, resultArray, j, parameters, filterString, jobList; var __frame = { name: "__4", line: 261 }; return __func(_, this, arguments, __4, 2, __frame, function __$__4() {
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsJobManagementClient(subscription);
log.info("client created");
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
filter = [];
if (options.submitter) {
filter.push((("submitter eq '" + options.submitter) + "'")); } ;
if (options.jobName) {
filter.push((("name eq '" + options.jobName) + "'")); } ;
if (options.submittedAfter) {
filter.push((("submitTime ge datetimeoffset'" + options.submittedAfter) + "'")); } ;
if (options.submittedBefore) {
filter.push((("submitTime lt datetimeoffset'" + options.submittedBefore) + "'")); } ;
if ((options.state && (options.state.length > 0))) {
intermediateStateArray = options.state.split(",");
stateString = "(";
stateArray = [];
for (i = 0; (i < intermediateStateArray.length); i++) {
stateArray.push((("state eq '" + intermediateStateArray[i]) + "'")); };
stateString += (stateArray.join(" or ") + ")");
filter.push(stateString); } ;
if ((options.result && (options.result.length > 0))) {
intermediateResultArray = options.result.split(",");
resultString = "(";
resultArray = [];
for (j = 0; (j < intermediateResultArray.length); j++) {
resultArray.push((("result eq '" + intermediateResultArray[j]) + "'")); };
resultString += (resultArray.join(" or ") + ")");
filter.push(resultString); } ;
if ((filter && (filter.length > 0))) {
filterString = filter.join(" and ");
parameters = {
filter: filterString }; } ;
jobList = [];
return withProgress(util.format($("Retrieving job list for account: %s"), accountName), function __1(log, _) { var response, pushJobs; var __frame = { name: "__1", line: 321 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() {
return client.job.list(accountName, parameters, __cb(_, __frame, 1, 32, function ___(__0, __1) { response = __1;
jobList = response;
pushJobs = function(eachValue) { jobList.push(eachValue); }; return (function ___(__break) { var __more; var __loop = __cb(_, __frame, 0, 0, function __$__1() { __more = false;
var __4 = (response.nextLink && (response.nextLink.length > 0)); if (__4) {
return client.job.listNext(response.nextLink, __cb(_, __frame, 5, 30, function ___(__0, __2) { response = __2;
response.forEach(pushJobs, jobList); while (__more) { __loop(); }; __more = true; }, true)); } else { __break(); } ; }); do { __loop(); } while (__more); __more = true; })(_); }, true)); }); }, __cb(_, __frame, 59, 4, function __$__4() {
dataLakeAnalyticsUtils.formatOutputList(cli, log, options, jobList); _(); }, true)); }); });
var dataLakeAnalyticsCatalog = dataLakeAnalyticsCommands.category("catalog").description($("Commands to manage your Data Lake Analytics Catalog"));
dataLakeAnalyticsCatalog.command("list [accountName] [itemType] [itemPath]").description($("Lists all of the specified catalog item types under the path or, if the full path is given, just the single catalog item at that path.")).usage("[options] <accountName> <itemType> <itemPath>").option("-n --accountName <accountName>", $("The Data Lake Analytics account name to perform the action on.")).option("-t --itemType <itemType>", $("The catalog item type to return. Valid values are (case insensitive): database, schema, secret, credential, assembly, externaldatasource, table, tablevaluedfunction, view, procedure, types, tablepartition or tablestatistics")).option("-p --itemPath <itemPath>", $("The path to the catalog item(s) to get or list in the format: <FirstPart>.<OptionalSecondPart>.<OptionalThirdPart>.<OptionalFourthPart>. This MUST be null when listing all databases.")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __5(accountName, itemType, itemPath, options, _) { var subscription, output; var __frame = { name: "__5", line: 344 }; return __func(_, this, arguments, __5, 4, __frame, function __$__5() {
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
if (!itemType) {
return _(null, cli.missingArgument("itemType")); } ;
subscription = profile.current.getSubscription(options.subscription);
return getCatalogItem(subscription, accountName, itemPath, itemType, __cb(_, __frame, 11, 17, function ___(__0, __1) { output = __1;
dataLakeAnalyticsUtils.formatOutputList(cli, log, options, output); _(); }, true)); }); });
var dataLakeAnalyticsCatalogCredential = dataLakeAnalyticsCatalog.category("credential").description($("Commands to manage your Data Lake Analytics Catalog credentials."));
dataLakeAnalyticsCatalogCredential.command("create [accountName] [databaseName] [hostUri] [credentialName] [credentialUserName]").description($("Creates the specified credential for the specified database.")).usage("[options] <accountName> <databaseName> <hostUri> <credentialName> <credentialUserName>").option("-n --accountName <accountName>", $("The Data Lake Analytics account name to perform the action on.")).option("-d --databaseName <databaseName>", $("The name of the database in which the credential will be created.")).option("-u --hostUri <hostUri>", $("The full host URI associated with the external data source. The credential will authenticate against this host URI.")).option("-e --credentialName <credentialName>", $("name of the credential to be created in the specified database")).option("-a --credentialUserName <credentialUserName>", $("the user name of the credential to authenticate with. Will prompt if not given")).option("-p --password <password>", $("the password that matches with the credentialUserName, will prompt if not given")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __6(accountName, databaseName, hostUri, credentialName, credentialUserName, options, _) { var subscription, password, client, params, response; var __frame = { name: "__6", line: 372 }; return __func(_, this, arguments, __6, 6, __frame, function __$__6() {
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
if (!databaseName) {
return _(null, cli.missingArgument("databaseName")); } ;
if (!hostUri) {
return _(null, cli.missingArgument("hostUri")); } ;
if (!credentialName) {
return _(null, cli.missingArgument("credentialName")); } ;
subscription = profile.current.getSubscription(options.subscription);
return cli.interaction.promptIfNotGiven("Credential username: ", credentialUserName, __cb(_, __frame, 19, 41, function ___(__0, __1) { credentialUserName = __1;
return cli.interaction.promptPasswordOnceIfNotGiven("Password: ", options.password, __cb(_, __frame, 20, 35, function ___(__0, __2) { password = __2;
client = utils.createDataLakeAnalyticsCatalogManagementClient(subscription);
params = {
userId: credentialUserName,
password: password,
uri: hostUri };
return client.catalog.createCredential(accountName, databaseName, credentialName, params, __cb(_, __frame, 29, 34, function ___(__0, __3) { response = __3;
dataLakeAnalyticsUtils.formatOutput(cli, log, options, response); _(); }, true)); }, true)); }, true)); }); });
dataLakeAnalyticsCatalogCredential.command("set [accountName] [databaseName] [hostUri] [credentialName] [credentialUserName]").description($("Updates the password of the specified credential in the specified database.")).usage("[options] <accountName> <databaseName> <hostUri> <credentialName> <credentialUserName>").option("-n --accountName <accountName>", $("The Data Lake Analytics account name to perform the action on.")).option("-d --databaseName <databaseName>", $("The name of the database in which the credential will be updated.")).option("-u --hostUri <hostUri>", $("The full host URI associated with the external data source. This must be the same as the hostUri used to create the credential.")).option("-e --credentialName <credentialName>", $("credential name to update.")).option("-a --credentialUserName <credentialUserName>", $("the user name of the credential to authenticate with. Will prompt if not given")).option("-p --password <password>", $("the original password that matches with the credentialUserName, will prompt if not given")).option("-w --newPassword <password>", $("the new password to update the credential with, will prompt if not given")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __7(accountName, databaseName, hostUri, credentialName, credentialUserName, options, _) { var subscription, password, newPassword, client, params, response; var __frame = { name: "__7", line: 416 }; return __func(_, this, arguments, __7, 6, __frame, function __$__7() {
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
if (!databaseName) {
return _(null, cli.missingArgument("databaseName")); } ;
if (!hostUri) {
return _(null, cli.missingArgument("hostUri")); } ;
if (!credentialName) {
return _(null, cli.missingArgument("credentialName")); } ;
subscription = profile.current.getSubscription(options.subscription);
return cli.interaction.promptIfNotGiven("Credential username: ", credentialUserName, __cb(_, __frame, 19, 41, function ___(__0, __1) { credentialUserName = __1;
return cli.interaction.promptPasswordOnceIfNotGiven("Old password: ", options.password, __cb(_, __frame, 20, 35, function ___(__0, __2) { password = __2;
return cli.interaction.promptPasswordOnceIfNotGiven("New password: ", options.newPassword, __cb(_, __frame, 21, 38, function ___(__0, __3) { newPassword = __3;
client = utils.createDataLakeAnalyticsCatalogManagementClient(subscription);
params = {
userId: credentialUserName,
password: password,
newPassword: newPassword,
uri: hostUri };
return client.catalog.updateCredential(accountName, databaseName, credentialName, params, __cb(_, __frame, 31, 34, function ___(__0, __4) { response = __4;
dataLakeAnalyticsUtils.formatOutput(cli, log, options, response); _(); }, true)); }, true)); }, true)); }, true)); }); });
dataLakeAnalyticsCatalogCredential.command("delete [accountName] [databaseName] [credentialName]").description($("Deletes the specified credential in the specified database.")).usage("[options] <accountName> <databaseName> <credentialName>").option("-n --accountName <accountName>", $("The Data Lake Analytics account name to perform the action on.")).option("-d --databaseName <databaseName>", $("The name of the database in which the credential(s) will be deleted.")).option("-e --credentialName <credentialName>", $("Credential name to delete.")).option("-p --password <password>", $("the password that matches with the username inside the specified credential. Required if the caller is not the owner of the Data Lake Analytics account.")).option("-q, --quiet", $("quiet mode (do not ask for delete confirmation)")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __8(accountName, databaseName, credentialName, options, _) { var subscription, client, params; var __frame = { name: "__8", line: 460 }; return __func(_, this, arguments, __8, 4, __frame, function __$__8() {
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
if (!databaseName) {
return _(null, cli.missingArgument("databaseName")); } ;
if (!credentialName) {
return _(null, cli.missingArgument("credentialName")); } ; return (function __$__8(_) {
var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Delete Credential %s in database %s? [y/n] "), credentialName, databaseName), __cb(_, __frame, 13, 43, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -459, 17, function ___(__0, __2) { return (function __$__8(__then) { if (__2) { return _(null); } else { __then(); } ; })(function __$__8() {
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsCatalogManagementClient(subscription);
params = { };
if (options.password) {
params.parameters = {
password: options.password }; } ;
return client.catalog.deleteCredential(accountName, databaseName, credentialName, params, __cb(_, __frame, 27, 19, function __$__8() { _(); }, true)); }); }, true)); }); });
var dataLakeAnalyticsCatalogSecret = dataLakeAnalyticsCatalog.category("secret").description($("DEPRECATED: Commands to manage your Data Lake Analytics Catalog secrets. This category will be removed in a future release. Please use the credential commands instead"));
dataLakeAnalyticsCatalogSecret.command("create [accountName] [databaseName] [hostUri] [secretName]").description($("DEPRECATED: Creates the specified secret for the specified database. This command will be removed in a future release. Please use 'credential create' instead.")).usage("[options] <accountName> <databaseName> <hostUri> <secretName>").option("-n --accountName <accountName>", $("The Data Lake Analytics account name to perform the action on.")).option("-d --databaseName <databaseName>", $("The name of the database in which the secret will be created.")).option("-u --hostUri <hostUri>", $("The full host URI associated with the external data source. The secret will be used with this host URI.")).option("-e --secretName <secretName>", $("secret name, will prompt if not given")).option("-p --password <password>", $("secret password, will prompt if not given")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __9(accountName, databaseName, hostUri, secretName, options, _) { var subscription, password, client, params, response; var __frame = { name: "__9", line: 502 }; return __func(_, this, arguments, __9, 5, __frame, function __$__9() {
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
if (!databaseName) {
return _(null, cli.missingArgument("databaseName")); } ;
if (!hostUri) {
return _(null, cli.missingArgument("hostUri")); } ;
subscription = profile.current.getSubscription(options.subscription);
return cli.interaction.promptIfNotGiven("SecretName: ", secretName, __cb(_, __frame, 15, 33, function ___(__0, __1) { secretName = __1;
return cli.interaction.promptPasswordOnceIfNotGiven("Password: ", options.password, __cb(_, __frame, 16, 35, function ___(__0, __2) { password = __2;
client = utils.createDataLakeAnalyticsCatalogManagementClient(subscription);
params = {
secretName: secretName,
password: password,
uri: hostUri };
return client.catalog.createSecret(accountName, databaseName, params.secretName, params, __cb(_, __frame, 25, 34, function ___(__0, __3) { response = __3;
dataLakeAnalyticsUtils.formatOutput(cli, log, options, response); _(); }, true)); }, true)); }, true)); }); });
dataLakeAnalyticsCatalogSecret.command("set [accountName] [databaseName] [hostUri] [secretName]").description($("DEPRECATED: Updates the password and/or hostUri of the specified secret in the specified database. This command will be removed in a future release. Please use 'credential set' instead.")).usage("[options] <accountName> <databaseName> <hostUri> <secretName>").option("-n --accountName <accountName>", $("The Data Lake Analytics account name to perform the action on.")).option("-d --databaseName <databaseName>", $("The name of the database in which the secret will be updated.")).option("-u --hostUri <hostUri>", $("The full host URI associated with the external data source. The secret will be used with this host URI.")).option("-e --secretName <secretName>", $("secret name, will prompt if not given")).option("-p --password <password>", $("secret password, will prompt if not given")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __10(accountName, databaseName, hostUri, secretName, options, _) { var subscription, password, client, params, response; var __frame = { name: "__10", line: 540 }; return __func(_, this, arguments, __10, 5, __frame, function __$__10() {
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
if (!databaseName) {
return _(null, cli.missingArgument("databaseName")); } ;
if (!hostUri) {
return _(null, cli.missingArgument("hostUri")); } ;
subscription = profile.current.getSubscription(options.subscription);
return cli.interaction.promptIfNotGiven("SecretName: ", secretName, __cb(_, __frame, 15, 33, function ___(__0, __1) { secretName = __1;
return cli.interaction.promptPasswordOnceIfNotGiven("Password: ", options.password, __cb(_, __frame, 16, 35, function ___(__0, __2) { password = __2;
client = utils.createDataLakeAnalyticsCatalogManagementClient(subscription);
params = {
secretName: secretName,
password: password,
uri: hostUri };
return client.catalog.updateSecret(accountName, databaseName, params.secretName, params, __cb(_, __frame, 25, 34, function ___(__0, __3) { response = __3;
dataLakeAnalyticsUtils.formatOutput(cli, log, options, response); _(); }, true)); }, true)); }, true)); }); });
dataLakeAnalyticsCatalogSecret.command("delete [accountName] [databaseName] [secretName]").description($("DEPRECATED: Deletes the specified secret in the specified database. This command will be removed in a future release. Please use 'credential delete' instead.")).usage("[options] <accountName> <databaseName> <hostUri> <secretName>").option("-n --accountName <accountName>", $("The Data Lake Analytics account name to perform the action on.")).option("-d --databaseName <databaseName>", $("The name of the database in which the secret(s) will be deleted.")).option("-e --secretName <secretName>", $("Optional secret name to delete, if not specified will delete all secrets in the specified database")).option("-q, --quiet", $("quiet mode (do not ask for delete confirmation)")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __11(accountName, databaseName, secretName, options, _) { var subscription, client; var __frame = { name: "__11", line: 577 }; return __func(_, this, arguments, __11, 4, __frame, function __$__11() {
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
if (!databaseName) {
return _(null, cli.missingArgument("databaseName")); } ; return (function __$__11(_) {
var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Delete Secret(s) in database %s? [y/n] "), databaseName), __cb(_, __frame, 9, 43, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -576, 17, function ___(__0, __2) { return (function __$__11(__then) { if (__2) { return _(null); } else { __then(); } ; })(function __$__11() {
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsCatalogManagementClient(subscription); return (function __$__11(__then) {
if (!secretName) {
return client.catalog.deleteAllSecrets(accountName, databaseName, __cb(_, __frame, 18, 21, __then, true)); } else {
return client.catalog.deleteSecret(accountName, databaseName, secretName, __cb(_, __frame, 21, 21, __then, true)); } ; })(_); }); }, true)); }); });
var dataLakeAnalyticsAccount = dataLakeAnalyticsCommands.category("account").description($("Commands to manage your Data Lake Analytics accounts"));
dataLakeAnalyticsAccount.command("list").description($("List all Data Lake Analytics accounts available for your subscription or subscription and resource group")).usage("[options]").option("-g --resource-group <resource-group>", $("the optional resource group to list the accounts in")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __12(options, _) { var subscription, accounts; var __frame = { name: "__12", line: 610 }; return __func(_, this, arguments, __12, 1, __frame, function __$__12() {
subscription = profile.current.getSubscription(options.subscription);
return listAllDataLakeAnalyticsAccounts(subscription, options.resourceGroup, __cb(_, __frame, 2, 19, function ___(__0, __1) { accounts = __1;
dataLakeAnalyticsUtils.formatOutputList(cli, log, options, accounts); _(); }, true)); }); });
dataLakeAnalyticsAccount.command("show [accountName]").description($("Shows a Data Lake Analytics account based on account name")).usage("[options] <accountName>").option("-n --accountName <accountName>", $("the Data Lake Analytics account name to retrieve")).option("-g --resource-group <resource-group>", $("the optional resource group to list the accounts in")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __13(accountName, options, _) { var subscription, client, dataLakeAnalyticsAccount; var __frame = { name: "__13", line: 622 }; return __func(_, this, arguments, __13, 2, __frame, function __$__13() {
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ;
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsManagementClient(subscription); return (function __$__13(__then) {
if (!options.resourceGroup) {
return getResourceGroupByAccountName(subscription, options.resourceGroup, accountName, __cb(_, __frame, 9, 30, function ___(__0, __1) { options.resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__13() {
return client.account.get(options.resourceGroup, accountName, __cb(_, __frame, 12, 50, function ___(__0, __2) { dataLakeAnalyticsAccount = __2;
dataLakeAnalyticsUtils.formatOutput(cli, log, options, dataLakeAnalyticsAccount); _(); }, true)); }); }); });
dataLakeAnalyticsAccount.command("delete [accountName]").description($("Deletes a Data Lake Analytics Account based on account name")).usage("[options] <accountName>").option("-n --accountName <accountName>", $("the Data Lake Analytics account name to delete")).option("-g --resource-group <resource-group>", $("the optional resource group to force the command to find the Data Lake Analytics account to delete in.")).option("-q, --quiet", $("quiet mode (do not ask for delete confirmation)")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __14(accountName, options, _) { var subscription, client; var __frame = { name: "__14", line: 645 }; return __func(_, this, arguments, __14, 2, __frame, function __$__14() {
if (!accountName) {
return _(null, cli.missingArgument("accountName")); } ; return (function __$__14(_) {
var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return cli.interaction.confirm(util.format($("Delete Data Lake Analytics Account %s? [y/n] "), accountName), __cb(_, __frame, 5, 43, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -644, 17, function ___(__0, __2) { return (function __$__14(__then) { if (__2) { return _(null); } else { __then(); } ; })(function __$__14() {
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsManagementClient(subscription); return (function __$__14(__then) {
if (!options.resourceGroup) {
return getResourceGroupByAccountName(subscription, options.resourceGroup, accountName, __cb(_, __frame, 13, 30, function ___(__0, __3) { options.resourceGroup = __3; __then(); }, true)); } else { __then(); } ; })(function __$__14() {
return client.account.deleteMethod(options.resourceGroup, accountName, __cb(_, __frame, 16, 19, function __$__14() {
log.info($("Successfully deleted the specified Data Lake Analytics Account.")); _(); }, true)); }); }); }, true)); }); });
dataLakeAnalyticsAccount.command("create [accountName] [location] [resource-group] [defaultDataLakeStore]").description($("Creates a Data Lake Analytics Account")).usage("[options] <accountName> <location> <resource-group> <defaultDataLakeStore>").option("-n --accountName <accountName>", $("The Data Lake Analytics account name to create")).option("-l --location <location>", $("the location the Data Lake Analytics account will be created in. Valid values are: North Central US, South Central US, Central US, West Europe, North Europe, West US, East US, East US 2, Japan East, Japan West, Brazil South, Southeast Asia, East Asia, Australia East, Australia Southeast")).option("-g --resource-group <resource-group>", $("the resource group to create the account in")).option("-d --defaultDataLakeStore <defaultDataLakeStore>", $("the default Data Lake Store to associate with this account.")).option("-p --maxDegreeOfParallelism <1 to the account limit>", $("Optional, the maximum supported degree of parallelism for this account, from 1 to the account defined limit. Default is 30")).option("-r --queryStoreRetentionTime <1 to 180>", $("Optional, the number of days that job metadata is retained, from 1 to 180. Default is 30")).option("-j --maxJobCount <1 to account limit>", $("Optional, the maximum supported jobs running under the account at the same time., from 1 to the account defined limit. Default is 3")).option("-t --tags <tags>", $(("Tags to set to the the Data Lake Analytics account. Can be mutliple. " + "In the format of 'name=value'. Name is required and value is optional. For example, -t tag1=value1;tag2"))).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __15(accountName, location, resourceGroup, defaultDataLakeStore, options, _) { var subscription, tags, dataLakeAnalyticsAccount; var __frame = { name: "__15", line: 678 }; return __func(_, this, arguments, __15, 5, __frame, function __$__15() {
subscription = profile.current.getSubscription(options.subscription);
tags = { };
tags = tagUtils.buildTagsParameter(tags, options);
return createOrUpdateDataLakeAnalyticsAccount(subscription, accountName, resourceGroup, location, defaultDataLakeStore, options.maxDegreeOfParallelism, options.queryStoreRetentionTime, options.maxJobCount, tags, __cb(_, __frame, 4, 35, function ___(__0, __1) { dataLakeAnalyticsAccount = __1;
dataLakeAnalyticsUtils.formatOutput(cli, log, options, dataLakeAnalyticsAccount); _(); }, true)); }); });
dataLakeAnalyticsAccount.command("set [accountName]").description($("Updates the properties of an existing Data Lake Analytics Account")).usage("[options] <accountName>").option("-n --accountName <accountName>", $("The Data Lake Analytics Account name to perform the action on.")).option("-g --resource-group <resource-group>", $("the optional resource group to forcibly look for the account to update in")).option("-p --maxDegreeOfParallelism <1 to the account limit>", $("Optionally update the maximum supported degree of parallelism for this account, from 1 to the account defined limit.")).option("-r --queryStoreRetentionTime <1 to 180>", $("Optionally update the number of days that job metadata is retained, from 1 to 180.")).option("-j --maxJobCount <1 to account limit>", $("Optionally update the maximum supported jobs running under the account at the same time., from 1 to the account defined limit.")).option("-t --tags <tags>", $(("Tags to set to the Data Lake Analytics account group. Can be mutliple. " + "In the format of 'name=value'. Name is required and value is optional. For example, -t tag1=value1;tag2"))).option("--no-tags", $("remove all existing tags")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __16(accountName, defaultDataLakeStore, options, _) { var subscription, client, dataLakeAnalyticsAccount, tags; var __frame = { name: "__16", line: 698 }; return __func(_, this, arguments, __16, 3, __frame, function __$__16() {
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsManagementClient(subscription); return (function __$__16(__then) {
if (!options.resourceGroup) {
return getResourceGroupByAccountName(subscription, options.resourceGroup, accountName, __cb(_, __frame, 5, 30, function ___(__0, __1) { options.resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__16() {
return client.account.get(options.resourceGroup, accountName, __cb(_, __frame, 8, 50, function ___(__0, __2) { dataLakeAnalyticsAccount = __2;
tags = { };
if ((!options.tags && (!options.no - tags))) {
tags = dataLakeAnalyticsAccount.tags; }
else {
tags = tagUtils.buildTagsParameter(tags, options); } ;
return createOrUpdateDataLakeAnalyticsAccount(subscription, accountName, options.resourceGroup, dataLakeAnalyticsAccount.location, null, options.maxDegreeOfParallelism, options.queryStoreRetentionTime, options.maxJobCount, tags, __cb(_, __frame, 18, 31, function ___(__0, __3) { dataLakeAnalyticsAccount = __3;
dataLakeAnalyticsUtils.formatOutput(cli, log, options, dataLakeAnalyticsAccount); _(); }, true)); }, true)); }); }); });
var dataLakeAnalyticsAccountDataSource = dataLakeAnalyticsAccount.category("datasource").description($("Commands to manage your Data Lake Analytics account data sources"));
dataLakeAnalyticsAccountDataSource.command("add [accountName]").description($("Adds an existing data source (Data Lake Store or Azure Blob) to the Data Lake Analytics Account")).usage("[options] <accountName>").option("-n --accountName <accountName>", $("The Data Lake Analytics Account name to perform the action on.")).option("-l --dataLakeStore <dataLakeStore>", $("the Data Lake Store account to add. NOTE: this argument cannot be specified with --azureBlob and --accessKey.")).option("-b --azureBlob <azureBlob>", $("the azure blob to add to the account. NOTE: this argument and --accessKey are part of a parameter set, and cannot be specified with --dataLakeStore.")).option("-k --accessKey <accessKey>", $("the access key associated with the azureBlob. NOTE: this argument and --azureBlob are part of a parameter set, and cannot be specified with --dataLakeStore.")).option("-g --resource-group <resource-group>", $("the optional resource group to forcibly look for the account to update in")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __17(accountName, options, _) { var subscription, client, parameters; var __frame = { name: "__17", line: 732 }; return __func(_, this, arguments, __17, 2, __frame, function __$__17() {
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsManagementClient(subscription);
if ((!options.dataLakeStore && !options.azureBlob)) {
return _(new Error($("Either --dataLakeStore or --azureBlob and --accessKey must be specified. They are two separate options and cannot all be specified at once."))); } ;
if ((options.dataLakeStore && options.azureBlob)) {
return _(new Error($("Either --dataLakeStore or --azureBlob and --accessKey must be specified. They are two separate options and cannot all be specified at once."))); } ;
if ((options.dataLakeStore && options.accessKey)) {
return _(new Error($("--accessKey can only be specified with --azureBlob."))); } ;
if ((options.azureBlob && !options.accessKey)) {
return _(new Error($("--accessKey must be specified with --azureBlob."))); } ; return (function __$__17(__then) {
if (!options.resourceGroup) {
return getResourceGroupByAccountName(subscription, options.resourceGroup, accountName, __cb(_, __frame, 21, 30, function ___(__0, __1) { options.resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__17() { return (function __$__17(__then) {
if (options.dataLakeStore) {
return client.dataLakeStoreAccounts.add(options.resourceGroup, accountName, options.dataLakeStore, __cb(_, __frame, 25, 35, __then, true)); } else {
parameters = {
accessKey: options.accessKey };
return client.storageAccounts.add(options.resourceGroup, accountName, options.azureBlob, parameters, __cb(_, __frame, 32, 29, __then, true)); } ; })(function __$__17() {
log.info($(("Successfully added the storage account specified to the Data Lake Analytics account: " + accountName))); _(); }); }); }); });
dataLakeAnalyticsAccountDataSource.command("delete [accountName]").description($("removes a data source (Data Lake Store or Azure Blob) from the Data Lake Analytics Account")).usage("[options] <accountName>").option("-n --accountName <accountName>", $("The Data Lake Analytics Account name to perform the action on.")).option("-l --dataLakeStore <dataLakeStore>", $("the Data Lake to remove from the account. NOTE: this argument is part of a parameter set, and cannot be specified with --azureBlob.")).option("-b --azureBlob <azureBlob>", $("the azure blob to remove from the account. NOTE: this argument is part of a parameter set, and cannot be specified with --dataLakeStore.")).option("-g --resource-group <resource-group>", $("the optional resource group to forcibly look for the account to update in")).option("-s, --subscription <id>", $("the subscription identifier")).execute(function __18(accountName, options, _) { var subscription, client; var __frame = { name: "__18", line: 778 }; return __func(_, this, arguments, __18, 2, __frame, function __$__18() {
subscription = profile.current.getSubscription(options.subscription);
client = utils.createDataLakeAnalyticsManagementClient(subscription);
if ((!options.dataLakeStore && !options.azureBlob)) {
return _(new Error($("Either --dataLakeStore or --azureBlob and --accessKey must be specified. They are two separate options and cannot all be specified at once."))); } ;
if ((options.dataLakeStore && options.azureBlob)) {
return _(new Error($("Either --dataLakeStore or --azureBlob and --accessKey must be specified. They are two separate options and cannot all be specified at once."))); } ; return (function __$__18(__then) {
if (!options.resourceGroup) {
return getResourceGroupByAccountName(subscription, options.resourceGroup, accountName, __cb(_, __frame, 13, 30, function ___(__0, __1) { options.resourceGroup = __1; __then(); }, true)); } else { __then(); } ; })(function __$__18() { return (function __$__18(__then) {
if (options.dataLakeStore) {
return client.dataLakeStoreAccounts.deleteMethod(options.resourceGroup, accountName, options.dataLakeStore, __cb(_, __frame, 17, 35, __then, true)); } else {
return client.storageAccounts.deleteMethod(options.resourceGroup, accountName, options.azureBlob, __cb(_, __frame, 20, 29, __then, true)); } ; })(function __$__18() {
log.info($(("Successfully removed the storage account specified from Data Lake Analytics account: " + accountName))); _(); }); }); }); });
dataLakeAnalyticsAccountDat