From 5ecf13539862bb9602696a7575568f228fc85e29 Mon Sep 17 00:00:00 2001 From: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Date: Sat, 2 Sep 2023 20:40:47 -0400 Subject: [PATCH] chore(code): fix `proxmox` package dependencies (#536) move `types` back from `internal` to `proxmox` and adjust a few other types, to make sure `proxmox` package is not dependent on anything else, and therefore can be extracted to a separate repo (#423) --- internal/cluster/datasource_haresource.go | 7 +- internal/cluster/datasource_haresources.go | 6 +- internal/cluster/haresource_model.go | 10 +- internal/cluster/resource_haresource.go | 17 +- internal/network/resource_linux_bridge.go | 52 +- internal/network/resource_linux_vlan.go | 50 +- internal/structure/attribute.go | 11 +- internal/validators/ha_resource_validator.go | 28 + proxmox/access/acl_types.go | 2 +- proxmox/access/roles.go | 2 +- proxmox/access/roles_types.go | 2 +- proxmox/access/users.go | 2 +- proxmox/access/users_types.go | 2 +- proxmox/api/ticket_auth_types.go | 2 +- proxmox/cluster/cluster_types.go | 2 +- proxmox/cluster/firewall/options_types.go | 2 +- proxmox/cluster/ha/groups/hagroups_types.go | 4 +- proxmox/cluster/ha/resources/resources.go | 12 +- .../cluster/ha/resources/resources_types.go | 16 +- proxmox/firewall/ipset_types.go | 2 +- proxmox/firewall/options_types.go | 2 +- proxmox/firewall/rules.go | 2 +- proxmox/nodes/certificate_types.go | 2 +- proxmox/nodes/containers/containers_types.go | 162 ++--- proxmox/nodes/network_types.go | 2 +- proxmox/nodes/nodes_types.go | 2 +- proxmox/nodes/storage_types.go | 2 +- proxmox/nodes/vms/vms_types.go | 634 +++++++++--------- proxmox/nodes/vms/vms_types_test.go | 40 +- proxmox/pools/pool_types.go | 4 +- proxmox/storage/storage_types.go | 2 +- {internal => proxmox}/types/common_types.go | 0 {internal => proxmox}/types/disk_size.go | 0 {internal => proxmox}/types/disk_size_test.go | 0 {internal => proxmox}/types/ha_resource_id.go | 8 - .../types/ha_resource_id_test.go | 0 .../types/ha_resource_state.go | 8 - .../types/ha_resource_state_test.go | 0 .../types/ha_resource_type.go | 10 +- .../types/ha_resource_type_test.go | 0 {internal => proxmox}/types/helpers.go | 0 proxmoxtf/resource/certificate.go | 2 +- .../resource/cluster/firewall/firewall.go | 2 +- proxmoxtf/resource/container.go | 60 +- proxmoxtf/resource/firewall/ipset.go | 2 +- proxmoxtf/resource/firewall/options.go | 2 +- proxmoxtf/resource/firewall/rules.go | 2 +- proxmoxtf/resource/group.go | 2 +- proxmoxtf/resource/role.go | 2 +- proxmoxtf/resource/user.go | 2 +- proxmoxtf/resource/validator/file.go | 2 +- proxmoxtf/resource/vm.go | 94 +-- 52 files changed, 647 insertions(+), 636 deletions(-) create mode 100644 internal/validators/ha_resource_validator.go rename {internal => proxmox}/types/common_types.go (100%) rename {internal => proxmox}/types/disk_size.go (100%) rename {internal => proxmox}/types/disk_size_test.go (100%) rename {internal => proxmox}/types/ha_resource_id.go (90%) rename {internal => proxmox}/types/ha_resource_id_test.go (100%) rename {internal => proxmox}/types/ha_resource_state.go (91%) rename {internal => proxmox}/types/ha_resource_state_test.go (100%) rename {internal => proxmox}/types/ha_resource_type.go (87%) rename {internal => proxmox}/types/ha_resource_type_test.go (100%) rename {internal => proxmox}/types/helpers.go (100%) diff --git a/internal/cluster/datasource_haresource.go b/internal/cluster/datasource_haresource.go index 90fe20da..96635d53 100644 --- a/internal/cluster/datasource_haresource.go +++ b/internal/cluster/datasource_haresource.go @@ -15,9 +15,10 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/bpg/terraform-provider-proxmox/internal/structure" - customtypes "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/internal/validators" "github.com/bpg/terraform-provider-proxmox/proxmox" haresources "github.com/bpg/terraform-provider-proxmox/proxmox/cluster/ha/resources" + proxmoxtypes "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // Ensure the implementation satisfies the expected interfaces. @@ -55,7 +56,7 @@ func (d *haresourceDatasource) Schema(_ context.Context, _ datasource.SchemaRequ Description: "The identifier of the Proxmox HA resource to read.", Required: true, Validators: []validator.String{ - customtypes.HAResourceIDValidator(), + validators.HAResourceIDValidator(), }, }, "type": schema.StringAttribute{ @@ -118,7 +119,7 @@ func (d *haresourceDatasource) Read(ctx context.Context, req datasource.ReadRequ return } - resID, err := customtypes.ParseHAResourceID(data.ResourceID.ValueString()) + resID, err := proxmoxtypes.ParseHAResourceID(data.ResourceID.ValueString()) if err != nil { resp.Diagnostics.AddError( "Unexpected error parsing Proxmox HA resource identifier", diff --git a/internal/cluster/datasource_haresources.go b/internal/cluster/datasource_haresources.go index 3c590284..66553fc7 100644 --- a/internal/cluster/datasource_haresources.go +++ b/internal/cluster/datasource_haresources.go @@ -18,9 +18,9 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/bpg/terraform-provider-proxmox/internal/structure" - customtypes "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox" haresources "github.com/bpg/terraform-provider-proxmox/proxmox/cluster/ha/resources" + proxmoxtypes "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // Ensure the implementation satisfies the expected interfaces. @@ -107,7 +107,7 @@ func (d *haresourcesDatasource) Configure( func (d *haresourcesDatasource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { var ( data haresourcesModel - fetchType *customtypes.HAResourceType + fetchType *proxmoxtypes.HAResourceType ) resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) @@ -119,7 +119,7 @@ func (d *haresourcesDatasource) Read(ctx context.Context, req datasource.ReadReq if data.Type.IsNull() { data.ID = types.StringValue("haresources") } else { - confType, err := customtypes.ParseHAResourceType(data.Type.ValueString()) + confType, err := proxmoxtypes.ParseHAResourceType(data.Type.ValueString()) if err != nil { resp.Diagnostics.AddError( "Unexpected HA resource type", diff --git a/internal/cluster/haresource_model.go b/internal/cluster/haresource_model.go index 62578ab6..ee44d8b7 100644 --- a/internal/cluster/haresource_model.go +++ b/internal/cluster/haresource_model.go @@ -9,8 +9,8 @@ package cluster import ( "fmt" - customtypes "github.com/bpg/terraform-provider-proxmox/internal/types" haresources "github.com/bpg/terraform-provider-proxmox/proxmox/cluster/ha/resources" + proxmoxtypes "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/hashicorp/terraform-plugin-framework/types" ) @@ -49,14 +49,14 @@ func (d *haresourceModel) importFromAPI(data *haresources.HAResourceGetResponseD // toRequestBase builds the common request data structure for HA resource creation or update API calls. func (d haresourceModel) toRequestBase() haresources.HAResourceDataBase { - var state customtypes.HAResourceState + var state proxmoxtypes.HAResourceState if d.State.IsNull() { - state = customtypes.HAResourceStateStarted + state = proxmoxtypes.HAResourceStateStarted } else { var err error - state, err = customtypes.ParseHAResourceState(d.State.ValueString()) + state, err = proxmoxtypes.ParseHAResourceState(d.State.ValueString()) if err != nil { panic(fmt.Errorf( "state string '%s' wrongly assumed to be valid; error: %w", @@ -75,7 +75,7 @@ func (d haresourceModel) toRequestBase() haresources.HAResourceDataBase { } // toCreateRequest builds the request data structure for creating a new HA resource. -func (d haresourceModel) toCreateRequest(resID customtypes.HAResourceID) *haresources.HAResourceCreateRequestBody { +func (d haresourceModel) toCreateRequest(resID proxmoxtypes.HAResourceID) *haresources.HAResourceCreateRequestBody { return &haresources.HAResourceCreateRequestBody{ ID: resID, Type: &resID.Type, diff --git a/internal/cluster/resource_haresource.go b/internal/cluster/resource_haresource.go index 63261e27..03affd3c 100644 --- a/internal/cluster/resource_haresource.go +++ b/internal/cluster/resource_haresource.go @@ -13,9 +13,10 @@ import ( "strings" "github.com/bpg/terraform-provider-proxmox/internal/structure" - customtypes "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/internal/validators" "github.com/bpg/terraform-provider-proxmox/proxmox" haresources "github.com/bpg/terraform-provider-proxmox/proxmox/cluster/ha/resources" + proxmoxtypes "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" @@ -71,7 +72,7 @@ func (r *haresourceResource) Schema( Description: "The Proxmox HA resource identifier", Required: true, Validators: []validator.String{ - customtypes.HAResourceIDValidator(), + validators.HAResourceIDValidator(), }, }, "state": schema.StringAttribute{ @@ -80,7 +81,7 @@ func (r *haresourceResource) Schema( Computed: true, Default: stringdefault.StaticString("started"), Validators: []validator.String{ - customtypes.HAResourceStateValidator(), + validators.HAResourceStateValidator(), }, }, "type": schema.StringAttribute{ @@ -88,7 +89,7 @@ func (r *haresourceResource) Schema( Computed: true, Optional: true, Validators: []validator.String{ - customtypes.HAResourceTypeValidator(), + validators.HAResourceTypeValidator(), }, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), @@ -164,7 +165,7 @@ func (r *haresourceResource) Create(ctx context.Context, req resource.CreateRequ return } - resID, err := customtypes.ParseHAResourceID(data.ResourceID.ValueString()) + resID, err := proxmoxtypes.ParseHAResourceID(data.ResourceID.ValueString()) if err != nil { resp.Diagnostics.AddError( "Unexpected error parsing Proxmox HA resource identifier", @@ -207,7 +208,7 @@ func (r *haresourceResource) Update( return } - resID, err := customtypes.ParseHAResourceID(state.ID.ValueString()) + resID, err := proxmoxtypes.ParseHAResourceID(state.ID.ValueString()) if err != nil { resp.Diagnostics.AddError( "Unexpected error parsing Proxmox HA resource identifier", @@ -246,7 +247,7 @@ func (r *haresourceResource) Delete( return } - resID, err := customtypes.ParseHAResourceID(data.ID.ValueString()) + resID, err := proxmoxtypes.ParseHAResourceID(data.ID.ValueString()) if err != nil { resp.Diagnostics.AddError( "Unexpected error parsing Proxmox HA resource identifier", @@ -322,7 +323,7 @@ func (r *haresourceResource) ImportState( func (r *haresourceResource) read(ctx context.Context, data *haresourceModel) (bool, diag.Diagnostics) { var diags diag.Diagnostics - resID, err := customtypes.ParseHAResourceID(data.ID.ValueString()) + resID, err := proxmoxtypes.ParseHAResourceID(data.ID.ValueString()) if err != nil { diags.AddError( "Unexpected error parsing Proxmox HA resource identifier", diff --git a/internal/network/resource_linux_bridge.go b/internal/network/resource_linux_bridge.go index c4d229d0..64d41098 100644 --- a/internal/network/resource_linux_bridge.go +++ b/internal/network/resource_linux_bridge.go @@ -24,9 +24,11 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - pvetypes "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/internal/structure" + customtypes "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox" "github.com/bpg/terraform-provider-proxmox/proxmox/nodes" + proxmoxtypes "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) var ( @@ -37,16 +39,16 @@ var ( type linuxBridgeResourceModel struct { // Base attributes - ID types.String `tfsdk:"id"` - NodeName types.String `tfsdk:"node_name"` - Name types.String `tfsdk:"name"` - Address pvetypes.IPCIDRValue `tfsdk:"address"` - Gateway pvetypes.IPAddrValue `tfsdk:"gateway"` - Address6 pvetypes.IPCIDRValue `tfsdk:"address6"` - Gateway6 pvetypes.IPAddrValue `tfsdk:"gateway6"` - Autostart types.Bool `tfsdk:"autostart"` - MTU types.Int64 `tfsdk:"mtu"` - Comment types.String `tfsdk:"comment"` + ID types.String `tfsdk:"id"` + NodeName types.String `tfsdk:"node_name"` + Name types.String `tfsdk:"name"` + Address customtypes.IPCIDRValue `tfsdk:"address"` + Gateway customtypes.IPAddrValue `tfsdk:"gateway"` + Address6 customtypes.IPCIDRValue `tfsdk:"address6"` + Gateway6 customtypes.IPAddrValue `tfsdk:"gateway6"` + Autostart types.Bool `tfsdk:"autostart"` + MTU types.Int64 `tfsdk:"mtu"` + Comment types.String `tfsdk:"comment"` // Linux bridge attributes Ports []types.String `tfsdk:"ports"` VLANAware types.Bool `tfsdk:"vlan_aware"` @@ -57,7 +59,7 @@ func (m *linuxBridgeResourceModel) exportToNetworkInterfaceCreateUpdateBody() *n body := &nodes.NetworkInterfaceCreateUpdateRequestBody{ Iface: m.Name.ValueString(), Type: "bridge", - Autostart: pvetypes.CustomBool(m.Autostart.ValueBool()).Pointer(), + Autostart: proxmoxtypes.CustomBool(m.Autostart.ValueBool()).Pointer(), } body.CIDR = m.Address.ValueStringPointer() @@ -87,7 +89,7 @@ func (m *linuxBridgeResourceModel) exportToNetworkInterfaceCreateUpdateBody() *n } if m.VLANAware.ValueBool() { - body.BridgeVLANAware = pvetypes.CustomBool(true).Pointer() + body.BridgeVLANAware = proxmoxtypes.CustomBool(true).Pointer() } return body @@ -97,10 +99,10 @@ func (m *linuxBridgeResourceModel) importFromNetworkInterfaceList( ctx context.Context, iface *nodes.NetworkInterfaceListResponseData, ) error { - m.Address = pvetypes.NewIPCIDRPointerValue(iface.CIDR) - m.Gateway = pvetypes.NewIPAddrPointerValue(iface.Gateway) - m.Address6 = pvetypes.NewIPCIDRPointerValue(iface.CIDR6) - m.Gateway6 = pvetypes.NewIPAddrPointerValue(iface.Gateway6) + m.Address = customtypes.NewIPCIDRPointerValue(iface.CIDR) + m.Gateway = customtypes.NewIPAddrPointerValue(iface.Gateway) + m.Address6 = customtypes.NewIPCIDRPointerValue(iface.CIDR6) + m.Gateway6 = customtypes.NewIPAddrPointerValue(iface.Gateway6) m.Autostart = types.BoolPointerValue(iface.Autostart.PointerBool()) if m.Autostart.IsNull() { @@ -169,13 +171,7 @@ func (r *linuxBridgeResource) Schema( Description: "Manages a Linux Bridge network interface in a Proxmox VE node.", Attributes: map[string]schema.Attribute{ // Base attributes - "id": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, - Description: "A unique identifier with format ':'", - }, + "id": structure.IDAttribute("A unique identifier with format ':'"), "node_name": schema.StringAttribute{ Description: "The name of the node.", Required: true, @@ -196,22 +192,22 @@ func (r *linuxBridgeResource) Schema( }, "address": schema.StringAttribute{ Description: "The interface IPv4/CIDR address.", - CustomType: pvetypes.IPCIDRType{}, + CustomType: customtypes.IPCIDRType{}, Optional: true, }, "gateway": schema.StringAttribute{ Description: "Default gateway address.", - CustomType: pvetypes.IPAddrType{}, + CustomType: customtypes.IPAddrType{}, Optional: true, }, "address6": schema.StringAttribute{ Description: "The interface IPv6/CIDR address.", - CustomType: pvetypes.IPCIDRType{}, + CustomType: customtypes.IPCIDRType{}, Optional: true, }, "gateway6": schema.StringAttribute{ Description: "Default IPv6 gateway address.", - CustomType: pvetypes.IPAddrType{}, + CustomType: customtypes.IPAddrType{}, Optional: true, }, "autostart": schema.BoolAttribute{ diff --git a/internal/network/resource_linux_vlan.go b/internal/network/resource_linux_vlan.go index 8c10d1f7..0c7bae4b 100644 --- a/internal/network/resource_linux_vlan.go +++ b/internal/network/resource_linux_vlan.go @@ -22,9 +22,11 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - pvetypes "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/internal/structure" + customtypes "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox" "github.com/bpg/terraform-provider-proxmox/proxmox/nodes" + proxmoxtypes "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) var ( @@ -35,16 +37,16 @@ var ( type linuxVLANResourceModel struct { // Base attributes - ID types.String `tfsdk:"id"` - NodeName types.String `tfsdk:"node_name"` - Name types.String `tfsdk:"name"` - Address pvetypes.IPCIDRValue `tfsdk:"address"` - Gateway pvetypes.IPAddrValue `tfsdk:"gateway"` - Address6 pvetypes.IPCIDRValue `tfsdk:"address6"` - Gateway6 pvetypes.IPAddrValue `tfsdk:"gateway6"` - Autostart types.Bool `tfsdk:"autostart"` - MTU types.Int64 `tfsdk:"mtu"` - Comment types.String `tfsdk:"comment"` + ID types.String `tfsdk:"id"` + NodeName types.String `tfsdk:"node_name"` + Name types.String `tfsdk:"name"` + Address customtypes.IPCIDRValue `tfsdk:"address"` + Gateway customtypes.IPAddrValue `tfsdk:"gateway"` + Address6 customtypes.IPCIDRValue `tfsdk:"address6"` + Gateway6 customtypes.IPAddrValue `tfsdk:"gateway6"` + Autostart types.Bool `tfsdk:"autostart"` + MTU types.Int64 `tfsdk:"mtu"` + Comment types.String `tfsdk:"comment"` // Linux VLAN attributes Interface types.String `tfsdk:"interface"` VLAN types.Int64 `tfsdk:"vlan"` @@ -55,7 +57,7 @@ func (m *linuxVLANResourceModel) exportToNetworkInterfaceCreateUpdateBody() *nod body := &nodes.NetworkInterfaceCreateUpdateRequestBody{ Iface: m.Name.ValueString(), Type: "vlan", - Autostart: pvetypes.CustomBool(m.Autostart.ValueBool()).Pointer(), + Autostart: proxmoxtypes.CustomBool(m.Autostart.ValueBool()).Pointer(), } body.CIDR = m.Address.ValueStringPointer() @@ -80,10 +82,10 @@ func (m *linuxVLANResourceModel) exportToNetworkInterfaceCreateUpdateBody() *nod } func (m *linuxVLANResourceModel) importFromNetworkInterfaceList(iface *nodes.NetworkInterfaceListResponseData) { - m.Address = pvetypes.NewIPCIDRPointerValue(iface.CIDR) - m.Gateway = pvetypes.NewIPAddrPointerValue(iface.Gateway) - m.Address6 = pvetypes.NewIPCIDRPointerValue(iface.CIDR6) - m.Gateway6 = pvetypes.NewIPAddrPointerValue(iface.Gateway6) + m.Address = customtypes.NewIPCIDRPointerValue(iface.CIDR) + m.Gateway = customtypes.NewIPAddrPointerValue(iface.Gateway) + m.Address6 = customtypes.NewIPCIDRPointerValue(iface.CIDR6) + m.Gateway6 = customtypes.NewIPAddrPointerValue(iface.Gateway6) m.Autostart = types.BoolPointerValue(iface.Autostart.PointerBool()) if iface.MTU != nil { @@ -143,13 +145,7 @@ func (r *linuxVLANResource) Schema( Description: "Manages a Linux VLAN network interface in a Proxmox VE node.", Attributes: map[string]schema.Attribute{ // Base attributes - "id": schema.StringAttribute{ - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, - Description: "A unique identifier with format ':'.", - }, + "id": structure.IDAttribute("A unique identifier with format ':'."), "node_name": schema.StringAttribute{ Description: "The name of the node.", Required: true, @@ -169,22 +165,22 @@ func (r *linuxVLANResource) Schema( }, "address": schema.StringAttribute{ Description: "The interface IPv4/CIDR address.", - CustomType: pvetypes.IPCIDRType{}, + CustomType: customtypes.IPCIDRType{}, Optional: true, }, "gateway": schema.StringAttribute{ Description: "Default gateway address.", - CustomType: pvetypes.IPAddrType{}, + CustomType: customtypes.IPAddrType{}, Optional: true, }, "address6": schema.StringAttribute{ Description: "The interface IPv6/CIDR address.", - CustomType: pvetypes.IPCIDRType{}, + CustomType: customtypes.IPCIDRType{}, Optional: true, }, "gateway6": schema.StringAttribute{ Description: "Default IPv6 gateway address.", - CustomType: pvetypes.IPAddrType{}, + CustomType: customtypes.IPAddrType{}, Optional: true, }, "autostart": schema.BoolAttribute{ diff --git a/internal/structure/attribute.go b/internal/structure/attribute.go index f6068a5f..c02052aa 100644 --- a/internal/structure/attribute.go +++ b/internal/structure/attribute.go @@ -13,11 +13,18 @@ import ( ) // IDAttribute generates an attribute definition suitable for the always-present `id` attribute. -func IDAttribute() schema.StringAttribute { - return schema.StringAttribute{ +func IDAttribute(desc ...string) schema.StringAttribute { + attr := schema.StringAttribute{ Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, + Description: "The unique identifier for the resource.", } + + if len(desc) > 0 { + attr.Description = desc[0] + } + + return attr } diff --git a/internal/validators/ha_resource_validator.go b/internal/validators/ha_resource_validator.go new file mode 100644 index 00000000..b89bc6d6 --- /dev/null +++ b/internal/validators/ha_resource_validator.go @@ -0,0 +1,28 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package validators + +import ( + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + + "github.com/bpg/terraform-provider-proxmox/proxmox/types" +) + +// HAResourceIDValidator returns a new HA resource identifier validator. +func HAResourceIDValidator() validator.String { + return NewParseValidator(types.ParseHAResourceID, "value must be a valid HA resource identifier") +} + +// HAResourceStateValidator returns a new HA resource state validator. +func HAResourceStateValidator() validator.String { + return NewParseValidator(types.ParseHAResourceState, "value must be a valid HA resource state") +} + +// HAResourceTypeValidator returns a new HA resource type validator. +func HAResourceTypeValidator() validator.String { + return NewParseValidator(types.ParseHAResourceType, "value must be a valid HA resource type") +} diff --git a/proxmox/access/acl_types.go b/proxmox/access/acl_types.go index 851c8606..88fcda0e 100644 --- a/proxmox/access/acl_types.go +++ b/proxmox/access/acl_types.go @@ -7,7 +7,7 @@ package access import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // ACLGetResponseBody contains the body from an access control list response. diff --git a/proxmox/access/roles.go b/proxmox/access/roles.go index 009ded95..9bc3266f 100644 --- a/proxmox/access/roles.go +++ b/proxmox/access/roles.go @@ -13,8 +13,8 @@ import ( "net/url" "sort" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/api" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) func (c *Client) rolesPath() string { diff --git a/proxmox/access/roles_types.go b/proxmox/access/roles_types.go index e9096b92..6ec18412 100644 --- a/proxmox/access/roles_types.go +++ b/proxmox/access/roles_types.go @@ -7,7 +7,7 @@ package access import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // RoleCreateRequestBody contains the data for an access group create request. diff --git a/proxmox/access/users.go b/proxmox/access/users.go index a1f3dfec..d7fed0c3 100644 --- a/proxmox/access/users.go +++ b/proxmox/access/users.go @@ -14,8 +14,8 @@ import ( "sort" "time" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/api" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) func (c *Client) usersPath() string { diff --git a/proxmox/access/users_types.go b/proxmox/access/users_types.go index 224eb061..a62b2efc 100644 --- a/proxmox/access/users_types.go +++ b/proxmox/access/users_types.go @@ -7,7 +7,7 @@ package access import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // UserChangePasswordRequestBody contains the data for a user password change request. diff --git a/proxmox/api/ticket_auth_types.go b/proxmox/api/ticket_auth_types.go index 97fcd38b..5419c746 100644 --- a/proxmox/api/ticket_auth_types.go +++ b/proxmox/api/ticket_auth_types.go @@ -7,7 +7,7 @@ package api import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // AuthenticationResponseBody contains the body from an authentication response. diff --git a/proxmox/cluster/cluster_types.go b/proxmox/cluster/cluster_types.go index 94289a8a..6943bc03 100644 --- a/proxmox/cluster/cluster_types.go +++ b/proxmox/cluster/cluster_types.go @@ -7,7 +7,7 @@ package cluster import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // NextIDRequestBody contains the data for a cluster next id request. diff --git a/proxmox/cluster/firewall/options_types.go b/proxmox/cluster/firewall/options_types.go index f618bf31..102391dc 100644 --- a/proxmox/cluster/firewall/options_types.go +++ b/proxmox/cluster/firewall/options_types.go @@ -13,7 +13,7 @@ import ( "strconv" "strings" - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // OptionsPutRequestBody is the request body for the PUT /cluster/firewall/options API call. diff --git a/proxmox/cluster/ha/groups/hagroups_types.go b/proxmox/cluster/ha/groups/hagroups_types.go index 5e9c5343..e1aba65a 100644 --- a/proxmox/cluster/ha/groups/hagroups_types.go +++ b/proxmox/cluster/ha/groups/hagroups_types.go @@ -6,7 +6,9 @@ package groups -import "github.com/bpg/terraform-provider-proxmox/internal/types" +import ( + "github.com/bpg/terraform-provider-proxmox/proxmox/types" +) // HAGroupListResponseBody contains the body from a HA group list response. type HAGroupListResponseBody struct { diff --git a/proxmox/cluster/ha/resources/resources.go b/proxmox/cluster/ha/resources/resources.go index a37e9b63..32c60361 100644 --- a/proxmox/cluster/ha/resources/resources.go +++ b/proxmox/cluster/ha/resources/resources.go @@ -13,17 +13,17 @@ import ( "net/url" "sort" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/api" + types2 "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) type haResourceTypeListQuery struct { - ResType *types.HAResourceType `url:"type"` + ResType *types2.HAResourceType `url:"type"` } // List retrieves the list of HA resources. If the `resType` argument is `nil`, all resources will be returned; // otherwise resources will be filtered by the specified type (either `ct` or `vm`). -func (c *Client) List(ctx context.Context, resType *types.HAResourceType) ([]*HAResourceListResponseData, error) { +func (c *Client) List(ctx context.Context, resType *types2.HAResourceType) ([]*HAResourceListResponseData, error) { options := &haResourceTypeListQuery{resType} resBody := &HAResourceListResponseBody{} @@ -46,7 +46,7 @@ func (c *Client) List(ctx context.Context, resType *types.HAResourceType) ([]*HA } // Get retrieves the configuration of a single HA resource. -func (c *Client) Get(ctx context.Context, id types.HAResourceID) (*HAResourceGetResponseData, error) { +func (c *Client) Get(ctx context.Context, id types2.HAResourceID) (*HAResourceGetResponseData, error) { resBody := &HAResourceGetResponseBody{} err := c.DoRequest(ctx, http.MethodGet, c.ExpandPath(url.PathEscape(id.String())), nil, resBody) @@ -72,7 +72,7 @@ func (c *Client) Create(ctx context.Context, data *HAResourceCreateRequestBody) } // Update updates an existing HA resource. -func (c *Client) Update(ctx context.Context, id types.HAResourceID, data *HAResourceUpdateRequestBody) error { +func (c *Client) Update(ctx context.Context, id types2.HAResourceID, data *HAResourceUpdateRequestBody) error { err := c.DoRequest(ctx, http.MethodPut, c.ExpandPath(url.PathEscape(id.String())), data, nil) if err != nil { return fmt.Errorf("error updating HA resource %v: %w", id, err) @@ -82,7 +82,7 @@ func (c *Client) Update(ctx context.Context, id types.HAResourceID, data *HAReso } // Delete deletes a HA resource. -func (c *Client) Delete(ctx context.Context, id types.HAResourceID) error { +func (c *Client) Delete(ctx context.Context, id types2.HAResourceID) error { err := c.DoRequest(ctx, http.MethodDelete, c.ExpandPath(url.PathEscape(id.String())), nil, nil) if err != nil { return fmt.Errorf("error deleting HA resource %v: %w", id, err) diff --git a/proxmox/cluster/ha/resources/resources_types.go b/proxmox/cluster/ha/resources/resources_types.go index b86d63ce..62ae2162 100644 --- a/proxmox/cluster/ha/resources/resources_types.go +++ b/proxmox/cluster/ha/resources/resources_types.go @@ -6,7 +6,9 @@ package resources -import "github.com/bpg/terraform-provider-proxmox/internal/types" +import ( + types2 "github.com/bpg/terraform-provider-proxmox/proxmox/types" +) // HAResourceListResponseBody contains the body from a HA resource list response. type HAResourceListResponseBody struct { @@ -15,7 +17,7 @@ type HAResourceListResponseBody struct { // HAResourceListResponseData contains the data from a HA resource list response. type HAResourceListResponseData struct { - ID types.HAResourceID `json:"sid"` + ID types2.HAResourceID `json:"sid"` } // HAResourceGetResponseBody contains the body from a HA resource get response. @@ -34,7 +36,7 @@ type HAResourceDataBase struct { // Maximal number of service restart attempts. MaxRestart *int64 `json:"max_restart" url:"max_restart,omitempty"` // Requested resource state. - State types.HAResourceState `json:"state" url:"state"` + State types2.HAResourceState `json:"state" url:"state"` } // HAResourceGetResponseData contains data received from the HA resource API when requesting information about a single @@ -42,9 +44,9 @@ type HAResourceDataBase struct { type HAResourceGetResponseData struct { HAResourceDataBase // Identifier of this resource - ID types.HAResourceID `json:"sid"` + ID types2.HAResourceID `json:"sid"` // Type of this resource - Type types.HAResourceType `json:"type"` + Type types2.HAResourceType `json:"type"` // SHA-1 digest of the resources' configuration. Digest *string `json:"digest,omitempty"` } @@ -53,9 +55,9 @@ type HAResourceGetResponseData struct { type HAResourceCreateRequestBody struct { HAResourceDataBase // Identifier of this resource - ID types.HAResourceID `url:"sid"` + ID types2.HAResourceID `url:"sid"` // Type of this resource - Type *types.HAResourceType `url:"type,omitempty"` + Type *types2.HAResourceType `url:"type,omitempty"` // SHA-1 digest of the resources' configuration. Digest *string `url:"comment,omitempty"` } diff --git a/proxmox/firewall/ipset_types.go b/proxmox/firewall/ipset_types.go index 87d31e25..d421726b 100644 --- a/proxmox/firewall/ipset_types.go +++ b/proxmox/firewall/ipset_types.go @@ -7,7 +7,7 @@ package firewall import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // IPSetListResponseBody contains the data from an IPSet get response. diff --git a/proxmox/firewall/options_types.go b/proxmox/firewall/options_types.go index 3f924ab0..68804f43 100644 --- a/proxmox/firewall/options_types.go +++ b/proxmox/firewall/options_types.go @@ -7,7 +7,7 @@ package firewall import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // OptionsPutRequestBody is the request body for the PUT /cluster/firewall/options API call. diff --git a/proxmox/firewall/rules.go b/proxmox/firewall/rules.go index 74f3b985..b6bb62d3 100644 --- a/proxmox/firewall/rules.go +++ b/proxmox/firewall/rules.go @@ -14,8 +14,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/api" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // Rule is an interface for the Proxmox firewall rule API. diff --git a/proxmox/nodes/certificate_types.go b/proxmox/nodes/certificate_types.go index f81f82e3..844e583d 100644 --- a/proxmox/nodes/certificate_types.go +++ b/proxmox/nodes/certificate_types.go @@ -7,7 +7,7 @@ package nodes import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // CertificateDeleteRequestBody contains the data for a custom certificate delete request. diff --git a/proxmox/nodes/containers/containers_types.go b/proxmox/nodes/containers/containers_types.go index ddc1b36c..100acc14 100644 --- a/proxmox/nodes/containers/containers_types.go +++ b/proxmox/nodes/containers/containers_types.go @@ -13,26 +13,26 @@ import ( "strconv" "strings" - "github.com/bpg/terraform-provider-proxmox/internal/types" + types2 "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // CloneRequestBody contains the data for an container clone request. type CloneRequestBody struct { - BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"` - Description *string `json:"description,omitempty" url:"description,omitempty"` - FullCopy *types.CustomBool `json:"full,omitempty" url:"full,omitempty,int"` - Hostname *string `json:"hostname,omitempty" url:"hostname,omitempty"` - PoolID *string `json:"pool,omitempty" url:"pool,omitempty"` - SnapshotName *string `json:"snapname,omitempty" url:"snapname,omitempty"` - TargetNodeName *string `json:"target,omitempty" url:"target,omitempty"` - TargetStorage *string `json:"storage,omitempty" url:"storage,omitempty"` - VMIDNew int `json:"newid" url:"newid"` + BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"` + Description *string `json:"description,omitempty" url:"description,omitempty"` + FullCopy *types2.CustomBool `json:"full,omitempty" url:"full,omitempty,int"` + Hostname *string `json:"hostname,omitempty" url:"hostname,omitempty"` + PoolID *string `json:"pool,omitempty" url:"pool,omitempty"` + SnapshotName *string `json:"snapname,omitempty" url:"snapname,omitempty"` + TargetNodeName *string `json:"target,omitempty" url:"target,omitempty"` + TargetStorage *string `json:"storage,omitempty" url:"storage,omitempty"` + VMIDNew int `json:"newid" url:"newid"` } // CreateRequestBody contains the data for a user create request. type CreateRequestBody struct { BandwidthLimit *float64 `json:"bwlimit,omitempty" url:"bwlimit,omitempty"` - ConsoleEnabled *types.CustomBool `json:"console,omitempty" url:"console,omitempty,int"` + ConsoleEnabled *types2.CustomBool `json:"console,omitempty" url:"console,omitempty,int"` ConsoleMode *string `json:"cmode,omitempty" url:"cmode,omitempty"` CPUArchitecture *string `json:"arch,omitempty" url:"arch,omitempty"` CPUCores *int `json:"cores,omitempty" url:"cores,omitempty"` @@ -45,10 +45,10 @@ type CreateRequestBody struct { DNSDomain *string `json:"searchdomain,omitempty" url:"searchdomain,omitempty"` DNSServer *string `json:"nameserver,omitempty" url:"nameserver,omitempty"` Features *CustomFeatures `json:"features,omitempty" url:"features,omitempty"` - Force *types.CustomBool `json:"force,omitempty" url:"force,omitempty,int"` + Force *types2.CustomBool `json:"force,omitempty" url:"force,omitempty,int"` HookScript *string `json:"hookscript,omitempty" url:"hookscript,omitempty"` Hostname *string `json:"hostname,omitempty" url:"hostname,omitempty"` - IgnoreUnpackErrors *types.CustomBool `json:"ignore-unpack-errors,omitempty" url:"force,omitempty,int"` + IgnoreUnpackErrors *types2.CustomBool `json:"ignore-unpack-errors,omitempty" url:"force,omitempty,int"` Lock *string `json:"lock,omitempty" url:"lock,omitempty,int"` MountPoints CustomMountPointArray `json:"mp,omitempty" url:"mp,omitempty,numbered"` NetworkInterfaces CustomNetworkInterfaceArray `json:"net,omitempty" url:"net,omitempty,numbered"` @@ -56,43 +56,43 @@ type CreateRequestBody struct { OSType *string `json:"ostype,omitempty" url:"ostype,omitempty"` Password *string `json:"password,omitempty" url:"password,omitempty"` PoolID *string `json:"pool,omitempty" url:"pool,omitempty"` - Protection *types.CustomBool `json:"protection,omitempty" url:"protection,omitempty,int"` - Restore *types.CustomBool `json:"restore,omitempty" url:"restore,omitempty,int"` + Protection *types2.CustomBool `json:"protection,omitempty" url:"protection,omitempty,int"` + Restore *types2.CustomBool `json:"restore,omitempty" url:"restore,omitempty,int"` RootFS *CustomRootFS `json:"rootfs,omitempty" url:"rootfs,omitempty"` SSHKeys *CustomSSHKeys `json:"ssh-public-keys,omitempty" url:"ssh-public-keys,omitempty"` - Start *types.CustomBool `json:"start,omitempty" url:"start,omitempty,int"` - StartOnBoot *types.CustomBool `json:"onboot,omitempty" url:"onboot,omitempty,int"` + Start *types2.CustomBool `json:"start,omitempty" url:"start,omitempty,int"` + StartOnBoot *types2.CustomBool `json:"onboot,omitempty" url:"onboot,omitempty,int"` StartupBehavior *CustomStartupBehavior `json:"startup,omitempty" url:"startup,omitempty"` Swap *int `json:"swap,omitempty" url:"swap,omitempty"` Tags *string `json:"tags,omitempty" url:"tags,omitempty"` - Template *types.CustomBool `json:"template,omitempty" url:"template,omitempty,int"` + Template *types2.CustomBool `json:"template,omitempty" url:"template,omitempty,int"` TTY *int `json:"tty,omitempty" url:"tty,omitempty"` - Unique *types.CustomBool `json:"unique,omitempty" url:"unique,omitempty,int"` - Unprivileged *types.CustomBool `json:"unprivileged,omitempty" url:"unprivileged,omitempty,int"` + Unique *types2.CustomBool `json:"unique,omitempty" url:"unique,omitempty,int"` + Unprivileged *types2.CustomBool `json:"unprivileged,omitempty" url:"unprivileged,omitempty,int"` VMID *int `json:"vmid,omitempty" url:"vmid,omitempty"` } // CustomFeatures contains the values for the "features" property. type CustomFeatures struct { - FUSE *types.CustomBool `json:"fuse,omitempty" url:"fuse,omitempty,int"` - KeyControl *types.CustomBool `json:"keyctl,omitempty" url:"keyctl,omitempty,int"` - MountTypes *[]string `json:"mount,omitempty" url:"mount,omitempty"` - Nesting *types.CustomBool `json:"nesting,omitempty" url:"nesting,omitempty,int"` + FUSE *types2.CustomBool `json:"fuse,omitempty" url:"fuse,omitempty,int"` + KeyControl *types2.CustomBool `json:"keyctl,omitempty" url:"keyctl,omitempty,int"` + MountTypes *[]string `json:"mount,omitempty" url:"mount,omitempty"` + Nesting *types2.CustomBool `json:"nesting,omitempty" url:"nesting,omitempty,int"` } // CustomMountPoint contains the values for the "mp[n]" properties. type CustomMountPoint struct { - ACL *types.CustomBool `json:"acl,omitempty" url:"acl,omitempty,int"` - Backup *types.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"` - DiskSize *string `json:"size,omitempty" url:"size,omitempty"` // read-only - Enabled bool `json:"-" url:"-"` - MountOptions *[]string `json:"mountoptions,omitempty" url:"mountoptions,omitempty"` - MountPoint string `json:"mp" url:"mp"` - Quota *types.CustomBool `json:"quota,omitempty" url:"quota,omitempty,int"` - ReadOnly *types.CustomBool `json:"ro,omitempty" url:"ro,omitempty,int"` - Replicate *types.CustomBool `json:"replicate,omitempty" url:"replicate,omitempty,int"` - Shared *types.CustomBool `json:"shared,omitempty" url:"shared,omitempty,int"` - Volume string `json:"volume" url:"volume"` + ACL *types2.CustomBool `json:"acl,omitempty" url:"acl,omitempty,int"` + Backup *types2.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"` + DiskSize *string `json:"size,omitempty" url:"size,omitempty"` // read-only + Enabled bool `json:"-" url:"-"` + MountOptions *[]string `json:"mountoptions,omitempty" url:"mountoptions,omitempty"` + MountPoint string `json:"mp" url:"mp"` + Quota *types2.CustomBool `json:"quota,omitempty" url:"quota,omitempty,int"` + ReadOnly *types2.CustomBool `json:"ro,omitempty" url:"ro,omitempty,int"` + Replicate *types2.CustomBool `json:"replicate,omitempty" url:"replicate,omitempty,int"` + Shared *types2.CustomBool `json:"shared,omitempty" url:"shared,omitempty,int"` + Volume string `json:"volume" url:"volume"` } // CustomMountPointArray is an array of CustomMountPoint. @@ -100,20 +100,20 @@ type CustomMountPointArray []CustomMountPoint // CustomNetworkInterface contains the values for the "net[n]" properties. type CustomNetworkInterface struct { - Bridge *string `json:"bridge,omitempty" url:"bridge,omitempty"` - Enabled bool `json:"-" url:"-"` - Firewall *types.CustomBool `json:"firewall,omitempty" url:"firewall,omitempty,int"` - IPv4Address *string `json:"ip,omitempty" url:"ip,omitempty"` - IPv4Gateway *string `json:"gw,omitempty" url:"gw,omitempty"` - IPv6Address *string `json:"ip6,omitempty" url:"ip6,omitempty"` - IPv6Gateway *string `json:"gw6,omitempty" url:"gw6,omitempty"` - MACAddress *string `json:"hwaddr,omitempty" url:"hwaddr,omitempty"` - MTU *int `json:"mtu,omitempty" url:"mtu,omitempty"` - Name string `json:"name" url:"name"` - RateLimit *float64 `json:"rate,omitempty" url:"rate,omitempty"` - Tag *int `json:"tag,omitempty" url:"tag,omitempty"` - Trunks *[]int `json:"trunks,omitempty" url:"trunks,omitempty"` - Type *string `json:"type,omitempty" url:"type,omitempty"` + Bridge *string `json:"bridge,omitempty" url:"bridge,omitempty"` + Enabled bool `json:"-" url:"-"` + Firewall *types2.CustomBool `json:"firewall,omitempty" url:"firewall,omitempty,int"` + IPv4Address *string `json:"ip,omitempty" url:"ip,omitempty"` + IPv4Gateway *string `json:"gw,omitempty" url:"gw,omitempty"` + IPv6Address *string `json:"ip6,omitempty" url:"ip6,omitempty"` + IPv6Gateway *string `json:"gw6,omitempty" url:"gw6,omitempty"` + MACAddress *string `json:"hwaddr,omitempty" url:"hwaddr,omitempty"` + MTU *int `json:"mtu,omitempty" url:"mtu,omitempty"` + Name string `json:"name" url:"name"` + RateLimit *float64 `json:"rate,omitempty" url:"rate,omitempty"` + Tag *int `json:"tag,omitempty" url:"tag,omitempty"` + Trunks *[]int `json:"trunks,omitempty" url:"trunks,omitempty"` + Type *string `json:"type,omitempty" url:"type,omitempty"` } // CustomNetworkInterfaceArray is an array of CustomNetworkInterface. @@ -121,14 +121,14 @@ type CustomNetworkInterfaceArray []CustomNetworkInterface // CustomRootFS contains the values for the "rootfs" property. type CustomRootFS struct { - ACL *types.CustomBool `json:"acl,omitempty" url:"acl,omitempty,int"` - Size *types.DiskSize `json:"size,omitempty" url:"size,omitempty"` - MountOptions *[]string `json:"mountoptions,omitempty" url:"mountoptions,omitempty"` - Quota *types.CustomBool `json:"quota,omitempty" url:"quota,omitempty,int"` - ReadOnly *types.CustomBool `json:"ro,omitempty" url:"ro,omitempty,int"` - Replicate *types.CustomBool `json:"replicate,omitempty" url:"replicate,omitempty,int"` - Shared *types.CustomBool `json:"shared,omitempty" url:"shared,omitempty,int"` - Volume string `json:"volume" url:"volume"` + ACL *types2.CustomBool `json:"acl,omitempty" url:"acl,omitempty,int"` + Size *types2.DiskSize `json:"size,omitempty" url:"size,omitempty"` + MountOptions *[]string `json:"mountoptions,omitempty" url:"mountoptions,omitempty"` + Quota *types2.CustomBool `json:"quota,omitempty" url:"quota,omitempty,int"` + ReadOnly *types2.CustomBool `json:"ro,omitempty" url:"ro,omitempty,int"` + Replicate *types2.CustomBool `json:"replicate,omitempty" url:"replicate,omitempty,int"` + Shared *types2.CustomBool `json:"shared,omitempty" url:"shared,omitempty,int"` + Volume string `json:"volume" url:"volume"` } // CustomSSHKeys contains the values for the "ssh-public-keys" property. @@ -153,7 +153,7 @@ type GetResponseBody struct { // GetResponseData contains the data from a user get response. type GetResponseData struct { - ConsoleEnabled *types.CustomBool `json:"console,omitempty"` + ConsoleEnabled *types2.CustomBool `json:"console,omitempty"` ConsoleMode *string `json:"cmode,omitempty"` CPUArchitecture *string `json:"arch,omitempty"` CPUCores *int `json:"cores,omitempty"` @@ -167,7 +167,7 @@ type GetResponseData struct { Features *CustomFeatures `json:"features,omitempty"` HookScript *string `json:"hookscript,omitempty"` Hostname *string `json:"hostname,omitempty"` - Lock *types.CustomBool `json:"lock,omitempty"` + Lock *types2.CustomBool `json:"lock,omitempty"` LXCConfiguration *[][2]string `json:"lxc,omitempty"` MountPoint0 *CustomMountPoint `json:"mp0,omitempty"` MountPoint1 *CustomMountPoint `json:"mp1,omitempty"` @@ -186,15 +186,15 @@ type GetResponseData struct { NetworkInterface6 *CustomNetworkInterface `json:"net6,omitempty"` NetworkInterface7 *CustomNetworkInterface `json:"net7,omitempty"` OSType *string `json:"ostype,omitempty"` - Protection *types.CustomBool `json:"protection,omitempty"` + Protection *types2.CustomBool `json:"protection,omitempty"` RootFS *CustomRootFS `json:"rootfs,omitempty"` - StartOnBoot *types.CustomBool `json:"onboot,omitempty"` + StartOnBoot *types2.CustomBool `json:"onboot,omitempty"` StartupBehavior *CustomStartupBehavior `json:"startup,omitempty"` Swap *int `json:"swap,omitempty"` Tags *string `json:"tags,omitempty"` - Template *types.CustomBool `json:"template,omitempty"` + Template *types2.CustomBool `json:"template,omitempty"` TTY *int `json:"tty,omitempty"` - Unprivileged *types.CustomBool `json:"unprivileged,omitempty"` + Unprivileged *types2.CustomBool `json:"unprivileged,omitempty"` } // GetStatusResponseBody contains the body from a container get status response. @@ -228,8 +228,8 @@ type RebootRequestBody struct { // ShutdownRequestBody contains the body for a container shutdown request. type ShutdownRequestBody struct { - ForceStop *types.CustomBool `json:"forceStop,omitempty" url:"forceStop,omitempty,int"` - Timeout *int `json:"timeout,omitempty" url:"timeout,omitempty"` + ForceStop *types2.CustomBool `json:"forceStop,omitempty" url:"forceStop,omitempty,int"` + Timeout *int `json:"timeout,omitempty" url:"timeout,omitempty"` } // UpdateRequestBody contains the data for an user update request. @@ -564,10 +564,10 @@ func (r *CustomFeatures) UnmarshalJSON(b []byte) error { if len(v) == 2 { switch v[0] { case "fuse": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.FUSE = &bv case "keyctl": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.KeyControl = &bv case "mount": if v[1] != "" { @@ -578,7 +578,7 @@ func (r *CustomFeatures) UnmarshalJSON(b []byte) error { r.MountTypes = &a } case "nesting": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Nesting = &bv } } @@ -606,10 +606,10 @@ func (r *CustomMountPoint) UnmarshalJSON(b []byte) error { } else if len(v) == 2 { switch v[0] { case "acl": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.ACL = &bv case "backup": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Backup = &bv case "mountoptions": if v[1] != "" { @@ -622,16 +622,16 @@ func (r *CustomMountPoint) UnmarshalJSON(b []byte) error { case "mp": r.MountPoint = v[1] case "quota": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Quota = &bv case "ro": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.ReadOnly = &bv case "replicate": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Replicate = &bv case "shared": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Shared = &bv case "size": r.DiskSize = &v[1] @@ -664,7 +664,7 @@ func (r *CustomNetworkInterface) UnmarshalJSON(b []byte) error { case "bridge": r.Bridge = &v[1] case "firewall": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Firewall = &bv case "gw": r.IPv4Gateway = &v[1] @@ -745,7 +745,7 @@ func (r *CustomRootFS) UnmarshalJSON(b []byte) error { } else if len(v) == 2 { switch v[0] { case "acl": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.ACL = &bv case "mountoptions": if v[1] != "" { @@ -756,19 +756,19 @@ func (r *CustomRootFS) UnmarshalJSON(b []byte) error { r.MountOptions = &a } case "quota": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Quota = &bv case "ro": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.ReadOnly = &bv case "replicate": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Replicate = &bv case "shared": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Shared = &bv case "size": - r.Size = new(types.DiskSize) + r.Size = new(types2.DiskSize) err := r.Size.UnmarshalJSON([]byte(v[1])) if err != nil { return fmt.Errorf("failed to unmarshal disk size: %w", err) diff --git a/proxmox/nodes/network_types.go b/proxmox/nodes/network_types.go index 55f47680..41041345 100644 --- a/proxmox/nodes/network_types.go +++ b/proxmox/nodes/network_types.go @@ -7,7 +7,7 @@ package nodes import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // NetworkInterfaceListResponseBody contains the body from a node network interface list response. diff --git a/proxmox/nodes/nodes_types.go b/proxmox/nodes/nodes_types.go index c86da585..b6671f75 100644 --- a/proxmox/nodes/nodes_types.go +++ b/proxmox/nodes/nodes_types.go @@ -11,7 +11,7 @@ import ( "fmt" "net/url" - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // CustomCommands contains an array of commands to execute. diff --git a/proxmox/nodes/storage_types.go b/proxmox/nodes/storage_types.go index ac54232b..c381bf50 100644 --- a/proxmox/nodes/storage_types.go +++ b/proxmox/nodes/storage_types.go @@ -7,7 +7,7 @@ package nodes import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // DatastoreFileListResponseBody contains the body from a datastore content list response. diff --git a/proxmox/nodes/vms/vms_types.go b/proxmox/nodes/vms/vms_types.go index dc4d99eb..efb4c502 100644 --- a/proxmox/nodes/vms/vms_types.go +++ b/proxmox/nodes/vms/vms_types.go @@ -15,14 +15,14 @@ import ( "strconv" "strings" - "github.com/bpg/terraform-provider-proxmox/internal/types" + types2 "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // CustomAgent handles QEMU agent parameters. type CustomAgent struct { - Enabled *types.CustomBool `json:"enabled,omitempty" url:"enabled,int"` - TrimClonedDisks *types.CustomBool `json:"fstrim_cloned_disks" url:"fstrim_cloned_disks,int"` - Type *string `json:"type" url:"type"` + Enabled *types2.CustomBool `json:"enabled,omitempty" url:"enabled,int"` + TrimClonedDisks *types2.CustomBool `json:"fstrim_cloned_disks" url:"fstrim_cloned_disks,int"` + Type *string `json:"type" url:"type"` } // CustomAudioDevice handles QEMU audio parameters. @@ -73,33 +73,33 @@ type CustomCloudInitSSHKeys []string // CustomCPUEmulation handles QEMU CPU emulation parameters. type CustomCPUEmulation struct { - Flags *[]string `json:"flags,omitempty" url:"flags,omitempty,semicolon"` - Hidden *types.CustomBool `json:"hidden,omitempty" url:"hidden,omitempty,int"` - HVVendorID *string `json:"hv-vendor-id,omitempty" url:"hv-vendor-id,omitempty"` - Type string `json:"cputype,omitempty" url:"cputype,omitempty"` + Flags *[]string `json:"flags,omitempty" url:"flags,omitempty,semicolon"` + Hidden *types2.CustomBool `json:"hidden,omitempty" url:"hidden,omitempty,int"` + HVVendorID *string `json:"hv-vendor-id,omitempty" url:"hv-vendor-id,omitempty"` + Type string `json:"cputype,omitempty" url:"cputype,omitempty"` } // CustomEFIDisk handles QEMU EFI disk parameters. type CustomEFIDisk struct { - FileVolume string `json:"file" url:"file"` - Format *string `json:"format,omitempty" url:"format,omitempty"` - Type *string `json:"efitype,omitempty" url:"efitype,omitempty"` - PreEnrolledKeys *types.CustomBool `json:"pre-enrolled-keys,omitempty" url:"pre-enrolled-keys,omitempty,int"` + FileVolume string `json:"file" url:"file"` + Format *string `json:"format,omitempty" url:"format,omitempty"` + Type *string `json:"efitype,omitempty" url:"efitype,omitempty"` + PreEnrolledKeys *types2.CustomBool `json:"pre-enrolled-keys,omitempty" url:"pre-enrolled-keys,omitempty,int"` } // CustomNetworkDevice handles QEMU network device parameters. type CustomNetworkDevice struct { - Model string `json:"model" url:"model"` - Bridge *string `json:"bridge,omitempty" url:"bridge,omitempty"` - Enabled bool `json:"-" url:"-"` - Firewall *types.CustomBool `json:"firewall,omitempty" url:"firewall,omitempty,int"` - LinkDown *types.CustomBool `json:"link_down,omitempty" url:"link_down,omitempty,int"` - MACAddress *string `json:"macaddr,omitempty" url:"macaddr,omitempty"` - Queues *int `json:"queues,omitempty" url:"queues,omitempty"` - RateLimit *float64 `json:"rate,omitempty" url:"rate,omitempty"` - Tag *int `json:"tag,omitempty" url:"tag,omitempty"` - MTU *int `json:"mtu,omitempty" url:"mtu,omitempty"` - Trunks []int `json:"trunks,omitempty" url:"trunks,omitempty"` + Model string `json:"model" url:"model"` + Bridge *string `json:"bridge,omitempty" url:"bridge,omitempty"` + Enabled bool `json:"-" url:"-"` + Firewall *types2.CustomBool `json:"firewall,omitempty" url:"firewall,omitempty,int"` + LinkDown *types2.CustomBool `json:"link_down,omitempty" url:"link_down,omitempty,int"` + MACAddress *string `json:"macaddr,omitempty" url:"macaddr,omitempty"` + Queues *int `json:"queues,omitempty" url:"queues,omitempty"` + RateLimit *float64 `json:"rate,omitempty" url:"rate,omitempty"` + Tag *int `json:"tag,omitempty" url:"tag,omitempty"` + MTU *int `json:"mtu,omitempty" url:"mtu,omitempty"` + Trunks []int `json:"trunks,omitempty" url:"trunks,omitempty"` } // CustomNetworkDevices handles QEMU network device parameters. @@ -118,13 +118,13 @@ type CustomNUMADevices []CustomNUMADevice // CustomPCIDevice handles QEMU host PCI device mapping parameters. type CustomPCIDevice struct { - DeviceIDs *[]string `json:"host,omitempty" url:"host,omitempty,semicolon"` - Mapping *string `json:"mapping,omitempty" url:"mapping,omitempty"` - MDev *string `json:"mdev,omitempty" url:"mdev,omitempty"` - PCIExpress *types.CustomBool `json:"pcie,omitempty" url:"pcie,omitempty,int"` - ROMBAR *types.CustomBool `json:"rombar,omitempty" url:"rombar,omitempty,int"` - ROMFile *string `json:"romfile,omitempty" url:"romfile,omitempty"` - XVGA *types.CustomBool `json:"x-vga,omitempty" url:"x-vga,omitempty,int"` + DeviceIDs *[]string `json:"host,omitempty" url:"host,omitempty,semicolon"` + Mapping *string `json:"mapping,omitempty" url:"mapping,omitempty"` + MDev *string `json:"mdev,omitempty" url:"mdev,omitempty"` + PCIExpress *types2.CustomBool `json:"pcie,omitempty" url:"pcie,omitempty,int"` + ROMBAR *types2.CustomBool `json:"rombar,omitempty" url:"rombar,omitempty,int"` + ROMFile *string `json:"romfile,omitempty" url:"romfile,omitempty"` + XVGA *types2.CustomBool `json:"x-vga,omitempty" url:"x-vga,omitempty,int"` } // CustomPCIDevices handles QEMU host PCI device mapping parameters. @@ -141,20 +141,20 @@ type CustomSharedMemory struct { // CustomSMBIOS handles QEMU SMBIOS parameters. type CustomSMBIOS struct { - Base64 *types.CustomBool `json:"base64,omitempty" url:"base64,omitempty,int"` - Family *string `json:"family,omitempty" url:"family,omitempty"` - Manufacturer *string `json:"manufacturer,omitempty" url:"manufacturer,omitempty"` - Product *string `json:"product,omitempty" url:"product,omitempty"` - Serial *string `json:"serial,omitempty" url:"serial,omitempty"` - SKU *string `json:"sku,omitempty" url:"sku,omitempty"` - UUID *string `json:"uuid,omitempty" url:"uuid,omitempty"` - Version *string `json:"version,omitempty" url:"version,omitempty"` + Base64 *types2.CustomBool `json:"base64,omitempty" url:"base64,omitempty,int"` + Family *string `json:"family,omitempty" url:"family,omitempty"` + Manufacturer *string `json:"manufacturer,omitempty" url:"manufacturer,omitempty"` + Product *string `json:"product,omitempty" url:"product,omitempty"` + Serial *string `json:"serial,omitempty" url:"serial,omitempty"` + SKU *string `json:"sku,omitempty" url:"sku,omitempty"` + UUID *string `json:"uuid,omitempty" url:"uuid,omitempty"` + Version *string `json:"version,omitempty" url:"version,omitempty"` } // CustomSpiceEnhancements handles QEMU spice enhancement parameters. type CustomSpiceEnhancements struct { - FolderSharing *types.CustomBool `json:"foldersharing,omitempty" url:"foldersharing,omitempty"` - VideoStreaming *string `json:"videostreaming,omitempty" url:"videostreaming,omitempty"` + FolderSharing *types2.CustomBool `json:"foldersharing,omitempty" url:"foldersharing,omitempty"` + VideoStreaming *string `json:"videostreaming,omitempty" url:"videostreaming,omitempty"` } // CustomStartupOrder handles QEMU startup order parameters. @@ -166,21 +166,21 @@ type CustomStartupOrder struct { // CustomStorageDevice handles QEMU SATA device parameters. type CustomStorageDevice struct { - AIO *string `json:"aio,omitempty" url:"aio,omitempty"` - BackupEnabled *types.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"` - BurstableReadSpeedMbps *int `json:"mbps_rd_max,omitempty" url:"mbps_rd_max,omitempty"` - Cache *string `json:"cache,omitempty" url:"cache,omitempty"` - BurstableWriteSpeedMbps *int `json:"mbps_wr_max,omitempty" url:"mbps_wr_max,omitempty"` - Discard *string `json:"discard,omitempty" url:"discard,omitempty"` - Enabled bool `json:"-" url:"-"` - FileVolume string `json:"file" url:"file"` - Format *string `json:"format,omitempty" url:"format,omitempty"` - IOThread *types.CustomBool `json:"iothread,omitempty" url:"iothread,omitempty,int"` - SSD *types.CustomBool `json:"ssd,omitempty" url:"ssd,omitempty,int"` - MaxReadSpeedMbps *int `json:"mbps_rd,omitempty" url:"mbps_rd,omitempty"` - MaxWriteSpeedMbps *int `json:"mbps_wr,omitempty" url:"mbps_wr,omitempty"` - Media *string `json:"media,omitempty" url:"media,omitempty"` - Size *types.DiskSize `json:"size,omitempty" url:"size,omitempty"` + AIO *string `json:"aio,omitempty" url:"aio,omitempty"` + BackupEnabled *types2.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"` + BurstableReadSpeedMbps *int `json:"mbps_rd_max,omitempty" url:"mbps_rd_max,omitempty"` + Cache *string `json:"cache,omitempty" url:"cache,omitempty"` + BurstableWriteSpeedMbps *int `json:"mbps_wr_max,omitempty" url:"mbps_wr_max,omitempty"` + Discard *string `json:"discard,omitempty" url:"discard,omitempty"` + Enabled bool `json:"-" url:"-"` + FileVolume string `json:"file" url:"file"` + Format *string `json:"format,omitempty" url:"format,omitempty"` + IOThread *types2.CustomBool `json:"iothread,omitempty" url:"iothread,omitempty,int"` + SSD *types2.CustomBool `json:"ssd,omitempty" url:"ssd,omitempty,int"` + MaxReadSpeedMbps *int `json:"mbps_rd,omitempty" url:"mbps_rd,omitempty"` + MaxWriteSpeedMbps *int `json:"mbps_wr,omitempty" url:"mbps_wr,omitempty"` + Media *string `json:"media,omitempty" url:"media,omitempty"` + Size *types2.DiskSize `json:"size,omitempty" url:"size,omitempty"` Interface *string ID *string FileID *string @@ -192,8 +192,8 @@ type CustomStorageDevices map[string]CustomStorageDevice // CustomUSBDevice handles QEMU USB device parameters. type CustomUSBDevice struct { - HostDevice string `json:"host" url:"host"` - USB3 *types.CustomBool `json:"usb3,omitempty" url:"usb3,omitempty,int"` + HostDevice string `json:"host" url:"host"` + USB3 *types2.CustomBool `json:"usb3,omitempty" url:"usb3,omitempty,int"` } // CustomUSBDevices handles QEMU USB device parameters. @@ -207,10 +207,10 @@ type CustomVGADevice struct { // CustomVirtualIODevice handles QEMU VirtIO device parameters. type CustomVirtualIODevice struct { - AIO *string `json:"aio,omitempty" url:"aio,omitempty"` - BackupEnabled *types.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"` - Enabled bool `json:"-" url:"-"` - FileVolume string `json:"file" url:"file"` + AIO *string `json:"aio,omitempty" url:"aio,omitempty"` + BackupEnabled *types2.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"` + Enabled bool `json:"-" url:"-"` + FileVolume string `json:"file" url:"file"` } // CustomVirtualIODevices handles QEMU VirtIO device parameters. @@ -224,89 +224,89 @@ type CustomWatchdogDevice struct { // CloneRequestBody contains the data for an virtual machine clone request. type CloneRequestBody struct { - BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"` - Description *string `json:"description,omitempty" url:"description,omitempty"` - FullCopy *types.CustomBool `json:"full,omitempty" url:"full,omitempty,int"` - Name *string `json:"name,omitempty" url:"name,omitempty"` - PoolID *string `json:"pool,omitempty" url:"pool,omitempty"` - SnapshotName *string `json:"snapname,omitempty" url:"snapname,omitempty"` - TargetNodeName *string `json:"target,omitempty" url:"target,omitempty"` - TargetStorage *string `json:"storage,omitempty" url:"storage,omitempty"` - TargetStorageFormat *string `json:"format,omitempty" url:"format,omitempty"` - VMIDNew int `json:"newid" url:"newid"` + BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"` + Description *string `json:"description,omitempty" url:"description,omitempty"` + FullCopy *types2.CustomBool `json:"full,omitempty" url:"full,omitempty,int"` + Name *string `json:"name,omitempty" url:"name,omitempty"` + PoolID *string `json:"pool,omitempty" url:"pool,omitempty"` + SnapshotName *string `json:"snapname,omitempty" url:"snapname,omitempty"` + TargetNodeName *string `json:"target,omitempty" url:"target,omitempty"` + TargetStorage *string `json:"storage,omitempty" url:"storage,omitempty"` + TargetStorageFormat *string `json:"format,omitempty" url:"format,omitempty"` + VMIDNew int `json:"newid" url:"newid"` } // CreateRequestBody contains the data for a virtual machine create request. type CreateRequestBody struct { - ACPI *types.CustomBool `json:"acpi,omitempty" url:"acpi,omitempty,int"` - Agent *CustomAgent `json:"agent,omitempty" url:"agent,omitempty"` - AllowReboot *types.CustomBool `json:"reboot,omitempty" url:"reboot,omitempty,int"` - AudioDevices CustomAudioDevices `json:"audio,omitempty" url:"audio,omitempty"` - Autostart *types.CustomBool `json:"autostart,omitempty" url:"autostart,omitempty,int"` - BackupFile *string `json:"archive,omitempty" url:"archive,omitempty"` - BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"` - BIOS *string `json:"bios,omitempty" url:"bios,omitempty"` - Boot *CustomBoot `json:"boot,omitempty" url:"boot,omitempty"` - CDROM *string `json:"cdrom,omitempty" url:"cdrom,omitempty"` - CloudInitConfig *CustomCloudInitConfig `json:"cloudinit,omitempty" url:"cloudinit,omitempty"` - CPUArchitecture *string `json:"arch,omitempty" url:"arch,omitempty"` - CPUCores *int `json:"cores,omitempty" url:"cores,omitempty"` - CPUEmulation *CustomCPUEmulation `json:"cpu,omitempty" url:"cpu,omitempty"` - CPULimit *int `json:"cpulimit,omitempty" url:"cpulimit,omitempty"` - CPUSockets *int `json:"sockets,omitempty" url:"sockets,omitempty"` - CPUUnits *int `json:"cpuunits,omitempty" url:"cpuunits,omitempty"` - DedicatedMemory *int `json:"memory,omitempty" url:"memory,omitempty"` - Delete []string `json:"delete,omitempty" url:"delete,omitempty,comma"` - DeletionProtection *types.CustomBool `json:"protection,omitempty" url:"force,omitempty,int"` - Description *string `json:"description,omitempty" url:"description,omitempty"` - EFIDisk *CustomEFIDisk `json:"efidisk0,omitempty" url:"efidisk0,omitempty"` - FloatingMemory *int `json:"balloon,omitempty" url:"balloon,omitempty"` - FloatingMemoryShares *int `json:"shares,omitempty" url:"shares,omitempty"` - Freeze *types.CustomBool `json:"freeze,omitempty" url:"freeze,omitempty,int"` - HookScript *string `json:"hookscript,omitempty" url:"hookscript,omitempty"` - Hotplug types.CustomCommaSeparatedList `json:"hotplug,omitempty" url:"hotplug,omitempty,comma"` - Hugepages *string `json:"hugepages,omitempty" url:"hugepages,omitempty"` - IDEDevices CustomStorageDevices `json:"ide,omitempty" url:",omitempty"` - KeyboardLayout *string `json:"keyboard,omitempty" url:"keyboard,omitempty"` - KVMArguments *string `json:"args,omitempty" url:"args,omitempty,space"` - KVMEnabled *types.CustomBool `json:"kvm,omitempty" url:"kvm,omitempty,int"` - LocalTime *types.CustomBool `json:"localtime,omitempty" url:"localtime,omitempty,int"` - Lock *string `json:"lock,omitempty" url:"lock,omitempty"` - Machine *string `json:"machine,omitempty" url:"machine,omitempty"` - MigrateDowntime *float64 `json:"migrate_downtime,omitempty" url:"migrate_downtime,omitempty"` - MigrateSpeed *int `json:"migrate_speed,omitempty" url:"migrate_speed,omitempty"` - Name *string `json:"name,omitempty" url:"name,omitempty"` - NetworkDevices CustomNetworkDevices `json:"net,omitempty" url:"net,omitempty"` - NUMADevices CustomNUMADevices `json:"numa_devices,omitempty" url:"numa,omitempty"` - NUMAEnabled *types.CustomBool `json:"numa,omitempty" url:"numa,omitempty,int"` - OSType *string `json:"ostype,omitempty" url:"ostype,omitempty"` - Overwrite *types.CustomBool `json:"force,omitempty" url:"force,omitempty,int"` - PCIDevices CustomPCIDevices `json:"hostpci,omitempty" url:"hostpci,omitempty"` - PoolID *string `json:"pool,omitempty" url:"pool,omitempty"` - Revert *string `json:"revert,omitempty" url:"revert,omitempty"` - SATADevices CustomStorageDevices `json:"sata,omitempty" url:"sata,omitempty"` - SCSIDevices CustomStorageDevices `json:"scsi,omitempty" url:"scsi,omitempty"` - SCSIHardware *string `json:"scsihw,omitempty" url:"scsihw,omitempty"` - SerialDevices CustomSerialDevices `json:"serial,omitempty" url:"serial,omitempty"` - SharedMemory *CustomSharedMemory `json:"ivshmem,omitempty" url:"ivshmem,omitempty"` - SkipLock *types.CustomBool `json:"skiplock,omitempty" url:"skiplock,omitempty,int"` - SMBIOS *CustomSMBIOS `json:"smbios1,omitempty" url:"smbios1,omitempty"` - SpiceEnhancements *CustomSpiceEnhancements `json:"spice_enhancements,omitempty" url:"spice_enhancements,omitempty"` - StartDate *string `json:"startdate,omitempty" url:"startdate,omitempty"` - StartOnBoot *types.CustomBool `json:"onboot,omitempty" url:"onboot,omitempty,int"` - StartupOrder *CustomStartupOrder `json:"startup,omitempty" url:"startup,omitempty"` - TabletDeviceEnabled *types.CustomBool `json:"tablet,omitempty" url:"tablet,omitempty,int"` - Tags *string `json:"tags,omitempty" url:"tags,omitempty"` - Template *types.CustomBool `json:"template,omitempty" url:"template,omitempty,int"` - TimeDriftFixEnabled *types.CustomBool `json:"tdf,omitempty" url:"tdf,omitempty,int"` - USBDevices CustomUSBDevices `json:"usb,omitempty" url:"usb,omitempty"` - VGADevice *CustomVGADevice `json:"vga,omitempty" url:"vga,omitempty"` - VirtualCPUCount *int `json:"vcpus,omitempty" url:"vcpus,omitempty"` - VirtualIODevices CustomStorageDevices `json:"virtio,omitempty" url:"virtio,omitempty"` - VMGenerationID *string `json:"vmgenid,omitempty" url:"vmgenid,omitempty"` - VMID *int `json:"vmid,omitempty" url:"vmid,omitempty"` - VMStateDatastoreID *string `json:"vmstatestorage,omitempty" url:"vmstatestorage,omitempty"` - WatchdogDevice *CustomWatchdogDevice `json:"watchdog,omitempty" url:"watchdog,omitempty"` + ACPI *types2.CustomBool `json:"acpi,omitempty" url:"acpi,omitempty,int"` + Agent *CustomAgent `json:"agent,omitempty" url:"agent,omitempty"` + AllowReboot *types2.CustomBool `json:"reboot,omitempty" url:"reboot,omitempty,int"` + AudioDevices CustomAudioDevices `json:"audio,omitempty" url:"audio,omitempty"` + Autostart *types2.CustomBool `json:"autostart,omitempty" url:"autostart,omitempty,int"` + BackupFile *string `json:"archive,omitempty" url:"archive,omitempty"` + BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"` + BIOS *string `json:"bios,omitempty" url:"bios,omitempty"` + Boot *CustomBoot `json:"boot,omitempty" url:"boot,omitempty"` + CDROM *string `json:"cdrom,omitempty" url:"cdrom,omitempty"` + CloudInitConfig *CustomCloudInitConfig `json:"cloudinit,omitempty" url:"cloudinit,omitempty"` + CPUArchitecture *string `json:"arch,omitempty" url:"arch,omitempty"` + CPUCores *int `json:"cores,omitempty" url:"cores,omitempty"` + CPUEmulation *CustomCPUEmulation `json:"cpu,omitempty" url:"cpu,omitempty"` + CPULimit *int `json:"cpulimit,omitempty" url:"cpulimit,omitempty"` + CPUSockets *int `json:"sockets,omitempty" url:"sockets,omitempty"` + CPUUnits *int `json:"cpuunits,omitempty" url:"cpuunits,omitempty"` + DedicatedMemory *int `json:"memory,omitempty" url:"memory,omitempty"` + Delete []string `json:"delete,omitempty" url:"delete,omitempty,comma"` + DeletionProtection *types2.CustomBool `json:"protection,omitempty" url:"force,omitempty,int"` + Description *string `json:"description,omitempty" url:"description,omitempty"` + EFIDisk *CustomEFIDisk `json:"efidisk0,omitempty" url:"efidisk0,omitempty"` + FloatingMemory *int `json:"balloon,omitempty" url:"balloon,omitempty"` + FloatingMemoryShares *int `json:"shares,omitempty" url:"shares,omitempty"` + Freeze *types2.CustomBool `json:"freeze,omitempty" url:"freeze,omitempty,int"` + HookScript *string `json:"hookscript,omitempty" url:"hookscript,omitempty"` + Hotplug types2.CustomCommaSeparatedList `json:"hotplug,omitempty" url:"hotplug,omitempty,comma"` + Hugepages *string `json:"hugepages,omitempty" url:"hugepages,omitempty"` + IDEDevices CustomStorageDevices `json:"ide,omitempty" url:",omitempty"` + KeyboardLayout *string `json:"keyboard,omitempty" url:"keyboard,omitempty"` + KVMArguments *string `json:"args,omitempty" url:"args,omitempty,space"` + KVMEnabled *types2.CustomBool `json:"kvm,omitempty" url:"kvm,omitempty,int"` + LocalTime *types2.CustomBool `json:"localtime,omitempty" url:"localtime,omitempty,int"` + Lock *string `json:"lock,omitempty" url:"lock,omitempty"` + Machine *string `json:"machine,omitempty" url:"machine,omitempty"` + MigrateDowntime *float64 `json:"migrate_downtime,omitempty" url:"migrate_downtime,omitempty"` + MigrateSpeed *int `json:"migrate_speed,omitempty" url:"migrate_speed,omitempty"` + Name *string `json:"name,omitempty" url:"name,omitempty"` + NetworkDevices CustomNetworkDevices `json:"net,omitempty" url:"net,omitempty"` + NUMADevices CustomNUMADevices `json:"numa_devices,omitempty" url:"numa,omitempty"` + NUMAEnabled *types2.CustomBool `json:"numa,omitempty" url:"numa,omitempty,int"` + OSType *string `json:"ostype,omitempty" url:"ostype,omitempty"` + Overwrite *types2.CustomBool `json:"force,omitempty" url:"force,omitempty,int"` + PCIDevices CustomPCIDevices `json:"hostpci,omitempty" url:"hostpci,omitempty"` + PoolID *string `json:"pool,omitempty" url:"pool,omitempty"` + Revert *string `json:"revert,omitempty" url:"revert,omitempty"` + SATADevices CustomStorageDevices `json:"sata,omitempty" url:"sata,omitempty"` + SCSIDevices CustomStorageDevices `json:"scsi,omitempty" url:"scsi,omitempty"` + SCSIHardware *string `json:"scsihw,omitempty" url:"scsihw,omitempty"` + SerialDevices CustomSerialDevices `json:"serial,omitempty" url:"serial,omitempty"` + SharedMemory *CustomSharedMemory `json:"ivshmem,omitempty" url:"ivshmem,omitempty"` + SkipLock *types2.CustomBool `json:"skiplock,omitempty" url:"skiplock,omitempty,int"` + SMBIOS *CustomSMBIOS `json:"smbios1,omitempty" url:"smbios1,omitempty"` + SpiceEnhancements *CustomSpiceEnhancements `json:"spice_enhancements,omitempty" url:"spice_enhancements,omitempty"` + StartDate *string `json:"startdate,omitempty" url:"startdate,omitempty"` + StartOnBoot *types2.CustomBool `json:"onboot,omitempty" url:"onboot,omitempty,int"` + StartupOrder *CustomStartupOrder `json:"startup,omitempty" url:"startup,omitempty"` + TabletDeviceEnabled *types2.CustomBool `json:"tablet,omitempty" url:"tablet,omitempty,int"` + Tags *string `json:"tags,omitempty" url:"tags,omitempty"` + Template *types2.CustomBool `json:"template,omitempty" url:"template,omitempty,int"` + TimeDriftFixEnabled *types2.CustomBool `json:"tdf,omitempty" url:"tdf,omitempty,int"` + USBDevices CustomUSBDevices `json:"usb,omitempty" url:"usb,omitempty"` + VGADevice *CustomVGADevice `json:"vga,omitempty" url:"vga,omitempty"` + VirtualCPUCount *int `json:"vcpus,omitempty" url:"vcpus,omitempty"` + VirtualIODevices CustomStorageDevices `json:"virtio,omitempty" url:"virtio,omitempty"` + VMGenerationID *string `json:"vmgenid,omitempty" url:"vmgenid,omitempty"` + VMID *int `json:"vmid,omitempty" url:"vmid,omitempty"` + VMStateDatastoreID *string `json:"vmstatestorage,omitempty" url:"vmstatestorage,omitempty"` + WatchdogDevice *CustomWatchdogDevice `json:"watchdog,omitempty" url:"watchdog,omitempty"` } // CreateResponseBody contains the body from a create response. @@ -358,137 +358,137 @@ type GetResponseBody struct { // GetResponseData contains the data from an virtual machine get response. type GetResponseData struct { - ACPI *types.CustomBool `json:"acpi,omitempty"` - Agent *CustomAgent `json:"agent,omitempty"` - AllowReboot *types.CustomBool `json:"reboot,omitempty"` - AudioDevice *CustomAudioDevice `json:"audio0,omitempty"` - Autostart *types.CustomBool `json:"autostart,omitempty"` - BackupFile *string `json:"archive,omitempty"` - BandwidthLimit *int `json:"bwlimit,omitempty"` - BIOS *string `json:"bios,omitempty"` - BootDisk *string `json:"bootdisk,omitempty"` - BootOrder *string `json:"boot,omitempty"` - CDROM *string `json:"cdrom,omitempty"` - CloudInitDNSDomain *string `json:"searchdomain,omitempty"` - CloudInitDNSServer *string `json:"nameserver,omitempty"` - CloudInitFiles *CustomCloudInitFiles `json:"cicustom,omitempty"` - CloudInitPassword *string `json:"cipassword,omitempty"` - CloudInitSSHKeys *CustomCloudInitSSHKeys `json:"sshkeys,omitempty"` - CloudInitType *string `json:"citype,omitempty"` - CloudInitUsername *string `json:"ciuser,omitempty"` - CPUArchitecture *string `json:"arch,omitempty"` - CPUCores *int `json:"cores,omitempty"` - CPUEmulation *CustomCPUEmulation `json:"cpu,omitempty"` - CPULimit *int `json:"cpulimit,omitempty"` - CPUSockets *int `json:"sockets,omitempty"` - CPUUnits *int `json:"cpuunits,omitempty"` - DedicatedMemory *int `json:"memory,omitempty"` - DeletionProtection *types.CustomBool `json:"protection,omitempty"` - Description *string `json:"description,omitempty"` - EFIDisk *CustomEFIDisk `json:"efidisk0,omitempty"` - FloatingMemory *int `json:"balloon,omitempty"` - FloatingMemoryShares *int `json:"shares,omitempty"` - Freeze *types.CustomBool `json:"freeze,omitempty"` - HookScript *string `json:"hookscript,omitempty"` - Hotplug *types.CustomCommaSeparatedList `json:"hotplug,omitempty"` - Hugepages *string `json:"hugepages,omitempty"` - IDEDevice0 *CustomStorageDevice `json:"ide0,omitempty"` - IDEDevice1 *CustomStorageDevice `json:"ide1,omitempty"` - IDEDevice2 *CustomStorageDevice `json:"ide2,omitempty"` - IDEDevice3 *CustomStorageDevice `json:"ide3,omitempty"` - IPConfig0 *CustomCloudInitIPConfig `json:"ipconfig0,omitempty"` - IPConfig1 *CustomCloudInitIPConfig `json:"ipconfig1,omitempty"` - IPConfig2 *CustomCloudInitIPConfig `json:"ipconfig2,omitempty"` - IPConfig3 *CustomCloudInitIPConfig `json:"ipconfig3,omitempty"` - IPConfig4 *CustomCloudInitIPConfig `json:"ipconfig4,omitempty"` - IPConfig5 *CustomCloudInitIPConfig `json:"ipconfig5,omitempty"` - IPConfig6 *CustomCloudInitIPConfig `json:"ipconfig6,omitempty"` - IPConfig7 *CustomCloudInitIPConfig `json:"ipconfig7,omitempty"` - KeyboardLayout *string `json:"keyboard,omitempty"` - KVMArguments *string `json:"args,omitempty"` - KVMEnabled *types.CustomBool `json:"kvm,omitempty"` - LocalTime *types.CustomBool `json:"localtime,omitempty"` - Lock *string `json:"lock,omitempty"` - Machine *string `json:"machine,omitempty"` - MigrateDowntime *float64 `json:"migrate_downtime,omitempty"` - MigrateSpeed *int `json:"migrate_speed,omitempty"` - Name *string `json:"name,omitempty"` - NetworkDevice0 *CustomNetworkDevice `json:"net0,omitempty"` - NetworkDevice1 *CustomNetworkDevice `json:"net1,omitempty"` - NetworkDevice2 *CustomNetworkDevice `json:"net2,omitempty"` - NetworkDevice3 *CustomNetworkDevice `json:"net3,omitempty"` - NetworkDevice4 *CustomNetworkDevice `json:"net4,omitempty"` - NetworkDevice5 *CustomNetworkDevice `json:"net5,omitempty"` - NetworkDevice6 *CustomNetworkDevice `json:"net6,omitempty"` - NetworkDevice7 *CustomNetworkDevice `json:"net7,omitempty"` - NUMADevices *CustomNUMADevices `json:"numa_devices,omitempty"` - NUMAEnabled *types.CustomBool `json:"numa,omitempty"` - OSType *string `json:"ostype,omitempty"` - Overwrite *types.CustomBool `json:"force,omitempty"` - PCIDevice0 *CustomPCIDevice `json:"hostpci0,omitempty"` - PCIDevice1 *CustomPCIDevice `json:"hostpci1,omitempty"` - PCIDevice2 *CustomPCIDevice `json:"hostpci2,omitempty"` - PCIDevice3 *CustomPCIDevice `json:"hostpci3,omitempty"` - PoolID *string `json:"pool,omitempty" url:"pool,omitempty"` - Revert *string `json:"revert,omitempty"` - SATADevice0 *CustomStorageDevice `json:"sata0,omitempty"` - SATADevice1 *CustomStorageDevice `json:"sata1,omitempty"` - SATADevice2 *CustomStorageDevice `json:"sata2,omitempty"` - SATADevice3 *CustomStorageDevice `json:"sata3,omitempty"` - SATADevice4 *CustomStorageDevice `json:"sata4,omitempty"` - SATADevice5 *CustomStorageDevice `json:"sata5,omitempty"` - SCSIDevice0 *CustomStorageDevice `json:"scsi0,omitempty"` - SCSIDevice1 *CustomStorageDevice `json:"scsi1,omitempty"` - SCSIDevice2 *CustomStorageDevice `json:"scsi2,omitempty"` - SCSIDevice3 *CustomStorageDevice `json:"scsi3,omitempty"` - SCSIDevice4 *CustomStorageDevice `json:"scsi4,omitempty"` - SCSIDevice5 *CustomStorageDevice `json:"scsi5,omitempty"` - SCSIDevice6 *CustomStorageDevice `json:"scsi6,omitempty"` - SCSIDevice7 *CustomStorageDevice `json:"scsi7,omitempty"` - SCSIDevice8 *CustomStorageDevice `json:"scsi8,omitempty"` - SCSIDevice9 *CustomStorageDevice `json:"scsi9,omitempty"` - SCSIDevice10 *CustomStorageDevice `json:"scsi10,omitempty"` - SCSIDevice11 *CustomStorageDevice `json:"scsi11,omitempty"` - SCSIDevice12 *CustomStorageDevice `json:"scsi12,omitempty"` - SCSIDevice13 *CustomStorageDevice `json:"scsi13,omitempty"` - SCSIHardware *string `json:"scsihw,omitempty"` - SerialDevice0 *string `json:"serial0,omitempty"` - SerialDevice1 *string `json:"serial1,omitempty"` - SerialDevice2 *string `json:"serial2,omitempty"` - SerialDevice3 *string `json:"serial3,omitempty"` - SharedMemory *CustomSharedMemory `json:"ivshmem,omitempty"` - SkipLock *types.CustomBool `json:"skiplock,omitempty"` - SMBIOS *CustomSMBIOS `json:"smbios1,omitempty"` - SpiceEnhancements *CustomSpiceEnhancements `json:"spice_enhancements,omitempty"` - StartDate *string `json:"startdate,omitempty"` - StartOnBoot *types.CustomBool `json:"onboot,omitempty"` - StartupOrder *CustomStartupOrder `json:"startup,omitempty"` - TabletDeviceEnabled *types.CustomBool `json:"tablet,omitempty"` - Tags *string `json:"tags,omitempty"` - Template *types.CustomBool `json:"template,omitempty"` - TimeDriftFixEnabled *types.CustomBool `json:"tdf,omitempty"` - USBDevices *CustomUSBDevices `json:"usb,omitempty"` - VGADevice *CustomVGADevice `json:"vga,omitempty"` - VirtualCPUCount *int `json:"vcpus,omitempty"` - VirtualIODevice0 *CustomStorageDevice `json:"virtio0,omitempty"` - VirtualIODevice1 *CustomStorageDevice `json:"virtio1,omitempty"` - VirtualIODevice2 *CustomStorageDevice `json:"virtio2,omitempty"` - VirtualIODevice3 *CustomStorageDevice `json:"virtio3,omitempty"` - VirtualIODevice4 *CustomStorageDevice `json:"virtio4,omitempty"` - VirtualIODevice5 *CustomStorageDevice `json:"virtio5,omitempty"` - VirtualIODevice6 *CustomStorageDevice `json:"virtio6,omitempty"` - VirtualIODevice7 *CustomStorageDevice `json:"virtio7,omitempty"` - VirtualIODevice8 *CustomStorageDevice `json:"virtio8,omitempty"` - VirtualIODevice9 *CustomStorageDevice `json:"virtio9,omitempty"` - VirtualIODevice10 *CustomStorageDevice `json:"virtio10,omitempty"` - VirtualIODevice11 *CustomStorageDevice `json:"virtio11,omitempty"` - VirtualIODevice12 *CustomStorageDevice `json:"virtio12,omitempty"` - VirtualIODevice13 *CustomStorageDevice `json:"virtio13,omitempty"` - VirtualIODevice14 *CustomStorageDevice `json:"virtio14,omitempty"` - VirtualIODevice15 *CustomStorageDevice `json:"virtio15,omitempty"` - VMGenerationID *string `json:"vmgenid,omitempty"` - VMStateDatastoreID *string `json:"vmstatestorage,omitempty"` - WatchdogDevice *CustomWatchdogDevice `json:"watchdog,omitempty"` + ACPI *types2.CustomBool `json:"acpi,omitempty"` + Agent *CustomAgent `json:"agent,omitempty"` + AllowReboot *types2.CustomBool `json:"reboot,omitempty"` + AudioDevice *CustomAudioDevice `json:"audio0,omitempty"` + Autostart *types2.CustomBool `json:"autostart,omitempty"` + BackupFile *string `json:"archive,omitempty"` + BandwidthLimit *int `json:"bwlimit,omitempty"` + BIOS *string `json:"bios,omitempty"` + BootDisk *string `json:"bootdisk,omitempty"` + BootOrder *string `json:"boot,omitempty"` + CDROM *string `json:"cdrom,omitempty"` + CloudInitDNSDomain *string `json:"searchdomain,omitempty"` + CloudInitDNSServer *string `json:"nameserver,omitempty"` + CloudInitFiles *CustomCloudInitFiles `json:"cicustom,omitempty"` + CloudInitPassword *string `json:"cipassword,omitempty"` + CloudInitSSHKeys *CustomCloudInitSSHKeys `json:"sshkeys,omitempty"` + CloudInitType *string `json:"citype,omitempty"` + CloudInitUsername *string `json:"ciuser,omitempty"` + CPUArchitecture *string `json:"arch,omitempty"` + CPUCores *int `json:"cores,omitempty"` + CPUEmulation *CustomCPUEmulation `json:"cpu,omitempty"` + CPULimit *int `json:"cpulimit,omitempty"` + CPUSockets *int `json:"sockets,omitempty"` + CPUUnits *int `json:"cpuunits,omitempty"` + DedicatedMemory *int `json:"memory,omitempty"` + DeletionProtection *types2.CustomBool `json:"protection,omitempty"` + Description *string `json:"description,omitempty"` + EFIDisk *CustomEFIDisk `json:"efidisk0,omitempty"` + FloatingMemory *int `json:"balloon,omitempty"` + FloatingMemoryShares *int `json:"shares,omitempty"` + Freeze *types2.CustomBool `json:"freeze,omitempty"` + HookScript *string `json:"hookscript,omitempty"` + Hotplug *types2.CustomCommaSeparatedList `json:"hotplug,omitempty"` + Hugepages *string `json:"hugepages,omitempty"` + IDEDevice0 *CustomStorageDevice `json:"ide0,omitempty"` + IDEDevice1 *CustomStorageDevice `json:"ide1,omitempty"` + IDEDevice2 *CustomStorageDevice `json:"ide2,omitempty"` + IDEDevice3 *CustomStorageDevice `json:"ide3,omitempty"` + IPConfig0 *CustomCloudInitIPConfig `json:"ipconfig0,omitempty"` + IPConfig1 *CustomCloudInitIPConfig `json:"ipconfig1,omitempty"` + IPConfig2 *CustomCloudInitIPConfig `json:"ipconfig2,omitempty"` + IPConfig3 *CustomCloudInitIPConfig `json:"ipconfig3,omitempty"` + IPConfig4 *CustomCloudInitIPConfig `json:"ipconfig4,omitempty"` + IPConfig5 *CustomCloudInitIPConfig `json:"ipconfig5,omitempty"` + IPConfig6 *CustomCloudInitIPConfig `json:"ipconfig6,omitempty"` + IPConfig7 *CustomCloudInitIPConfig `json:"ipconfig7,omitempty"` + KeyboardLayout *string `json:"keyboard,omitempty"` + KVMArguments *string `json:"args,omitempty"` + KVMEnabled *types2.CustomBool `json:"kvm,omitempty"` + LocalTime *types2.CustomBool `json:"localtime,omitempty"` + Lock *string `json:"lock,omitempty"` + Machine *string `json:"machine,omitempty"` + MigrateDowntime *float64 `json:"migrate_downtime,omitempty"` + MigrateSpeed *int `json:"migrate_speed,omitempty"` + Name *string `json:"name,omitempty"` + NetworkDevice0 *CustomNetworkDevice `json:"net0,omitempty"` + NetworkDevice1 *CustomNetworkDevice `json:"net1,omitempty"` + NetworkDevice2 *CustomNetworkDevice `json:"net2,omitempty"` + NetworkDevice3 *CustomNetworkDevice `json:"net3,omitempty"` + NetworkDevice4 *CustomNetworkDevice `json:"net4,omitempty"` + NetworkDevice5 *CustomNetworkDevice `json:"net5,omitempty"` + NetworkDevice6 *CustomNetworkDevice `json:"net6,omitempty"` + NetworkDevice7 *CustomNetworkDevice `json:"net7,omitempty"` + NUMADevices *CustomNUMADevices `json:"numa_devices,omitempty"` + NUMAEnabled *types2.CustomBool `json:"numa,omitempty"` + OSType *string `json:"ostype,omitempty"` + Overwrite *types2.CustomBool `json:"force,omitempty"` + PCIDevice0 *CustomPCIDevice `json:"hostpci0,omitempty"` + PCIDevice1 *CustomPCIDevice `json:"hostpci1,omitempty"` + PCIDevice2 *CustomPCIDevice `json:"hostpci2,omitempty"` + PCIDevice3 *CustomPCIDevice `json:"hostpci3,omitempty"` + PoolID *string `json:"pool,omitempty" url:"pool,omitempty"` + Revert *string `json:"revert,omitempty"` + SATADevice0 *CustomStorageDevice `json:"sata0,omitempty"` + SATADevice1 *CustomStorageDevice `json:"sata1,omitempty"` + SATADevice2 *CustomStorageDevice `json:"sata2,omitempty"` + SATADevice3 *CustomStorageDevice `json:"sata3,omitempty"` + SATADevice4 *CustomStorageDevice `json:"sata4,omitempty"` + SATADevice5 *CustomStorageDevice `json:"sata5,omitempty"` + SCSIDevice0 *CustomStorageDevice `json:"scsi0,omitempty"` + SCSIDevice1 *CustomStorageDevice `json:"scsi1,omitempty"` + SCSIDevice2 *CustomStorageDevice `json:"scsi2,omitempty"` + SCSIDevice3 *CustomStorageDevice `json:"scsi3,omitempty"` + SCSIDevice4 *CustomStorageDevice `json:"scsi4,omitempty"` + SCSIDevice5 *CustomStorageDevice `json:"scsi5,omitempty"` + SCSIDevice6 *CustomStorageDevice `json:"scsi6,omitempty"` + SCSIDevice7 *CustomStorageDevice `json:"scsi7,omitempty"` + SCSIDevice8 *CustomStorageDevice `json:"scsi8,omitempty"` + SCSIDevice9 *CustomStorageDevice `json:"scsi9,omitempty"` + SCSIDevice10 *CustomStorageDevice `json:"scsi10,omitempty"` + SCSIDevice11 *CustomStorageDevice `json:"scsi11,omitempty"` + SCSIDevice12 *CustomStorageDevice `json:"scsi12,omitempty"` + SCSIDevice13 *CustomStorageDevice `json:"scsi13,omitempty"` + SCSIHardware *string `json:"scsihw,omitempty"` + SerialDevice0 *string `json:"serial0,omitempty"` + SerialDevice1 *string `json:"serial1,omitempty"` + SerialDevice2 *string `json:"serial2,omitempty"` + SerialDevice3 *string `json:"serial3,omitempty"` + SharedMemory *CustomSharedMemory `json:"ivshmem,omitempty"` + SkipLock *types2.CustomBool `json:"skiplock,omitempty"` + SMBIOS *CustomSMBIOS `json:"smbios1,omitempty"` + SpiceEnhancements *CustomSpiceEnhancements `json:"spice_enhancements,omitempty"` + StartDate *string `json:"startdate,omitempty"` + StartOnBoot *types2.CustomBool `json:"onboot,omitempty"` + StartupOrder *CustomStartupOrder `json:"startup,omitempty"` + TabletDeviceEnabled *types2.CustomBool `json:"tablet,omitempty"` + Tags *string `json:"tags,omitempty"` + Template *types2.CustomBool `json:"template,omitempty"` + TimeDriftFixEnabled *types2.CustomBool `json:"tdf,omitempty"` + USBDevices *CustomUSBDevices `json:"usb,omitempty"` + VGADevice *CustomVGADevice `json:"vga,omitempty"` + VirtualCPUCount *int `json:"vcpus,omitempty"` + VirtualIODevice0 *CustomStorageDevice `json:"virtio0,omitempty"` + VirtualIODevice1 *CustomStorageDevice `json:"virtio1,omitempty"` + VirtualIODevice2 *CustomStorageDevice `json:"virtio2,omitempty"` + VirtualIODevice3 *CustomStorageDevice `json:"virtio3,omitempty"` + VirtualIODevice4 *CustomStorageDevice `json:"virtio4,omitempty"` + VirtualIODevice5 *CustomStorageDevice `json:"virtio5,omitempty"` + VirtualIODevice6 *CustomStorageDevice `json:"virtio6,omitempty"` + VirtualIODevice7 *CustomStorageDevice `json:"virtio7,omitempty"` + VirtualIODevice8 *CustomStorageDevice `json:"virtio8,omitempty"` + VirtualIODevice9 *CustomStorageDevice `json:"virtio9,omitempty"` + VirtualIODevice10 *CustomStorageDevice `json:"virtio10,omitempty"` + VirtualIODevice11 *CustomStorageDevice `json:"virtio11,omitempty"` + VirtualIODevice12 *CustomStorageDevice `json:"virtio12,omitempty"` + VirtualIODevice13 *CustomStorageDevice `json:"virtio13,omitempty"` + VirtualIODevice14 *CustomStorageDevice `json:"virtio14,omitempty"` + VirtualIODevice15 *CustomStorageDevice `json:"virtio15,omitempty"` + VMGenerationID *string `json:"vmgenid,omitempty"` + VMStateDatastoreID *string `json:"vmstatestorage,omitempty"` + WatchdogDevice *CustomWatchdogDevice `json:"watchdog,omitempty"` } // GetStatusResponseBody contains the body from a VM get status response. @@ -498,19 +498,19 @@ type GetStatusResponseBody struct { // GetStatusResponseData contains the data from a VM get status response. type GetStatusResponseData struct { - AgentEnabled *types.CustomBool `json:"agent,omitempty"` - CPUCount *float64 `json:"cpus,omitempty"` - Lock *string `json:"lock,omitempty"` - MemoryAllocation *int `json:"maxmem,omitempty"` - Name *string `json:"name,omitempty"` - PID *int `json:"pid,omitempty"` - QMPStatus *string `json:"qmpstatus,omitempty"` - RootDiskSize *int `json:"maxdisk,omitempty"` - SpiceSupport *types.CustomBool `json:"spice,omitempty"` - Status string `json:"status,omitempty"` - Tags *string `json:"tags,omitempty"` - Uptime *int `json:"uptime,omitempty"` - VMID *int `json:"vmid,omitempty"` + AgentEnabled *types2.CustomBool `json:"agent,omitempty"` + CPUCount *float64 `json:"cpus,omitempty"` + Lock *string `json:"lock,omitempty"` + MemoryAllocation *int `json:"maxmem,omitempty"` + Name *string `json:"name,omitempty"` + PID *int `json:"pid,omitempty"` + QMPStatus *string `json:"qmpstatus,omitempty"` + RootDiskSize *int `json:"maxdisk,omitempty"` + SpiceSupport *types2.CustomBool `json:"spice,omitempty"` + Status string `json:"status,omitempty"` + Tags *string `json:"tags,omitempty"` + Uptime *int `json:"uptime,omitempty"` + VMID *int `json:"vmid,omitempty"` } // ListResponseBody contains the body from a virtual machine list response. @@ -527,10 +527,10 @@ type ListResponseData struct { // MigrateRequestBody contains the body for a VM migration request. type MigrateRequestBody struct { - OnlineMigration *types.CustomBool `json:"online,omitempty" url:"online,omitempty,int"` - TargetNode string `json:"target" url:"target"` - TargetStorage *string `json:"targetstorage,omitempty" url:"targetstorage,omitempty"` - WithLocalDisks *types.CustomBool `json:"with-local-disks,omitempty" url:"with-local-disks,omitempty,int"` + OnlineMigration *types2.CustomBool `json:"online,omitempty" url:"online,omitempty,int"` + TargetNode string `json:"target" url:"target"` + TargetStorage *string `json:"targetstorage,omitempty" url:"targetstorage,omitempty"` + WithLocalDisks *types2.CustomBool `json:"with-local-disks,omitempty" url:"with-local-disks,omitempty,int"` } // MigrateResponseBody contains the body from a VM migrate response. @@ -540,12 +540,12 @@ type MigrateResponseBody struct { // MoveDiskRequestBody contains the body for a VM move disk request. type MoveDiskRequestBody struct { - BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"` - DeleteOriginalDisk *types.CustomBool `json:"delete,omitempty" url:"delete,omitempty,int"` - Digest *string `json:"digest,omitempty" url:"digest,omitempty"` - Disk string `json:"disk" url:"disk"` - TargetStorage string `json:"storage" url:"storage"` - TargetStorageFormat *string `json:"format,omitempty" url:"format,omitempty"` + BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"` + DeleteOriginalDisk *types2.CustomBool `json:"delete,omitempty" url:"delete,omitempty,int"` + Digest *string `json:"digest,omitempty" url:"digest,omitempty"` + Disk string `json:"disk" url:"disk"` + TargetStorage string `json:"storage" url:"storage"` + TargetStorageFormat *string `json:"format,omitempty" url:"format,omitempty"` } // MoveDiskResponseBody contains the body from a VM move disk response. @@ -565,18 +565,18 @@ type RebootResponseBody struct { // ResizeDiskRequestBody contains the body for a VM resize disk request. type ResizeDiskRequestBody struct { - Digest *string `json:"digest,omitempty" url:"digest,omitempty"` - Disk string `json:"disk" url:"disk"` - Size types.DiskSize `json:"size" url:"size"` - SkipLock *types.CustomBool `json:"skiplock,omitempty" url:"skiplock,omitempty,int"` + Digest *string `json:"digest,omitempty" url:"digest,omitempty"` + Disk string `json:"disk" url:"disk"` + Size types2.DiskSize `json:"size" url:"size"` + SkipLock *types2.CustomBool `json:"skiplock,omitempty" url:"skiplock,omitempty,int"` } // ShutdownRequestBody contains the body for a VM shutdown request. type ShutdownRequestBody struct { - ForceStop *types.CustomBool `json:"forceStop,omitempty" url:"forceStop,omitempty,int"` - KeepActive *types.CustomBool `json:"keepActive,omitempty" url:"keepActive,omitempty,int"` - SkipLock *types.CustomBool `json:"skipLock,omitempty" url:"skipLock,omitempty,int"` - Timeout *int `json:"timeout,omitempty" url:"timeout,omitempty"` + ForceStop *types2.CustomBool `json:"forceStop,omitempty" url:"forceStop,omitempty,int"` + KeepActive *types2.CustomBool `json:"keepActive,omitempty" url:"keepActive,omitempty,int"` + SkipLock *types2.CustomBool `json:"skipLock,omitempty" url:"skipLock,omitempty,int"` + Timeout *int `json:"timeout,omitempty" url:"timeout,omitempty"` } // ShutdownResponseBody contains the body from a VM shutdown response. @@ -1292,15 +1292,15 @@ func (r *CustomAgent) UnmarshalJSON(b []byte) error { v := strings.Split(strings.TrimSpace(p), "=") if len(v) == 1 { - enabled := types.CustomBool(v[0] == "1") + enabled := types2.CustomBool(v[0] == "1") r.Enabled = &enabled } else if len(v) == 2 { switch v[0] { case "enabled": - enabled := types.CustomBool(v[1] == "1") + enabled := types2.CustomBool(v[1] == "1") r.Enabled = &enabled case "fstrim_cloned_disks": - fstrim := types.CustomBool(v[1] == "1") + fstrim := types2.CustomBool(v[1] == "1") r.TrimClonedDisks = &fstrim case "type": r.Type = &v[1] @@ -1475,7 +1475,7 @@ func (r *CustomCPUEmulation) UnmarshalJSON(b []byte) error { r.Flags = &f } case "hidden": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Hidden = &bv case "hv-vendor-id": r.HVVendorID = &v[1] @@ -1513,7 +1513,7 @@ func (r *CustomEFIDisk) UnmarshalJSON(b []byte) error { t := strings.ToLower(v[1]) r.Type = &t case "pre-enrolled-keys": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.PreEnrolledKeys = &bv } } @@ -1541,10 +1541,10 @@ func (r *CustomNetworkDevice) UnmarshalJSON(b []byte) error { case "bridge": r.Bridge = &v[1] case "firewall": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.Firewall = &bv case "link_down": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.LinkDown = &bv case "macaddr": r.MACAddress = &v[1] @@ -1629,15 +1629,15 @@ func (r *CustomPCIDevice) UnmarshalJSON(b []byte) error { case "mdev": r.MDev = &v[1] case "pcie": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.PCIExpress = &bv case "rombar": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.ROMBAR = &bv case "romfile": r.ROMFile = &v[1] case "x-vga": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.XVGA = &bv } } @@ -1693,7 +1693,7 @@ func (r *CustomSMBIOS) UnmarshalJSON(b []byte) error { if len(v) == 2 { switch v[0] { case "base64": - base64 := types.CustomBool(v[1] == "1") + base64 := types2.CustomBool(v[1] == "1") r.Base64 = &base64 case "family": r.Family = &v[1] @@ -1787,7 +1787,7 @@ func (r *CustomStorageDevice) UnmarshalJSON(b []byte) error { r.AIO = &v[1] case "backup": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.BackupEnabled = &bv case "file": @@ -1825,7 +1825,7 @@ func (r *CustomStorageDevice) UnmarshalJSON(b []byte) error { r.Media = &v[1] case "size": - r.Size = new(types.DiskSize) + r.Size = new(types2.DiskSize) err := r.Size.UnmarshalJSON([]byte(v[1])) if err != nil { return fmt.Errorf("failed to unmarshal disk size: %w", err) @@ -1835,11 +1835,11 @@ func (r *CustomStorageDevice) UnmarshalJSON(b []byte) error { r.Format = &v[1] case "iothread": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.IOThread = &bv case "ssd": - bv := types.CustomBool(v[1] == "1") + bv := types2.CustomBool(v[1] == "1") r.SSD = &bv case "discard": diff --git a/proxmox/nodes/vms/vms_types_test.go b/proxmox/nodes/vms/vms_types_test.go index ef4e48e7..20c2c1b2 100644 --- a/proxmox/nodes/vms/vms_types_test.go +++ b/proxmox/nodes/vms/vms_types_test.go @@ -11,13 +11,13 @@ import ( "github.com/stretchr/testify/require" - "github.com/bpg/terraform-provider-proxmox/internal/types" + types2 "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) func TestCustomStorageDevice_UnmarshalJSON(t *testing.T) { t.Parallel() - ds8gig := types.DiskSizeFromGigabytes(8) + ds8gig := types2.DiskSizeFromGigabytes(8) tests := []struct { name string line string @@ -28,26 +28,26 @@ func TestCustomStorageDevice_UnmarshalJSON(t *testing.T) { name: "simple volume", line: `"local-lvm:vm-2041-disk-0,discard=on,ssd=1,iothread=1,size=8G,cache=writeback"`, want: &CustomStorageDevice{ - Cache: types.StrPtr("writeback"), - Discard: types.StrPtr("on"), + Cache: types2.StrPtr("writeback"), + Discard: types2.StrPtr("on"), Enabled: true, FileVolume: "local-lvm:vm-2041-disk-0", - IOThread: types.BoolPtr(true), + IOThread: types2.BoolPtr(true), Size: &ds8gig, - SSD: types.BoolPtr(true), + SSD: types2.BoolPtr(true), }, }, { name: "raw volume type", line: `"nfs:2041/vm-2041-disk-0.raw,discard=ignore,ssd=1,iothread=1,size=8G"`, want: &CustomStorageDevice{ - Discard: types.StrPtr("ignore"), + Discard: types2.StrPtr("ignore"), Enabled: true, FileVolume: "nfs:2041/vm-2041-disk-0.raw", - Format: types.StrPtr("raw"), - IOThread: types.BoolPtr(true), + Format: types2.StrPtr("raw"), + IOThread: types2.BoolPtr(true), Size: &ds8gig, - SSD: types.BoolPtr(true), + SSD: types2.BoolPtr(true), }, }, } @@ -80,10 +80,10 @@ func TestCustomPCIDevice_UnmarshalJSON(t *testing.T) { want: &CustomPCIDevice{ DeviceIDs: &[]string{"0000:81:00.2"}, MDev: nil, - PCIExpress: types.BoolPtr(false), - ROMBAR: types.BoolPtr(true), + PCIExpress: types2.BoolPtr(false), + ROMBAR: types2.BoolPtr(true), ROMFile: nil, - XVGA: types.BoolPtr(false), + XVGA: types2.BoolPtr(false), }, }, { @@ -92,10 +92,10 @@ func TestCustomPCIDevice_UnmarshalJSON(t *testing.T) { want: &CustomPCIDevice{ DeviceIDs: &[]string{"81:00.4"}, MDev: nil, - PCIExpress: types.BoolPtr(false), - ROMBAR: types.BoolPtr(true), + PCIExpress: types2.BoolPtr(false), + ROMBAR: types2.BoolPtr(true), ROMFile: nil, - XVGA: types.BoolPtr(false), + XVGA: types2.BoolPtr(false), }, }, { @@ -103,12 +103,12 @@ func TestCustomPCIDevice_UnmarshalJSON(t *testing.T) { line: `"mapping=mappeddevice,pcie=0,rombar=1,x-vga=0"`, want: &CustomPCIDevice{ DeviceIDs: nil, - Mapping: types.StrPtr("mappeddevice"), + Mapping: types2.StrPtr("mappeddevice"), MDev: nil, - PCIExpress: types.BoolPtr(false), - ROMBAR: types.BoolPtr(true), + PCIExpress: types2.BoolPtr(false), + ROMBAR: types2.BoolPtr(true), ROMFile: nil, - XVGA: types.BoolPtr(false), + XVGA: types2.BoolPtr(false), }, }, } diff --git a/proxmox/pools/pool_types.go b/proxmox/pools/pool_types.go index 7fa12a31..45d6524f 100644 --- a/proxmox/pools/pool_types.go +++ b/proxmox/pools/pool_types.go @@ -6,7 +6,9 @@ package pools -import "github.com/bpg/terraform-provider-proxmox/internal/types" +import ( + "github.com/bpg/terraform-provider-proxmox/proxmox/types" +) // PoolCreateRequestBody contains the data for a pool create request. type PoolCreateRequestBody struct { diff --git a/proxmox/storage/storage_types.go b/proxmox/storage/storage_types.go index 2c2a71b7..bf223172 100644 --- a/proxmox/storage/storage_types.go +++ b/proxmox/storage/storage_types.go @@ -7,7 +7,7 @@ package storage import ( - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // DatastoreGetResponseBody contains the body from a datastore get response. diff --git a/internal/types/common_types.go b/proxmox/types/common_types.go similarity index 100% rename from internal/types/common_types.go rename to proxmox/types/common_types.go diff --git a/internal/types/disk_size.go b/proxmox/types/disk_size.go similarity index 100% rename from internal/types/disk_size.go rename to proxmox/types/disk_size.go diff --git a/internal/types/disk_size_test.go b/proxmox/types/disk_size_test.go similarity index 100% rename from internal/types/disk_size_test.go rename to proxmox/types/disk_size_test.go diff --git a/internal/types/ha_resource_id.go b/proxmox/types/ha_resource_id.go similarity index 90% rename from internal/types/ha_resource_id.go rename to proxmox/types/ha_resource_id.go index 744a9a37..68002e05 100644 --- a/internal/types/ha_resource_id.go +++ b/proxmox/types/ha_resource_id.go @@ -14,10 +14,7 @@ import ( "strings" "github.com/google/go-querystring/query" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - - "github.com/bpg/terraform-provider-proxmox/internal/validators" ) // NOTE: the linter believes the `HAResourceID` structure below should be tagged with `json:` due to some values of it @@ -76,11 +73,6 @@ func ParseHAResourceID(input string) (HAResourceID, error) { return resID, nil } -// HAResourceIDValidator returns a new HA resource identifier validator. -func HAResourceIDValidator() validator.String { - return validators.NewParseValidator(ParseHAResourceID, "value must be a valid HA resource identifier") -} - // String converts a HAResourceID value into a string. func (rid HAResourceID) String() string { return fmt.Sprintf("%s:%s", rid.Type, rid.Name) diff --git a/internal/types/ha_resource_id_test.go b/proxmox/types/ha_resource_id_test.go similarity index 100% rename from internal/types/ha_resource_id_test.go rename to proxmox/types/ha_resource_id_test.go diff --git a/internal/types/ha_resource_state.go b/proxmox/types/ha_resource_state.go similarity index 91% rename from internal/types/ha_resource_state.go rename to proxmox/types/ha_resource_state.go index 7d07cfee..383f5879 100644 --- a/internal/types/ha_resource_state.go +++ b/proxmox/types/ha_resource_state.go @@ -12,10 +12,7 @@ import ( "net/url" "github.com/google/go-querystring/query" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - - "github.com/bpg/terraform-provider-proxmox/internal/validators" ) // HAResourceState represents the requested state of a HA resource. @@ -67,11 +64,6 @@ func ParseHAResourceState(input string) (HAResourceState, error) { } } -// HAResourceStateValidator returns a new HA resource state validator. -func HAResourceStateValidator() validator.String { - return validators.NewParseValidator(ParseHAResourceState, "value must be a valid HA resource state") -} - // String converts a HAResourceState value into a string. func (s HAResourceState) String() string { switch s { diff --git a/internal/types/ha_resource_state_test.go b/proxmox/types/ha_resource_state_test.go similarity index 100% rename from internal/types/ha_resource_state_test.go rename to proxmox/types/ha_resource_state_test.go diff --git a/internal/types/ha_resource_type.go b/proxmox/types/ha_resource_type.go similarity index 87% rename from internal/types/ha_resource_type.go rename to proxmox/types/ha_resource_type.go index 1f0ecc68..89f0efc5 100644 --- a/internal/types/ha_resource_type.go +++ b/proxmox/types/ha_resource_type.go @@ -12,13 +12,10 @@ import ( "net/url" "github.com/google/go-querystring/query" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - - "github.com/bpg/terraform-provider-proxmox/internal/validators" ) -// HAResourceType represents the type of a HA resource. +// HAResourceType represents the type of HA resource. type HAResourceType int // Ensure various interfaces are supported by the HA resource type type. @@ -52,11 +49,6 @@ func ParseHAResourceType(input string) (HAResourceType, error) { } } -// HAResourceTypeValidator returns a new HA resource type validator. -func HAResourceTypeValidator() validator.String { - return validators.NewParseValidator(ParseHAResourceType, "value must be a valid HA resource type") -} - // String converts a HAResourceType value into a string. func (t HAResourceType) String() string { switch t { diff --git a/internal/types/ha_resource_type_test.go b/proxmox/types/ha_resource_type_test.go similarity index 100% rename from internal/types/ha_resource_type_test.go rename to proxmox/types/ha_resource_type_test.go diff --git a/internal/types/helpers.go b/proxmox/types/helpers.go similarity index 100% rename from internal/types/helpers.go rename to proxmox/types/helpers.go diff --git a/proxmoxtf/resource/certificate.go b/proxmoxtf/resource/certificate.go index 65ed7cd2..927d45d0 100644 --- a/proxmoxtf/resource/certificate.go +++ b/proxmoxtf/resource/certificate.go @@ -15,8 +15,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/nodes" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/bpg/terraform-provider-proxmox/proxmoxtf" ) diff --git a/proxmoxtf/resource/cluster/firewall/firewall.go b/proxmoxtf/resource/cluster/firewall/firewall.go index 47e2412b..e4361f19 100644 --- a/proxmoxtf/resource/cluster/firewall/firewall.go +++ b/proxmoxtf/resource/cluster/firewall/firewall.go @@ -12,8 +12,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/cluster/firewall" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/bpg/terraform-provider-proxmox/proxmoxtf" "github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator" ) diff --git a/proxmoxtf/resource/container.go b/proxmoxtf/resource/container.go index 47dc6eea..23fc8199 100644 --- a/proxmoxtf/resource/container.go +++ b/proxmoxtf/resource/container.go @@ -17,8 +17,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/nodes/containers" + types2 "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/bpg/terraform-provider-proxmox/proxmoxtf" "github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator" "github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure" @@ -801,7 +801,7 @@ func containerCreateClone(ctx context.Context, d *schema.ResourceData, m interfa vmID = *vmIDNew } - fullCopy := types.CustomBool(true) + fullCopy := types2.CustomBool(true) cloneBody := &containers.CloneRequestBody{ FullCopy: &fullCopy, @@ -854,7 +854,7 @@ func containerCreateClone(ctx context.Context, d *schema.ResourceData, m interfa if len(console) > 0 { consoleBlock := console[0].(map[string]interface{}) - consoleEnabled := types.CustomBool( + consoleEnabled := types2.CustomBool( consoleBlock[mkResourceVirtualEnvironmentContainerConsoleEnabled].(bool), ) consoleMode := consoleBlock[mkResourceVirtualEnvironmentContainerConsoleMode].(string) @@ -1009,7 +1009,7 @@ func containerCreateClone(ctx context.Context, d *schema.ResourceData, m interfa bridge := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceBridge].(string) enabled := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceEnabled].(bool) - firewall := types.CustomBool( + firewall := types2.CustomBool( networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceFirewall].(bool), ) macAddress := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceMACAddress].(string) @@ -1093,7 +1093,7 @@ func containerCreateClone(ctx context.Context, d *schema.ResourceData, m interfa updateBody.Tags = &tagString } - template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool)) + template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool)) //nolint:gosimple if template != dvResourceVirtualEnvironmentContainerTemplate { @@ -1135,7 +1135,7 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf return diag.FromErr(err) } - consoleEnabled := types.CustomBool( + consoleEnabled := types2.CustomBool( consoleBlock[mkResourceVirtualEnvironmentContainerConsoleEnabled].(bool), ) consoleMode := consoleBlock[mkResourceVirtualEnvironmentContainerConsoleMode].(string) @@ -1193,7 +1193,7 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf return diag.FromErr(err) } - nesting := types.CustomBool(featuresBlock[mkResourceVirtualEnvironmentContainerFeaturesNesting].(bool)) + nesting := types2.CustomBool(featuresBlock[mkResourceVirtualEnvironmentContainerFeaturesNesting].(bool)) features := containers.CustomFeatures{ Nesting: &nesting, } @@ -1304,14 +1304,14 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf mountPointMap := mp.(map[string]interface{}) mountPointObject := containers.CustomMountPoint{} - acl := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointACL].(bool)) - backup := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointBackup].(bool)) + acl := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointACL].(bool)) + backup := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointBackup].(bool)) mountOptions := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointMountOptions].([]interface{}) path := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointPath].(string) - quota := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointQuota].(bool)) - readOnly := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReadOnly].(bool)) - replicate := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReplicate].(bool)) - shared := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointShared].(bool)) + quota := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointQuota].(bool)) + readOnly := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReadOnly].(bool)) + replicate := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReplicate].(bool)) + shared := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointShared].(bool)) size := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointSize].(string) volume := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointVolume].(string) @@ -1324,9 +1324,9 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf mountPointObject.Shared = &shared if len(size) > 0 { - var ds types.DiskSize + var ds types2.DiskSize - ds, err = types.ParseDiskSize(size) + ds, err = types2.ParseDiskSize(size) if err != nil { return diag.Errorf("invalid disk size: %s", err.Error()) } @@ -1422,10 +1422,10 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf operatingSystemType := operatingSystemBlock[mkResourceVirtualEnvironmentContainerOperatingSystemType].(string) poolID := d.Get(mkResourceVirtualEnvironmentContainerPoolID).(string) - started := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerStarted).(bool)) + started := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerStarted).(bool)) tags := d.Get(mkResourceVirtualEnvironmentContainerTags).([]interface{}) - template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool)) - unprivileged := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerUnprivileged).(bool)) + template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool)) + unprivileged := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerUnprivileged).(bool)) vmID := d.Get(mkResourceVirtualEnvironmentContainerVMID).(int) if vmID == -1 { @@ -1750,7 +1750,7 @@ func containerRead(ctx context.Context, d *schema.ResourceData, m interface{}) d } } else if len(currentConsole) > 0 || //nolint:lll - console[mkResourceVirtualEnvironmentContainerConsoleEnabled] != types.CustomBool(dvResourceVirtualEnvironmentContainerConsoleEnabled) || + console[mkResourceVirtualEnvironmentContainerConsoleEnabled] != types2.CustomBool(dvResourceVirtualEnvironmentContainerConsoleEnabled) || console[mkResourceVirtualEnvironmentContainerConsoleMode] != dvResourceVirtualEnvironmentContainerConsoleMode || console[mkResourceVirtualEnvironmentContainerConsoleTTYCount] != dvResourceVirtualEnvironmentContainerConsoleTTYCount { err := d.Set(mkResourceVirtualEnvironmentContainerConsole, []interface{}{console}) @@ -2266,7 +2266,7 @@ func containerUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) description := d.Get(mkResourceVirtualEnvironmentContainerDescription).(string) updateBody.Description = &description - template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool)) + template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool)) if d.HasChange(mkResourceVirtualEnvironmentContainerTemplate) { updateBody.Template = &template @@ -2285,7 +2285,7 @@ func containerUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) return diag.FromErr(err) } - consoleEnabled := types.CustomBool( + consoleEnabled := types2.CustomBool( consoleBlock[mkResourceVirtualEnvironmentContainerConsoleEnabled].(bool), ) consoleMode := consoleBlock[mkResourceVirtualEnvironmentContainerConsoleMode].(string) @@ -2429,14 +2429,14 @@ func containerUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) mountPointMap := mp.(map[string]interface{}) mountPointObject := containers.CustomMountPoint{} - acl := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointACL].(bool)) - backup := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointBackup].(bool)) + acl := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointACL].(bool)) + backup := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointBackup].(bool)) mountOptions := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointMountOptions].([]interface{}) path := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointPath].(string) - quota := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointQuota].(bool)) - readOnly := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReadOnly].(bool)) - replicate := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReplicate].(bool)) - shared := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointShared].(bool)) + quota := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointQuota].(bool)) + readOnly := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReadOnly].(bool)) + replicate := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReplicate].(bool)) + shared := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointShared].(bool)) volume := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointVolume].(string) mountPointObject.ACL = &acl @@ -2490,7 +2490,7 @@ func containerUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) bridge := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceBridge].(string) enabled := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceEnabled].(bool) - firewall := types.CustomBool( + firewall := types2.CustomBool( networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceFirewall].(bool), ) macAddress := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceMACAddress].(string) @@ -2606,7 +2606,7 @@ func containerUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) return diag.FromErr(e) } } else { - forceStop := types.CustomBool(true) + forceStop := types2.CustomBool(true) shutdownTimeout := 300 e = containerAPI.ShutdownContainer(ctx, &containers.ShutdownRequestBody{ @@ -2666,7 +2666,7 @@ func containerDelete(ctx context.Context, d *schema.ResourceData, m interface{}) } if status.Status != "stopped" { - forceStop := types.CustomBool(true) + forceStop := types2.CustomBool(true) shutdownTimeout := 300 err = containerAPI.ShutdownContainer( diff --git a/proxmoxtf/resource/firewall/ipset.go b/proxmoxtf/resource/firewall/ipset.go index ea132c1b..b7373e94 100644 --- a/proxmoxtf/resource/firewall/ipset.go +++ b/proxmoxtf/resource/firewall/ipset.go @@ -13,8 +13,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/firewall" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure" ) diff --git a/proxmoxtf/resource/firewall/options.go b/proxmoxtf/resource/firewall/options.go index c7461d8c..77b2f9c7 100644 --- a/proxmoxtf/resource/firewall/options.go +++ b/proxmoxtf/resource/firewall/options.go @@ -12,8 +12,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/firewall" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator" "github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure" ) diff --git a/proxmoxtf/resource/firewall/rules.go b/proxmoxtf/resource/firewall/rules.go index 88c59c49..879442b0 100644 --- a/proxmoxtf/resource/firewall/rules.go +++ b/proxmoxtf/resource/firewall/rules.go @@ -16,8 +16,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/firewall" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator" "github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure" ) diff --git a/proxmoxtf/resource/group.go b/proxmoxtf/resource/group.go index 960e7e82..725ad830 100644 --- a/proxmoxtf/resource/group.go +++ b/proxmoxtf/resource/group.go @@ -13,8 +13,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/access" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/bpg/terraform-provider-proxmox/proxmoxtf" ) diff --git a/proxmoxtf/resource/role.go b/proxmoxtf/resource/role.go index 4afd96d9..fe0e24b8 100644 --- a/proxmoxtf/resource/role.go +++ b/proxmoxtf/resource/role.go @@ -13,8 +13,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/access" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/bpg/terraform-provider-proxmox/proxmoxtf" ) diff --git a/proxmoxtf/resource/user.go b/proxmoxtf/resource/user.go index a8f00f62..b972334c 100644 --- a/proxmoxtf/resource/user.go +++ b/proxmoxtf/resource/user.go @@ -15,8 +15,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/access" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/bpg/terraform-provider-proxmox/proxmoxtf" ) diff --git a/proxmoxtf/resource/validator/file.go b/proxmoxtf/resource/validator/file.go index 2c72d514..75f9af42 100644 --- a/proxmoxtf/resource/validator/file.go +++ b/proxmoxtf/resource/validator/file.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/bpg/terraform-provider-proxmox/internal/types" + "github.com/bpg/terraform-provider-proxmox/proxmox/types" ) // FileFormat returns a schema validation function for a file format. diff --git a/proxmoxtf/resource/vm.go b/proxmoxtf/resource/vm.go index 08726eaf..8eae9808 100644 --- a/proxmoxtf/resource/vm.go +++ b/proxmoxtf/resource/vm.go @@ -25,10 +25,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/bpg/terraform-provider-proxmox/internal/types" "github.com/bpg/terraform-provider-proxmox/proxmox/cluster" "github.com/bpg/terraform-provider-proxmox/proxmox/nodes/vms" "github.com/bpg/terraform-provider-proxmox/proxmox/pools" + types2 "github.com/bpg/terraform-provider-proxmox/proxmox/types" "github.com/bpg/terraform-provider-proxmox/proxmoxtf" "github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator" "github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure" @@ -1619,7 +1619,7 @@ func vmStart(ctx context.Context, vmAPI *vms.Client, d *schema.ResourceData) dia func vmShutdown(ctx context.Context, vmAPI *vms.Client, d *schema.ResourceData) diag.Diagnostics { tflog.Debug(ctx, "Shutting down VM") - forceStop := types.CustomBool(true) + forceStop := types2.CustomBool(true) shutdownTimeout := d.Get(mkResourceVirtualEnvironmentVMTimeoutShutdownVM).(int) e := vmAPI.ShutdownVM(ctx, &vms.ShutdownRequestBody{ @@ -1671,7 +1671,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d } } - fullCopy := types.CustomBool(cloneFull) + fullCopy := types2.CustomBool(cloneFull) cloneBody := &vms.CloneRequestBody{ FullCopy: &fullCopy, @@ -1752,7 +1752,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d } // Migrate to target node - withLocalDisks := types.CustomBool(true) + withLocalDisks := types2.CustomBool(true) migrateBody := &vms.MigrateRequestBody{ TargetNode: nodeName, WithLocalDisks: &withLocalDisks, @@ -1786,7 +1786,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d } // Now that the virtual machine has been cloned, we need to perform some modifications. - acpi := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMACPI).(bool)) + acpi := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMACPI).(bool)) agent := d.Get(mkResourceVirtualEnvironmentVMAgent).([]interface{}) audioDevices := vmGetAudioDeviceList(d) @@ -1802,9 +1802,9 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d networkDevice := d.Get(mkResourceVirtualEnvironmentVMNetworkDevice).([]interface{}) operatingSystem := d.Get(mkResourceVirtualEnvironmentVMOperatingSystem).([]interface{}) serialDevice := d.Get(mkResourceVirtualEnvironmentVMSerialDevice).([]interface{}) - onBoot := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool)) - tabletDevice := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool)) - template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool)) + onBoot := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool)) + tabletDevice := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool)) + template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool)) vga := d.Get(mkResourceVirtualEnvironmentVMVGA).([]interface{}) updateBody := &vms.UpdateRequestBody{ @@ -1823,10 +1823,10 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d if len(agent) > 0 { agentBlock := agent[0].(map[string]interface{}) - agentEnabled := types.CustomBool( + agentEnabled := types2.CustomBool( agentBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool), ) - agentTrim := types.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool)) + agentTrim := types2.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool)) agentType := agentBlock[mkResourceVirtualEnvironmentVMAgentType].(string) updateBody.Agent = &vms.CustomAgent{ @@ -1892,7 +1892,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d cpuCores := cpuBlock[mkResourceVirtualEnvironmentVMCPUCores].(int) cpuFlags := cpuBlock[mkResourceVirtualEnvironmentVMCPUFlags].([]interface{}) cpuHotplugged := cpuBlock[mkResourceVirtualEnvironmentVMCPUHotplugged].(int) - cpuNUMA := types.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool)) + cpuNUMA := types2.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool)) cpuSockets := cpuBlock[mkResourceVirtualEnvironmentVMCPUSockets].(int) cpuType := cpuBlock[mkResourceVirtualEnvironmentVMCPUType].(string) cpuUnits := cpuBlock[mkResourceVirtualEnvironmentVMCPUUnits].(int) @@ -2127,7 +2127,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d ) } - deleteOriginalDisk := types.CustomBool(true) + deleteOriginalDisk := types2.CustomBool(true) diskMoveBody := &vms.MoveDiskRequestBody{ DeleteOriginalDisk: &deleteOriginalDisk, @@ -2137,7 +2137,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d diskResizeBody := &vms.ResizeDiskRequestBody{ Disk: diskInterface, - Size: types.DiskSizeFromGigabytes(diskSize), + Size: types2.DiskSizeFromGigabytes(diskSize), } moveDisk := false @@ -2198,7 +2198,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d ) } - deleteOriginalDisk := types.CustomBool(true) + deleteOriginalDisk := types2.CustomBool(true) diskMoveBody := &vms.MoveDiskRequestBody{ DeleteOriginalDisk: &deleteOriginalDisk, @@ -2239,7 +2239,7 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{}) resource := VM() - acpi := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMACPI).(bool)) + acpi := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMACPI).(bool)) agentBlock, err := structure.GetSchemaBlock( resource, @@ -2252,10 +2252,10 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{}) return diag.FromErr(err) } - agentEnabled := types.CustomBool( + agentEnabled := types2.CustomBool( agentBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool), ) - agentTrim := types.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool)) + agentTrim := types2.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool)) agentType := agentBlock[mkResourceVirtualEnvironmentVMAgentType].(string) kvmArguments := d.Get(mkResourceVirtualEnvironmentVMKVMArguments).(string) @@ -2303,7 +2303,7 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{}) cpuFlags := cpuBlock[mkResourceVirtualEnvironmentVMCPUFlags].([]interface{}) cpuHotplugged := cpuBlock[mkResourceVirtualEnvironmentVMCPUHotplugged].(int) cpuSockets := cpuBlock[mkResourceVirtualEnvironmentVMCPUSockets].(int) - cpuNUMA := types.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool)) + cpuNUMA := types2.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool)) cpuType := cpuBlock[mkResourceVirtualEnvironmentVMCPUType].(string) cpuUnits := cpuBlock[mkResourceVirtualEnvironmentVMCPUUnits].(int) @@ -2322,7 +2322,7 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{}) datastoreID, _ := block[mkResourceVirtualEnvironmentVMEFIDiskDatastoreID].(string) fileFormat, _ := block[mkResourceVirtualEnvironmentVMEFIDiskFileFormat].(string) efiType, _ := block[mkResourceVirtualEnvironmentVMEFIDiskType].(string) - preEnrolledKeys := types.CustomBool(block[mkResourceVirtualEnvironmentVMEFIDiskPreEnrolledKeys].(bool)) + preEnrolledKeys := types2.CustomBool(block[mkResourceVirtualEnvironmentVMEFIDiskPreEnrolledKeys].(bool)) if fileFormat == "" { fileFormat = dvResourceVirtualEnvironmentVMEFIDiskFileFormat @@ -2404,9 +2404,9 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{}) startupOrder := vmGetStartupOrder(d) - onBoot := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool)) - tabletDevice := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool)) - template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool)) + onBoot := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool)) + tabletDevice := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool)) + template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool)) vgaDevice, err := vmGetVGADeviceObject(d) if err != nil { @@ -2633,8 +2633,8 @@ func vmCreateCustomDisks(ctx context.Context, d *schema.ResourceData, m interfac size, _ := block[mkResourceVirtualEnvironmentVMDiskSize].(int) speed := block[mkResourceVirtualEnvironmentVMDiskSpeed].([]interface{}) diskInterface, _ := block[mkResourceVirtualEnvironmentVMDiskInterface].(string) - ioThread := types.CustomBool(block[mkResourceVirtualEnvironmentVMDiskIOThread].(bool)) - ssd := types.CustomBool(block[mkResourceVirtualEnvironmentVMDiskSSD].(bool)) + ioThread := types2.CustomBool(block[mkResourceVirtualEnvironmentVMDiskIOThread].(bool)) + ssd := types2.CustomBool(block[mkResourceVirtualEnvironmentVMDiskSSD].(bool)) discard, _ := block[mkResourceVirtualEnvironmentVMDiskDiscard].(string) cache, _ := block[mkResourceVirtualEnvironmentVMDiskCache].(string) @@ -2998,8 +2998,8 @@ func vmGetDiskDeviceObjects( fileID, _ := block[mkResourceVirtualEnvironmentVMDiskFileID].(string) size, _ := block[mkResourceVirtualEnvironmentVMDiskSize].(int) diskInterface, _ := block[mkResourceVirtualEnvironmentVMDiskInterface].(string) - ioThread := types.CustomBool(block[mkResourceVirtualEnvironmentVMDiskIOThread].(bool)) - ssd := types.CustomBool(block[mkResourceVirtualEnvironmentVMDiskSSD].(bool)) + ioThread := types2.CustomBool(block[mkResourceVirtualEnvironmentVMDiskIOThread].(bool)) + ssd := types2.CustomBool(block[mkResourceVirtualEnvironmentVMDiskSSD].(bool)) discard := block[mkResourceVirtualEnvironmentVMDiskDiscard].(string) cache := block[mkResourceVirtualEnvironmentVMDiskCache].(string) @@ -3027,7 +3027,7 @@ func vmGetDiskDeviceObjects( diskDevice.Interface = &diskInterface diskDevice.Format = &fileFormat diskDevice.FileID = &fileID - diskSize := types.DiskSizeFromGigabytes(size) + diskSize := types2.DiskSizeFromGigabytes(size) diskDevice.Size = &diskSize diskDevice.SizeInt = &size diskDevice.IOThread = &ioThread @@ -3100,7 +3100,7 @@ func vmGetEfiDisk(d *schema.ResourceData, disk []interface{}) *vms.CustomEFIDisk datastoreID, _ := block[mkResourceVirtualEnvironmentVMEFIDiskDatastoreID].(string) fileFormat, _ := block[mkResourceVirtualEnvironmentVMEFIDiskFileFormat].(string) efiType, _ := block[mkResourceVirtualEnvironmentVMEFIDiskType].(string) - preEnrolledKeys := types.CustomBool(block[mkResourceVirtualEnvironmentVMEFIDiskPreEnrolledKeys].(bool)) + preEnrolledKeys := types2.CustomBool(block[mkResourceVirtualEnvironmentVMEFIDiskPreEnrolledKeys].(bool)) // special case for efi disk, the size is ignored, see docs for more info efiDiskConfig.FileVolume = fmt.Sprintf("%s:1", datastoreID) @@ -3131,7 +3131,7 @@ func vmGetEfiDiskAsStorageDevice(d *schema.ResourceData, disk []interface{}) (*v } if efiDisk.Type != nil { - ds, err := types.ParseDiskSize(*efiDisk.Type) + ds, err := types2.ParseDiskSize(*efiDisk.Type) if err != nil { return nil, fmt.Errorf("invalid efi disk type: %s", err.Error()) } @@ -3154,12 +3154,12 @@ func vmGetHostPCIDeviceObjects(d *schema.ResourceData) vms.CustomPCIDevices { ids, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceID].(string) mdev, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceMDev].(string) - pcie := types.CustomBool(block[mkResourceVirtualEnvironmentVMHostPCIDevicePCIE].(bool)) - rombar := types.CustomBool( + pcie := types2.CustomBool(block[mkResourceVirtualEnvironmentVMHostPCIDevicePCIE].(bool)) + rombar := types2.CustomBool( block[mkResourceVirtualEnvironmentVMHostPCIDeviceROMBAR].(bool), ) romfile, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceROMFile].(string) - xvga := types.CustomBool(block[mkResourceVirtualEnvironmentVMHostPCIDeviceXVGA].(bool)) + xvga := types2.CustomBool(block[mkResourceVirtualEnvironmentVMHostPCIDeviceXVGA].(bool)) mapping, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceMapping].(string) device := vms.CustomPCIDevice{ @@ -3199,7 +3199,7 @@ func vmGetNetworkDeviceObjects(d *schema.ResourceData) vms.CustomNetworkDevices bridge := block[mkResourceVirtualEnvironmentVMNetworkDeviceBridge].(string) enabled := block[mkResourceVirtualEnvironmentVMNetworkDeviceEnabled].(bool) - firewall := types.CustomBool(block[mkResourceVirtualEnvironmentVMNetworkDeviceFirewall].(bool)) + firewall := types2.CustomBool(block[mkResourceVirtualEnvironmentVMNetworkDeviceFirewall].(bool)) macAddress := block[mkResourceVirtualEnvironmentVMNetworkDeviceMACAddress].(string) model := block[mkResourceVirtualEnvironmentVMNetworkDeviceModel].(string) rateLimit := block[mkResourceVirtualEnvironmentVMNetworkDeviceRateLimit].(float64) @@ -3275,7 +3275,7 @@ func vmGetSMBIOS(d *schema.ResourceData) *vms.CustomSMBIOS { //nolint:nestif if len(smbiosSections) > 0 { smbiosBlock := smbiosSections[0].(map[string]interface{}) - b64 := types.CustomBool(true) + b64 := types2.CustomBool(true) family, _ := smbiosBlock[mkResourceVirtualEnvironmentVMSMBIOSFamily].(string) manufacturer, _ := smbiosBlock[mkResourceVirtualEnvironmentVMSMBIOSManufacturer].(string) product, _ := smbiosBlock[mkResourceVirtualEnvironmentVMSMBIOSProduct].(string) @@ -3323,7 +3323,7 @@ func vmGetSMBIOS(d *schema.ResourceData) *vms.CustomSMBIOS { } if smbios.UUID == nil || *smbios.UUID == "" { - smbios.UUID = types.StrPtr(uuid.New().String()) + smbios.UUID = types2.StrPtr(uuid.New().String()) } return &smbios @@ -3405,7 +3405,7 @@ func vmGetVGADeviceObject(d *schema.ResourceData) (*vms.CustomVGADevice, error) return nil, err } - vgaEnabled := types.CustomBool(vgaBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool)) + vgaEnabled := types2.CustomBool(vgaBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool)) vgaMemory := vgaBlock[mkResourceVirtualEnvironmentVMVGAMemory].(int) vgaType := vgaBlock[mkResourceVirtualEnvironmentVMVGAType].(string) @@ -4857,12 +4857,12 @@ func vmUpdatePool( oldPool := oldPoolValue.(string) newPool := newPoolValue.(string) - vmList := (types.CustomCommaSeparatedList)([]string{strconv.Itoa(vmID)}) + vmList := (types2.CustomCommaSeparatedList)([]string{strconv.Itoa(vmID)}) tflog.Debug(ctx, fmt.Sprintf("Moving VM %d from pool '%s' to pool '%s'", vmID, oldPool, newPool)) if oldPool != "" { - trueValue := types.CustomBool(true) + trueValue := types2.CustomBool(true) poolUpdate := &pools.PoolUpdateRequestBody{ VMs: &vmList, Delete: &trueValue, @@ -4914,7 +4914,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D vmAPI := api.Node(oldNodeName).VM(vmID) migrateTimeout := d.Get(mkResourceVirtualEnvironmentVMTimeoutMigrate).(int) - trueValue := types.CustomBool(true) + trueValue := types2.CustomBool(true) migrateBody := &vms.MigrateRequestBody{ TargetNode: nodeName, WithLocalDisks: &trueValue, @@ -4958,7 +4958,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D // Prepare the new primitive configuration values. if d.HasChange(mkResourceVirtualEnvironmentVMACPI) { - acpi := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMACPI).(bool)) + acpi := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMACPI).(bool)) updateBody.ACPI = &acpi rebootRequired = true } @@ -4981,7 +4981,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D } if d.HasChange(mkResourceVirtualEnvironmentVMOnBoot) { - startOnBoot := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool)) + startOnBoot := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool)) updateBody.StartOnBoot = &startOnBoot } @@ -5011,12 +5011,12 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D } if d.HasChange(mkResourceVirtualEnvironmentVMTabletDevice) { - tabletDevice := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool)) + tabletDevice := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool)) updateBody.TabletDeviceEnabled = &tabletDevice rebootRequired = true } - template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool)) + template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool)) if d.HasChange(mkResourceVirtualEnvironmentVMTemplate) { updateBody.Template = &template @@ -5036,10 +5036,10 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D return diag.FromErr(err) } - agentEnabled := types.CustomBool( + agentEnabled := types2.CustomBool( agentBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool), ) - agentTrim := types.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool)) + agentTrim := types2.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool)) agentType := agentBlock[mkResourceVirtualEnvironmentVMAgentType].(string) updateBody.Agent = &vms.CustomAgent{ @@ -5151,7 +5151,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D cpuCores := cpuBlock[mkResourceVirtualEnvironmentVMCPUCores].(int) cpuFlags := cpuBlock[mkResourceVirtualEnvironmentVMCPUFlags].([]interface{}) cpuHotplugged := cpuBlock[mkResourceVirtualEnvironmentVMCPUHotplugged].(int) - cpuNUMA := types.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool)) + cpuNUMA := types2.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool)) cpuSockets := cpuBlock[mkResourceVirtualEnvironmentVMCPUSockets].(int) cpuType := cpuBlock[mkResourceVirtualEnvironmentVMCPUType].(string) cpuUnits := cpuBlock[mkResourceVirtualEnvironmentVMCPUUnits].(int) @@ -5568,7 +5568,7 @@ func vmUpdateDiskLocationAndSize( } if *oldDisk.ID != *diskNewEntries[prefix][oldKey].ID { - deleteOriginalDisk := types.CustomBool(true) + deleteOriginalDisk := types2.CustomBool(true) diskMoveBodies = append( diskMoveBodies,