This commit is contained in:
asteam
2025-07-01 13:44:09 +03:00
parent 5382579a5f
commit ddbb12996d
1041 changed files with 2842 additions and 96448 deletions

View File

@@ -62,6 +62,7 @@ func DataSourceImage(ctx context.Context, state *models.RecordImageModel, c *cli
ResID: types.StringValue(image.ResID),
RescueCD: types.BoolValue(image.RescueCD),
SepID: types.Int64Value(int64(image.SepID)),
SnapshotID: types.StringValue(image.SnapshotID),
Size: types.Int64Value(int64(image.Size)),
Status: types.StringValue(image.Status),
TechStatus: types.StringValue(image.TechStatus),
@@ -77,7 +78,7 @@ func DataSourceImage(ctx context.Context, state *models.RecordImageModel, c *cli
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenDrivers", diags))
}
state.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, image.PresentTo)
state.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, image.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenPresentTo", diags))
}

View File

@@ -71,6 +71,7 @@ func ResourceImage(ctx context.Context, plan *models.ImageResourceModel, c *clie
ResID: types.StringValue(image.ResID),
RescueCD: types.BoolValue(image.RescueCD),
Size: types.Int64Value(int64(image.Size)),
SnapshotID: types.StringValue(image.SnapshotID),
Status: types.StringValue(image.Status),
TechStatus: types.StringValue(image.TechStatus),
Version: types.StringValue(image.Version),
@@ -84,7 +85,7 @@ func ResourceImage(ctx context.Context, plan *models.ImageResourceModel, c *clie
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenDrivers", diags))
}
plan.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, image.PresentTo)
plan.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, image.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenPresentTo", diags))
}

View File

@@ -2,6 +2,7 @@ package flattens
import (
"context"
"encoding/json"
"fmt"
"strconv"
@@ -30,42 +31,46 @@ func ResourceImageVirtual(ctx context.Context, plan *models.ImageVirtualResource
return diags
}
cdPresentedTo, _ := json.Marshal(image.CdPresentedTo)
*plan = models.ImageVirtualResourceModel{
ImageName: types.StringValue(image.Name),
LinkTo: types.Int64Value(int64(image.LinkTo)),
Timeouts: plan.Timeouts,
Id: types.StringValue(strconv.Itoa(int(image.ID))),
LastUpdated: plan.LastUpdated,
UNCPath: types.StringValue(image.UNCPath),
CKey: types.StringValue(image.CKey),
AccountID: types.Int64Value(int64(image.AccountID)),
Architecture: types.StringValue(image.Architecture),
BootType: types.StringValue(image.BootType),
Bootable: types.BoolValue(image.Bootable),
ComputeCIID: types.Int64Value(int64(image.ComputeCIID)),
DeletedTime: types.Int64Value(int64(image.DeletedTime)),
Description: types.StringValue(image.Description),
Enabled: types.BoolValue(image.Enabled),
GID: types.Int64Value(int64(image.GID)),
GUID: types.Int64Value(int64(image.GUID)),
History: flattenHistoryInResource(ctx, &image.History),
HotResize: types.BoolValue(image.HotResize),
LastModified: types.Int64Value(int64(image.LastModified)),
Milestones: types.Int64Value(int64(image.Milestones)),
ImageId: types.Int64Value(int64(image.ID)),
ImageType: types.StringValue(image.Type),
Password: types.StringValue(image.Password),
PoolName: types.StringValue(image.Pool),
ProviderName: types.StringValue(image.ProviderName),
PurgeAttempts: types.Int64Value(int64(image.PurgeAttempts)),
ResID: types.StringValue(image.ResID),
RescueCD: types.BoolValue(image.RescueCD),
SepID: types.Int64Value(int64(image.SepID)),
Size: types.Int64Value(int64(image.Size)),
Status: types.StringValue(image.Status),
TechStatus: types.StringValue(image.TechStatus),
Username: types.StringValue(image.Username),
Version: types.StringValue(image.Version),
ImageName: types.StringValue(image.Name),
LinkTo: types.Int64Value(int64(image.LinkTo)),
Timeouts: plan.Timeouts,
Id: types.StringValue(strconv.Itoa(int(image.ID))),
LastUpdated: plan.LastUpdated,
UNCPath: types.StringValue(image.UNCPath),
CKey: types.StringValue(image.CKey),
AccountID: types.Int64Value(int64(image.AccountID)),
Architecture: types.StringValue(image.Architecture),
BootType: types.StringValue(image.BootType),
Bootable: types.BoolValue(image.Bootable),
CdPresentedTo: types.StringValue(string(cdPresentedTo)),
ComputeCIID: types.Int64Value(int64(image.ComputeCIID)),
DeletedTime: types.Int64Value(int64(image.DeletedTime)),
Description: types.StringValue(image.Description),
Enabled: types.BoolValue(image.Enabled),
GID: types.Int64Value(int64(image.GID)),
GUID: types.Int64Value(int64(image.GUID)),
History: flattenHistoryInResource(ctx, &image.History),
HotResize: types.BoolValue(image.HotResize),
LastModified: types.Int64Value(int64(image.LastModified)),
Milestones: types.Int64Value(int64(image.Milestones)),
NetworkInterfaceNaming: types.StringValue(image.NetworkInterfaceNaming),
ImageId: types.Int64Value(int64(image.ID)),
ImageType: types.StringValue(image.Type),
Password: types.StringValue(image.Password),
PoolName: types.StringValue(image.Pool),
ProviderName: types.StringValue(image.ProviderName),
PurgeAttempts: types.Int64Value(int64(image.PurgeAttempts)),
ResID: types.StringValue(image.ResID),
RescueCD: types.BoolValue(image.RescueCD),
SepID: types.Int64Value(int64(image.SepID)),
Size: types.Int64Value(int64(image.Size)),
SnapshotID: types.StringValue(image.SnapshotID),
Status: types.StringValue(image.Status),
TechStatus: types.StringValue(image.TechStatus),
Username: types.StringValue(image.Username),
Version: types.StringValue(image.Version),
}
plan.ACL, diags = types.ListValueFrom(ctx, types.StringType, image.ACL)
@@ -76,7 +81,7 @@ func ResourceImageVirtual(ctx context.Context, plan *models.ImageVirtualResource
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenDrivers", diags))
}
plan.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, image.PresentTo)
plan.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, image.PresentTo)
if diags != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenPresentTo", diags))
}