1.0.1
This commit is contained in:
@@ -0,0 +1,191 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceNode() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
"node_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
},
|
||||
"consumption": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"consumed": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"ram": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"computes": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"routers": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vcpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"free": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"ram": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"reserved": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"ram": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"total": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"ram": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"hostname": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"cpu_info": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"clock_speed": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"core_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"phys_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"cpu_allocation_ratio": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ipaddr": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"isolated_cpus": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"need_reboot": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"nic_info": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"driver": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"max_vfs": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"numa_node": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"num_vfs": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"os_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"pci_slot": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vf_list": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"fn_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"pci_slot": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"numa_topology": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"node_num": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"nodes": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"cpu_list": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"memory": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"one_g": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"two_m": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"total": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"reserved_cpus": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"roles": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"sriov_enabled": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"stack_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"version": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceNodeList() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
"by_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "find node by id",
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find node by name",
|
||||
},
|
||||
"version": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find node by version",
|
||||
},
|
||||
"release": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find node by release version",
|
||||
},
|
||||
"sep_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "find node by sepID",
|
||||
},
|
||||
"role": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find node by node roles",
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find node by node status",
|
||||
},
|
||||
"sort_by": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "sort by one of supported fields, format +|-(field)",
|
||||
},
|
||||
"page": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "page number",
|
||||
},
|
||||
"size": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "page size, maximum - 100",
|
||||
},
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"items": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"additional_pkgs": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"cpu_info": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"clock_speed": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"core_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"phys_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
"description": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"guid": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"hostkey": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"node_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ipaddr": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"isolated_cpus": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"lastcheck": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"machine_guid": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"mainboard_sn": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"memory": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"milestones": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"model": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"need_reboot": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"net_addr": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"cidr": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"index": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ip": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"mac": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"mtu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"network_mode": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"nic_info": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"driver": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"max_vfs": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"numa_node": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"num_vfs": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"os_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"pci_slot": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vf_list": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"fn_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"pci_slot": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"node_uuid": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"numa_topology": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"node_num": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"nodes": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"cpu_list": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"memory": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"one_g": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"two_m": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"total": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"peer_backup": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"peer_log": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"peer_stats": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"pgpus": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"public_keys": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"release": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"reserved_cpus": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"roles": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"seps": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"serial_num": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"sriov_enabled": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"stack_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"tags": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"version": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user