Skip to content

Commit

Permalink
Base working version
Browse files Browse the repository at this point in the history
  • Loading branch information
hemeryar committed Nov 8, 2024
1 parent 74da99a commit bee48ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions datadog/fwprovider/resource_datadog_rum_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,21 +263,6 @@ func (r *rumMetricResource) updateState(ctx context.Context, state *rumMetricMod

state.EventType = types.StringValue(string(attributes.GetEventType()))

if groupBy, ok := attributes.GetGroupByOk(); ok && len(*groupBy) > 0 {
state.GroupBy = []*rumMetricGroupByModel{}
for _, groupByDdItem := range *groupBy {
groupByTfItem := rumMetricGroupByModel{}
if path, ok := groupByDdItem.GetPathOk(); ok {
groupByTfItem.Path = types.StringValue(*path)
}
if tagName, ok := groupByDdItem.GetTagNameOk(); ok {
groupByTfItem.TagName = types.StringValue(*tagName)
}

state.GroupBy = append(state.GroupBy, &groupByTfItem)
}
}

if compute, ok := attributes.GetComputeOk(); ok {

computeTf := rumMetricComputeModel{}
Expand Down Expand Up @@ -306,6 +291,21 @@ func (r *rumMetricResource) updateState(ctx context.Context, state *rumMetricMod
state.Filter = &filterTf
}

if groupBy, ok := attributes.GetGroupByOk(); ok && len(*groupBy) > 0 {
state.GroupBy = []*rumMetricGroupByModel{}
for _, groupByDdItem := range *groupBy {
groupByTfItem := rumMetricGroupByModel{}
if path, ok := groupByDdItem.GetPathOk(); ok {
groupByTfItem.Path = types.StringValue(*path)
}
if tagName, ok := groupByDdItem.GetTagNameOk(); ok {
groupByTfItem.TagName = types.StringValue(*tagName)
}

state.GroupBy = append(state.GroupBy, &groupByTfItem)
}
}

if uniqueness, ok := attributes.GetUniquenessOk(); ok {

uniquenessTf := rumMetricUniquenessModel{}
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/rum_metric.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ resource "datadog_rum_metric" "foo" {

- `compute` (Block, Optional) (see [below for nested schema](#nestedblock--compute))
- `filter` (Block, Optional) (see [below for nested schema](#nestedblock--filter))
- `group_by` (Block List) (see [below for nested schema](#nestedblock--group_by))
- `group_by` (Block Set) (see [below for nested schema](#nestedblock--group_by))
- `uniqueness` (Block, Optional) (see [below for nested schema](#nestedblock--uniqueness))

### Read-Only
Expand Down

0 comments on commit bee48ca

Please sign in to comment.