This commit is contained in:
2025-02-07 11:59:43 +03:00
parent 60e23338ad
commit b8f118097e
177 changed files with 16418 additions and 214 deletions

View File

@@ -50,7 +50,9 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
AutoStartWithNode: types.BoolValue(computeRecord.AutoStart),
Chipset: types.StringValue(computeRecord.Chipset),
BootDiskSize: types.Int64Value(int64(computeRecord.BootDiskSize)),
BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &computeRecord.BootOrder),
CdImageId: types.Int64Value(int64(computeRecord.CdImageId)),
Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.Clones),
CloneReference: types.Int64Value(int64(computeRecord.CloneReference)),
ComputeCIID: types.Int64Value(int64(computeRecord.ComputeCIID)),
CPU: types.Int64Value(int64(computeRecord.CPU)),
@@ -86,11 +88,13 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
NumaNodeId: types.Int64Value(int64(computeRecord.NumaNodeId)),
OSUsers: flattenOSUsers(ctx, &computeRecord.OSUsers),
Pinned: types.BoolValue(computeRecord.Pinned),
PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.PreferredCPU),
PCIDevices: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, flattenPCI(ctx, pciDevicesList)),
RAM: types.Int64Value(int64(computeRecord.RAM)),
ReferenceID: types.StringValue(computeRecord.ReferenceID),
Registered: types.BoolValue(computeRecord.Registered),
ResName: types.StringValue(computeRecord.ResName),
ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.ReservedNodeCpus),
RGID: types.Int64Value(int64(computeRecord.RGID)),
RGName: types.StringValue(computeRecord.RGName),
SnapSets: flattenSnapSet(ctx, &computeRecord.SnapSets),
@@ -105,27 +109,14 @@ func DataSourceCompute(ctx context.Context, state *models.RecordComputeModel, c
VirtualImageID: types.Int64Value(int64(computeRecord.VirtualImageID)),
VirtualImageName: types.StringValue(computeRecord.VirtualImageName),
VNCPassword: types.StringValue(computeRecord.VNCPassword),
VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &computeRecord.VGPUs),
}
state.BootOrder, diags = types.ListValueFrom(ctx, types.StringType, computeRecord.BootOrder)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error FlattenDataSourceCompute", diags))
}
state.Clones, diags = types.ListValueFrom(ctx, types.Int64Type, computeRecord.Clones)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error FlattenDataSourceCompute", diags))
}
state.Tags, diags = types.MapValueFrom(ctx, types.StringType, computeRecord.Tags)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error FlattenDataSourceCompute", diags))
}
state.ReservedNodeCpus, diags = types.ListValueFrom(ctx, types.Int64Type, computeRecord.ReservedNodeCpus)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error FlattenDataSourceCompute", diags))
}
state.VGPUs, diags = types.ListValueFrom(ctx, types.Int64Type, computeRecord.VGPUs)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error FlattenDataSourceCompute", diags))
}
tflog.Info(ctx, "End FlattenDataSourceCompute")
return nil
}

View File

@@ -11,6 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-log/tflog"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/flattens"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/kvmvm/models"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/kvmvm/utilities"
)
@@ -74,7 +75,9 @@ func flattenItemsList(ctx context.Context, computes *compute.ListComputes) []mod
Architecture: types.StringValue(item.Architecture),
AutoStartWithNode: types.BoolValue(item.AutoStart),
BootDiskSize: types.Int64Value(int64(item.BootDiskSize)),
BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.BootOrder),
CdImageId: types.Int64Value(int64(item.CdImageId)),
Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Clones),
CloneReference: types.Int64Value(int64(item.CloneReference)),
Chipset: types.StringValue(item.Chipset),
ComputeCIID: types.Int64Value(int64(item.ComputeCIID)),
@@ -105,10 +108,12 @@ func flattenItemsList(ctx context.Context, computes *compute.ListComputes) []mod
NumaAffinity: types.StringValue(item.NumaAffinity),
NumaNodeId: types.Int64Value(int64(item.NumaNodeId)),
Pinned: types.BoolValue(item.Pinned),
PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.PreferredCPU),
RAM: types.Int64Value(int64(item.RAM)),
ReferenceID: types.StringValue(item.ReferenceID),
Registered: types.BoolValue(item.Registered),
ResName: types.StringValue(item.ResName),
ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.ReservedNodeCpus),
RGID: types.Int64Value(int64(item.RGID)),
RGName: types.StringValue(item.RGName),
SnapSets: flattenSnapSetInList(ctx, &item.SnapSets),
@@ -122,28 +127,13 @@ func flattenItemsList(ctx context.Context, computes *compute.ListComputes) []mod
UserManaged: types.BoolValue(item.UserManaged),
VINSConnected: types.Int64Value(int64(item.VINSConnected)),
VirtualImageID: types.Int64Value(int64(item.VirtualImageID)),
VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.VGPUs),
}
temp.BootOrder, diags = types.ListValueFrom(ctx, types.StringType, item.BootOrder)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
temp.Clones, diags = types.ListValueFrom(ctx, types.Int64Type, item.Clones)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
temp.Tags, diags = types.MapValueFrom(ctx, types.StringType, item.Tags)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
temp.ReservedNodeCpus, diags = types.ListValueFrom(ctx, types.Int64Type, item.ReservedNodeCpus)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
temp.VGPUs, diags = types.ListValueFrom(ctx, types.Int64Type, item.VGPUs)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
res = append(res, temp)
}

