in ec/ecresource/deploymentresource/integrationsserver/v2/integrations_server_config.go [75:124]
func integrationsServerConfigPayload(ctx context.Context, cfgObj attr.Value, res *models.IntegrationsServerConfiguration) diag.Diagnostics {
var diags diag.Diagnostics
if cfgObj.IsNull() || cfgObj.IsUnknown() {
return nil
}
var cfg *v1.IntegrationsServerConfigTF
if diags = tfsdk.ValueAs(ctx, cfgObj, &cfg); diags.HasError() {
return nil
}
if cfg == nil {
return nil
}
if !cfg.DebugEnabled.IsNull() {
if res.SystemSettings == nil {
res.SystemSettings = &models.IntegrationsServerSystemSettings{}
}
res.SystemSettings.DebugEnabled = ec.Bool(cfg.DebugEnabled.ValueBool())
}
if cfg.UserSettingsJson.ValueString() != "" {
if err := json.Unmarshal([]byte(cfg.UserSettingsJson.ValueString()), &res.UserSettingsJSON); err != nil {
diags.AddError("failed expanding IntegrationsServer user_settings_json", err.Error())
}
}
if cfg.UserSettingsOverrideJson.ValueString() != "" {
if err := json.Unmarshal([]byte(cfg.UserSettingsOverrideJson.ValueString()), &res.UserSettingsOverrideJSON); err != nil {
diags.AddError("failed expanding IntegrationsServer user_settings_override_json", err.Error())
}
}
if !cfg.UserSettingsYaml.IsNull() {
res.UserSettingsYaml = cfg.UserSettingsYaml.ValueString()
}
if !cfg.UserSettingsOverrideYaml.IsNull() {
res.UserSettingsOverrideYaml = cfg.UserSettingsOverrideYaml.ValueString()
}
if !cfg.DockerImage.IsNull() {
res.DockerImage = cfg.DockerImage.ValueString()
}
return diags
}