Skip to content

Commit d00d57a

Browse files
authored
Merge pull request #7628 from srsedate/preview
Masked Enumeration Property Fixes for ScaleAction and MetricTrigger
2 parents 31386ea + 33dab7e commit d00d57a

File tree

3 files changed

+57
-6
lines changed

3 files changed

+57
-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,12 +18,13 @@
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
* Fixed issue #7513 [Insights] Set-AzureRMDiagnosticSetting requires explicit specification of categories during creation of setting
2325
- Now the cmdlet does not require explicit indication of the categories to enable during creation, i.e. it works as it is documented
2426

2527
## Version 5.1.4
26-
2728
* Fixed issues #6833 and #7102 (Diagnostic Settings area)
2829
- Issues with the default name, i.e. "service", during creation and listing/getting of diagnostic settings
2930
- Issues creating diagnostic settings with categories

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

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,47 @@ 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
31+
{
32+
return (ComparisonOperationType)System.Enum.Parse(typeof(ComparisonOperationType), base.OperatorProperty.ToString());
33+
}
34+
set
35+
{
36+
base.OperatorProperty = (Monitor.Models.ComparisonOperationType)System.Enum.Parse(typeof(Monitor.Models.ComparisonOperationType), value.ToString());
37+
}
38+
}
2939

3040
/// <summary>
3141
/// Gets or sets the Statistic of the Metric Trigger
3242
/// </summary>
33-
public new MetricStatisticType Statistic { get; set; }
43+
public new MetricStatisticType Statistic
44+
{
45+
get
46+
{
47+
return (MetricStatisticType)System.Enum.Parse(typeof(MetricStatisticType), base.Statistic.ToString());
48+
}
49+
set
50+
{
51+
base.Statistic = (Monitor.Models.MetricStatisticType)System.Enum.Parse(typeof(Monitor.Models.MetricStatisticType), value.ToString());
52+
}
53+
}
3454

3555
/// <summary>
3656
/// Gets or sets the TimeAggregation of the Metric Trigger
3757
/// </summary>
38-
public new TimeAggregationType TimeAggregation { get; set; }
58+
public new TimeAggregationType TimeAggregation
59+
{
60+
get
61+
{
62+
return (TimeAggregationType)System.Enum.Parse(typeof(TimeAggregationType), base.TimeAggregation.ToString());
63+
}
64+
set
65+
{
66+
base.TimeAggregation = (Monitor.Models.TimeAggregationType)System.Enum.Parse(typeof(Monitor.Models.TimeAggregationType), value.ToString());
67+
}
68+
}
3969

4070
/// <summary>
4171
/// Initializes a new instance of the MetricTrigger class.

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,32 @@ 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
31+
{
32+
return (ScaleType)System.Enum.Parse(typeof(ScaleType), base.Type.ToString());
33+
}
34+
set
35+
{
36+
base.Type = (Monitor.Models.ScaleType)System.Enum.Parse(typeof(Monitor.Models.ScaleType), value.ToString());
37+
}
38+
}
2939

3040
/// <summary>
3141
/// Gets or sets the Direction of the scale action
3242
/// </summary>
33-
public new ScaleDirection Direction { get; set; }
43+
public new ScaleDirection Direction
44+
{
45+
get
46+
{
47+
return (ScaleDirection)System.Enum.Parse(typeof(ScaleDirection), base.Direction.ToString());
48+
}
49+
set
50+
{
51+
base.Direction = (Monitor.Models.ScaleDirection)System.Enum.Parse(typeof(Monitor.Models.ScaleDirection), value.ToString());
52+
}
53+
}
3454

3555
/// <summary>
3656
/// Initializes a new instance of the ScaleAction class.

0 commit comments

Comments
 (0)