From 7bd63021674714e7a442865ab66d92eff10df011 Mon Sep 17 00:00:00 2001 From: Sander Blue Date: Fri, 21 Jun 2024 15:36:53 -0500 Subject: [PATCH 1/3] chore: make necessary adjustments to support entities package codegen updates --- newrelic/provider_test.go | 15 +++++++++++++-- newrelic/structures_newrelic_one_dashboard.go | 10 +++++----- newrelic/structures_newrelic_workflow.go | 1 + 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/newrelic/provider_test.go b/newrelic/provider_test.go index 77a9d912a..9c880c9f7 100644 --- a/newrelic/provider_test.go +++ b/newrelic/provider_test.go @@ -155,7 +155,14 @@ func testAccCreateEntity(t *testing.T, name string) { } retryErr := resource.RetryContext(context.Background(), 30*time.Second, func() *resource.RetryError { - entityResults, err := client.GetEntitySearchWithContext(context.Background(), entities.EntitySearchOptions{}, "", params, []entities.EntitySearchSortCriteria{}) + entityResults, err := client.GetEntitySearchWithContext( + context.Background(), + entities.EntitySearchOptions{}, + "", + params, + []entities.EntitySearchSortCriteria{}, + []entities.SortCriterionWithDirection{}, + ) if err != nil { return resource.RetryableError(err) } @@ -321,6 +328,7 @@ func testAccSyntheticTestEntitiesCleanup(t *testing.T) { Name: nameSuffix, }, []entities.EntitySearchSortCriteria{}, + []entities.SortCriterionWithDirection{}, ) if err != nil { @@ -385,12 +393,15 @@ func testAccBrowserApplicationsCleanup(t *testing.T) { t.Logf("***** fetching test browser application entities created by Terraform ******") - testBrowserApplicationEntities, err := client.GetEntitySearch(entities.EntitySearchOptions{}, "", + testBrowserApplicationEntities, err := client.GetEntitySearch( + entities.EntitySearchOptions{}, + "", entities.EntitySearchQueryBuilder{ Domain: "BROWSER", Type: "APPLICATION", }, []entities.EntitySearchSortCriteria{}, + []entities.SortCriterionWithDirection{}, ) if err != nil { diff --git a/newrelic/structures_newrelic_one_dashboard.go b/newrelic/structures_newrelic_one_dashboard.go index d12ed4981..411613d95 100644 --- a/newrelic/structures_newrelic_one_dashboard.go +++ b/newrelic/structures_newrelic_one_dashboard.go @@ -1006,19 +1006,19 @@ func flattenDashboardVariable(in *[]entities.DashboardVariable, d *schema.Resour m := make(map[string]interface{}) if v.DefaultValues != nil { - m["default_values"] = flattenVariableDefaultValues(v.DefaultValues) + m["default_values"] = flattenVariableDefaultValues(&v.DefaultValues) } m["is_multi_selection"] = v.IsMultiSelection m["item"] = flattenVariableItems(v.Items) m["name"] = v.Name - if v.NRQLQuery != nil { - m["nrql_query"] = flattenVariableNRQLQuery(v.NRQLQuery) + if &v.NRQLQuery != nil { + m["nrql_query"] = flattenVariableNRQLQuery(&v.NRQLQuery) } m["replacement_strategy"] = strings.ToLower(string(v.ReplacementStrategy)) m["title"] = v.Title m["type"] = strings.ToLower(string(v.Type)) - if v.Options != nil { - options := flattenVariableOptions(v.Options, d, i) + if &v.Options != nil { + options := flattenVariableOptions(&v.Options, d, i) if options != nil { // set options -> ignore_time_range to the state only if they already exist in the configuration // needed to make this backward compatible with configurations which do not yet have options -> ignore_time_range diff --git a/newrelic/structures_newrelic_workflow.go b/newrelic/structures_newrelic_workflow.go index 77a438c6e..dd4fecd7d 100644 --- a/newrelic/structures_newrelic_workflow.go +++ b/newrelic/structures_newrelic_workflow.go @@ -3,6 +3,7 @@ package newrelic import ( "context" "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/newrelic/newrelic-client-go/v2/pkg/ai" "github.com/newrelic/newrelic-client-go/v2/pkg/workflows" From a5a4bec697c99bca4e0e303bf86ddc21dc7f2e7b Mon Sep 17 00:00:00 2001 From: Sander Blue Date: Thu, 27 Jun 2024 12:36:26 -0500 Subject: [PATCH 2/3] chore(deps): upgrade newrelic-client-go to v2.38.0 (entities pkg release) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6d05ec050..df75b761e 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/newrelic/go-agent/v3 v3.30.0 github.com/newrelic/go-insights v1.0.3 - github.com/newrelic/newrelic-client-go/v2 v2.37.0 + github.com/newrelic/newrelic-client-go/v2 v2.38.0 github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 ) diff --git a/go.sum b/go.sum index e9355bfca..95700bfef 100644 --- a/go.sum +++ b/go.sum @@ -267,8 +267,8 @@ github.com/newrelic/go-agent/v3 v3.30.0 h1:ZXHCT/Cot4iIPwcegCZURuRQOsfmGA6wilW+S github.com/newrelic/go-agent/v3 v3.30.0/go.mod h1:9utrgxlSryNqRrTvII2XBL+0lpofXbqXApvVWPpbzUg= github.com/newrelic/go-insights v1.0.3 h1:zSNp1CEZnXktzSIEsbHJk8v6ZihdPFP2WsO/fzau3OQ= github.com/newrelic/go-insights v1.0.3/go.mod h1:A20BoT8TNkqPGX2nS/Z2fYmKl3Cqa3iKZd4whzedCY4= -github.com/newrelic/newrelic-client-go/v2 v2.37.0 h1:Uq/FjtDhT+y2iSm/GctBaiHQeN6Wi6ClK6V4OQ44GLg= -github.com/newrelic/newrelic-client-go/v2 v2.37.0/go.mod h1:pDFY24/6iIMEbPIdowTRrRn9YYwkXc3j+B+XpTb4oF4= +github.com/newrelic/newrelic-client-go/v2 v2.38.0 h1:2Q106SyrB7e0zeWP7374HBCJ2N5aWhZ8sZBkzmxwzn0= +github.com/newrelic/newrelic-client-go/v2 v2.38.0/go.mod h1:pDFY24/6iIMEbPIdowTRrRn9YYwkXc3j+B+XpTb4oF4= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= From 2c2b55a2ebc5937bae75de2fb6384386cea09dfd Mon Sep 17 00:00:00 2001 From: Sander Blue Date: Mon, 1 Jul 2024 15:25:04 -0500 Subject: [PATCH 3/3] chore(dashboards): adjustments to the dashboard types adjustments --- go.mod | 2 +- go.sum | 4 ++-- newrelic/structures_newrelic_one_dashboard.go | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index df75b761e..a9709a5ae 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/newrelic/go-agent/v3 v3.30.0 github.com/newrelic/go-insights v1.0.3 - github.com/newrelic/newrelic-client-go/v2 v2.38.0 + github.com/newrelic/newrelic-client-go/v2 v2.39.1 github.com/stretchr/testify v1.9.0 golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 ) diff --git a/go.sum b/go.sum index 95700bfef..1076986e3 100644 --- a/go.sum +++ b/go.sum @@ -267,8 +267,8 @@ github.com/newrelic/go-agent/v3 v3.30.0 h1:ZXHCT/Cot4iIPwcegCZURuRQOsfmGA6wilW+S github.com/newrelic/go-agent/v3 v3.30.0/go.mod h1:9utrgxlSryNqRrTvII2XBL+0lpofXbqXApvVWPpbzUg= github.com/newrelic/go-insights v1.0.3 h1:zSNp1CEZnXktzSIEsbHJk8v6ZihdPFP2WsO/fzau3OQ= github.com/newrelic/go-insights v1.0.3/go.mod h1:A20BoT8TNkqPGX2nS/Z2fYmKl3Cqa3iKZd4whzedCY4= -github.com/newrelic/newrelic-client-go/v2 v2.38.0 h1:2Q106SyrB7e0zeWP7374HBCJ2N5aWhZ8sZBkzmxwzn0= -github.com/newrelic/newrelic-client-go/v2 v2.38.0/go.mod h1:pDFY24/6iIMEbPIdowTRrRn9YYwkXc3j+B+XpTb4oF4= +github.com/newrelic/newrelic-client-go/v2 v2.39.1 h1:05b9E0bReE9RS00rB8DzD7F1Vxb8+dHMiV95H1TLToI= +github.com/newrelic/newrelic-client-go/v2 v2.39.1/go.mod h1:pDFY24/6iIMEbPIdowTRrRn9YYwkXc3j+B+XpTb4oF4= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= diff --git a/newrelic/structures_newrelic_one_dashboard.go b/newrelic/structures_newrelic_one_dashboard.go index 411613d95..d12ed4981 100644 --- a/newrelic/structures_newrelic_one_dashboard.go +++ b/newrelic/structures_newrelic_one_dashboard.go @@ -1006,19 +1006,19 @@ func flattenDashboardVariable(in *[]entities.DashboardVariable, d *schema.Resour m := make(map[string]interface{}) if v.DefaultValues != nil { - m["default_values"] = flattenVariableDefaultValues(&v.DefaultValues) + m["default_values"] = flattenVariableDefaultValues(v.DefaultValues) } m["is_multi_selection"] = v.IsMultiSelection m["item"] = flattenVariableItems(v.Items) m["name"] = v.Name - if &v.NRQLQuery != nil { - m["nrql_query"] = flattenVariableNRQLQuery(&v.NRQLQuery) + if v.NRQLQuery != nil { + m["nrql_query"] = flattenVariableNRQLQuery(v.NRQLQuery) } m["replacement_strategy"] = strings.ToLower(string(v.ReplacementStrategy)) m["title"] = v.Title m["type"] = strings.ToLower(string(v.Type)) - if &v.Options != nil { - options := flattenVariableOptions(&v.Options, d, i) + if v.Options != nil { + options := flattenVariableOptions(v.Options, d, i) if options != nil { // set options -> ignore_time_range to the state only if they already exist in the configuration // needed to make this backward compatible with configurations which do not yet have options -> ignore_time_range