@@ -39,15 +39,13 @@ func (m ClientKeyJavascriptLoaderScriptResourceModel) AttributeTypes() map[strin
39
39
}
40
40
}
41
41
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 ) {
45
43
m .BrowserSdkVersion = types .StringValue (key .BrowserSdkVersion )
46
44
m .PerformanceMonitoringEnabled = types .BoolValue (key .DynamicSdkLoaderOptions .HasPerformance )
47
45
m .SessionReplayEnabled = types .BoolValue (key .DynamicSdkLoaderOptions .HasReplay )
48
46
m .DebugEnabled = types .BoolValue (key .DynamicSdkLoaderOptions .HasDebug )
49
47
50
- return diags
48
+ return
51
49
}
52
50
53
51
type ClientKeyResourceModel struct {
@@ -67,9 +65,7 @@ type ClientKeyResourceModel struct {
67
65
DsnCsp types.String `tfsdk:"dsn_csp"`
68
66
}
69
67
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 ) {
73
69
m .Id = types .StringValue (key .Id )
74
70
m .ProjectId = types .StringValue (key .ProjectId .String ())
75
71
m .Name = types .StringValue (key .Name )
@@ -114,7 +110,7 @@ func (m *ClientKeyResourceModel) Fill(ctx context.Context, key apiclient.Project
114
110
m .DsnCsp = types .StringNull ()
115
111
}
116
112
117
- return diags
113
+ return
118
114
}
119
115
120
116
var _ resource.Resource = & ClientKeyResource {}
@@ -382,28 +378,22 @@ func (r *ClientKeyResource) Update(ctx context.Context, req resource.UpdateReque
382
378
}
383
379
384
380
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 {})... )
387
383
if resp .Diagnostics .HasError () {
388
384
return
389
385
}
390
386
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 (),
407
397
}
408
398
}
409
399
0 commit comments