azure-cli
Version:
Microsoft Azure Cross Platform Command Line tool
231 lines (100 loc) • 15 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 utils = require("../../util/utils");
var serviceFabricUtils = require("./serviceFabricUtils");
var serviceFabricClient = require("azure-servicefabric");
var $ = utils.getLocaleString;
exports.init = function(cli) {
var log = cli.output;
var serviceFabric = cli.category("servicefabric").description($("Commands to manage your Azure Service Fabric"));
var partition = serviceFabric.category("partition").description($("Commands to manage your partition"));
partition.command("show [serviceName]").description($("Show partition")).option("-n --service-name <serviceName>", $("the name of the service")).option("-i --partition-id <partitionId>", $("the id of the partition")).option("--select <fields>", $("select fields to show, call without this parameter to see all fields")).execute(function __1(serviceName, options, _) { var progress, config, client, res; var __frame = { name: "__1", line: 38 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() {
progress = cli.interaction.progress($("Show partition")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__1() {
return serviceFabricUtils.readServiceFabricConfig(progress, __cb(_, __frame, 4, 40, function ___(__0, __1) { config = __1;
return serviceFabricUtils.createConnectionUrl(config, __cb(_, __frame, 6, 79, function ___(__0, __2) { return serviceFabricUtils.getClientOptions(config, __cb(_, __frame, 6, 130, function ___(__0, __3) { client = new serviceFabricClient("3.0-preview", __2, __3);
return serviceFabricUtils.parseUrl(serviceName, __cb(_, __frame, 7, 41, function ___(__0, __4) { serviceName = __4;
res = null; return (function __$__1(__then) {
if (!options.partitionId) {
return client.partitions.list(serviceName, options, __cb(_, __frame, 10, 34, function ___(__0, __5) { res = __5; __then(); }, true)); } else {
return client.partitions.get(serviceName, options.partitionId, options, __cb(_, __frame, 13, 34, function ___(__0, __6) { res = __6; __then(); }, true)); } ; })(function __$__1() { return (function __$__1(__then) {
if (options.select) {
return serviceFabricUtils.pick(res, options.select, __cb(_, __frame, 16, 35, function ___(__0, __7) { res = __7; __then(); }, true)); } else { __then(); } ; })(function __$__1() {
serviceFabricUtils.setPartitionEnumVal(res);
progress.end();
cli.interaction.formatOutput(res, function(data) {
log.json(data); }); __then(); }); }); }, true)); }, true)); }, true)); }, true)); }); })(function ___(e, __result) { __catch(function __$__1() { if (e) {
progress.end();
return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__1() { _(); }); }); }); });
partition.command("repair").description($("Repair partition")).option("-n --service-name <serviceName>", $("the name of the service")).option("-i --partition-id <partitionId>", $("the id of the partition")).execute(function __2(options, _) { var progress, config, client, res; var __frame = { name: "__2", line: 73 }; return __func(_, this, arguments, __2, 1, __frame, function __$__2() {
if ((!options.serviceName && !options.partitionId)) {
return _($("The serviceName or partitionId is required")); } ;
progress = cli.interaction.progress($("Repair partition")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() {
return serviceFabricUtils.readServiceFabricConfig(progress, __cb(_, __frame, 8, 40, function ___(__0, __1) { config = __1;
return serviceFabricUtils.createConnectionUrl(config, __cb(_, __frame, 10, 79, function ___(__0, __2) { return serviceFabricUtils.getClientOptions(config, __cb(_, __frame, 10, 130, function ___(__0, __3) { client = new serviceFabricClient("3.0-preview", __2, __3);
res = null; return (function __$__2(__then) {
if (!options.partitionId) {
return serviceFabricUtils.parseUrl(options.serviceName, __cb(_, __frame, 14, 51, function ___(__0, __4) { options.serviceName = __4;
return client.partitionLists.repair(options.serviceName, options, __cb(_, __frame, 15, 38, function ___(__0, __5) { res = __5; __then(); }, true)); }, true)); } else { return (function __$__2(__then) {
if (!options.serviceName) {
return client.partitions.repair(options.partitionId, options, __cb(_, __frame, 18, 34, function ___(__0, __6) { res = __6; __then(); }, true)); } else { __then(); } ; })(__then); } ; })(function __$__2() {
progress.end();
cli.interaction.formatOutput(res, function(data) {
log.json(data); }); __then(); }); }, true)); }, true)); }, true)); }); })(function ___(e, __result) { __catch(function __$__2() { if (e) {
progress.end();
return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__2() { _(); }); }); }); });
var partitionHealth = partition.category("health").description($("Commands to manage your partition health"));
partitionHealth.command("show [partitionId]").description($("Show partition health")).option("-i --partition-id <partitionId>", $("the id of the partition")).option("-f --events-health-state-filter <eventsHealthStateFilter>", $("the filter of the events health state, values are [Default|None|Ok|Warning|Error|All]")).option("-r --replicas-health-state-filter <replicasHealthStateFilter>", $("the filter of the replicas health state, values are [Default|None|Ok|Warning|Error|All]")).option("--select <fields>", $("select fields to show, call without this parameter to see all fields")).execute(function __3(partitionId, options, _) { var progress, config, client, res; var __frame = { name: "__3", line: 114 }; return __func(_, this, arguments, __3, 2, __frame, function __$__3() {
progress = cli.interaction.progress($("Show partition health")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__3() {
return serviceFabricUtils.readServiceFabricConfig(progress, __cb(_, __frame, 4, 40, function ___(__0, __1) { config = __1;
return serviceFabricUtils.createConnectionUrl(config, __cb(_, __frame, 6, 79, function ___(__0, __2) { return serviceFabricUtils.getClientOptions(config, __cb(_, __frame, 6, 130, function ___(__0, __3) { client = new serviceFabricClient("3.0-preview", __2, __3);
return client.partitionHealths.get(partitionId, options, __cb(_, __frame, 7, 42, function ___(__0, __4) { res = __4; return (function __$__3(__then) {
if (options.select) {
return serviceFabricUtils.pick(res, options.select, __cb(_, __frame, 9, 35, function ___(__0, __5) { res = __5; __then(); }, true)); } else { __then(); } ; })(function __$__3() {
serviceFabricUtils.setPartitionEnumVal(res);
progress.end();
cli.interaction.formatOutput(res, function(data) {
log.json(data); }); __then(); }); }, true)); }, true)); }, true)); }, true)); }); })(function ___(e, __result) { __catch(function __$__3() { if (e) {
progress.end();
return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__3() { _(); }); }); }); });
partitionHealth.command("send [partitionId] [sourceId] [property] [healthState]").description($("Send partition health, Example: azure servicefabric partition health send --partition-id 1234 fabric:app --source-id monitor --property pc --health-state Ok --description healthy")).option("-i --partition-id <partitionId>", $("the id of the partition")).option("-o --source-id <sourceId>", $("the id of the source")).option("-p --property <property>", $("the property")).option("-e --health-state <healthState>", $("the state of the health, values are [Ok|Warning|Error|Unknown]")).option("-d --description <description>", $("the description")).option("-m --time-to-live-in-milliseconds <timeToLiveInMilliseconds>", $("the time in milliseconds for live")).option("-n --sequence-number <sequenceNumber>", $("the number of the sequence")).option("-w --remove-when-expired", $("the boolean of the remove when expired")).execute(function __4(partitionId, sourceId, property, healthState, options, _) { var progress, config, client, partitionHealthReport, res; var __frame = { name: "__4", line: 148 }; return __func(_, this, arguments, __4, 5, __frame, function __$__4() {
progress = cli.interaction.progress($("Send partition health")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__4() {
return serviceFabricUtils.readServiceFabricConfig(progress, __cb(_, __frame, 4, 40, function ___(__0, __1) { config = __1;
return serviceFabricUtils.createConnectionUrl(config, __cb(_, __frame, 6, 79, function ___(__0, __2) { return serviceFabricUtils.getClientOptions(config, __cb(_, __frame, 6, 130, function ___(__0, __3) { client = new serviceFabricClient("3.0-preview", __2, __3);
partitionHealthReport = { };
if (sourceId) { partitionHealthReport.sourceId = sourceId; } ;
if (property) { partitionHealthReport.property = property; } ;
if (healthState) { partitionHealthReport.healthState = serviceFabricUtils.getEnumVal("healthState", healthState); } ;
if (options.description) { partitionHealthReport.description = options.description; } ;
if (options.timeToLiveInMilliseconds) { partitionHealthReport.timeToLiveInMilliSeconds = options.timeToLiveInMilliseconds; } ;
if (options.sequenceNumber) { partitionHealthReport.sequenceNumber = options.sequenceNumber; } ;
if (options.removeWhenExpired) {
partitionHealthReport.removeWhenExpired = true; } ;
return client.partitionHealths.send(partitionId, partitionHealthReport, options, __cb(_, __frame, 17, 42, function ___(__0, __4) { res = __4;
progress.end();
cli.interaction.formatOutput(res, function(data) {
log.json(data); }); __then(); }, true)); }, true)); }, true)); }, true)); }); })(function ___(e, __result) { __catch(function __$__4() { if (e) {
progress.end();
return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__4() { _(); }); }); }); });
var partitionLoad = partition.category("load").description($("Commands to manage your partition load information"));
partitionLoad.command("show [partitionId]").description($("Show partition load information")).option("-i --partition-id <partitionId>", $("the id of the partition")).option("--select <fields>", $("select fields to show, call without this parameter to see all fields")).execute(function __5(partitionId, options, _) { var progress, config, client, res; var __frame = { name: "__5", line: 185 }; return __func(_, this, arguments, __5, 2, __frame, function __$__5() {
progress = cli.interaction.progress($("Show partition load information")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__5() {
return serviceFabricUtils.readServiceFabricConfig(progress, __cb(_, __frame, 4, 40, function ___(__0, __1) { config = __1;
return serviceFabricUtils.createConnectionUrl(config, __cb(_, __frame, 6, 79, function ___(__0, __2) { return serviceFabricUtils.getClientOptions(config, __cb(_, __frame, 6, 130, function ___(__0, __3) { client = new serviceFabricClient("3.0-preview", __2, __3);
return client.partitionLoadInformations.get(partitionId, options, __cb(_, __frame, 7, 51, function ___(__0, __4) { res = __4; return (function __$__5(__then) {
if (options.select) {
return serviceFabricUtils.pick(res, options.select, __cb(_, __frame, 9, 35, function ___(__0, __5) { res = __5; __then(); }, true)); } else { __then(); } ; })(function __$__5() {
serviceFabricUtils.setPartitionEnumVal(res);
progress.end();
cli.interaction.formatOutput(res, function(data) {
log.json(data); }); __then(); }); }, true)); }, true)); }, true)); }, true)); }); })(function ___(e, __result) { __catch(function __$__5() { if (e) {
progress.end();
return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__5() { _(); }); }); }); });
partitionLoad.command("reset [partitionId]").description($("Reset partition")).option("-i --partition-id <partitionId>", $("the id of the partition")).execute(function __6(partitionId, options, _) { var progress, config, client, res; var __frame = { name: "__6", line: 212 }; return __func(_, this, arguments, __6, 2, __frame, function __$__6() {
return cli.interaction.promptIfNotGiven($("partitionId:"), partitionId, __cb(_, __frame, 1, 36, function ___(__0, __1) { partitionId = __1;
progress = cli.interaction.progress($("Reset partition")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() {
return serviceFabricUtils.readServiceFabricConfig(progress, __cb(_, __frame, 6, 40, function ___(__0, __2) { config = __2;
return serviceFabricUtils.createConnectionUrl(config, __cb(_, __frame, 8, 79, function ___(__0, __3) { return serviceFabricUtils.getClientOptions(config, __cb(_, __frame, 8, 130, function ___(__0, __4) { client = new serviceFabricClient("3.0-preview", __3, __4);
return client.partitionLoads.reset(partitionId, options, __cb(_, __frame, 9, 40, function ___(__0, __5) { res = __5;
progress.end();
cli.interaction.formatOutput(res, function(data) {
log.json(data); }); __then(); }, true)); }, true)); }, true)); }, true)); }); })(function ___(e, __result) { __catch(function __$__6() { if (e) {
progress.end();
return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__6() { _(); }); }); }, true)); }); });};