Skip to content

Commit 30490fc

Browse files
author
srsedate
committed
Fixed issue with masked enumeration properties for ScaleAction and MetricTrigger autoscale transitional classes.
/// Updated change log.
1 parent bf0dd26 commit 30490fc

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

src/ResourceManager/Insights/Commands.Insights/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Fixed issue #7267 (Autoscale area)
22+
- Issues with creating a new autoscale rule not properly setting enumerated parameters (would always set them to the default value).
2123

2224
## Version 5.1.4
23-
2425
* Fixed issues #6833 and #7102 (Diagnostic Settings area)
2526
- Issues with the default name, i.e. "service", during creation and listing/getting of diagnostic settings
2627
- Issues creating diagnostic settings with categories

src/ResourceManager/Insights/Commands.Insights/TransitionalClasses/MetricTrigger.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,29 @@ public class MetricTrigger : Monitor.Models.MetricTrigger
2525
/// <summary>
2626
/// Gets or sets the OperatorProperty of the Metric Trigger
2727
/// </summary>
28-
public new ComparisonOperationType OperatorProperty { get; set; }
28+
public new ComparisonOperationType OperatorProperty
29+
{
30+
get => (ComparisonOperationType)System.Enum.Parse(typeof(ComparisonOperationType), base.OperatorProperty.ToString());
31+
set => base.OperatorProperty = (Monitor.Models.ComparisonOperationType)System.Enum.Parse(typeof(Monitor.Models.ComparisonOperationType), value.ToString());
32+
}
2933

3034
/// <summary>
3135
/// Gets or sets the Statistic of the Metric Trigger
3236
/// </summary>
33-
public new MetricStatisticType Statistic { get; set; }
37+
public new MetricStatisticType Statistic
38+
{
39+
get => (MetricStatisticType)System.Enum.Parse(typeof(MetricStatisticType), base.Statistic.ToString());
40+
set => base.Statistic = (Monitor.Models.MetricStatisticType)System.Enum.Parse(typeof(Monitor.Models.MetricStatisticType), value.ToString());
41+
}
3442

3543
/// <summary>
3644
/// Gets or sets the TimeAggregation of the Metric Trigger
3745
/// </summary>
38-
public new TimeAggregationType TimeAggregation { get; set; }
46+
public new TimeAggregationType TimeAggregation
47+
{
48+
get => (TimeAggregationType)System.Enum.Parse(typeof(TimeAggregationType), base.TimeAggregation.ToString());
49+
set => base.TimeAggregation = (Monitor.Models.TimeAggregationType)System.Enum.Parse(typeof(Monitor.Models.TimeAggregationType), value.ToString());
50+
}
3951

4052
/// <summary>
4153
/// Initializes a new instance of the MetricTrigger class.

src/ResourceManager/Insights/Commands.Insights/TransitionalClasses/ScaleAction.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,20 @@ public class ScaleAction : Monitor.Models.ScaleAction
2525
/// <summary>
2626
/// Gets or sets the ScaleType of the scale action
2727
/// </summary>
28-
public new ScaleType Type { get; set; }
28+
public new ScaleType Type
29+
{
30+
get => (ScaleType)System.Enum.Parse(typeof(ScaleType), base.Type.ToString());
31+
set => base.Type = (Monitor.Models.ScaleType)System.Enum.Parse(typeof(Monitor.Models.ScaleType), value.ToString());
32+
}
2933

3034
/// <summary>
3135
/// Gets or sets the Direction of the scale action
3236
/// </summary>
33-
public new ScaleDirection Direction { get; set; }
37+
public new ScaleDirection Direction
38+
{
39+
get => (ScaleDirection)System.Enum.Parse(typeof(ScaleDirection), base.Direction.ToString());
40+
set => base.Direction = (Monitor.Models.ScaleDirection)System.Enum.Parse(typeof(Monitor.Models.ScaleDirection), value.ToString());
41+
}
3442

3543
/// <summary>
3644
/// Initializes a new instance of the ScaleAction class.

0 commit comments

Comments
 (0)