Update SDK dependencies (#100)
* Update dependencies * Fix tests * Fix field assignment * Update field assignment * Remove unused functions --------- Co-authored-by: Henrique Santos <henrique.santos@freiheit.com>
This commit is contained in:
parent
9937717104
commit
c3618f2b63
35 changed files with 249 additions and 224 deletions
|
|
@ -9,22 +9,6 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
||||
)
|
||||
|
||||
func ToPtrInt32(source types.Int64) *int32 {
|
||||
if source.IsNull() || source.IsUnknown() {
|
||||
return nil
|
||||
}
|
||||
ttlInt64 := source.ValueInt64()
|
||||
ttlInt32 := int32(ttlInt64)
|
||||
return &ttlInt32
|
||||
}
|
||||
|
||||
func ToTypeInt64(i *int32) types.Int64 {
|
||||
if i == nil {
|
||||
return types.Int64PointerValue(nil)
|
||||
}
|
||||
return types.Int64Value(int64(*i))
|
||||
}
|
||||
|
||||
func ToString(ctx context.Context, v attr.Value) (string, error) {
|
||||
if t := v.Type(ctx); t != types.StringType {
|
||||
return "", fmt.Errorf("type mismatch. expected 'types.StringType' but got '%s'", t.String())
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||
"github.com/stackitcloud/stackit-sdk-go/services/dns"
|
||||
"github.com/stackitcloud/stackit-sdk-go/services/dns/wait"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
)
|
||||
|
|
@ -452,7 +451,7 @@ func mapFields(recordSetResp *dns.RecordSetResponse, model *Model) error {
|
|||
model.Error = types.StringPointerValue(recordSet.Error)
|
||||
model.Name = types.StringPointerValue(recordSet.Name)
|
||||
model.State = types.StringPointerValue(recordSet.State)
|
||||
model.TTL = conversion.ToTypeInt64(recordSet.Ttl)
|
||||
model.TTL = types.Int64PointerValue(recordSet.Ttl)
|
||||
model.Type = types.StringPointerValue(recordSet.Type)
|
||||
return nil
|
||||
}
|
||||
|
|
@ -477,7 +476,7 @@ func toCreatePayload(model *Model) (*dns.CreateRecordSetPayload, error) {
|
|||
Comment: model.Comment.ValueStringPointer(),
|
||||
Name: model.Name.ValueStringPointer(),
|
||||
Records: &records,
|
||||
Ttl: conversion.ToPtrInt32(model.TTL),
|
||||
Ttl: model.TTL.ValueInt64Pointer(),
|
||||
Type: model.Type.ValueStringPointer(),
|
||||
}, nil
|
||||
}
|
||||
|
|
@ -502,6 +501,6 @@ func toUpdatePayload(model *Model) (*dns.UpdateRecordSetPayload, error) {
|
|||
Comment: model.Comment.ValueStringPointer(),
|
||||
Name: model.Name.ValueStringPointer(),
|
||||
Records: &records,
|
||||
Ttl: conversion.ToPtrInt32(model.TTL),
|
||||
Ttl: model.TTL.ValueInt64Pointer(),
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ func TestMapFields(t *testing.T) {
|
|||
{Content: utils.Ptr("record_2")},
|
||||
},
|
||||
State: utils.Ptr("state"),
|
||||
Ttl: utils.Ptr(int32(1)),
|
||||
Ttl: utils.Ptr(int64(1)),
|
||||
Type: utils.Ptr("type"),
|
||||
},
|
||||
},
|
||||
|
|
@ -88,7 +88,7 @@ func TestMapFields(t *testing.T) {
|
|||
Name: utils.Ptr("name"),
|
||||
Records: nil,
|
||||
State: utils.Ptr("state"),
|
||||
Ttl: utils.Ptr(int32(2123456789)),
|
||||
Ttl: utils.Ptr(int64(2123456789)),
|
||||
Type: utils.Ptr("type"),
|
||||
},
|
||||
},
|
||||
|
|
@ -178,7 +178,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
{Content: utils.Ptr("record_1")},
|
||||
{Content: utils.Ptr("record_2")},
|
||||
},
|
||||
Ttl: utils.Ptr(int32(1)),
|
||||
Ttl: utils.Ptr(int64(1)),
|
||||
Type: utils.Ptr("type"),
|
||||
},
|
||||
true,
|
||||
|
|
@ -196,7 +196,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
Comment: nil,
|
||||
Name: utils.Ptr(""),
|
||||
Records: &[]dns.RecordPayload{},
|
||||
Ttl: utils.Ptr(int32(2123456789)),
|
||||
Ttl: utils.Ptr(int64(2123456789)),
|
||||
Type: utils.Ptr(""),
|
||||
},
|
||||
true,
|
||||
|
|
@ -260,7 +260,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
{Content: utils.Ptr("record_1")},
|
||||
{Content: utils.Ptr("record_2")},
|
||||
},
|
||||
Ttl: utils.Ptr(int32(1)),
|
||||
Ttl: utils.Ptr(int64(1)),
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
@ -276,7 +276,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
Comment: nil,
|
||||
Name: utils.Ptr(""),
|
||||
Records: &[]dns.RecordPayload{},
|
||||
Ttl: utils.Ptr(int32(2123456789)),
|
||||
Ttl: utils.Ptr(int64(2123456789)),
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import (
|
|||
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||
"github.com/stackitcloud/stackit-sdk-go/services/dns"
|
||||
"github.com/stackitcloud/stackit-sdk-go/services/dns/wait"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
)
|
||||
|
|
@ -543,17 +542,17 @@ func mapFields(zoneResp *dns.ZoneResponse, model *Model) error {
|
|||
model.Acl = types.StringPointerValue(z.Acl)
|
||||
model.Active = types.BoolPointerValue(z.Active)
|
||||
model.ContactEmail = types.StringPointerValue(z.ContactEmail)
|
||||
model.DefaultTTL = conversion.ToTypeInt64(z.DefaultTTL)
|
||||
model.DefaultTTL = types.Int64PointerValue(z.DefaultTTL)
|
||||
model.DnsName = types.StringPointerValue(z.DnsName)
|
||||
model.ExpireTime = conversion.ToTypeInt64(z.ExpireTime)
|
||||
model.ExpireTime = types.Int64PointerValue(z.ExpireTime)
|
||||
model.IsReverseZone = types.BoolPointerValue(z.IsReverseZone)
|
||||
model.Name = types.StringPointerValue(z.Name)
|
||||
model.NegativeCache = conversion.ToTypeInt64(z.NegativeCache)
|
||||
model.NegativeCache = types.Int64PointerValue(z.NegativeCache)
|
||||
model.PrimaryNameServer = types.StringPointerValue(z.PrimaryNameServer)
|
||||
model.RecordCount = types.Int64PointerValue(rc)
|
||||
model.RefreshTime = conversion.ToTypeInt64(z.RefreshTime)
|
||||
model.RetryTime = conversion.ToTypeInt64(z.RetryTime)
|
||||
model.SerialNumber = conversion.ToTypeInt64(z.SerialNumber)
|
||||
model.RefreshTime = types.Int64PointerValue(z.RefreshTime)
|
||||
model.RetryTime = types.Int64PointerValue(z.RetryTime)
|
||||
model.SerialNumber = types.Int64PointerValue(z.SerialNumber)
|
||||
model.State = types.StringPointerValue(z.State)
|
||||
model.Type = types.StringPointerValue(z.Type)
|
||||
model.Visibility = types.StringPointerValue(z.Visibility)
|
||||
|
|
@ -580,11 +579,11 @@ func toCreatePayload(model *Model) (*dns.CreateZonePayload, error) {
|
|||
Description: model.Description.ValueStringPointer(),
|
||||
Acl: model.Acl.ValueStringPointer(),
|
||||
Type: model.Type.ValueStringPointer(),
|
||||
DefaultTTL: conversion.ToPtrInt32(model.DefaultTTL),
|
||||
ExpireTime: conversion.ToPtrInt32(model.ExpireTime),
|
||||
RefreshTime: conversion.ToPtrInt32(model.RefreshTime),
|
||||
RetryTime: conversion.ToPtrInt32(model.RetryTime),
|
||||
NegativeCache: conversion.ToPtrInt32(model.NegativeCache),
|
||||
DefaultTTL: model.DefaultTTL.ValueInt64Pointer(),
|
||||
ExpireTime: model.ExpireTime.ValueInt64Pointer(),
|
||||
RefreshTime: model.RefreshTime.ValueInt64Pointer(),
|
||||
RetryTime: model.RetryTime.ValueInt64Pointer(),
|
||||
NegativeCache: model.NegativeCache.ValueInt64Pointer(),
|
||||
IsReverseZone: model.IsReverseZone.ValueBoolPointer(),
|
||||
Primaries: &modelPrimaries,
|
||||
}, nil
|
||||
|
|
@ -600,11 +599,11 @@ func toUpdatePayload(model *Model) (*dns.UpdateZonePayload, error) {
|
|||
ContactEmail: model.ContactEmail.ValueStringPointer(),
|
||||
Description: model.Description.ValueStringPointer(),
|
||||
Acl: model.Acl.ValueStringPointer(),
|
||||
DefaultTTL: conversion.ToPtrInt32(model.DefaultTTL),
|
||||
ExpireTime: conversion.ToPtrInt32(model.ExpireTime),
|
||||
RefreshTime: conversion.ToPtrInt32(model.RefreshTime),
|
||||
RetryTime: conversion.ToPtrInt32(model.RetryTime),
|
||||
NegativeCache: conversion.ToPtrInt32(model.NegativeCache),
|
||||
DefaultTTL: model.DefaultTTL.ValueInt64Pointer(),
|
||||
ExpireTime: model.ExpireTime.ValueInt64Pointer(),
|
||||
RefreshTime: model.RefreshTime.ValueInt64Pointer(),
|
||||
RetryTime: model.RetryTime.ValueInt64Pointer(),
|
||||
NegativeCache: model.NegativeCache.ValueInt64Pointer(),
|
||||
Primaries: nil, // API returns error if this field is set, even if nothing changes
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ func TestMapFields(t *testing.T) {
|
|||
Active: utils.Ptr(false),
|
||||
CreationStarted: utils.Ptr("bar"),
|
||||
CreationFinished: utils.Ptr("foo"),
|
||||
DefaultTTL: utils.Ptr(int32(1)),
|
||||
ExpireTime: utils.Ptr(int32(2)),
|
||||
RefreshTime: utils.Ptr(int32(3)),
|
||||
RetryTime: utils.Ptr(int32(4)),
|
||||
SerialNumber: utils.Ptr(int32(5)),
|
||||
NegativeCache: utils.Ptr(int32(6)),
|
||||
DefaultTTL: utils.Ptr(int64(1)),
|
||||
ExpireTime: utils.Ptr(int64(2)),
|
||||
RefreshTime: utils.Ptr(int64(3)),
|
||||
RetryTime: utils.Ptr(int64(4)),
|
||||
SerialNumber: utils.Ptr(int64(5)),
|
||||
NegativeCache: utils.Ptr(int64(6)),
|
||||
State: utils.Ptr("state"),
|
||||
Type: utils.Ptr("type"),
|
||||
Primaries: &[]string{"primary"},
|
||||
|
|
@ -73,7 +73,7 @@ func TestMapFields(t *testing.T) {
|
|||
ContactEmail: utils.Ptr("a@b.cd"),
|
||||
Description: utils.Ptr("description"),
|
||||
IsReverseZone: utils.Ptr(false),
|
||||
RecordCount: utils.Ptr(int32(3)),
|
||||
RecordCount: utils.Ptr(int64(3)),
|
||||
},
|
||||
},
|
||||
Model{
|
||||
|
|
@ -115,12 +115,12 @@ func TestMapFields(t *testing.T) {
|
|||
Active: nil,
|
||||
CreationStarted: utils.Ptr("bar"),
|
||||
CreationFinished: utils.Ptr("foo"),
|
||||
DefaultTTL: utils.Ptr(int32(2123456789)),
|
||||
ExpireTime: utils.Ptr(int32(-2)),
|
||||
RefreshTime: utils.Ptr(int32(3)),
|
||||
RetryTime: utils.Ptr(int32(4)),
|
||||
SerialNumber: utils.Ptr(int32(5)),
|
||||
NegativeCache: utils.Ptr(int32(0)),
|
||||
DefaultTTL: utils.Ptr(int64(2123456789)),
|
||||
ExpireTime: utils.Ptr(int64(-2)),
|
||||
RefreshTime: utils.Ptr(int64(3)),
|
||||
RetryTime: utils.Ptr(int64(4)),
|
||||
SerialNumber: utils.Ptr(int64(5)),
|
||||
NegativeCache: utils.Ptr(int64(0)),
|
||||
State: utils.Ptr("state"),
|
||||
Type: utils.Ptr("type"),
|
||||
Primaries: nil,
|
||||
|
|
@ -131,7 +131,7 @@ func TestMapFields(t *testing.T) {
|
|||
ContactEmail: nil,
|
||||
Description: nil,
|
||||
IsReverseZone: nil,
|
||||
RecordCount: utils.Ptr(int32(-2123456789)),
|
||||
RecordCount: utils.Ptr(int64(-2123456789)),
|
||||
},
|
||||
},
|
||||
Model{
|
||||
|
|
@ -242,11 +242,11 @@ func TestToCreatePayload(t *testing.T) {
|
|||
Type: utils.Ptr("Type"),
|
||||
ContactEmail: utils.Ptr("ContactEmail"),
|
||||
Primaries: &[]string{"primary"},
|
||||
RetryTime: utils.Ptr(int32(3)),
|
||||
RefreshTime: utils.Ptr(int32(4)),
|
||||
ExpireTime: utils.Ptr(int32(5)),
|
||||
DefaultTTL: utils.Ptr(int32(4534534)),
|
||||
NegativeCache: utils.Ptr(int32(-4534534)),
|
||||
RetryTime: utils.Ptr(int64(3)),
|
||||
RefreshTime: utils.Ptr(int64(4)),
|
||||
ExpireTime: utils.Ptr(int64(5)),
|
||||
DefaultTTL: utils.Ptr(int64(4534534)),
|
||||
NegativeCache: utils.Ptr(int64(-4534534)),
|
||||
IsReverseZone: utils.Ptr(true),
|
||||
},
|
||||
true,
|
||||
|
|
@ -320,11 +320,11 @@ func TestToPayloadUpdate(t *testing.T) {
|
|||
Acl: utils.Ptr("Acl"),
|
||||
Description: utils.Ptr("Description"),
|
||||
ContactEmail: utils.Ptr("ContactEmail"),
|
||||
RetryTime: utils.Ptr(int32(3)),
|
||||
RefreshTime: utils.Ptr(int32(4)),
|
||||
ExpireTime: utils.Ptr(int32(5)),
|
||||
DefaultTTL: utils.Ptr(int32(4534534)),
|
||||
NegativeCache: utils.Ptr(int32(-4534534)),
|
||||
RetryTime: utils.Ptr(int64(3)),
|
||||
RefreshTime: utils.Ptr(int64(4)),
|
||||
ExpireTime: utils.Ptr(int64(5)),
|
||||
DefaultTTL: utils.Ptr(int64(4534534)),
|
||||
NegativeCache: utils.Ptr(int64(-4534534)),
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -370,7 +369,7 @@ func mapFields(credentialsResp *logme.CredentialsResponse, model *Model) error {
|
|||
model.HttpAPIURI = types.StringPointerValue(credentials.HttpApiUri)
|
||||
model.Name = types.StringPointerValue(credentials.Name)
|
||||
model.Password = types.StringPointerValue(credentials.Password)
|
||||
model.Port = conversion.ToTypeInt64(credentials.Port)
|
||||
model.Port = types.Int64PointerValue(credentials.Port)
|
||||
model.Uri = types.StringPointerValue(credentials.Uri)
|
||||
model.Username = types.StringPointerValue(credentials.Username)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: utils.Ptr("http"),
|
||||
Name: utils.Ptr("name"),
|
||||
Password: utils.Ptr("password"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
Uri: utils.Ptr("uri"),
|
||||
Username: utils.Ptr("username"),
|
||||
},
|
||||
|
|
@ -89,7 +89,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: nil,
|
||||
Name: nil,
|
||||
Password: utils.Ptr(""),
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
Uri: nil,
|
||||
Username: utils.Ptr(""),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -370,7 +369,7 @@ func mapFields(credentialsResp *mariadb.CredentialsResponse, model *Model) error
|
|||
model.HttpAPIURI = types.StringPointerValue(credentials.HttpApiUri)
|
||||
model.Name = types.StringPointerValue(credentials.Name)
|
||||
model.Password = types.StringPointerValue(credentials.Password)
|
||||
model.Port = conversion.ToTypeInt64(credentials.Port)
|
||||
model.Port = types.Int64PointerValue(credentials.Port)
|
||||
model.Uri = types.StringPointerValue(credentials.Uri)
|
||||
model.Username = types.StringPointerValue(credentials.Username)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: utils.Ptr("http"),
|
||||
Name: utils.Ptr("name"),
|
||||
Password: utils.Ptr("password"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
Uri: utils.Ptr("uri"),
|
||||
Username: utils.Ptr("username"),
|
||||
},
|
||||
|
|
@ -89,7 +89,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: nil,
|
||||
Name: nil,
|
||||
Password: utils.Ptr(""),
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
Uri: nil,
|
||||
Username: utils.Ptr(""),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -591,8 +590,8 @@ func mapFields(resp *mongodbflex.GetInstanceResponse, model *Model, flavor *flav
|
|||
flavorValues = map[string]attr.Value{
|
||||
"id": types.StringValue(*instance.Flavor.Id),
|
||||
"description": types.StringValue(*instance.Flavor.Description),
|
||||
"cpu": conversion.ToTypeInt64(instance.Flavor.Cpu),
|
||||
"ram": conversion.ToTypeInt64(instance.Flavor.Memory),
|
||||
"cpu": types.Int64PointerValue(instance.Flavor.Cpu),
|
||||
"ram": types.Int64PointerValue(instance.Flavor.Memory),
|
||||
}
|
||||
}
|
||||
flavorObject, diags := types.ObjectValue(flavorTypes, flavorValues)
|
||||
|
|
@ -609,7 +608,7 @@ func mapFields(resp *mongodbflex.GetInstanceResponse, model *Model, flavor *flav
|
|||
} else {
|
||||
storageValues = map[string]attr.Value{
|
||||
"class": types.StringValue(*instance.Storage.Class),
|
||||
"size": conversion.ToTypeInt64(instance.Storage.Size),
|
||||
"size": types.Int64PointerValue(instance.Storage.Size),
|
||||
}
|
||||
}
|
||||
storageObject, diags := types.ObjectValue(storageTypes, storageValues)
|
||||
|
|
@ -650,7 +649,7 @@ func mapFields(resp *mongodbflex.GetInstanceResponse, model *Model, flavor *flav
|
|||
model.Name = types.StringPointerValue(instance.Name)
|
||||
model.ACL = aclList
|
||||
model.Flavor = flavorObject
|
||||
model.Replicas = conversion.ToTypeInt64(instance.Replicas)
|
||||
model.Replicas = types.Int64PointerValue(instance.Replicas)
|
||||
model.Storage = storageObject
|
||||
model.Version = types.StringPointerValue(instance.Version)
|
||||
model.Options = optionsObject
|
||||
|
|
@ -686,10 +685,10 @@ func toCreatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
BackupSchedule: model.BackupSchedule.ValueStringPointer(),
|
||||
FlavorId: flavor.Id.ValueStringPointer(),
|
||||
Name: model.Name.ValueStringPointer(),
|
||||
Replicas: conversion.ToPtrInt32(model.Replicas),
|
||||
Replicas: model.Replicas.ValueInt64Pointer(),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Class: storage.Class.ValueStringPointer(),
|
||||
Size: conversion.ToPtrInt32(storage.Size),
|
||||
Size: storage.Size.ValueInt64Pointer(),
|
||||
},
|
||||
Version: model.Version.ValueStringPointer(),
|
||||
Options: &payloadOptions,
|
||||
|
|
@ -725,10 +724,10 @@ func toUpdatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
BackupSchedule: model.BackupSchedule.ValueStringPointer(),
|
||||
FlavorId: flavor.Id.ValueStringPointer(),
|
||||
Name: model.Name.ValueStringPointer(),
|
||||
Replicas: conversion.ToPtrInt32(model.Replicas),
|
||||
Replicas: model.Replicas.ValueInt64Pointer(),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Class: storage.Class.ValueStringPointer(),
|
||||
Size: conversion.ToPtrInt32(storage.Size),
|
||||
Size: storage.Size.ValueInt64Pointer(),
|
||||
},
|
||||
Version: model.Version.ValueStringPointer(),
|
||||
Options: &payloadOptions,
|
||||
|
|
@ -746,11 +745,11 @@ func loadFlavorId(ctx context.Context, client mongoDBFlexClient, model *Model, f
|
|||
if flavor == nil {
|
||||
return fmt.Errorf("nil flavor")
|
||||
}
|
||||
cpu := conversion.ToPtrInt32(flavor.CPU)
|
||||
cpu := flavor.CPU.ValueInt64Pointer()
|
||||
if cpu == nil {
|
||||
return fmt.Errorf("nil CPU")
|
||||
}
|
||||
ram := conversion.ToPtrInt32(flavor.RAM)
|
||||
ram := flavor.RAM.ValueInt64Pointer()
|
||||
if ram == nil {
|
||||
return fmt.Errorf("nil RAM")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,18 +81,18 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
BackupSchedule: utils.Ptr("schedule"),
|
||||
Flavor: &mongodbflex.InstanceFlavor{
|
||||
Cpu: utils.Ptr(int32(12)),
|
||||
Cpu: utils.Ptr(int64(12)),
|
||||
Description: utils.Ptr("description"),
|
||||
Id: utils.Ptr("flavor_id"),
|
||||
Memory: utils.Ptr(int32(34)),
|
||||
Memory: utils.Ptr(int64(34)),
|
||||
},
|
||||
Id: utils.Ptr("iid"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int32(56)),
|
||||
Replicas: utils.Ptr(int64(56)),
|
||||
Status: utils.Ptr("status"),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int32(78)),
|
||||
Size: utils.Ptr(int64(78)),
|
||||
},
|
||||
Options: &map[string]string{
|
||||
"type": "type",
|
||||
|
|
@ -147,7 +147,7 @@ func TestMapFields(t *testing.T) {
|
|||
Flavor: nil,
|
||||
Id: utils.Ptr("iid"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int32(56)),
|
||||
Replicas: utils.Ptr(int64(56)),
|
||||
Status: utils.Ptr("status"),
|
||||
Storage: nil,
|
||||
Options: &map[string]string{
|
||||
|
|
@ -297,10 +297,10 @@ func TestToCreatePayload(t *testing.T) {
|
|||
BackupSchedule: utils.Ptr("schedule"),
|
||||
FlavorId: utils.Ptr("flavor_id"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int32(12)),
|
||||
Replicas: utils.Ptr(int64(12)),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int32(34)),
|
||||
Size: utils.Ptr(int64(34)),
|
||||
},
|
||||
Options: &map[string]string{"type": "type"},
|
||||
Version: utils.Ptr("version"),
|
||||
|
|
@ -337,7 +337,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
BackupSchedule: nil,
|
||||
FlavorId: nil,
|
||||
Name: nil,
|
||||
Replicas: utils.Ptr(int32(2123456789)),
|
||||
Replicas: utils.Ptr(int64(2123456789)),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Class: nil,
|
||||
Size: nil,
|
||||
|
|
@ -476,10 +476,10 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
BackupSchedule: utils.Ptr("schedule"),
|
||||
FlavorId: utils.Ptr("flavor_id"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int32(12)),
|
||||
Replicas: utils.Ptr(int64(12)),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int32(34)),
|
||||
Size: utils.Ptr(int64(34)),
|
||||
},
|
||||
Options: &map[string]string{"type": "type"},
|
||||
Version: utils.Ptr("version"),
|
||||
|
|
@ -516,7 +516,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
BackupSchedule: nil,
|
||||
FlavorId: nil,
|
||||
Name: nil,
|
||||
Replicas: utils.Ptr(int32(2123456789)),
|
||||
Replicas: utils.Ptr(int64(2123456789)),
|
||||
Storage: &mongodbflex.InstanceStorage{
|
||||
Class: nil,
|
||||
Size: nil,
|
||||
|
|
@ -615,9 +615,9 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
Flavors: &[]mongodbflex.HandlersInfraFlavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
Cpu: utils.Ptr(int32(2)),
|
||||
Cpu: utils.Ptr(int64(2)),
|
||||
Description: utils.Ptr("description"),
|
||||
Memory: utils.Ptr(int32(8)),
|
||||
Memory: utils.Ptr(int64(8)),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -640,15 +640,15 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
Flavors: &[]mongodbflex.HandlersInfraFlavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
Cpu: utils.Ptr(int32(2)),
|
||||
Cpu: utils.Ptr(int64(2)),
|
||||
Description: utils.Ptr("description"),
|
||||
Memory: utils.Ptr(int32(8)),
|
||||
Memory: utils.Ptr(int64(8)),
|
||||
},
|
||||
{
|
||||
Id: utils.Ptr("fid-2"),
|
||||
Cpu: utils.Ptr(int32(1)),
|
||||
Cpu: utils.Ptr(int64(1)),
|
||||
Description: utils.Ptr("description"),
|
||||
Memory: utils.Ptr(int32(4)),
|
||||
Memory: utils.Ptr(int64(4)),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -671,15 +671,15 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
Flavors: &[]mongodbflex.HandlersInfraFlavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
Cpu: utils.Ptr(int32(1)),
|
||||
Cpu: utils.Ptr(int64(1)),
|
||||
Description: utils.Ptr("description"),
|
||||
Memory: utils.Ptr(int32(8)),
|
||||
Memory: utils.Ptr(int64(8)),
|
||||
},
|
||||
{
|
||||
Id: utils.Ptr("fid-2"),
|
||||
Cpu: utils.Ptr(int32(1)),
|
||||
Cpu: utils.Ptr(int64(1)),
|
||||
Description: utils.Ptr("description"),
|
||||
Memory: utils.Ptr(int32(4)),
|
||||
Memory: utils.Ptr(int64(4)),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -227,6 +226,6 @@ func mapDataSourceFields(userResp *mongodbflex.GetUserResponse, model *DataSourc
|
|||
model.Roles = rolesSet
|
||||
}
|
||||
model.Host = types.StringPointerValue(user.Host)
|
||||
model.Port = conversion.ToTypeInt64(user.Port)
|
||||
model.Port = types.Int64PointerValue(user.Port)
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ func TestMapDataSourceFields(t *testing.T) {
|
|||
Username: utils.Ptr("username"),
|
||||
Database: utils.Ptr("database"),
|
||||
Host: utils.Ptr("host"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
},
|
||||
},
|
||||
DataSourceModel{
|
||||
|
|
@ -76,7 +76,7 @@ func TestMapDataSourceFields(t *testing.T) {
|
|||
Username: nil,
|
||||
Database: nil,
|
||||
Host: nil,
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
},
|
||||
},
|
||||
DataSourceModel{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -378,7 +377,7 @@ func mapFieldsCreate(userResp *mongodbflex.CreateUserResponse, model *Model) err
|
|||
model.Roles = rolesSet
|
||||
}
|
||||
model.Host = types.StringPointerValue(user.Host)
|
||||
model.Port = conversion.ToTypeInt64(user.Port)
|
||||
model.Port = types.Int64PointerValue(user.Port)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -425,7 +424,7 @@ func mapFields(userResp *mongodbflex.GetUserResponse, model *Model) error {
|
|||
model.Roles = rolesSet
|
||||
}
|
||||
model.Host = types.StringPointerValue(user.Host)
|
||||
model.Port = conversion.ToTypeInt64(user.Port)
|
||||
model.Port = types.Int64PointerValue(user.Port)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
Database: utils.Ptr("database"),
|
||||
Password: utils.Ptr("password"),
|
||||
Host: utils.Ptr("host"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
},
|
||||
},
|
||||
Model{
|
||||
|
|
@ -84,7 +84,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
Database: nil,
|
||||
Password: utils.Ptr(""),
|
||||
Host: nil,
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
},
|
||||
},
|
||||
Model{
|
||||
|
|
@ -192,7 +192,7 @@ func TestMapFields(t *testing.T) {
|
|||
Username: utils.Ptr("username"),
|
||||
Database: utils.Ptr("database"),
|
||||
Host: utils.Ptr("host"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
},
|
||||
},
|
||||
Model{
|
||||
|
|
@ -221,7 +221,7 @@ func TestMapFields(t *testing.T) {
|
|||
Username: nil,
|
||||
Database: nil,
|
||||
Host: nil,
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
},
|
||||
},
|
||||
Model{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -370,7 +369,7 @@ func mapFields(credentialsResp *opensearch.CredentialsResponse, model *Model) er
|
|||
model.HttpAPIURI = types.StringPointerValue(credentials.HttpApiUri)
|
||||
model.Name = types.StringPointerValue(credentials.Name)
|
||||
model.Password = types.StringPointerValue(credentials.Password)
|
||||
model.Port = conversion.ToTypeInt64(credentials.Port)
|
||||
model.Port = types.Int64PointerValue(credentials.Port)
|
||||
model.Uri = types.StringPointerValue(credentials.Uri)
|
||||
model.Username = types.StringPointerValue(credentials.Username)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: utils.Ptr("http"),
|
||||
Name: utils.Ptr("name"),
|
||||
Password: utils.Ptr("password"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
Uri: utils.Ptr("uri"),
|
||||
Username: utils.Ptr("username"),
|
||||
},
|
||||
|
|
@ -89,7 +89,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: nil,
|
||||
Name: nil,
|
||||
Password: utils.Ptr(""),
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
Uri: nil,
|
||||
Username: utils.Ptr(""),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -542,8 +541,8 @@ func mapFields(resp *postgresflex.InstanceResponse, model *Model, flavor *flavor
|
|||
flavorValues = map[string]attr.Value{
|
||||
"id": types.StringValue(*instance.Flavor.Id),
|
||||
"description": types.StringValue(*instance.Flavor.Description),
|
||||
"cpu": conversion.ToTypeInt64(instance.Flavor.Cpu),
|
||||
"ram": conversion.ToTypeInt64(instance.Flavor.Memory),
|
||||
"cpu": types.Int64PointerValue(instance.Flavor.Cpu),
|
||||
"ram": types.Int64PointerValue(instance.Flavor.Memory),
|
||||
}
|
||||
}
|
||||
flavorObject, diags := types.ObjectValue(flavorTypes, flavorValues)
|
||||
|
|
@ -560,7 +559,7 @@ func mapFields(resp *postgresflex.InstanceResponse, model *Model, flavor *flavor
|
|||
} else {
|
||||
storageValues = map[string]attr.Value{
|
||||
"class": types.StringValue(*instance.Storage.Class),
|
||||
"size": conversion.ToTypeInt64(instance.Storage.Size),
|
||||
"size": types.Int64PointerValue(instance.Storage.Size),
|
||||
}
|
||||
}
|
||||
storageObject, diags := types.ObjectValue(storageTypes, storageValues)
|
||||
|
|
@ -580,7 +579,7 @@ func mapFields(resp *postgresflex.InstanceResponse, model *Model, flavor *flavor
|
|||
model.ACL = aclList
|
||||
model.BackupSchedule = types.StringPointerValue(instance.BackupSchedule)
|
||||
model.Flavor = flavorObject
|
||||
model.Replicas = conversion.ToTypeInt64(instance.Replicas)
|
||||
model.Replicas = types.Int64PointerValue(instance.Replicas)
|
||||
model.Storage = storageObject
|
||||
model.Version = types.StringPointerValue(instance.Version)
|
||||
return nil
|
||||
|
|
@ -607,10 +606,10 @@ func toCreatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
BackupSchedule: model.BackupSchedule.ValueStringPointer(),
|
||||
FlavorId: flavor.Id.ValueStringPointer(),
|
||||
Name: model.Name.ValueStringPointer(),
|
||||
Replicas: conversion.ToPtrInt32(model.Replicas),
|
||||
Replicas: model.Replicas.ValueInt64Pointer(),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Class: storage.Class.ValueStringPointer(),
|
||||
Size: conversion.ToPtrInt32(storage.Size),
|
||||
Size: storage.Size.ValueInt64Pointer(),
|
||||
},
|
||||
Version: model.Version.ValueStringPointer(),
|
||||
}, nil
|
||||
|
|
@ -637,10 +636,10 @@ func toUpdatePayload(model *Model, acl []string, flavor *flavorModel, storage *s
|
|||
BackupSchedule: model.BackupSchedule.ValueStringPointer(),
|
||||
FlavorId: flavor.Id.ValueStringPointer(),
|
||||
Name: model.Name.ValueStringPointer(),
|
||||
Replicas: conversion.ToPtrInt32(model.Replicas),
|
||||
Replicas: model.Replicas.ValueInt64Pointer(),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Class: storage.Class.ValueStringPointer(),
|
||||
Size: conversion.ToPtrInt32(storage.Size),
|
||||
Size: storage.Size.ValueInt64Pointer(),
|
||||
},
|
||||
Version: model.Version.ValueStringPointer(),
|
||||
}, nil
|
||||
|
|
@ -657,11 +656,11 @@ func loadFlavorId(ctx context.Context, client postgresFlexClient, model *Model,
|
|||
if flavor == nil {
|
||||
return fmt.Errorf("nil flavor")
|
||||
}
|
||||
cpu := conversion.ToPtrInt32(flavor.CPU)
|
||||
cpu := flavor.CPU.ValueInt64Pointer()
|
||||
if cpu == nil {
|
||||
return fmt.Errorf("nil CPU")
|
||||
}
|
||||
ram := conversion.ToPtrInt32(flavor.RAM)
|
||||
ram := flavor.RAM.ValueInt64Pointer()
|
||||
if ram == nil {
|
||||
return fmt.Errorf("nil RAM")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,18 +76,18 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
BackupSchedule: utils.Ptr("schedule"),
|
||||
Flavor: &postgresflex.InstanceFlavor{
|
||||
Cpu: utils.Ptr(int32(12)),
|
||||
Cpu: utils.Ptr(int64(12)),
|
||||
Description: utils.Ptr("description"),
|
||||
Id: utils.Ptr("flavor_id"),
|
||||
Memory: utils.Ptr(int32(34)),
|
||||
Memory: utils.Ptr(int64(34)),
|
||||
},
|
||||
Id: utils.Ptr("iid"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int32(56)),
|
||||
Replicas: utils.Ptr(int64(56)),
|
||||
Status: utils.Ptr("status"),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int32(78)),
|
||||
Size: utils.Ptr(int64(78)),
|
||||
},
|
||||
Version: utils.Ptr("version"),
|
||||
},
|
||||
|
|
@ -135,7 +135,7 @@ func TestMapFields(t *testing.T) {
|
|||
Flavor: nil,
|
||||
Id: utils.Ptr("iid"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int32(56)),
|
||||
Replicas: utils.Ptr(int64(56)),
|
||||
Status: utils.Ptr("status"),
|
||||
Storage: nil,
|
||||
Version: utils.Ptr("version"),
|
||||
|
|
@ -268,10 +268,10 @@ func TestToCreatePayload(t *testing.T) {
|
|||
BackupSchedule: utils.Ptr("schedule"),
|
||||
FlavorId: utils.Ptr("flavor_id"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int32(12)),
|
||||
Replicas: utils.Ptr(int64(12)),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int32(34)),
|
||||
Size: utils.Ptr(int64(34)),
|
||||
},
|
||||
Version: utils.Ptr("version"),
|
||||
},
|
||||
|
|
@ -304,7 +304,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
BackupSchedule: nil,
|
||||
FlavorId: nil,
|
||||
Name: nil,
|
||||
Replicas: utils.Ptr(int32(2123456789)),
|
||||
Replicas: utils.Ptr(int64(2123456789)),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Class: nil,
|
||||
Size: nil,
|
||||
|
|
@ -422,10 +422,10 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
BackupSchedule: utils.Ptr("schedule"),
|
||||
FlavorId: utils.Ptr("flavor_id"),
|
||||
Name: utils.Ptr("name"),
|
||||
Replicas: utils.Ptr(int32(12)),
|
||||
Replicas: utils.Ptr(int64(12)),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Class: utils.Ptr("class"),
|
||||
Size: utils.Ptr(int32(34)),
|
||||
Size: utils.Ptr(int64(34)),
|
||||
},
|
||||
Version: utils.Ptr("version"),
|
||||
},
|
||||
|
|
@ -458,7 +458,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
BackupSchedule: nil,
|
||||
FlavorId: nil,
|
||||
Name: nil,
|
||||
Replicas: utils.Ptr(int32(2123456789)),
|
||||
Replicas: utils.Ptr(int64(2123456789)),
|
||||
Storage: &postgresflex.InstanceStorage{
|
||||
Class: nil,
|
||||
Size: nil,
|
||||
|
|
@ -542,9 +542,9 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
Flavors: &[]postgresflex.InstanceFlavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
Cpu: utils.Ptr(int32(2)),
|
||||
Cpu: utils.Ptr(int64(2)),
|
||||
Description: utils.Ptr("description"),
|
||||
Memory: utils.Ptr(int32(8)),
|
||||
Memory: utils.Ptr(int64(8)),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -567,15 +567,15 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
Flavors: &[]postgresflex.InstanceFlavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
Cpu: utils.Ptr(int32(2)),
|
||||
Cpu: utils.Ptr(int64(2)),
|
||||
Description: utils.Ptr("description"),
|
||||
Memory: utils.Ptr(int32(8)),
|
||||
Memory: utils.Ptr(int64(8)),
|
||||
},
|
||||
{
|
||||
Id: utils.Ptr("fid-2"),
|
||||
Cpu: utils.Ptr(int32(1)),
|
||||
Cpu: utils.Ptr(int64(1)),
|
||||
Description: utils.Ptr("description"),
|
||||
Memory: utils.Ptr(int32(4)),
|
||||
Memory: utils.Ptr(int64(4)),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -598,15 +598,15 @@ func TestLoadFlavorId(t *testing.T) {
|
|||
Flavors: &[]postgresflex.InstanceFlavor{
|
||||
{
|
||||
Id: utils.Ptr("fid-1"),
|
||||
Cpu: utils.Ptr(int32(1)),
|
||||
Cpu: utils.Ptr(int64(1)),
|
||||
Description: utils.Ptr("description"),
|
||||
Memory: utils.Ptr(int32(8)),
|
||||
Memory: utils.Ptr(int64(8)),
|
||||
},
|
||||
{
|
||||
Id: utils.Ptr("fid-2"),
|
||||
Cpu: utils.Ptr(int32(1)),
|
||||
Cpu: utils.Ptr(int64(1)),
|
||||
Description: utils.Ptr("description"),
|
||||
Memory: utils.Ptr(int32(4)),
|
||||
Memory: utils.Ptr(int64(4)),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework/datasource"
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -222,6 +221,6 @@ func mapDataSourceFields(userResp *postgresflex.UserResponse, model *DataSourceM
|
|||
model.Roles = rolesSet
|
||||
}
|
||||
model.Host = types.StringPointerValue(user.Host)
|
||||
model.Port = conversion.ToTypeInt64(user.Port)
|
||||
model.Port = types.Int64PointerValue(user.Port)
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ func TestMapDataSourceFields(t *testing.T) {
|
|||
},
|
||||
Username: utils.Ptr("username"),
|
||||
Host: utils.Ptr("host"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
},
|
||||
},
|
||||
DataSourceModel{
|
||||
|
|
@ -72,7 +72,7 @@ func TestMapDataSourceFields(t *testing.T) {
|
|||
Roles: &[]string{},
|
||||
Username: nil,
|
||||
Host: nil,
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
},
|
||||
},
|
||||
DataSourceModel{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -377,7 +376,7 @@ func mapFieldsCreate(userResp *postgresflex.CreateUserResponse, model *Model) er
|
|||
model.Roles = rolesSet
|
||||
}
|
||||
model.Host = types.StringPointerValue(user.Host)
|
||||
model.Port = conversion.ToTypeInt64(user.Port)
|
||||
model.Port = types.Int64PointerValue(user.Port)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -423,7 +422,7 @@ func mapFields(userResp *postgresflex.UserResponse, model *Model) error {
|
|||
model.Roles = rolesSet
|
||||
}
|
||||
model.Host = types.StringPointerValue(user.Host)
|
||||
model.Port = conversion.ToTypeInt64(user.Port)
|
||||
model.Port = types.Int64PointerValue(user.Port)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
Username: utils.Ptr("username"),
|
||||
Password: utils.Ptr("password"),
|
||||
Host: utils.Ptr("host"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
},
|
||||
},
|
||||
Model{
|
||||
|
|
@ -80,7 +80,7 @@ func TestMapFieldsCreate(t *testing.T) {
|
|||
Username: nil,
|
||||
Password: utils.Ptr(""),
|
||||
Host: nil,
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
},
|
||||
},
|
||||
Model{
|
||||
|
|
@ -185,7 +185,7 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
Username: utils.Ptr("username"),
|
||||
Host: utils.Ptr("host"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
},
|
||||
},
|
||||
Model{
|
||||
|
|
@ -212,7 +212,7 @@ func TestMapFields(t *testing.T) {
|
|||
Roles: &[]string{},
|
||||
Username: nil,
|
||||
Host: nil,
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
},
|
||||
},
|
||||
Model{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -370,7 +369,7 @@ func mapFields(credentialsResp *postgresql.CredentialsResponse, model *Model) er
|
|||
model.HttpAPIURI = types.StringPointerValue(credentials.HttpApiUri)
|
||||
model.Name = types.StringPointerValue(credentials.Name)
|
||||
model.Password = types.StringPointerValue(credentials.Password)
|
||||
model.Port = conversion.ToTypeInt64(credentials.Port)
|
||||
model.Port = types.Int64PointerValue(credentials.Port)
|
||||
model.Uri = types.StringPointerValue(credentials.Uri)
|
||||
model.Username = types.StringPointerValue(credentials.Username)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: utils.Ptr("http"),
|
||||
Name: utils.Ptr("name"),
|
||||
Password: utils.Ptr("password"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
Uri: utils.Ptr("uri"),
|
||||
Username: utils.Ptr("username"),
|
||||
},
|
||||
|
|
@ -89,7 +89,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: nil,
|
||||
Name: nil,
|
||||
Password: nil,
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
Uri: nil,
|
||||
Username: nil,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -345,7 +344,7 @@ func toCreatePayload(model *Model, parameters *parametersModel, parametersPlugin
|
|||
InstanceName: model.Name.ValueStringPointer(),
|
||||
Parameters: &postgresql.InstanceParameters{
|
||||
EnableMonitoring: parameters.EnableMonitoring.ValueBoolPointer(),
|
||||
MetricsFrequency: conversion.ToPtrInt32(parameters.MetricsFrequency),
|
||||
MetricsFrequency: parameters.MetricsFrequency.ValueInt64Pointer(),
|
||||
MetricsPrefix: parameters.MetricsPrefix.ValueStringPointer(),
|
||||
MonitoringInstanceId: parameters.MonitoringInstanceId.ValueStringPointer(),
|
||||
Plugins: parametersPlugins,
|
||||
|
|
@ -487,7 +486,7 @@ func toUpdatePayload(model *Model, parameters *parametersModel, parametersPlugin
|
|||
return &postgresql.UpdateInstancePayload{
|
||||
Parameters: &postgresql.InstanceParameters{
|
||||
EnableMonitoring: parameters.EnableMonitoring.ValueBoolPointer(),
|
||||
MetricsFrequency: conversion.ToPtrInt32(parameters.MetricsFrequency),
|
||||
MetricsFrequency: parameters.MetricsFrequency.ValueInt64Pointer(),
|
||||
MetricsPrefix: parameters.MetricsPrefix.ValueStringPointer(),
|
||||
MonitoringInstanceId: parameters.MonitoringInstanceId.ValueStringPointer(),
|
||||
Plugins: parametersPlugins,
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
InstanceName: utils.Ptr("name"),
|
||||
Parameters: &postgresql.InstanceParameters{
|
||||
EnableMonitoring: utils.Ptr(true),
|
||||
MetricsFrequency: utils.Ptr(int32(123)),
|
||||
MetricsFrequency: utils.Ptr(int64(123)),
|
||||
MetricsPrefix: utils.Ptr("prefix"),
|
||||
MonitoringInstanceId: utils.Ptr("monitoring"),
|
||||
Plugins: &[]string{
|
||||
|
|
@ -257,7 +257,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
InstanceName: utils.Ptr(""),
|
||||
Parameters: &postgresql.InstanceParameters{
|
||||
EnableMonitoring: nil,
|
||||
MetricsFrequency: utils.Ptr(int32(2123456789)),
|
||||
MetricsFrequency: utils.Ptr(int64(2123456789)),
|
||||
MetricsPrefix: nil,
|
||||
MonitoringInstanceId: nil,
|
||||
Plugins: &[]string{
|
||||
|
|
@ -351,7 +351,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
&postgresql.UpdateInstancePayload{
|
||||
Parameters: &postgresql.InstanceParameters{
|
||||
EnableMonitoring: utils.Ptr(true),
|
||||
MetricsFrequency: utils.Ptr(int32(123)),
|
||||
MetricsFrequency: utils.Ptr(int64(123)),
|
||||
MetricsPrefix: utils.Ptr("prefix"),
|
||||
MonitoringInstanceId: utils.Ptr("monitoring"),
|
||||
Plugins: &[]string{
|
||||
|
|
@ -382,7 +382,7 @@ func TestToUpdatePayload(t *testing.T) {
|
|||
&postgresql.UpdateInstancePayload{
|
||||
Parameters: &postgresql.InstanceParameters{
|
||||
EnableMonitoring: nil,
|
||||
MetricsFrequency: utils.Ptr(int32(2123456789)),
|
||||
MetricsFrequency: utils.Ptr(int64(2123456789)),
|
||||
MetricsPrefix: nil,
|
||||
MonitoringInstanceId: nil,
|
||||
Plugins: &[]string{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -370,7 +369,7 @@ func mapFields(credentialsResp *rabbitmq.CredentialsResponse, model *Model) erro
|
|||
model.HttpAPIURI = types.StringPointerValue(credentials.HttpApiUri)
|
||||
model.Name = types.StringPointerValue(credentials.Name)
|
||||
model.Password = types.StringPointerValue(credentials.Password)
|
||||
model.Port = conversion.ToTypeInt64(credentials.Port)
|
||||
model.Port = types.Int64PointerValue(credentials.Port)
|
||||
model.Uri = types.StringPointerValue(credentials.Uri)
|
||||
model.Username = types.StringPointerValue(credentials.Username)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: utils.Ptr("http"),
|
||||
Name: utils.Ptr("name"),
|
||||
Password: utils.Ptr("password"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
Uri: utils.Ptr("uri"),
|
||||
Username: utils.Ptr("username"),
|
||||
},
|
||||
|
|
@ -89,7 +89,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: nil,
|
||||
Name: nil,
|
||||
Password: utils.Ptr(""),
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
Uri: nil,
|
||||
Username: utils.Ptr(""),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
|
|
@ -370,7 +369,7 @@ func mapFields(credentialsResp *redis.CredentialsResponse, model *Model) error {
|
|||
model.HttpAPIURI = types.StringPointerValue(credentials.HttpApiUri)
|
||||
model.Name = types.StringPointerValue(credentials.Name)
|
||||
model.Password = types.StringPointerValue(credentials.Password)
|
||||
model.Port = conversion.ToTypeInt64(credentials.Port)
|
||||
model.Port = types.Int64PointerValue(credentials.Port)
|
||||
model.Uri = types.StringPointerValue(credentials.Uri)
|
||||
model.Username = types.StringPointerValue(credentials.Username)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: utils.Ptr("http"),
|
||||
Name: utils.Ptr("name"),
|
||||
Password: utils.Ptr("password"),
|
||||
Port: utils.Ptr(int32(1234)),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
Uri: utils.Ptr("uri"),
|
||||
Username: utils.Ptr("username"),
|
||||
},
|
||||
|
|
@ -89,7 +89,7 @@ func TestMapFields(t *testing.T) {
|
|||
HttpApiUri: nil,
|
||||
Name: nil,
|
||||
Password: utils.Ptr(""),
|
||||
Port: utils.Ptr(int32(2123456789)),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
Uri: nil,
|
||||
Username: utils.Ptr(""),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -663,10 +663,10 @@ func toNodepoolsPayload(ctx context.Context, m *Cluster) []ske.Nodepool {
|
|||
}
|
||||
cnp := ske.Nodepool{
|
||||
Name: nodePool.Name.ValueStringPointer(),
|
||||
Minimum: conversion.ToPtrInt32(nodePool.Minimum),
|
||||
Maximum: conversion.ToPtrInt32(nodePool.Maximum),
|
||||
MaxSurge: conversion.ToPtrInt32(nodePool.MaxSurge),
|
||||
MaxUnavailable: conversion.ToPtrInt32(nodePool.MaxUnavailable),
|
||||
Minimum: nodePool.Minimum.ValueInt64Pointer(),
|
||||
Maximum: nodePool.Maximum.ValueInt64Pointer(),
|
||||
MaxSurge: nodePool.MaxSurge.ValueInt64Pointer(),
|
||||
MaxUnavailable: nodePool.MaxUnavailable.ValueInt64Pointer(),
|
||||
Machine: &ske.Machine{
|
||||
Type: nodePool.MachineType.ValueStringPointer(),
|
||||
Image: &ske.Image{
|
||||
|
|
@ -676,7 +676,7 @@ func toNodepoolsPayload(ctx context.Context, m *Cluster) []ske.Nodepool {
|
|||
},
|
||||
Volume: &ske.Volume{
|
||||
Type: nodePool.VolumeType.ValueStringPointer(),
|
||||
Size: conversion.ToPtrInt32(nodePool.VolumeSize),
|
||||
Size: nodePool.VolumeSize.ValueInt64Pointer(),
|
||||
},
|
||||
Taints: &ts,
|
||||
Cri: &cn,
|
||||
|
|
@ -837,12 +837,12 @@ func mapFields(ctx context.Context, cl *ske.ClusterResponse, m *Cluster) error {
|
|||
MachineType: types.StringPointerValue(np.Machine.Type),
|
||||
OSName: maimna,
|
||||
OSVersion: maimver,
|
||||
Minimum: conversion.ToTypeInt64(np.Minimum),
|
||||
Maximum: conversion.ToTypeInt64(np.Maximum),
|
||||
MaxSurge: conversion.ToTypeInt64(np.MaxSurge),
|
||||
MaxUnavailable: conversion.ToTypeInt64(np.MaxUnavailable),
|
||||
Minimum: types.Int64PointerValue(np.Minimum),
|
||||
Maximum: types.Int64PointerValue(np.Maximum),
|
||||
MaxSurge: types.Int64PointerValue(np.MaxSurge),
|
||||
MaxUnavailable: types.Int64PointerValue(np.MaxUnavailable),
|
||||
VolumeType: vt,
|
||||
VolumeSize: conversion.ToTypeInt64(np.Volume.Size),
|
||||
VolumeSize: types.Int64PointerValue(np.Volume.Size),
|
||||
Labels: types.MapNull(types.StringType),
|
||||
Taints: nil,
|
||||
CRI: crin,
|
||||
|
|
|
|||
|
|
@ -90,10 +90,10 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
Type: utils.Ptr("B"),
|
||||
},
|
||||
MaxSurge: utils.Ptr(int32(3)),
|
||||
MaxSurge: utils.Ptr(int64(3)),
|
||||
MaxUnavailable: nil,
|
||||
Maximum: utils.Ptr(int32(5)),
|
||||
Minimum: utils.Ptr(int32(1)),
|
||||
Maximum: utils.Ptr(int64(5)),
|
||||
Minimum: utils.Ptr(int64(1)),
|
||||
Name: utils.Ptr("node"),
|
||||
Taints: &[]ske.Taint{
|
||||
{
|
||||
|
|
@ -103,7 +103,7 @@ func TestMapFields(t *testing.T) {
|
|||
},
|
||||
},
|
||||
Volume: &ske.Volume{
|
||||
Size: utils.Ptr(int32(3)),
|
||||
Size: utils.Ptr(int64(3)),
|
||||
Type: utils.Ptr("type"),
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue