From cf76c2eff84e7084df3397b17af688d0bf3f745b Mon Sep 17 00:00:00 2001 From: pranav-new-relic Date: Fri, 30 Aug 2024 13:21:32 +0530 Subject: [PATCH] fix(synthetics): allow new -> legacy runtime downgrade until Oct 22 for simple browser, scripted monitors --- ...uctures_newrelic_synthetics_script_api_monitor.go | 12 ++++++++---- ...res_newrelic_synthetics_script_browser_monitor.go | 12 ++++++++---- ...res_newrelic_synthetics_simple_browser_monitor.go | 12 ++++++++---- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/newrelic/structures_newrelic_synthetics_script_api_monitor.go b/newrelic/structures_newrelic_synthetics_script_api_monitor.go index f7bc25ce8..e096a61fc 100644 --- a/newrelic/structures_newrelic_synthetics_script_api_monitor.go +++ b/newrelic/structures_newrelic_synthetics_script_api_monitor.go @@ -27,9 +27,8 @@ func buildSyntheticsScriptAPIMonitorInput(d *schema.ResourceData) synthetics.Syn _, runtimeTypeOk := d.GetOk("runtime_type") _, runtimeVersionOk := d.GetOk("runtime_type_version") + input.Runtime = &synthetics.SyntheticsRuntimeInput{} if scriptLangOk || runtimeTypeOk || runtimeVersionOk { - input.Runtime = &synthetics.SyntheticsRuntimeInput{} - if v, ok := d.GetOk("script_language"); ok { input.Runtime.ScriptLanguage = v.(string) } @@ -39,6 +38,9 @@ func buildSyntheticsScriptAPIMonitorInput(d *schema.ResourceData) synthetics.Syn if v, ok := d.GetOk("runtime_type_version"); ok { input.Runtime.RuntimeTypeVersion = synthetics.SemVer(v.(string)) } + } else { + input.Runtime.RuntimeType = "" + input.Runtime.RuntimeTypeVersion = "" } return input @@ -66,9 +68,8 @@ func buildSyntheticsScriptAPIMonitorUpdateInput(d *schema.ResourceData) syntheti _, runtimeTypeOk := d.GetOk("runtime_type") _, runtimeVersionOk := d.GetOk("runtime_type_version") + input.Runtime = &synthetics.SyntheticsRuntimeInput{} if scriptLangOk || runtimeTypeOk || runtimeVersionOk { - input.Runtime = &synthetics.SyntheticsRuntimeInput{} - if v, ok := d.GetOk("script_language"); ok { input.Runtime.ScriptLanguage = v.(string) } @@ -78,6 +79,9 @@ func buildSyntheticsScriptAPIMonitorUpdateInput(d *schema.ResourceData) syntheti if v, ok := d.GetOk("runtime_type_version"); ok { input.Runtime.RuntimeTypeVersion = synthetics.SemVer(v.(string)) } + } else { + input.Runtime.RuntimeType = "" + input.Runtime.RuntimeTypeVersion = "" } return input diff --git a/newrelic/structures_newrelic_synthetics_script_browser_monitor.go b/newrelic/structures_newrelic_synthetics_script_browser_monitor.go index ec9749538..a587a3f97 100644 --- a/newrelic/structures_newrelic_synthetics_script_browser_monitor.go +++ b/newrelic/structures_newrelic_synthetics_script_browser_monitor.go @@ -29,9 +29,8 @@ func buildSyntheticsScriptBrowserMonitorInput(d *schema.ResourceData) synthetics runtimeType, runtimeTypeOk := d.GetOk("runtime_type") runtimeTypeVersion, runtimeTypeVersionOk := d.GetOk("runtime_type_version") + input.Runtime = &synthetics.SyntheticsRuntimeInput{} if scriptLangOk || runtimeTypeOk || runtimeTypeVersionOk { - input.Runtime = &synthetics.SyntheticsRuntimeInput{} - if scriptLangOk { input.Runtime.ScriptLanguage = sciptLang.(string) } @@ -43,6 +42,9 @@ func buildSyntheticsScriptBrowserMonitorInput(d *schema.ResourceData) synthetics if runtimeTypeVersionOk { input.Runtime.RuntimeTypeVersion = synthetics.SemVer(runtimeTypeVersion.(string)) } + } else { + input.Runtime.RuntimeType = "" + input.Runtime.RuntimeTypeVersion = "" } enableScreenshot := d.Get("enable_screenshot_on_failure_and_script").(bool) @@ -90,9 +92,8 @@ func buildSyntheticsScriptBrowserUpdateInput(d *schema.ResourceData) synthetics. sciptLang, scriptLangOk := d.GetOk("script_language") runtimeType, runtimeTypeOk := d.GetOk("runtime_type") runtimeTypeVersion, runtimeTypeVersionOk := d.GetOk("runtime_type_version") + input.Runtime = &synthetics.SyntheticsRuntimeInput{} if scriptLangOk || runtimeTypeOk || runtimeTypeVersionOk { - input.Runtime = &synthetics.SyntheticsRuntimeInput{} - if scriptLangOk { input.Runtime.ScriptLanguage = sciptLang.(string) } @@ -104,6 +105,9 @@ func buildSyntheticsScriptBrowserUpdateInput(d *schema.ResourceData) synthetics. if runtimeTypeVersionOk { input.Runtime.RuntimeTypeVersion = synthetics.SemVer(runtimeTypeVersion.(string)) } + } else { + input.Runtime.RuntimeType = "" + input.Runtime.RuntimeTypeVersion = "" } enableScreenshot := d.Get("enable_screenshot_on_failure_and_script").(bool) diff --git a/newrelic/structures_newrelic_synthetics_simple_browser_monitor.go b/newrelic/structures_newrelic_synthetics_simple_browser_monitor.go index 9d1a928ee..a659dcd69 100644 --- a/newrelic/structures_newrelic_synthetics_simple_browser_monitor.go +++ b/newrelic/structures_newrelic_synthetics_simple_browser_monitor.go @@ -60,9 +60,8 @@ func buildSyntheticsSimpleBrowserMonitorRuntimeAndDeviceEmulation(d *schema.Reso runtimeType, runtimeTypeOk := d.GetOk("runtime_type") runtimeTypeVersion, runtimeTypeVersionOk := d.GetOk("runtime_type_version") + simpleBrowserMonitorInput.Runtime = &synthetics.SyntheticsRuntimeInput{} if scriptLangOk || runtimeTypeOk || runtimeTypeVersionOk { - simpleBrowserMonitorInput.Runtime = &synthetics.SyntheticsRuntimeInput{} - if scriptLangOk { simpleBrowserMonitorInput.Runtime.ScriptLanguage = scriptLang.(string) } @@ -74,6 +73,9 @@ func buildSyntheticsSimpleBrowserMonitorRuntimeAndDeviceEmulation(d *schema.Reso if runtimeTypeVersionOk { simpleBrowserMonitorInput.Runtime.RuntimeTypeVersion = synthetics.SemVer(runtimeTypeVersion.(string)) } + } else { + simpleBrowserMonitorInput.Runtime.RuntimeType = "" + simpleBrowserMonitorInput.Runtime.RuntimeTypeVersion = "" } do, doOk := d.GetOk("device_orientation") @@ -150,9 +152,8 @@ func buildSyntheticsSimpleBrowserMonitorRuntimeAndDeviceEmulationUpdateStruct(d runtimeType, runtimeTypeOk := d.GetOk("runtime_type") runtimeTypeVersion, runtimeTypeVersionOk := d.GetOk("runtime_type_version") + simpleBrowserMonitorUpdateInput.Runtime = &synthetics.SyntheticsRuntimeInput{} if scriptLangOk || runtimeTypeOk || runtimeTypeVersionOk { - simpleBrowserMonitorUpdateInput.Runtime = &synthetics.SyntheticsRuntimeInput{} - if scriptLangOk { simpleBrowserMonitorUpdateInput.Runtime.ScriptLanguage = scriptLang.(string) } @@ -164,6 +165,9 @@ func buildSyntheticsSimpleBrowserMonitorRuntimeAndDeviceEmulationUpdateStruct(d if runtimeTypeVersionOk { simpleBrowserMonitorUpdateInput.Runtime.RuntimeTypeVersion = synthetics.SemVer(runtimeTypeVersion.(string)) } + } else { + simpleBrowserMonitorUpdateInput.Runtime.RuntimeType = "" + simpleBrowserMonitorUpdateInput.Runtime.RuntimeTypeVersion = "" } do, doOk := d.GetOk("device_orientation")