Skip to content

Commit

Permalink
Make all enums case sensitive according to comments in another PR (#1989
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Junyi Yi committed Oct 11, 2018
1 parent 60f0184 commit 16facf4
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions azurerm/resource_arm_monitor_metric_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ func resourceArmMonitorMetricAlert() *schema.Resource {
"Minimum",
"Maximum",
"Total",
}, true),
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
}, false),
},
"operator": {
Type: schema.TypeString,
Expand All @@ -87,8 +86,7 @@ func resourceArmMonitorMetricAlert() *schema.Resource {
"GreaterThanOrEqual",
"LessThan",
"LessThanOrEqual",
}, true),
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
}, false),
},
"threshold": {
Type: schema.TypeFloat,
Expand All @@ -110,8 +108,7 @@ func resourceArmMonitorMetricAlert() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{
"Include",
"Exclude",
}, true),
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
}, false),
},
"values": {
Type: schema.TypeList,
Expand Down Expand Up @@ -360,18 +357,19 @@ func expandMonitorMetricAlertAction(input []interface{}) *[]insights.MetricAlert
actions := make([]insights.MetricAlertAction, 0)
for _, item := range input {
v := item.(map[string]interface{})

props := make(map[string]*string)
if pVal, ok := v["webhook_properties"]; ok {
for pk, pv := range pVal.(map[string]interface{}) {
props[pk] = utils.String(pv.(string))
if agID := v["action_group_id"].(string); agID != "" {
props := make(map[string]*string)
if pVal, ok := v["webhook_properties"]; ok {
for pk, pv := range pVal.(map[string]interface{}) {
props[pk] = utils.String(pv.(string))
}
}
}

actions = append(actions, insights.MetricAlertAction{
ActionGroupID: utils.String(v["action_group_id"].(string)),
WebhookProperties: props,
})
actions = append(actions, insights.MetricAlertAction{
ActionGroupID: utils.String(agID),
WebhookProperties: props,
})
}
}
return &actions
}
Expand Down

0 comments on commit 16facf4

Please sign in to comment.