fix: fix linter errors
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 17s
CI Workflow / Prepare GO cache (pull_request) Successful in 2m10s
CI Workflow / CI run build and linting (pull_request) Successful in 7m10s
CI Workflow / Code coverage report (pull_request) Successful in 4s
CI Workflow / CI run tests (pull_request) Failing after 9m13s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 16m53s

This commit is contained in:
Marcel S. Henselin 2026-03-09 14:03:29 +01:00
parent ab9ff41b24
commit c8ea125bac
45 changed files with 1266 additions and 139 deletions

View file

@ -12,6 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v3beta1api"
sqlserverflexbetaDataGen "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/instance/datasources_gen"
sqlserverflexbetaResGen "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/instance/resources_gen"
)
@ -230,7 +231,7 @@ func toCreatePayload(
FlavorId: model.FlavorId.ValueString(),
Name: model.Name.ValueString(),
Network: networkPayload,
RetentionDays: int32(model.RetentionDays.ValueInt64()),
RetentionDays: int32(model.RetentionDays.ValueInt64()), //nolint:gosec // TODO
Storage: storagePayload,
Version: v3beta1api.InstanceVersion(model.Version.ValueString()),
}, nil
@ -249,21 +250,24 @@ func toUpdatePayload(
}
replVal := v3beta1api.Replicas(uint32(m.Replicas.ValueInt64())) // nolint:gosec // check is performed above
var netAcl []string
diags := m.Network.Acl.ElementsAs(ctx, &netAcl, false)
var netACL []string
diags := m.Network.Acl.ElementsAs(ctx, &netACL, false)
resp.Diagnostics.Append(diags...)
if diags.HasError() {
return nil, fmt.Errorf("error converting model network acl value")
}
if m.RetentionDays.ValueInt64() > math.MaxInt32 {
return nil, fmt.Errorf("value is too large for int32")
}
return &v3beta1api.UpdateInstanceRequestPayload{
BackupSchedule: m.BackupSchedule.ValueString(),
FlavorId: m.FlavorId.ValueString(),
Name: m.Name.ValueString(),
Network: v3beta1api.UpdateInstanceRequestPayloadNetwork{
Acl: netAcl,
Acl: netACL,
},
Replicas: replVal,
RetentionDays: int32(m.RetentionDays.ValueInt64()),
RetentionDays: int32(m.RetentionDays.ValueInt64()), //nolint:gosec // checked above
Storage: v3beta1api.StorageUpdate{Size: m.Storage.Size.ValueInt64Pointer()},
Version: v3beta1api.InstanceVersion(m.Version.ValueString()),
}, nil