azure-cli
Version:
Microsoft Azure Cross Platform Command Line tool
233 lines (99 loc) • 15.5 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 replica = serviceFabric.category("replica").description($("Commands to manage your replica"));
replica.command("show [partitionId]").description($("Show replica")).option("-i --partition-id <partitionId>", $("the id of the partition")).option("-r --replica-id <replicaId>", $("the id of the replica")).option("--select <fields>", $("select fields to show, call without this parameter to see all fields")).execute(function __1(partitionId, 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 replica")); 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);
res = null; return (function __$__1(__then) {
if (!options.replicaId) {
return client.replicas.list(partitionId, options, __cb(_, __frame, 9, 32, function ___(__0, __4) { res = __4; __then(); }, true)); } else {
return client.replicas.get(partitionId, options.replicaId, options, __cb(_, __frame, 12, 32, function ___(__0, __5) { res = __5; __then(); }, true)); } ; })(function __$__1() { return (function __$__1(__then) {
if (options.select) {
return serviceFabricUtils.pick(res, options.select, __cb(_, __frame, 15, 35, function ___(__0, __6) { res = __6; __then(); }, true)); } else { __then(); } ; })(function __$__1() {
serviceFabricUtils.setReplicaEnumVal(res);
progress.end();
cli.interaction.formatOutput(res, function(data) {
log.json(data); }); __then(); }); }); }, true)); }, true)); }, true)); }); })(function ___(e, __result) { __catch(function __$__1() { if (e) {
progress.end();
return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__1() { _(); }); }); }); });
var replicaDeployed = replica.category("deployed").description($("Commands to manage your deployed replica"));
replicaDeployed.command("show [nodeName] [applicationName]").description($("Show deployed replica")).option("-n --node-name <nodeName>", $("the name of the node")).option("-a --application-name <applicationName>", $("the name of the application")).option("--select <fields>", $("select fields to show, call without this parameter to see all fields")).execute(function __2(nodeName, applicationName, options, _) { var progress, config, client, res; var __frame = { name: "__2", line: 76 }; return __func(_, this, arguments, __2, 3, __frame, function __$__2() {
progress = cli.interaction.progress($("ShowDeployedReplica")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__2() {
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(applicationName, __cb(_, __frame, 7, 45, function ___(__0, __4) { applicationName = __4;
return client.deployedReplicas.get(nodeName, applicationName, options, __cb(_, __frame, 8, 42, function ___(__0, __5) { res = __5; return (function __$__2(__then) {
if (options.select) {
return serviceFabricUtils.pick(res, options.select, __cb(_, __frame, 10, 35, function ___(__0, __6) { res = __6; __then(); }, true)); } else { __then(); } ; })(function __$__2() {
serviceFabricUtils.setReplicaEnumVal(res);
progress.end();
cli.interaction.formatOutput(res, function(data) {
log.json(data); }); __then(); }); }, true)); }, true)); }, true)); }, true)); }, true)); }); })(function ___(e, __result) { __catch(function __$__2() { if (e) {
progress.end();
return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__2() { _(); }); }); }); });
replicaDeployed.command("detail [nodeName] [partitionName] [replicaId]").description($("Show deployed replica detail")).option("-n --node-name <nodeName>", $("the name of the node")).option("-p --partition-name <partitionName>", $("the name of the partition")).option("-i --replica-id <replicaId>", $("the id of the replica")).option("--select <fields>", $("select fields to show, call without this parameter to see all fields")).execute(function __3(nodeName, partitionName, replicaId, options, _) { var progress, config, client, res; var __frame = { name: "__3", line: 107 }; return __func(_, this, arguments, __3, 4, __frame, function __$__3() {
progress = cli.interaction.progress($("ShowDeployedReplicaDetail")); 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.deployedReplicaDetails.get(nodeName, partitionName, replicaId, options, __cb(_, __frame, 7, 48, 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.setReplicaEnumVal(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() { _(); }); }); }); });
var replicaHealth = replica.category("health").description($("Commands to manage your replica health"));
replicaHealth.command("show [partitionId] [replicaId]").description($("Show replica health")).option("-i --partition-id <partitionId>", $("the id of the partition")).option("-r --replica-id <replicaId>", $("the id of the replicas")).option("-f --events-health-state-filter <eventsHealthStateFilter>", $("the filter of the events 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 __4(partitionId, replicaId, options, _) { var progress, config, client, res; var __frame = { name: "__4", line: 140 }; return __func(_, this, arguments, __4, 3, __frame, function __$__4() {
progress = cli.interaction.progress($("Show 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);
return client.replicaHealths.get(partitionId, replicaId, options, __cb(_, __frame, 7, 40, function ___(__0, __4) { res = __4; return (function __$__4(__then) {
if (options.select) {
return serviceFabricUtils.pick(res, options.select, __cb(_, __frame, 9, 35, function ___(__0, __5) { res = __5; __then(); }, true)); } else { __then(); } ; })(function __$__4() {
serviceFabricUtils.setReplicaEnumVal(res);
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() { _(); }); }); }); });
replicaHealth.command("send [partitionId] [replicaId] [sourceId] [property] [healthState]").description($("Send replica health, Example: azure servicefabric replica 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("-r --replica-id <replicaId>", $("the id of the replica")).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 __5(partitionId, replicaId, sourceId, property, healthState, options, _) { var progress, config, client, replicaHealthReport, res; var __frame = { name: "__5", line: 175 }; return __func(_, this, arguments, __5, 6, __frame, function __$__5() {
progress = cli.interaction.progress($("Send replica health")); 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, 5, 79, function ___(__0, __2) { return serviceFabricUtils.getClientOptions(config, __cb(_, __frame, 5, 130, function ___(__0, __3) { client = new serviceFabricClient("3.0-preview", __2, __3);
replicaHealthReport = { };
if (sourceId) { replicaHealthReport.sourceId = sourceId; } ;
if (property) { replicaHealthReport.property = property; } ;
if (healthState) { replicaHealthReport.healthState = serviceFabricUtils.getEnumVal("healthState", healthState); } ;
if (options.description) { replicaHealthReport.description = options.description; } ;
if (options.timeToLiveInMilliseconds) { replicaHealthReport.timeToLiveInMilliSeconds = options.timeToLiveInMilliseconds; } ;
if (options.sequenceNumber) { replicaHealthReport.sequenceNumber = options.sequenceNumber; } ;
if (options.removeWhenExpired) {
replicaHealthReport.removeWhenExpired = true; } ;
return client.replicaHealths.send(partitionId, replicaId, replicaHealthReport, options, __cb(_, __frame, 16, 40, 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 __$__5() { if (e) {
progress.end();
return _(e); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$__5() { _(); }); }); }); });
var replicaLoad = replica.category("load").description($("Commands to manage your replica load information"));
replicaLoad.command("show [partitionId] [replicaId]").description($("Show replica load information")).option("-i --partition-id <partitionId>", $("the id of the partition")).option("-r --replica-id <replicaId>", $("the id of the replica")).option("--select <fields>", $("select fields to show, call without this parameter to see all fields")).execute(function __6(partitionId, replicaId, options, _) { var progress, config, client, res; var __frame = { name: "__6", line: 212 }; return __func(_, this, arguments, __6, 3, __frame, function __$__6() {
progress = cli.interaction.progress($("Show replica load information")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$__6() {
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.replicaLoadInformations.get(partitionId, replicaId, options, __cb(_, __frame, 7, 49, function ___(__0, __4) { res = __4; return (function __$__6(__then) {
if (options.select) {
return serviceFabricUtils.pick(res, options.select, __cb(_, __frame, 9, 35, function ___(__0, __5) { res = __5; __then(); }, true)); } else { __then(); } ; })(function __$__6() {
serviceFabricUtils.setReplicaEnumVal(res);
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() { _(); }); }); }); });};