Skip to content

Commit c4a8813

Browse files
author
Josh Williams
committed
Fix lint
1 parent c0774c3 commit c4a8813

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

sumologic/resource_sumologic_cse_aggregation_rule.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func resourceSumologicCSEAggregationRuleRead(d *schema.ResourceData, meta interf
117117
return nil
118118
}
119119

120-
d.Set("aggregation_functions", CSEAggregationRuleGet.AggregationFunctions)
120+
d.Set("aggregation_functions", aggregationFunctionsArrayToResource(CSEAggregationRuleGet.AggregationFunctions))
121121
d.Set("description_expression", CSEAggregationRuleGet.DescriptionExpression)
122122
d.Set("enabled", CSEAggregationRuleGet.Enabled)
123123
d.Set("entity_selectors", entitySelectorArrayToResource(CSEAggregationRuleGet.EntitySelectors))
@@ -205,6 +205,20 @@ func resourceToAggregationFunctionsArray(resourceAggregationFunctions []interfac
205205
return result
206206
}
207207

208+
func aggregationFunctionsArrayToResource(aggregationFunctions []AggregationFunction) []map[string]interface{} {
209+
result := make([]map[string]interface{}, len(aggregationFunctions))
210+
211+
for i, aggregationFunction := range aggregationFunctions {
212+
result[i] = map[string]interface{}{
213+
"name": aggregationFunction.Name,
214+
"function": aggregationFunction.Function,
215+
"arguments": aggregationFunction.Arguments,
216+
}
217+
}
218+
219+
return result
220+
}
221+
208222
func resourceToCSEAggregationRule(d *schema.ResourceData) (CSEAggregationRule, error) {
209223
id := d.Id()
210224
if id == "" {

sumologic/resource_sumologic_cse_chain_rule.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func resourceSumologicCSEChainRuleRead(d *schema.ResourceData, meta interface{})
104104
d.Set("description", CSEChainRuleGet.Description)
105105
d.Set("enabled", CSEChainRuleGet.Enabled)
106106
d.Set("entity_selectors", entitySelectorArrayToResource(CSEChainRuleGet.EntitySelectors))
107-
d.Set("expressions_and_limits", CSEChainRuleGet.ExpressionsAndLimits)
107+
d.Set("expressions_and_limits", expressionsAndLimitsArrayToResource(CSEChainRuleGet.ExpressionsAndLimits))
108108
d.Set("group_by_fields", CSEChainRuleGet.GroupByFields)
109109
d.Set("is_prototype", CSEChainRuleGet.IsPrototype)
110110
d.Set("ordered", CSEChainRuleGet.Ordered)
@@ -179,6 +179,19 @@ func resourceToExpressionsAndLimitsArray(resourceExpressionsAndLimits []interfac
179179
return result
180180
}
181181

182+
func expressionsAndLimitsArrayToResource(expressionsAndLimits []ExpressionAndLimit) []map[string]interface{} {
183+
result := make([]map[string]interface{}, len(expressionsAndLimits))
184+
185+
for i, expressionAndLimit := range expressionsAndLimits {
186+
result[i] = map[string]interface{}{
187+
"expression": expressionAndLimit.Expression,
188+
"limit": expressionAndLimit.Limit,
189+
}
190+
}
191+
192+
return result
193+
}
194+
182195
func resourceToCSEChainRule(d *schema.ResourceData) (CSEChainRule, error) {
183196
id := d.Id()
184197
if id == "" {

0 commit comments

Comments
 (0)