View File

@@ -11,6 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-log/tflog"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/flattens"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/kvmvm/models"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/kvmvm/utilities"
)
@@ -72,7 +73,9 @@ func flattenItemsListDeleted(ctx context.Context, computes *compute.ListComputes
Architecture: types.StringValue(item.Architecture),
AutoStartWithNode: types.BoolValue(item.AutoStart),
BootDiskSize: types.Int64Value(int64(item.BootDiskSize)),
BootOrder: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.BootOrder),
CdImageId: types.Int64Value(int64(item.CdImageId)),
Clones: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Clones),
Chipset: types.StringValue(item.Chipset),
CloneReference: types.Int64Value(int64(item.CloneReference)),
ComputeCIID: types.Int64Value(int64(item.ComputeCIID)),
@@ -103,10 +106,12 @@ func flattenItemsListDeleted(ctx context.Context, computes *compute.ListComputes
NumaAffinity: types.StringValue(item.NumaAffinity),
NumaNodeId: types.Int64Value(int64(item.NumaNodeId)),
Pinned: types.BoolValue(item.Pinned),
PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.PreferredCPU),
RAM: types.Int64Value(int64(item.RAM)),
ReferenceID: types.StringValue(item.ReferenceID),
Registered: types.BoolValue(item.Registered),
ResName: types.StringValue(item.ResName),
ReservedNodeCpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.ReservedNodeCpus),
RGID: types.Int64Value(int64(item.RGID)),
RGName: types.StringValue(item.RGName),
SnapSets: flattenSnapSetInListDeleted(ctx, &item.SnapSets),
@@ -120,28 +125,13 @@ func flattenItemsListDeleted(ctx context.Context, computes *compute.ListComputes
UserManaged: types.BoolValue(item.UserManaged),
VINSConnected: types.Int64Value(int64(item.VINSConnected)),
VirtualImageID: types.Int64Value(int64(item.VirtualImageID)),
VGPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.VGPUs),
}
temp.BootOrder, diags = types.ListValueFrom(ctx, types.StringType, item.BootOrder)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsListDeleted", diags))
}
temp.Clones, diags = types.ListValueFrom(ctx, types.Int64Type, item.Clones)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsListDeleted", diags))
}
temp.Tags, diags = types.MapValueFrom(ctx, types.StringType, item.Tags)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsListDeleted", diags))
}
temp.ReservedNodeCpus, diags = types.ListValueFrom(ctx, types.Int64Type, item.ReservedNodeCpus)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsList", diags))
}
temp.VGPUs, diags = types.ListValueFrom(ctx, types.Int64Type, item.VGPUs)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenItemsListDeleted", diags))
}
res = append(res, temp)
}

View File

@@ -121,6 +121,7 @@ func ComputeResource(ctx context.Context, plan *models.ResourceComputeModel, c *
NumaNodeId: types.Int64Value(int64(recordItemCompute.NumaNodeId)),
OSUsers: flattenResourceOSUsers(ctx, &recordItemCompute.OSUsers),
Pinned: types.BoolValue(recordItemCompute.Pinned),
PreferredCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordItemCompute.PreferredCPU),
ReferenceID: types.StringValue(recordItemCompute.ReferenceID),
Registered: types.BoolValue(recordItemCompute.Registered),
ResName: types.StringValue(recordItemCompute.ResName),