1.3.0
This commit is contained in:
@@ -39,18 +39,23 @@ func DiskDataSource(ctx context.Context, state *models.DataSourceDiskModel, c *c
|
||||
Timeouts: state.Timeouts,
|
||||
|
||||
// computed fields
|
||||
Id: types.StringValue(id.String()),
|
||||
ID: types.StringValue(id.String()),
|
||||
AccountID: types.Int64Value(int64(recordDisk.AccountID)),
|
||||
AccountName: types.StringValue(recordDisk.AccountName),
|
||||
ACL: types.StringValue(string(diskAcl)),
|
||||
Computes: flattenComputes(ctx, recordDisk.Computes),
|
||||
CreatedBy: types.StringValue(recordDisk.CreatedBy),
|
||||
CreatedTime: types.Int64Value(int64(recordDisk.CreatedTime)),
|
||||
DeletedBy: types.StringValue(recordDisk.DeletedBy),
|
||||
DeletedTime: types.Int64Value(int64(recordDisk.DeletedTime)),
|
||||
Description: types.StringValue(recordDisk.Description),
|
||||
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
|
||||
DeviceName: types.StringValue(recordDisk.DeviceName),
|
||||
GID: types.Int64Value(int64(recordDisk.GID)),
|
||||
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
|
||||
MachineID: types.Int64Value(int64(recordDisk.MachineID)),
|
||||
MachineName: types.StringValue(recordDisk.MachineName),
|
||||
Milestones: types.Int64Value(int64(recordDisk.Milestones)),
|
||||
Name: types.StringValue(recordDisk.Name),
|
||||
Order: types.Int64Value(int64(recordDisk.Order)),
|
||||
Params: types.StringValue(recordDisk.Params),
|
||||
@@ -64,20 +69,23 @@ func DiskDataSource(ctx context.Context, state *models.DataSourceDiskModel, c *c
|
||||
SepID: types.Int64Value(int64(recordDisk.SepID)),
|
||||
SepType: types.StringValue(recordDisk.SepType),
|
||||
Shareable: types.BoolValue(recordDisk.Shareable),
|
||||
SizeAvailable: types.Float64Value(recordDisk.SizeAvailable),
|
||||
SizeMax: types.Int64Value(int64(recordDisk.SizeMax)),
|
||||
SizeUsed: types.Float64Value(recordDisk.SizeUsed),
|
||||
Snapshots: flattenSnapshots(ctx, recordDisk.Snapshots),
|
||||
Status: types.StringValue(recordDisk.Status),
|
||||
TechStatus: types.StringValue(recordDisk.TechStatus),
|
||||
Type: types.StringValue(recordDisk.Type),
|
||||
UpdatedBy: types.StringValue(recordDisk.UpdatedBy),
|
||||
UpdatedTime: types.Int64Value(int64(recordDisk.UpdatedTime)),
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
state.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
|
||||
state.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.Images to state.Images", diags))
|
||||
}
|
||||
state.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
|
||||
state.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.PresentTo to state.PresentTo", diags))
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func DiskListDataSource(ctx context.Context, state *models.DataSourceDiskListMod
|
||||
Timeouts: state.Timeouts,
|
||||
|
||||
// computed fields
|
||||
Id: types.StringValue(id.String()),
|
||||
ID: types.StringValue(id.String()),
|
||||
EntryCount: types.Int64Value(int64(diskList.EntryCount)),
|
||||
}
|
||||
|
||||
@@ -59,7 +59,9 @@ func DiskListDataSource(ctx context.Context, state *models.DataSourceDiskListMod
|
||||
AccountName: types.StringValue(recordDisk.AccountName),
|
||||
ACL: types.StringValue(string(diskAcl)),
|
||||
Computes: flattenComputes(ctx, recordDisk.Computes),
|
||||
CreatedBy: types.StringValue(recordDisk.CreatedBy),
|
||||
CreatedTime: types.Int64Value(int64(recordDisk.CreatedTime)),
|
||||
DeletedBy: types.StringValue(recordDisk.DeletedBy),
|
||||
DeletedTime: types.Int64Value(int64(recordDisk.DeletedTime)),
|
||||
Description: types.StringValue(recordDisk.Description),
|
||||
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
|
||||
@@ -68,6 +70,9 @@ func DiskListDataSource(ctx context.Context, state *models.DataSourceDiskListMod
|
||||
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
|
||||
DiskId: types.Int64Value(int64(recordDisk.ID)),
|
||||
DiskName: types.StringValue(recordDisk.Name),
|
||||
MachineID: types.Int64Value(int64(recordDisk.MachineID)),
|
||||
MachineName: types.StringValue(recordDisk.MachineName),
|
||||
Milestones: types.Int64Value(int64(recordDisk.Milestones)),
|
||||
Order: types.Int64Value(int64(recordDisk.Order)),
|
||||
Params: types.StringValue(recordDisk.Params),
|
||||
ParentID: types.Int64Value(int64(recordDisk.ParentID)),
|
||||
@@ -80,20 +85,23 @@ func DiskListDataSource(ctx context.Context, state *models.DataSourceDiskListMod
|
||||
SepID: types.Int64Value(int64(recordDisk.SepID)),
|
||||
SepType: types.StringValue(recordDisk.SepType),
|
||||
Shareable: types.BoolValue(recordDisk.Shareable),
|
||||
SizeAvailable: types.Float64Value(recordDisk.SizeAvailable),
|
||||
SizeMax: types.Int64Value(int64(recordDisk.SizeMax)),
|
||||
SizeUsed: types.Float64Value(recordDisk.SizeUsed),
|
||||
Snapshots: flattenSnapshots(ctx, recordDisk.Snapshots),
|
||||
Status: types.StringValue(recordDisk.Status),
|
||||
TechStatus: types.StringValue(recordDisk.TechStatus),
|
||||
Type: types.StringValue(recordDisk.Type),
|
||||
UpdatedBy: types.StringValue(recordDisk.UpdatedBy),
|
||||
UpdatedTime: types.Int64Value(int64(recordDisk.UpdatedTime)),
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDataSource: cannot flatten recordDisk.Images to d.Images", diags))
|
||||
}
|
||||
d.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
|
||||
d.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDataSource: cannot flatten recordDisk.PresentTo to d.PresentTo", diags))
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func DiskListDeletedDataSource(ctx context.Context, state *models.DataSourceDisk
|
||||
Timeouts: state.Timeouts,
|
||||
|
||||
// computed fields
|
||||
Id: types.StringValue(id.String()),
|
||||
ID: types.StringValue(id.String()),
|
||||
EntryCount: types.Int64Value(int64(diskList.EntryCount)),
|
||||
}
|
||||
|
||||
@@ -56,7 +56,9 @@ func DiskListDeletedDataSource(ctx context.Context, state *models.DataSourceDisk
|
||||
AccountName: types.StringValue(recordDisk.AccountName),
|
||||
ACL: types.StringValue(string(diskAcl)),
|
||||
Computes: flattenComputes(ctx, recordDisk.Computes),
|
||||
CreatedBy: types.StringValue(recordDisk.CreatedBy),
|
||||
CreatedTime: types.Int64Value(int64(recordDisk.CreatedTime)),
|
||||
DeletedBy: types.StringValue(recordDisk.DeletedBy),
|
||||
DeletedTime: types.Int64Value(int64(recordDisk.DeletedTime)),
|
||||
Description: types.StringValue(recordDisk.Description),
|
||||
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
|
||||
@@ -65,6 +67,7 @@ func DiskListDeletedDataSource(ctx context.Context, state *models.DataSourceDisk
|
||||
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
|
||||
DiskId: types.Int64Value(int64(recordDisk.ID)),
|
||||
DiskName: types.StringValue(recordDisk.Name),
|
||||
Milestones: types.Int64Value(int64(recordDisk.Milestones)),
|
||||
Order: types.Int64Value(int64(recordDisk.Order)),
|
||||
Params: types.StringValue(recordDisk.Params),
|
||||
ParentID: types.Int64Value(int64(recordDisk.ParentID)),
|
||||
@@ -77,20 +80,23 @@ func DiskListDeletedDataSource(ctx context.Context, state *models.DataSourceDisk
|
||||
SepID: types.Int64Value(int64(recordDisk.SepID)),
|
||||
SepType: types.StringValue(recordDisk.SepType),
|
||||
Shareable: types.BoolValue(recordDisk.Shareable),
|
||||
SizeAvailable: types.Float64Value(recordDisk.SizeAvailable),
|
||||
SizeMax: types.Int64Value(int64(recordDisk.SizeMax)),
|
||||
SizeUsed: types.Float64Value(recordDisk.SizeUsed),
|
||||
Snapshots: flattenSnapshots(ctx, recordDisk.Snapshots),
|
||||
Status: types.StringValue(recordDisk.Status),
|
||||
TechStatus: types.StringValue(recordDisk.TechStatus),
|
||||
Type: types.StringValue(recordDisk.Type),
|
||||
UpdatedBy: types.StringValue(recordDisk.UpdatedBy),
|
||||
UpdatedTime: types.Int64Value(int64(recordDisk.UpdatedTime)),
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDeletedDataSource: cannot flatten recordDisk.Images to d.Images", diags))
|
||||
}
|
||||
d.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
|
||||
d.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskListDeletedDataSource: cannot flatten recordDisk.PresentTo to d.PresentTo", diags))
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ func DiskListUnattachedDataSource(ctx context.Context, state *models.DataSourceD
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
|
||||
d.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskListUnattachedDataSource: cannot flatten recordDisk.Images to d.Images", diags))
|
||||
}
|
||||
|
||||
@@ -47,14 +47,13 @@ func DiskReplicationDataSource(ctx context.Context, state *models.RecordDiskMode
|
||||
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
|
||||
GID: types.Int64Value(int64(recordDisk.GID)),
|
||||
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
|
||||
Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.Images),
|
||||
Images: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDisk.Images),
|
||||
Name: types.StringValue(recordDisk.Name),
|
||||
Order: types.Int64Value(int64(recordDisk.Order)),
|
||||
Params: types.StringValue(recordDisk.Params),
|
||||
ParentID: types.Int64Value(int64(recordDisk.ParentID)),
|
||||
PCISlot: types.Int64Value(int64(recordDisk.PCISlot)),
|
||||
Pool: types.StringValue(recordDisk.Pool),
|
||||
PresentTo: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.PresentTo),
|
||||
PurgeTime: types.Int64Value(int64(recordDisk.PurgeTime)),
|
||||
Replication: &models.ItemReplicationModel{},
|
||||
ResID: types.StringValue(recordDisk.ResID),
|
||||
@@ -73,6 +72,11 @@ func DiskReplicationDataSource(ctx context.Context, state *models.RecordDiskMode
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
state.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.PresentTo to state.PresentTo", diags))
|
||||
}
|
||||
|
||||
iotune := models.DiskReplicationIOTune{
|
||||
ReadBytesSec: types.Int64Value(int64(recordDisk.IOTune.ReadBytesSec)),
|
||||
ReadBytesSecMax: types.Int64Value(int64(recordDisk.IOTune.ReadBytesSecMax)),
|
||||
|
||||
@@ -23,7 +23,7 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
diskId, err := strconv.ParseUint(plan.Id.ValueString(), 10, 64)
|
||||
diskId, err := strconv.ParseUint(plan.ID.ValueString(), 10, 64)
|
||||
if err != nil {
|
||||
diags.AddError("flattens.DiskResource: Cannot parse disk ID from state", err.Error())
|
||||
return diags
|
||||
@@ -43,13 +43,11 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
|
||||
AccountID: types.Int64Value(int64(recordDisk.AccountID)),
|
||||
DiskName: types.StringValue(recordDisk.Name),
|
||||
SizeMax: types.Int64Value(int64(recordDisk.SizeMax)),
|
||||
GID: types.Int64Value(int64(recordDisk.GID)),
|
||||
|
||||
// optional fields
|
||||
Description: plan.Description,
|
||||
Pool: plan.Pool,
|
||||
SEPID: plan.SEPID,
|
||||
Type: plan.Type,
|
||||
Description: types.StringValue(recordDisk.Description),
|
||||
Pool: types.StringValue(recordDisk.Pool),
|
||||
SEPID: types.Int64Value(int64(recordDisk.SepID)),
|
||||
Detach: plan.Detach,
|
||||
Permanently: plan.Permanently,
|
||||
Shareable: plan.Shareable,
|
||||
@@ -57,16 +55,21 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
|
||||
|
||||
// computed fields
|
||||
LastUpdated: plan.LastUpdated,
|
||||
Id: types.StringValue(strconv.Itoa(int(recordDisk.ID))),
|
||||
DiskId: types.Int64Value(int64(recordDisk.ID)),
|
||||
ID: types.StringValue(strconv.Itoa(int(recordDisk.ID))),
|
||||
DiskID: types.Int64Value(int64(recordDisk.ID)),
|
||||
AccountName: types.StringValue(recordDisk.AccountName),
|
||||
ACL: types.StringValue(string(diskAcl)),
|
||||
Computes: flattenComputes(ctx, recordDisk.Computes),
|
||||
CreatedBy: types.StringValue(recordDisk.CreatedBy),
|
||||
CreatedTime: types.Int64Value(int64(recordDisk.CreatedTime)),
|
||||
DeletedBy: types.StringValue(recordDisk.DeletedBy),
|
||||
DeletedTime: types.Int64Value(int64(recordDisk.DeletedTime)),
|
||||
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
|
||||
DeviceName: types.StringValue(recordDisk.DeviceName),
|
||||
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
|
||||
MachineID: types.Int64Value(int64(recordDisk.MachineID)),
|
||||
MachineName: types.StringValue(recordDisk.MachineName),
|
||||
GID: types.Int64Value(int64(recordDisk.GID)),
|
||||
Order: types.Int64Value(int64(recordDisk.Order)),
|
||||
Params: types.StringValue(recordDisk.Params),
|
||||
ParentID: types.Int64Value(int64(recordDisk.ParentID)),
|
||||
@@ -80,14 +83,17 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
|
||||
Snapshots: flattenSnapshots(ctx, recordDisk.Snapshots),
|
||||
Status: types.StringValue(recordDisk.Status),
|
||||
TechStatus: types.StringValue(recordDisk.TechStatus),
|
||||
Type: types.StringValue(recordDisk.Type),
|
||||
UpdatedBy: types.StringValue(recordDisk.UpdatedBy),
|
||||
UpdatedTime: types.Int64Value(int64(recordDisk.UpdatedTime)),
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
plan.Images, diags = types.ListValueFrom(ctx, types.StringType, recordDisk.Images)
|
||||
plan.Images, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.Images)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskResource: cannot flatten recordDisk.Images to plan.Images", diags))
|
||||
}
|
||||
plan.PresentTo, diags = types.ListValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
|
||||
plan.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskResource: cannot flatten recordDisk.PresentTo to plan.PresentTo", diags))
|
||||
}
|
||||
@@ -129,7 +135,7 @@ func DiskResource(ctx context.Context, plan *models.ResourceDiskModel, c *client
|
||||
}
|
||||
plan.IOTune = obj
|
||||
|
||||
tflog.Info(ctx, "flattens.DiskResource: after flatten", map[string]any{"disk_id": plan.Id.ValueString()})
|
||||
tflog.Info(ctx, "flattens.DiskResource: after flatten", map[string]any{"disk_id": plan.ID.ValueString()})
|
||||
|
||||
tflog.Info(ctx, "End flattens.DiskResource")
|
||||
return nil
|
||||
|
||||
@@ -57,13 +57,12 @@ func DiskReplicationResource(ctx context.Context, state *models.ResourceRecordDi
|
||||
DestructionTime: types.Int64Value(int64(recordDisk.DestructionTime)),
|
||||
GID: types.Int64Value(int64(recordDisk.GID)),
|
||||
ImageID: types.Int64Value(int64(recordDisk.ImageID)),
|
||||
Images: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.Images),
|
||||
Images: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, recordDisk.Images),
|
||||
Order: types.Int64Value(int64(recordDisk.Order)),
|
||||
Params: types.StringValue(recordDisk.Params),
|
||||
ParentID: types.Int64Value(int64(recordDisk.ParentID)),
|
||||
PCISlot: types.Int64Value(int64(recordDisk.PCISlot)),
|
||||
Pool: types.StringValue(recordDisk.Pool),
|
||||
PresentTo: flattens.FlattenSimpleTypeToList(ctx, types.StringType, recordDisk.PresentTo),
|
||||
PurgeTime: types.Int64Value(int64(recordDisk.PurgeTime)),
|
||||
ResID: types.StringValue(recordDisk.ResID),
|
||||
ResName: types.StringValue(recordDisk.ResName),
|
||||
@@ -80,6 +79,11 @@ func DiskReplicationResource(ctx context.Context, state *models.ResourceRecordDi
|
||||
VMID: types.Int64Value(int64(recordDisk.VMID)),
|
||||
}
|
||||
|
||||
state.PresentTo, diags = types.MapValueFrom(ctx, types.Int64Type, recordDisk.PresentTo)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("flattens.DiskDataSource: cannot flatten recordDisk.PresentTo to state.PresentTo", diags))
|
||||
}
|
||||
|
||||
iotune := models.ResourceDiskReplicationIOTuneModel{
|
||||
ReadBytesSec: types.Int64Value(int64(recordDisk.IOTune.ReadBytesSec)),
|
||||
ReadBytesSecMax: types.Int64Value(int64(recordDisk.IOTune.ReadBytesSecMax)),
|
||||
|
||||
Reference in New Issue
Block a user