@@ -39,15 +39,13 @@ func (m ClientKeyJavascriptLoaderScriptResourceModel) AttributeTypes() map[strin
3939 }
4040}
4141
42- func (m * ClientKeyJavascriptLoaderScriptResourceModel ) Fill (ctx context.Context , key apiclient.ProjectKey ) diag.Diagnostics {
43- var diags diag.Diagnostics
44-
42+ func (m * ClientKeyJavascriptLoaderScriptResourceModel ) Fill (ctx context.Context , key apiclient.ProjectKey ) (diags diag.Diagnostics ) {
4543 m .BrowserSdkVersion = types .StringValue (key .BrowserSdkVersion )
4644 m .PerformanceMonitoringEnabled = types .BoolValue (key .DynamicSdkLoaderOptions .HasPerformance )
4745 m .SessionReplayEnabled = types .BoolValue (key .DynamicSdkLoaderOptions .HasReplay )
4846 m .DebugEnabled = types .BoolValue (key .DynamicSdkLoaderOptions .HasDebug )
4947
50- return diags
48+ return
5149}
5250
5351type ClientKeyResourceModel struct {
@@ -67,9 +65,7 @@ type ClientKeyResourceModel struct {
6765 DsnCsp types.String `tfsdk:"dsn_csp"`
6866}
6967
70- func (m * ClientKeyResourceModel ) Fill (ctx context.Context , key apiclient.ProjectKey ) diag.Diagnostics {
71- var diags diag.Diagnostics
72-
68+ func (m * ClientKeyResourceModel ) Fill (ctx context.Context , key apiclient.ProjectKey ) (diags diag.Diagnostics ) {
7369 m .Id = types .StringValue (key .Id )
7470 m .ProjectId = types .StringValue (key .ProjectId .String ())
7571 m .Name = types .StringValue (key .Name )
@@ -114,7 +110,7 @@ func (m *ClientKeyResourceModel) Fill(ctx context.Context, key apiclient.Project
114110 m .DsnCsp = types .StringNull ()
115111 }
116112
117- return diags
113+ return
118114}
119115
120116var _ resource.Resource = & ClientKeyResource {}
@@ -382,28 +378,22 @@ func (r *ClientKeyResource) Update(ctx context.Context, req resource.UpdateReque
382378 }
383379
384380 if ! plan .JavascriptLoaderScript .Equal (state .JavascriptLoaderScript ) {
385- var javascriptLoaderScriptPlan , javascriptLoaderScriptState ClientKeyJavascriptLoaderScriptResourceModel
386- resp .Diagnostics .Append (plan .JavascriptLoaderScript .As (ctx , & javascriptLoaderScriptPlan , basetypes.ObjectAsOptions {})... )
381+ var javascriptLoaderScript ClientKeyJavascriptLoaderScriptResourceModel
382+ resp .Diagnostics .Append (plan .JavascriptLoaderScript .As (ctx , & javascriptLoaderScript , basetypes.ObjectAsOptions {})... )
387383 if resp .Diagnostics .HasError () {
388384 return
389385 }
390386
391- if ! javascriptLoaderScriptPlan .BrowserSdkVersion .Equal (javascriptLoaderScriptState .BrowserSdkVersion ) {
392- body .BrowserSdkVersion = javascriptLoaderScriptPlan .BrowserSdkVersion .ValueStringPointer ()
393- }
394-
395- if ! javascriptLoaderScriptPlan .SessionReplayEnabled .Equal (javascriptLoaderScriptState .SessionReplayEnabled ) ||
396- ! javascriptLoaderScriptPlan .PerformanceMonitoringEnabled .Equal (javascriptLoaderScriptState .PerformanceMonitoringEnabled ) ||
397- ! javascriptLoaderScriptPlan .DebugEnabled .Equal (javascriptLoaderScriptState .DebugEnabled ) {
398- body .DynamicSdkLoaderOptions = & struct {
399- HasDebug * bool `json:"hasDebug,omitempty"`
400- HasPerformance * bool `json:"hasPerformance,omitempty"`
401- HasReplay * bool `json:"hasReplay,omitempty"`
402- }{
403- HasReplay : javascriptLoaderScriptPlan .SessionReplayEnabled .ValueBoolPointer (),
404- HasDebug : javascriptLoaderScriptPlan .DebugEnabled .ValueBoolPointer (),
405- HasPerformance : javascriptLoaderScriptPlan .PerformanceMonitoringEnabled .ValueBoolPointer (),
406- }
387+ // NOTE: Both `BrowserSdkVersion` and `DynamicSdkLoaderOptions` must be set together.
388+ body .BrowserSdkVersion = javascriptLoaderScript .BrowserSdkVersion .ValueStringPointer ()
389+ body .DynamicSdkLoaderOptions = & struct {
390+ HasDebug * bool `json:"hasDebug,omitempty"`
391+ HasPerformance * bool `json:"hasPerformance,omitempty"`
392+ HasReplay * bool `json:"hasReplay,omitempty"`
393+ }{
394+ HasReplay : javascriptLoaderScript .SessionReplayEnabled .ValueBoolPointer (),
395+ HasDebug : javascriptLoaderScript .DebugEnabled .ValueBoolPointer (),
396+ HasPerformance : javascriptLoaderScript .PerformanceMonitoringEnabled .ValueBoolPointer (),
407397 }
408398 }
409399
0 commit comments