You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform-provider-dynamix/internal/service/cloudapi/kvmvm/models/model_resource_compute.go

337 lines
14 KiB

7 months ago
package models
import (
"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/types"
disks "repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/disks/models"
)
type ResourceComputeModel struct {
// required fields
Name types.String `tfsdk:"name"`
RGID types.Int64 `tfsdk:"rg_id"`
Driver types.String `tfsdk:"driver"`
CPU types.Int64 `tfsdk:"cpu"`
RAM types.Int64 `tfsdk:"ram"`
//optional fields
ImageID types.Int64 `tfsdk:"image_id"`
WithoutBootDisk types.Bool `tfsdk:"without_boot_disk"`
BootDiskSize types.Int64 `tfsdk:"boot_disk_size"`
AffinityLabel types.String `tfsdk:"affinity_label"`
AffinityRules types.Set `tfsdk:"affinity_rules"`
AntiAffinityRules types.Set `tfsdk:"anti_affinity_rules"`
CustomFields types.String `tfsdk:"custom_fields"`
Stateless types.Bool `tfsdk:"stateless"`
SepId types.Int64 `tfsdk:"sep_id"`
Pool types.String `tfsdk:"pool"`
ExtraDisks types.Set `tfsdk:"extra_disks"`
Network types.Set `tfsdk:"network"`
Tags types.Set `tfsdk:"tags"`
PortForwarding types.Set `tfsdk:"port_forwarding"`
UserAccess types.Set `tfsdk:"user_access"`
Snapshot types.Set `tfsdk:"snapshot"`
Rollback types.Object `tfsdk:"rollback"`
CD types.Object `tfsdk:"cd"`
PinToStack types.Bool `tfsdk:"pin_to_stack"`
Description types.String `tfsdk:"description"`
CloudInit types.String `tfsdk:"cloud_init"`
Enabled types.Bool `tfsdk:"enabled"`
Pause types.Bool `tfsdk:"pause"`
Reset types.Bool `tfsdk:"reset"`
Restore types.Bool `tfsdk:"restore"`
AutoStart types.Bool `tfsdk:"auto_start"`
ForceStop types.Bool `tfsdk:"force_stop"`
ForceResize types.Bool `tfsdk:"force_resize"`
DataDisks types.String `tfsdk:"data_disks"`
Started types.Bool `tfsdk:"started"`
DetachDisks types.Bool `tfsdk:"detach_disks"`
Permanently types.Bool `tfsdk:"permanently"`
IS types.String `tfsdk:"is"`
IpaType types.String `tfsdk:"ipa_type"`
NumaAffinity types.String `tfsdk:"numa_affinity"`
CPUPin types.Bool `tfsdk:"cpu_pin"`
HPBacked types.Bool `tfsdk:"hp_backed"`
// response fields
ID types.String `tfsdk:"id"`
AccountId types.Int64 `tfsdk:"account_id"`
AccountName types.String `tfsdk:"account_name"`
ACL types.Object `tfsdk:"acl"` //k8s
AffinityWeight types.Int64 `tfsdk:"affinity_weight"`
Architecture types.String `tfsdk:"arch"`
BootOrder types.List `tfsdk:"boot_order"`
BootDisk types.Object `tfsdk:"boot_disk"`
BootDiskId types.Int64 `tfsdk:"boot_disk_id"`
CdImageId types.Int64 `tfsdk:"cd_image_id"`
CloneReference types.Int64 `tfsdk:"clone_reference"`
Clones types.List `tfsdk:"clones"`
ComputeCIID types.Int64 `tfsdk:"computeci_id"`
ComputeId types.Int64 `tfsdk:"compute_id"`
CreatedBy types.String `tfsdk:"created_by"`
CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedBy types.String `tfsdk:"deleted_by"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
Devices types.String `tfsdk:"devices"`
Disks types.List `tfsdk:"disks"`
GID types.Int64 `tfsdk:"gid"`
GUID types.Int64 `tfsdk:"guid"`
ImageName types.String `tfsdk:"image_name"`
Interfaces types.List `tfsdk:"interfaces"`
LockStatus types.String `tfsdk:"lock_status"`
ManagerID types.Int64 `tfsdk:"manager_id"`
ManagerType types.String `tfsdk:"manager_type"`
MigrationJob types.Int64 `tfsdk:"migrationjob"`
Milestones types.Int64 `tfsdk:"milestones"`
NatableVINSID types.Int64 `tfsdk:"natable_vins_id"`
NatableVINSIP types.String `tfsdk:"natable_vins_ip"`
NatableVINSName types.String `tfsdk:"natable_vins_name"`
NatableVINSNetwork types.String `tfsdk:"natable_vins_network"`
NatableVINSNetworkName types.String `tfsdk:"natable_vins_network_name"`
NeedReboot types.Bool `tfsdk:"need_reboot"`
NumaNodeId types.Int64 `tfsdk:"numa_node_id"`
OSUsers types.List `tfsdk:"os_users"`
Pinned types.Bool `tfsdk:"pinned"`
ReferenceID types.String `tfsdk:"reference_id"`
Registered types.Bool `tfsdk:"registered"`
ResName types.String `tfsdk:"res_name"`
ReservedNodeCpus types.List `tfsdk:"reserved_node_cpus"`
RGName types.String `tfsdk:"rg_name"`
SnapSets types.List `tfsdk:"snap_sets"`
StatelessSepID types.Int64 `tfsdk:"stateless_sep_id"`
StatelessSepType types.String `tfsdk:"stateless_sep_type"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
Timeouts timeouts.Value `tfsdk:"timeouts"`
UpdatedBy types.String `tfsdk:"updated_by"`
UpdatedTime types.Int64 `tfsdk:"updated_time"`
UserManaged types.Bool `tfsdk:"user_managed"`
Userdata types.String `tfsdk:"user_data"`
VGPUs types.List `tfsdk:"vgpus"`
VirtualImageID types.Int64 `tfsdk:"virtual_image_id"`
VirtualImageName types.String `tfsdk:"virtual_image_name"`
}
type RecordResourceACLModel struct {
AccountACL types.List `tfsdk:"account_acl"`
ComputeACL types.List `tfsdk:"compute_acl"`
RGACL types.List `tfsdk:"rg_acl"`
}
type ItemResourceDiskModel struct {
CKey types.String `tfsdk:"ckey"`
ACL types.String `tfsdk:"acl"`
AccountID types.Int64 `tfsdk:"account_id"`
BootPartition types.Int64 `tfsdk:"boot_partition"`
CreatedTime types.Int64 `tfsdk:"created_time"`
DeletedTime types.Int64 `tfsdk:"deleted_time"`
Description types.String `tfsdk:"desc"`
DestructionTime types.Int64 `tfsdk:"destruction_time"`
DiskPath types.String `tfsdk:"disk_path"`
GID types.Int64 `tfsdk:"gid"`
GUID types.Int64 `tfsdk:"guid"`
ID types.Int64 `tfsdk:"disk_id"`
ImageID types.Int64 `tfsdk:"image_id"`
Images types.List `tfsdk:"images"`
IOTune types.Object `tfsdk:"iotune"`
IQN types.String `tfsdk:"iqn"`
Login types.String `tfsdk:"login"`
Milestones types.Int64 `tfsdk:"milestones"`
Name types.String `tfsdk:"name"`
Order types.Int64 `tfsdk:"order"`
Params types.String `tfsdk:"params"`
ParentID types.Int64 `tfsdk:"parent_id"`
Passwd types.String `tfsdk:"passwd"`
PCISlot types.Int64 `tfsdk:"pci_slot"`
Pool types.String `tfsdk:"pool"`
PresentTo types.List `tfsdk:"present_to"`
PurgeTime types.Int64 `tfsdk:"purge_time"`
ReferenceID types.String `tfsdk:"reference_id"`
RealityDeviceNumber types.Int64 `tfsdk:"reality_device_number"`
Replication types.Object `tfsdk:"replication"`
ResID types.String `tfsdk:"res_id"`
Role types.String `tfsdk:"role"`
SepID types.Int64 `tfsdk:"sep_id"`
Shareable types.Bool `tfsdk:"shareable"`
SizeMax types.Int64 `tfsdk:"size_max"`
SizeUsed types.Float64 `tfsdk:"size_used"`
Snapshots types.List `tfsdk:"snapshots"`
Status types.String `tfsdk:"status"`
TechStatus types.String `tfsdk:"tech_status"`
Type types.String `tfsdk:"type"`
VMID types.Int64 `tfsdk:"vmid"`
}
type ItemPortForfardingModel struct {
PublicPortStart types.Int64 `tfsdk:"public_port_start"`
PublicPortEnd types.Int64 `tfsdk:"public_port_end"`
LocalPort types.Int64 `tfsdk:"local_port"`
Proto types.String `tfsdk:"proto"`
}
type ItemNetworkModel struct {
NetType types.String `tfsdk:"net_type"`
NetId types.Int64 `tfsdk:"net_id"`
IpAddress types.String `tfsdk:"ip_address"`
Mac types.String `tfsdk:"mac"`
}
type ItemResourceInterfacesModel struct {
ConnID types.Int64 `tfsdk:"conn_id"`
ConnType types.String `tfsdk:"conn_type"`
GetGW types.String `tfsdk:"get_gw"`
Enabled types.Bool `tfsdk:"enabled"`
FLIPGroupID types.Int64 `tfsdk:"flip_group_id"`
GUID types.String `tfsdk:"guid"`
IPAddress types.String `tfsdk:"ip_address"`
ListenSSH types.Bool `tfsdk:"listen_ssh"`
MAC types.String `tfsdk:"mac"`
Name types.String `tfsdk:"name"`
NetID types.Int64 `tfsdk:"net_id"`
NetMask types.Int64 `tfsdk:"netmask"`
NetType types.String `tfsdk:"net_type"`
NodeID types.Int64 `tfsdk:"node_id"`
PCISlot types.Int64 `tfsdk:"pci_slot"`
QOS types.Object `tfsdk:"qos"`
Target types.String `tfsdk:"target"`
Type types.String `tfsdk:"type"`
VNFs types.List `tfsdk:"vnfs"`
}
type ItemResourceRulesModel struct {
Key types.String `tfsdk:"key"`
Mode types.String `tfsdk:"mode"`
Policy types.String `tfsdk:"policy"`
Topology types.String `tfsdk:"topology"`
Value types.String `tfsdk:"value"`
}
var ItemNetwork = map[string]attr.Type{
"net_type": types.StringType,
"net_id": types.Int64Type,
"ip_address": types.StringType,
"mac": types.StringType,
}
var ItemDisk = map[string]attr.Type{
"ckey": types.StringType,
"acl": types.StringType,
"account_id": types.Int64Type,
"boot_partition": types.Int64Type,
"created_time": types.Int64Type,
"deleted_time": types.Int64Type,
"desc": types.StringType,
"destruction_time": types.Int64Type,
"disk_path": types.StringType,
"gid": types.Int64Type,
"guid": types.Int64Type,
"disk_id": types.Int64Type,
"image_id": types.Int64Type,
"images": types.ListType{ElemType: types.StringType},
"iotune": types.ObjectType{AttrTypes: disks.ItemIOTune},
"iqn": types.StringType,
"login": types.StringType,
"milestones": types.Int64Type,
"name": types.StringType,
"order": types.Int64Type,
"params": types.StringType,
"parent_id": types.Int64Type,
"passwd": types.StringType,
"pci_slot": types.Int64Type,
"pool": types.StringType,
"present_to": types.ListType{ElemType: types.Int64Type},
"purge_time": types.Int64Type,
"replication": types.ObjectType{AttrTypes: ItemReplication},
"reality_device_number": types.Int64Type,
"reference_id": types.StringType,
"res_id": types.StringType,
"role": types.StringType,
"sep_id": types.Int64Type,
"shareable": types.BoolType,
"size_max": types.Int64Type,
"size_used": types.Float64Type,
"snapshots": types.ListType{ElemType: types.ObjectType{AttrTypes: ItemSnapshot}},
"status": types.StringType,
"tech_status": types.StringType,
"type": types.StringType,
"vmid": types.Int64Type,
}
var ItemReplication = map[string]attr.Type{
"disk_id": types.Int64Type,
"pool_id": types.StringType,
"role": types.StringType,
"self_volume_id": types.StringType,
"storage_id": types.StringType,
"volume_id": types.StringType,
}
var ItemSnapshot = map[string]attr.Type{
"guid": types.StringType,
"label": types.StringType,
"reference_id": types.StringType,
"res_id": types.StringType,
"snap_set_guid": types.StringType,
"snap_set_time": types.Int64Type,
"timestamp": types.Int64Type,
}
var ListACL = map[string]attr.Type{
"account_acl": types.ListType{ElemType: types.ObjectType{AttrTypes: ItemACL}},
"compute_acl": types.ListType{ElemType: types.ObjectType{AttrTypes: ItemACL}},
"rg_acl": types.ListType{ElemType: types.ObjectType{AttrTypes: ItemACL}},
}
var ItemACL = map[string]attr.Type{
"explicit": types.BoolType,
"guid": types.StringType,
"right": types.StringType,
"status": types.StringType,
"type": types.StringType,
"user_group_id": types.StringType,
}
var ItemInterfaces = map[string]attr.Type{
"conn_id": types.Int64Type,
"conn_type": types.StringType,
"get_gw": types.StringType,
"enabled": types.BoolType,
"flip_group_id": types.Int64Type,
"guid": types.StringType,
"ip_address": types.StringType,
"listen_ssh": types.BoolType,
"mac": types.StringType,
"name": types.StringType,
"net_id": types.Int64Type,
"netmask": types.Int64Type,
"net_type": types.StringType,
"node_id": types.Int64Type,
"pci_slot": types.Int64Type,
"qos": types.ObjectType{AttrTypes: ItemQos},
"target": types.StringType,
"type": types.StringType,
"vnfs": types.ListType{ElemType: types.Int64Type},
}
var ItemQos = map[string]attr.Type{
"e_rate": types.Int64Type,
"guid": types.StringType,
"in_burst": types.Int64Type,
"in_rate": types.Int64Type,
}
var ItemOSUsers = map[string]attr.Type{
"guid": types.StringType,
"login": types.StringType,
"password": types.StringType,
"public_key": types.StringType,
}
var ItemSnapSets = map[string]attr.Type{
"disks": types.ListType{ElemType: types.Int64Type},
"guid": types.StringType,
"label": types.StringType,
"timestamp": types.Int64Type,
}