Skip to content

Commit

Permalink
Added --probe-name support
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailTryakhov committed Nov 14, 2016
1 parent 8c77bbc commit 9766831
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/commands/arm/network/appGateway._js
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ __.extend(AppGateways.prototype, {
}

var httpSettings = { name: httpSettingsName };
httpSettings = self._parseHttpSettings(httpSettings, options, true);
httpSettings = self._parseHttpSettings(resourceGroup, appGatewayName, httpSettings, options, true);
var settings = utils.findFirstCaseIgnore(appGateway.backendHttpSettingsCollection, {name: httpSettingsName});
if (settings) {
throw new Error(util.format($('A http settings with name "%s" already exists for an application gateway "%s"'), httpSettingsName, appGatewayName));
Expand All @@ -723,7 +723,7 @@ __.extend(AppGateways.prototype, {
}

var index = utils.indexOfCaseIgnore(appGateway.backendHttpSettingsCollection, {name: httpSettingsName});
httpSettings = self._parseHttpSettings(httpSettings, options, false);
httpSettings = self._parseHttpSettings(resourceGroup, appGatewayName, httpSettings, options, false);
appGateway.backendHttpSettingsCollection[index] = httpSettings;
self._setAppGateway(resourceGroup, appGatewayName, appGateway, options, _);
},
Expand Down Expand Up @@ -1924,7 +1924,7 @@ __.extend(AppGateways.prototype, {
return frontendIp;
},

_parseHttpSettings: function (httpSettings, options, useDefaults) {
_parseHttpSettings: function (resourceGroup, appGatewayName, httpSettings, options, useDefaults) {
var self = this;
if (options.protocol) {
var protocol = utils.verifyParamExistsInCollection(constants.appGateway.settings.protocol,
Expand Down Expand Up @@ -1956,7 +1956,16 @@ __.extend(AppGateways.prototype, {
if(options.probeId) {
httpSettings.probe = {
id: options.probeId
};
if (options.probeName) {
self.output.warn(util.format($('both --probe-name and --probe-id were entered. --probe-name parameter would be excluded')))
}
} else if (options.probeName) {
self.subscriptionId = self._getSubscriptionId(options);
httpSettings.probe = {
id: self._generateResourceId(resourceGroup, appGatewayName, 'probes', options.probeName)
};
console.log('PROBE: '+httpSettings.probe.id);
}

return httpSettings;
Expand Down
2 changes: 2 additions & 0 deletions lib/commands/arm/network/network._js
Original file line number Diff line number Diff line change
Expand Up @@ -3238,6 +3238,7 @@ exports.init = function (cli) {
'\n [%s],' +
'\n default value is [%s]'),
constants.appGateway.settings.affinity, constants.appGateway.settings.affinity[0]))
.option('-r, --probe-name [probe-name]', $('the associated application gateway probe name'))
.option('-i, --probe-id [probe-id]', $('the associated application gateway probe ID'))
.option('--nowait', $('does not wait for the operation to complete. Returns as soon as the intial request is received by the server.'))
.option('-s, --subscription <subscription>', $('the subscription identifier'))
Expand Down Expand Up @@ -3266,6 +3267,7 @@ exports.init = function (cli) {
'\n [%s],' +
'\n default value is [%s]'),
constants.appGateway.settings.affinity, constants.appGateway.settings.affinity[0]))
.option('-r, --probe-name [probe-name]', $('the associated application gateway probe name'))
.option('-i, --probe-id [probe-id]', $('the associated application gateway probe ID'))
.option('--nowait', $('does not wait for the operation to complete. Returns as soon as the intial request is received by the server.'))
.option('-s, --subscription <subscription>', $('the subscription identifier'))
Expand Down
18 changes: 18 additions & 0 deletions lib/plugins.arm.json
Original file line number Diff line number Diff line change
Expand Up @@ -70249,6 +70249,15 @@
"long": "--cookie-based-affinity",
"description": "enable or disable cookie based affinity, valid values are\n [Disabled,Enabled],\n default value is [Disabled]"
},
{
"flags": "-r, --probe-name [probe-name]",
"required": 0,
"optional": -18,
"bool": true,
"short": "-r",
"long": "--probe-name",
"description": "the associated application gateway probe name"
},
{
"flags": "-i, --probe-id [probe-id]",
"required": 0,
Expand Down Expand Up @@ -70363,6 +70372,15 @@
"long": "--cookie-based-affinity",
"description": "enable or disable cookie based affinity, valid values are\n [Disabled,Enabled],\n default value is [Disabled]"
},
{
"flags": "-r, --probe-name [probe-name]",
"required": 0,
"optional": -18,
"bool": true,
"short": "-r",
"long": "--probe-name",
"description": "the associated application gateway probe name"
},
{
"flags": "-i, --probe-id [probe-id]",
"required": 0,
Expand Down

0 comments on commit 9766831

Please sign in to comment.