Skip to content

Commit

Permalink
golint
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyeqf committed Feb 8, 2023
1 parent 49c6359 commit 958417e
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions internal/services/sentinel/sentinel_alert_rule_anomaly.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sentinel

import (
"context"
"encoding/json"
"fmt"

"github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2022-10-01/workspaces"
Expand Down Expand Up @@ -68,16 +67,12 @@ func flattenSentinelAlertRuleAnomalyMultiSelect(input *[]azuresdkhacks.AnomalySe
o := AnomalyRuleMultiSelectModel{}
if item.Values != nil {
values := make([]string, 0)
for _, value := range *item.Values {
values = append(values, value)
}
values = append(values, *item.Values...)
o.Values = values
}
if item.SupportValues != nil {
supportValues := make([]string, 0)
for _, supportValue := range *item.SupportValues {
supportValues = append(supportValues, supportValue)
}
supportValues = append(supportValues, *item.SupportValues...)
o.SupportValues = supportValues
}
if item.Name != nil {
Expand Down Expand Up @@ -141,9 +136,7 @@ func flattenSentinelAlertRuleAnomalySingleSelect(input *[]azuresdkhacks.AnomalyS
}
if item.SupportValues != nil {
supportValues := make([]string, 0)
for _, supportValue := range *item.SupportValues {
supportValues = append(supportValues, supportValue)
}
supportValues = append(supportValues, *item.SupportValues...)
o.SupportValues = supportValues
}
if item.Name != nil {
Expand Down Expand Up @@ -312,14 +305,3 @@ func AlertRuleAnomalyReadWithPredicate(ctx context.Context, baseClient securityi
func AlertRuleAnomalyIdFromWorkspaceId(workspaceId workspaces.WorkspaceId, name string) string {
return parse.NewMLAnalyticsSettingsID(workspaceId.SubscriptionId, workspaceId.ResourceGroupName, workspaceId.WorkspaceName, name).ID()
}

func flattenSentinelAlertRuleAnomalyCustomizableObservations(input interface{}) (string, error) {
value := ""
val, err := json.Marshal(input)
if err != nil {
return "", fmt.Errorf("failed to marshal to json: %+v", err)
}
value = string(val)

return value, nil
}

0 comments on commit 958417e

Please sign in to comment.