Fix: fix imports and names (#9)
* fix: add missing entries and correct refs * fix: add missing docs --------- Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
This commit is contained in:
parent
db080dc89a
commit
944a75295f
19 changed files with 424 additions and 235 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
|
||||
postgresflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha"
|
||||
"github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion"
|
||||
postgresflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils"
|
||||
|
||||
|
|
@ -47,7 +48,7 @@ func NewUserDataSource() datasource.DataSource {
|
|||
|
||||
// userDataSource is the data source implementation.
|
||||
type userDataSource struct {
|
||||
client *postgresflexalpha.APIClient
|
||||
client *postgresflex.APIClient
|
||||
providerData core.ProviderData
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +73,7 @@ func (r *userDataSource) Configure(
|
|||
return
|
||||
}
|
||||
|
||||
apiClient := postgresflexalphaUtils.ConfigureClient(ctx, &r.providerData, &resp.Diagnostics)
|
||||
apiClient := postgresflexUtils.ConfigureClient(ctx, &r.providerData, &resp.Diagnostics)
|
||||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
|
|
@ -219,7 +220,7 @@ func (r *userDataSource) Read(
|
|||
tflog.Info(ctx, "Postgres Flex user read")
|
||||
}
|
||||
|
||||
func mapDataSourceFields(userResp *postgresflexalpha.GetUserResponse, model *DataSourceModel, region string) error {
|
||||
func mapDataSourceFields(userResp *postgresflex.GetUserResponse, model *DataSourceModel, region string) error {
|
||||
if userResp == nil {
|
||||
return fmt.Errorf("response is nil")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import (
|
|||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha"
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/utils"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/pkg/postgresflexalpha"
|
||||
)
|
||||
|
||||
func TestMapDataSourceFields(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,11 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha/wait"
|
||||
postgresflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils"
|
||||
|
||||
postgresflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
|
|
@ -59,7 +62,7 @@ func NewUserResource() resource.Resource {
|
|||
|
||||
// userResource is the resource implementation.
|
||||
type userResource struct {
|
||||
client *postgresflexalpha.APIClient
|
||||
client *postgresflex.APIClient
|
||||
providerData core.ProviderData
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +113,7 @@ func (r *userResource) Configure(ctx context.Context, req resource.ConfigureRequ
|
|||
return
|
||||
}
|
||||
|
||||
apiClient := postgresflexalphaUtils.ConfigureClient(ctx, &r.providerData, &resp.Diagnostics)
|
||||
apiClient := postgresflexUtils.ConfigureClient(ctx, &r.providerData, &resp.Diagnostics)
|
||||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
|
|
@ -538,8 +541,8 @@ func (r *userResource) ImportState(
|
|||
}
|
||||
|
||||
func mapFieldsCreate(
|
||||
userResp *postgresflexalpha.CreateUserResponse,
|
||||
rolesArg *[]postgresflexalpha.UserRole,
|
||||
userResp *postgresflex.CreateUserResponse,
|
||||
rolesArg *[]postgresflex.UserRole,
|
||||
model *Model,
|
||||
region string,
|
||||
) error {
|
||||
|
|
@ -587,7 +590,7 @@ func mapFieldsCreate(
|
|||
return nil
|
||||
}
|
||||
|
||||
func mapFields(userResp *postgresflexalpha.GetUserResponse, model *Model, region string) error {
|
||||
func mapFields(userResp *postgresflex.GetUserResponse, model *Model, region string) error {
|
||||
if userResp == nil {
|
||||
return fmt.Errorf("response is nil")
|
||||
}
|
||||
|
|
@ -631,7 +634,7 @@ func mapFields(userResp *postgresflexalpha.GetUserResponse, model *Model, region
|
|||
return nil
|
||||
}
|
||||
|
||||
func toCreatePayload(model *Model, roles *[]string) (*postgresflexalpha.CreateUserRequestPayload, error) {
|
||||
func toCreatePayload(model *Model, roles *[]string) (*postgresflex.CreateUserRequestPayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
|
@ -639,22 +642,22 @@ func toCreatePayload(model *Model, roles *[]string) (*postgresflexalpha.CreateUs
|
|||
return nil, fmt.Errorf("nil roles")
|
||||
}
|
||||
|
||||
return &postgresflexalpha.CreateUserRequestPayload{
|
||||
return &postgresflex.CreateUserRequestPayload{
|
||||
Roles: toPayloadRoles(roles),
|
||||
Name: conversion.StringValueToPointer(model.Username),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func toPayloadRoles(roles *[]string) *[]postgresflexalpha.UserRole {
|
||||
var userRoles = make([]postgresflexalpha.UserRole, 0, len(*roles))
|
||||
func toPayloadRoles(roles *[]string) *[]postgresflex.UserRole {
|
||||
var userRoles = make([]postgresflex.UserRole, 0, len(*roles))
|
||||
for _, role := range *roles {
|
||||
userRoles = append(userRoles, postgresflexalpha.UserRole(role))
|
||||
userRoles = append(userRoles, postgresflex.UserRole(role))
|
||||
}
|
||||
return &userRoles
|
||||
}
|
||||
|
||||
func toUpdatePayload(model *Model, roles *[]string) (
|
||||
*postgresflexalpha.UpdateUserRequestPayload,
|
||||
*postgresflex.UpdateUserRequestPayload,
|
||||
error,
|
||||
) {
|
||||
if model == nil {
|
||||
|
|
@ -664,7 +667,7 @@ func toUpdatePayload(model *Model, roles *[]string) (
|
|||
return nil, fmt.Errorf("nil roles")
|
||||
}
|
||||
|
||||
return &postgresflexalpha.UpdateUserRequestPayload{
|
||||
return &postgresflex.UpdateUserRequestPayload{
|
||||
Roles: toPayloadRoles(roles),
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import (
|
|||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha"
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/utils"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/pkg/postgresflexalpha"
|
||||
)
|
||||
|
||||
func TestMapFieldsCreate(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue