1.2.1
This commit is contained in:
@@ -2,6 +2,7 @@ package flattens
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||
@@ -35,19 +36,25 @@ func NodeDataSource(ctx context.Context, state *models.DataSourceNode, c *client
|
||||
Consumption: flattenConsumpion(ctx, &recordNode.Consumption),
|
||||
CpuInfo: flattenCpuInfo(ctx, &recordNode.CpuInfo),
|
||||
CPUAllocationRatio: types.Int64Value(int64(recordNode.CPUAllocationRatio)),
|
||||
DPDK: flattenDPDK(ctx, &recordNode.DPDK),
|
||||
GID: types.Int64Value(int64(recordNode.GID)),
|
||||
ID: types.StringValue(strconv.Itoa(int(recordNode.ID))),
|
||||
IPAddr: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &recordNode.IPAddr),
|
||||
IsolatedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &recordNode.IsolatedCpus),
|
||||
IsolatedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &recordNode.IsolatedCpus),
|
||||
Name: types.StringValue(recordNode.Name),
|
||||
NeedReboot: types.BoolValue(recordNode.NeedReboot),
|
||||
NetworkMode: types.StringValue(recordNode.NetworkMode),
|
||||
NicInfo: flattenNicInfo(ctx, recordNode.NicInfo),
|
||||
NumaTopology: flattenNumaTopology(ctx, &recordNode.NumaTopology),
|
||||
ReservedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &recordNode.ReservedCPUs),
|
||||
ReservedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &recordNode.ReservedCPUs),
|
||||
Roles: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &recordNode.Roles),
|
||||
SriovEnabled: types.BoolValue(recordNode.SriovEnabled),
|
||||
StackId: types.Int64Value(int64(recordNode.StackID)),
|
||||
Status: types.StringValue(recordNode.Status),
|
||||
ToActive: flattenRole(ctx, &recordNode.ToActive),
|
||||
ToInstalling: flattenRole(ctx, &recordNode.ToInstalling),
|
||||
ToMaintenance: flattenRole(ctx, &recordNode.ToMaintenance),
|
||||
ToRestricted: flattenRole(ctx, &recordNode.ToRestricted),
|
||||
Version: types.StringValue(recordNode.Version),
|
||||
}
|
||||
|
||||
@@ -125,7 +132,7 @@ func flattenVFList(ctx context.Context, vfMap []interface{}) []models.VFList {
|
||||
for _, item := range vfMap {
|
||||
itemMap := item.(map[string]interface{})
|
||||
vf := models.VFList{
|
||||
FnID: types.Int64Value(itemMap["fnId"].(int64)),
|
||||
FnID: types.Int64Value(int64(itemMap["fnId"].(float64))),
|
||||
PCISlot: types.StringValue(itemMap["pciSlot"].(string)),
|
||||
}
|
||||
vfList = append(vfList, vf)
|
||||
@@ -167,3 +174,37 @@ func flattenNumaTopologyNodes(ctx context.Context, nodes map[string]node.NodeInf
|
||||
tflog.Info(ctx, "End flattenNumaTopologyNodes")
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenDPDK(ctx context.Context, dpdk *node.DPDK) *models.DPDKModel {
|
||||
tflog.Info(ctx, "Start flattenDPDK")
|
||||
hpMemory, diags := types.MapValueFrom(ctx, types.Int64Type, dpdk.HPMemory)
|
||||
if diags != nil {
|
||||
tflog.Error(ctx, fmt.Sprint("Error flattenDPDK", diags))
|
||||
}
|
||||
res := models.DPDKModel{
|
||||
Bridges: &models.Bridges{
|
||||
Backplane1: &models.Backplane1{
|
||||
Interfaces: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &dpdk.Bridges.Backplane1.Interfaces),
|
||||
NumaNode: types.Int64Value(int64(dpdk.Bridges.Backplane1.NumaNode)),
|
||||
},
|
||||
},
|
||||
HPMemory: hpMemory,
|
||||
PMDCPU: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &dpdk.PMDCPU),
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "End flattenDPDK")
|
||||
return &res
|
||||
}
|
||||
|
||||
func flattenRole(ctx context.Context, role *node.Role) *models.Role {
|
||||
tflog.Info(ctx, "Start flattenRole")
|
||||
|
||||
res := models.Role{
|
||||
Actor: types.StringValue(role.Actor),
|
||||
Reason: types.StringValue(role.Reason),
|
||||
Time: types.Int64Value(int64(role.Time)),
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "End flattenRole")
|
||||
return &res
|
||||
}
|
||||
|
||||
@@ -57,44 +57,46 @@ func flattenItemsList(ctx context.Context, recordList *node.ListNodes) []models.
|
||||
|
||||
for _, item := range recordList.Data {
|
||||
temp := models.ItemNodeModel{
|
||||
AdditionalPkgs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.AdditionalPkgs),
|
||||
CpuInfo: flattenCpuInfo(ctx, &item.CpuInfo),
|
||||
Description: types.StringValue(item.Description),
|
||||
GID: types.Int64Value(int64(item.GID)),
|
||||
GUID: types.StringValue(item.GUID),
|
||||
HostKey: types.StringValue(item.HostKey),
|
||||
IPAddr: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.IPAddr),
|
||||
IsolatedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.IsolatedCpus),
|
||||
LastCheck: types.Int64Value(int64(item.LastCheck)),
|
||||
MachineGUID: types.StringValue(item.MachineGUID),
|
||||
MainboardSN: types.StringValue(item.MainboardSN),
|
||||
Memory: types.Int64Value(int64(item.Memory)),
|
||||
Milestones: types.Int64Value(int64(item.Milestones)),
|
||||
Model: types.StringValue(item.Model),
|
||||
Name: types.StringValue(item.Name),
|
||||
NeedReboot: types.BoolValue(item.NeedReboot),
|
||||
NetAddr: flattenNetAddr(ctx, item.NetAddr),
|
||||
NetworkMode: types.StringValue(item.NetworkMode),
|
||||
NicInfo: flattenNicInfo(ctx, item.NicInfo),
|
||||
NodeUUID: types.StringValue(item.NodeUUID),
|
||||
NodeID: types.Int64Value(int64(item.ID)),
|
||||
NumaTopology: flattenNumaTopology(ctx, &item.NumaTopology),
|
||||
PeerBackup: types.Int64Value(int64(item.PeerBackup)),
|
||||
PeerLog: types.Int64Value(int64(item.PeerLog)),
|
||||
PeerStats: types.Int64Value(int64(item.PeerStats)),
|
||||
Pgpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Pgpus),
|
||||
PublicKeys: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.PublicKeys),
|
||||
Release: types.StringValue(item.Release),
|
||||
ReservedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.ReservedCPUs),
|
||||
Roles: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.Roles),
|
||||
SEPs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Seps),
|
||||
SerialNum: types.StringValue(item.SerialNum),
|
||||
SriovEnabled: types.BoolValue(item.SriovEnabled),
|
||||
StackId: types.Int64Value(int64(item.StackID)),
|
||||
Status: types.StringValue(item.Status),
|
||||
Tags: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.Tags),
|
||||
Type: types.StringValue(item.Type),
|
||||
Version: types.StringValue(item.Version),
|
||||
AdditionalPkgs: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.AdditionalPkgs),
|
||||
CpuInfo: flattenCpuInfo(ctx, &item.CpuInfo),
|
||||
Description: types.StringValue(item.Description),
|
||||
DPDK: flattenDPDK(ctx, &item.DPDK),
|
||||
GID: types.Int64Value(int64(item.GID)),
|
||||
GUID: types.StringValue(item.GUID),
|
||||
HostKey: types.StringValue(item.HostKey),
|
||||
IPAddr: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.IPAddr),
|
||||
IsolatedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.IsolatedCpus),
|
||||
LastCheck: types.Int64Value(int64(item.LastCheck)),
|
||||
MachineGUID: types.StringValue(item.MachineGUID),
|
||||
MainboardSN: types.StringValue(item.MainboardSN),
|
||||
Memory: types.Int64Value(int64(item.Memory)),
|
||||
Milestones: types.Int64Value(int64(item.Milestones)),
|
||||
Model: types.StringValue(item.Model),
|
||||
Name: types.StringValue(item.Name),
|
||||
NeedReboot: types.BoolValue(item.NeedReboot),
|
||||
NetAddr: flattenNetAddr(ctx, item.NetAddr),
|
||||
NetworkMode: types.StringValue(item.NetworkMode),
|
||||
NicInfo: flattenNicInfo(ctx, item.NicInfo),
|
||||
NodeUUID: types.StringValue(item.NodeUUID),
|
||||
NodeID: types.Int64Value(int64(item.ID)),
|
||||
NumaTopology: flattenNumaTopology(ctx, &item.NumaTopology),
|
||||
PeerBackup: types.Int64Value(int64(item.PeerBackup)),
|
||||
PeerLog: types.Int64Value(int64(item.PeerLog)),
|
||||
PeerStats: types.Int64Value(int64(item.PeerStats)),
|
||||
Pgpus: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Pgpus),
|
||||
PublicKeys: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.PublicKeys),
|
||||
Release: types.StringValue(item.Release),
|
||||
ReservedCPUs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.ReservedCPUs),
|
||||
Roles: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.Roles),
|
||||
SEPs: flattens.FlattenSimpleTypeToList(ctx, types.Int64Type, &item.Seps),
|
||||
SerialNum: types.StringValue(item.SerialNum),
|
||||
SriovEnabled: types.BoolValue(item.SriovEnabled),
|
||||
StackId: types.Int64Value(int64(item.StackID)),
|
||||
Status: types.StringValue(item.Status),
|
||||
Tags: flattens.FlattenSimpleTypeToList(ctx, types.StringType, &item.Tags),
|
||||
Type: types.StringValue(item.Type),
|
||||
UEFIFirmwareFile: types.StringValue(item.UEFIFirmwareFile),
|
||||
Version: types.StringValue(item.Version),
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
|
||||
@@ -14,12 +14,14 @@ type DataSourceNode struct {
|
||||
Consumption *ConsumptionModel `tfsdk:"consumption"`
|
||||
CpuInfo *CpuInfoModel `tfsdk:"cpu_info"`
|
||||
CPUAllocationRatio types.Int64 `tfsdk:"cpu_allocation_ratio"`
|
||||
DPDK *DPDKModel `tfsdk:"dpdk"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
ID types.String `tfsdk:"id"`
|
||||
IPAddr types.List `tfsdk:"ipaddr"`
|
||||
IsolatedCPUs types.List `tfsdk:"isolated_cpus"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NeedReboot types.Bool `tfsdk:"need_reboot"`
|
||||
NetworkMode types.String `tfsdk:"network_mode"`
|
||||
NicInfo []NicInfoModel `tfsdk:"nic_info"`
|
||||
NumaTopology *NumaTopologyModel `tfsdk:"numa_topology"`
|
||||
ReservedCPUs types.List `tfsdk:"reserved_cpus"`
|
||||
@@ -27,6 +29,10 @@ type DataSourceNode struct {
|
||||
SriovEnabled types.Bool `tfsdk:"sriov_enabled"`
|
||||
StackId types.Int64 `tfsdk:"stack_id"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
ToActive *Role `tfsdk:"to_active"`
|
||||
ToInstalling *Role `tfsdk:"to_installing"`
|
||||
ToMaintenance *Role `tfsdk:"to_maintenance"`
|
||||
ToRestricted *Role `tfsdk:"to_restricted"`
|
||||
Version types.String `tfsdk:"version"`
|
||||
}
|
||||
|
||||
@@ -85,3 +91,24 @@ type NumaTopologyNodesMemory struct {
|
||||
TwoM types.Int64 `tfsdk:"two_m"`
|
||||
Total types.Int64 `tfsdk:"total"`
|
||||
}
|
||||
|
||||
type DPDKModel struct {
|
||||
Bridges *Bridges `tfsdk:"bridges"`
|
||||
HPMemory types.Map `tfsdk:"hp_memory"`
|
||||
PMDCPU types.List `tfsdk:"pmd_cpu"`
|
||||
}
|
||||
|
||||
type Bridges struct {
|
||||
Backplane1 *Backplane1 `tfsdk:"backplane1"`
|
||||
}
|
||||
|
||||
type Backplane1 struct {
|
||||
Interfaces types.List `tfsdk:"interfaces"`
|
||||
NumaNode types.Int64 `tfsdk:"numa_node"`
|
||||
}
|
||||
|
||||
type Role struct {
|
||||
Actor types.String `tfsdk:"actor"`
|
||||
Reason types.String `tfsdk:"reason"`
|
||||
Time types.Int64 `tfsdk:"time"`
|
||||
}
|
||||
|
||||
@@ -25,44 +25,46 @@ type DataSourceNodeList struct {
|
||||
}
|
||||
|
||||
type ItemNodeModel struct {
|
||||
AdditionalPkgs types.List `tfsdk:"additional_pkgs"`
|
||||
CpuInfo *CpuInfoModel `tfsdk:"cpu_info"`
|
||||
Description types.String `tfsdk:"description"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
HostKey types.String `tfsdk:"hostkey"`
|
||||
IPAddr types.List `tfsdk:"ipaddr"`
|
||||
IsolatedCPUs types.List `tfsdk:"isolated_cpus"`
|
||||
LastCheck types.Int64 `tfsdk:"lastcheck"`
|
||||
MachineGUID types.String `tfsdk:"machine_guid"`
|
||||
MainboardSN types.String `tfsdk:"mainboard_sn"`
|
||||
Memory types.Int64 `tfsdk:"memory"`
|
||||
Milestones types.Int64 `tfsdk:"milestones"`
|
||||
Model types.String `tfsdk:"model"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NeedReboot types.Bool `tfsdk:"need_reboot"`
|
||||
NetAddr []NetAddrModel `tfsdk:"net_addr"`
|
||||
NetworkMode types.String `tfsdk:"network_mode"`
|
||||
NicInfo []NicInfoModel `tfsdk:"nic_info"`
|
||||
NodeUUID types.String `tfsdk:"node_uuid"`
|
||||
NodeID types.Int64 `tfsdk:"node_id"`
|
||||
NumaTopology *NumaTopologyModel `tfsdk:"numa_topology"`
|
||||
PeerBackup types.Int64 `tfsdk:"peer_backup"`
|
||||
PeerLog types.Int64 `tfsdk:"peer_log"`
|
||||
PeerStats types.Int64 `tfsdk:"peer_stats"`
|
||||
Pgpus types.List `tfsdk:"pgpus"`
|
||||
PublicKeys types.List `tfsdk:"public_keys"`
|
||||
Release types.String `tfsdk:"release"`
|
||||
ReservedCPUs types.List `tfsdk:"reserved_cpus"`
|
||||
Roles types.List `tfsdk:"roles"`
|
||||
SEPs types.List `tfsdk:"seps"`
|
||||
SerialNum types.String `tfsdk:"serial_num"`
|
||||
SriovEnabled types.Bool `tfsdk:"sriov_enabled"`
|
||||
StackId types.Int64 `tfsdk:"stack_id"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
Tags types.List `tfsdk:"tags"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
Version types.String `tfsdk:"version"`
|
||||
AdditionalPkgs types.List `tfsdk:"additional_pkgs"`
|
||||
CpuInfo *CpuInfoModel `tfsdk:"cpu_info"`
|
||||
Description types.String `tfsdk:"description"`
|
||||
DPDK *DPDKModel `tfsdk:"dpdk"`
|
||||
GID types.Int64 `tfsdk:"gid"`
|
||||
GUID types.String `tfsdk:"guid"`
|
||||
HostKey types.String `tfsdk:"hostkey"`
|
||||
IPAddr types.List `tfsdk:"ipaddr"`
|
||||
IsolatedCPUs types.List `tfsdk:"isolated_cpus"`
|
||||
LastCheck types.Int64 `tfsdk:"lastcheck"`
|
||||
MachineGUID types.String `tfsdk:"machine_guid"`
|
||||
MainboardSN types.String `tfsdk:"mainboard_sn"`
|
||||
Memory types.Int64 `tfsdk:"memory"`
|
||||
Milestones types.Int64 `tfsdk:"milestones"`
|
||||
Model types.String `tfsdk:"model"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
NeedReboot types.Bool `tfsdk:"need_reboot"`
|
||||
NetAddr []NetAddrModel `tfsdk:"net_addr"`
|
||||
NetworkMode types.String `tfsdk:"network_mode"`
|
||||
NicInfo []NicInfoModel `tfsdk:"nic_info"`
|
||||
NodeUUID types.String `tfsdk:"node_uuid"`
|
||||
NodeID types.Int64 `tfsdk:"node_id"`
|
||||
NumaTopology *NumaTopologyModel `tfsdk:"numa_topology"`
|
||||
PeerBackup types.Int64 `tfsdk:"peer_backup"`
|
||||
PeerLog types.Int64 `tfsdk:"peer_log"`
|
||||
PeerStats types.Int64 `tfsdk:"peer_stats"`
|
||||
Pgpus types.List `tfsdk:"pgpus"`
|
||||
PublicKeys types.List `tfsdk:"public_keys"`
|
||||
Release types.String `tfsdk:"release"`
|
||||
ReservedCPUs types.List `tfsdk:"reserved_cpus"`
|
||||
Roles types.List `tfsdk:"roles"`
|
||||
SEPs types.List `tfsdk:"seps"`
|
||||
SerialNum types.String `tfsdk:"serial_num"`
|
||||
SriovEnabled types.Bool `tfsdk:"sriov_enabled"`
|
||||
StackId types.Int64 `tfsdk:"stack_id"`
|
||||
Status types.String `tfsdk:"status"`
|
||||
Tags types.List `tfsdk:"tags"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
UEFIFirmwareFile types.String `tfsdk:"uefi_firmware_file"`
|
||||
Version types.String `tfsdk:"version"`
|
||||
}
|
||||
|
||||
type NetAddrModel struct {
|
||||
|
||||
@@ -76,6 +76,36 @@ func MakeSchemaDataSourceNode() map[string]schema.Attribute {
|
||||
"cpu_allocation_ratio": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"dpdk": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"bridges": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"backplane1": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"interfaces": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"numa_node": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"hp_memory": schema.MapAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"pmd_cpu": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
},
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
@@ -88,7 +118,7 @@ func MakeSchemaDataSourceNode() map[string]schema.Attribute {
|
||||
},
|
||||
"isolated_cpus": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
@@ -96,6 +126,9 @@ func MakeSchemaDataSourceNode() map[string]schema.Attribute {
|
||||
"need_reboot": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"network_mode": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"nic_info": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
@@ -169,7 +202,7 @@ func MakeSchemaDataSourceNode() map[string]schema.Attribute {
|
||||
},
|
||||
"reserved_cpus": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"roles": schema.ListAttribute{
|
||||
Computed: true,
|
||||
@@ -184,6 +217,62 @@ func MakeSchemaDataSourceNode() map[string]schema.Attribute {
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"to_active": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"actor": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"reason": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"to_installing": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"actor": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"reason": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"to_maintenance": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"actor": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"reason": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"to_restricted": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"actor": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"reason": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"version": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -75,6 +75,36 @@ func MakeSchemaDataSourceNodeList() map[string]schema.Attribute {
|
||||
"description": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"dpdk": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"bridges": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"backplane1": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"interfaces": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"numa_node": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"hp_memory": schema.MapAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"pmd_cpu": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
},
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
@@ -93,7 +123,7 @@ func MakeSchemaDataSourceNodeList() map[string]schema.Attribute {
|
||||
},
|
||||
"isolated_cpus": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"lastcheck": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
@@ -245,7 +275,7 @@ func MakeSchemaDataSourceNodeList() map[string]schema.Attribute {
|
||||
},
|
||||
"reserved_cpus": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"roles": schema.ListAttribute{
|
||||
Computed: true,
|
||||
@@ -274,6 +304,9 @@ func MakeSchemaDataSourceNodeList() map[string]schema.Attribute {
|
||||
"type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"uefi_firmware_file": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"version": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -337,10 +337,11 @@ func flattenReservations(ctx context.Context, items *vins.ListReservations) type
|
||||
tempSlice := make([]types.Object, 0, len(*items))
|
||||
for _, item := range *items {
|
||||
temp := models.ReservationModel{
|
||||
IP: types.StringValue(item.IP),
|
||||
MAC: types.StringValue(item.MAC),
|
||||
Type: types.StringValue(item.Type),
|
||||
VMID: types.Int64Value(int64(item.VMID)),
|
||||
AccountID: types.Int64Value(int64(item.AccountID)),
|
||||
IP: types.StringValue(item.IP),
|
||||
MAC: types.StringValue(item.MAC),
|
||||
Type: types.StringValue(item.Type),
|
||||
VMID: types.Int64Value(int64(item.VMID)),
|
||||
}
|
||||
|
||||
obj, diags := types.ObjectValueFrom(ctx, models.ItemReservations, temp)
|
||||
|
||||
@@ -175,10 +175,11 @@ type RecordDHCPConfigModel struct {
|
||||
}
|
||||
|
||||
type ReservationModel struct {
|
||||
IP types.String `tfsdk:"ip"`
|
||||
MAC types.String `tfsdk:"mac"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
VMID types.Int64 `tfsdk:"vm_id"`
|
||||
AccountID types.Int64 `tfsdk:"account_id""`
|
||||
IP types.String `tfsdk:"ip"`
|
||||
MAC types.String `tfsdk:"mac"`
|
||||
Type types.String `tfsdk:"type"`
|
||||
VMID types.Int64 `tfsdk:"vm_id"`
|
||||
}
|
||||
|
||||
type RecordNATModel struct {
|
||||
@@ -375,10 +376,11 @@ var ItemDHCPConfig = map[string]attr.Type{
|
||||
}
|
||||
|
||||
var ItemReservations = map[string]attr.Type{
|
||||
"ip": types.StringType,
|
||||
"mac": types.StringType,
|
||||
"type": types.StringType,
|
||||
"vm_id": types.Int64Type,
|
||||
"account_id": types.Int64Type,
|
||||
"ip": types.StringType,
|
||||
"mac": types.StringType,
|
||||
"type": types.StringType,
|
||||
"vm_id": types.Int64Type,
|
||||
}
|
||||
|
||||
var ItemGW = map[string]attr.Type{
|
||||
|
||||
@@ -333,6 +333,9 @@ func MakeSchemaDataSourceVINS() map[string]schema.Attribute {
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"account_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ip": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user