mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 02:31:10 +00:00
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)
This commit is contained in:
parent
124cac247c
commit
5ecf135398
@ -15,9 +15,10 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||||
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/internal/structure"
|
"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"
|
"github.com/bpg/terraform-provider-proxmox/proxmox"
|
||||||
haresources "github.com/bpg/terraform-provider-proxmox/proxmox/cluster/ha/resources"
|
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.
|
// 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.",
|
Description: "The identifier of the Proxmox HA resource to read.",
|
||||||
Required: true,
|
Required: true,
|
||||||
Validators: []validator.String{
|
Validators: []validator.String{
|
||||||
customtypes.HAResourceIDValidator(),
|
validators.HAResourceIDValidator(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"type": schema.StringAttribute{
|
"type": schema.StringAttribute{
|
||||||
@ -118,7 +119,7 @@ func (d *haresourceDatasource) Read(ctx context.Context, req datasource.ReadRequ
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resID, err := customtypes.ParseHAResourceID(data.ResourceID.ValueString())
|
resID, err := proxmoxtypes.ParseHAResourceID(data.ResourceID.ValueString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.Diagnostics.AddError(
|
resp.Diagnostics.AddError(
|
||||||
"Unexpected error parsing Proxmox HA resource identifier",
|
"Unexpected error parsing Proxmox HA resource identifier",
|
||||||
|
@ -18,9 +18,9 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/internal/structure"
|
"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"
|
||||||
haresources "github.com/bpg/terraform-provider-proxmox/proxmox/cluster/ha/resources"
|
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.
|
// 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) {
|
func (d *haresourcesDatasource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
|
||||||
var (
|
var (
|
||||||
data haresourcesModel
|
data haresourcesModel
|
||||||
fetchType *customtypes.HAResourceType
|
fetchType *proxmoxtypes.HAResourceType
|
||||||
)
|
)
|
||||||
|
|
||||||
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
|
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() {
|
if data.Type.IsNull() {
|
||||||
data.ID = types.StringValue("haresources")
|
data.ID = types.StringValue("haresources")
|
||||||
} else {
|
} else {
|
||||||
confType, err := customtypes.ParseHAResourceType(data.Type.ValueString())
|
confType, err := proxmoxtypes.ParseHAResourceType(data.Type.ValueString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.Diagnostics.AddError(
|
resp.Diagnostics.AddError(
|
||||||
"Unexpected HA resource type",
|
"Unexpected HA resource type",
|
||||||
|
@ -9,8 +9,8 @@ package cluster
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
customtypes "github.com/bpg/terraform-provider-proxmox/internal/types"
|
|
||||||
haresources "github.com/bpg/terraform-provider-proxmox/proxmox/cluster/ha/resources"
|
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"
|
"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.
|
// toRequestBase builds the common request data structure for HA resource creation or update API calls.
|
||||||
func (d haresourceModel) toRequestBase() haresources.HAResourceDataBase {
|
func (d haresourceModel) toRequestBase() haresources.HAResourceDataBase {
|
||||||
var state customtypes.HAResourceState
|
var state proxmoxtypes.HAResourceState
|
||||||
|
|
||||||
if d.State.IsNull() {
|
if d.State.IsNull() {
|
||||||
state = customtypes.HAResourceStateStarted
|
state = proxmoxtypes.HAResourceStateStarted
|
||||||
} else {
|
} else {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
state, err = customtypes.ParseHAResourceState(d.State.ValueString())
|
state, err = proxmoxtypes.ParseHAResourceState(d.State.ValueString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Errorf(
|
panic(fmt.Errorf(
|
||||||
"state string '%s' wrongly assumed to be valid; error: %w",
|
"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.
|
// 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{
|
return &haresources.HAResourceCreateRequestBody{
|
||||||
ID: resID,
|
ID: resID,
|
||||||
Type: &resID.Type,
|
Type: &resID.Type,
|
||||||
|
@ -13,9 +13,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/internal/structure"
|
"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"
|
"github.com/bpg/terraform-provider-proxmox/proxmox"
|
||||||
haresources "github.com/bpg/terraform-provider-proxmox/proxmox/cluster/ha/resources"
|
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/int64validator"
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||||
@ -71,7 +72,7 @@ func (r *haresourceResource) Schema(
|
|||||||
Description: "The Proxmox HA resource identifier",
|
Description: "The Proxmox HA resource identifier",
|
||||||
Required: true,
|
Required: true,
|
||||||
Validators: []validator.String{
|
Validators: []validator.String{
|
||||||
customtypes.HAResourceIDValidator(),
|
validators.HAResourceIDValidator(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"state": schema.StringAttribute{
|
"state": schema.StringAttribute{
|
||||||
@ -80,7 +81,7 @@ func (r *haresourceResource) Schema(
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Default: stringdefault.StaticString("started"),
|
Default: stringdefault.StaticString("started"),
|
||||||
Validators: []validator.String{
|
Validators: []validator.String{
|
||||||
customtypes.HAResourceStateValidator(),
|
validators.HAResourceStateValidator(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"type": schema.StringAttribute{
|
"type": schema.StringAttribute{
|
||||||
@ -88,7 +89,7 @@ func (r *haresourceResource) Schema(
|
|||||||
Computed: true,
|
Computed: true,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Validators: []validator.String{
|
Validators: []validator.String{
|
||||||
customtypes.HAResourceTypeValidator(),
|
validators.HAResourceTypeValidator(),
|
||||||
},
|
},
|
||||||
PlanModifiers: []planmodifier.String{
|
PlanModifiers: []planmodifier.String{
|
||||||
stringplanmodifier.UseStateForUnknown(),
|
stringplanmodifier.UseStateForUnknown(),
|
||||||
@ -164,7 +165,7 @@ func (r *haresourceResource) Create(ctx context.Context, req resource.CreateRequ
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resID, err := customtypes.ParseHAResourceID(data.ResourceID.ValueString())
|
resID, err := proxmoxtypes.ParseHAResourceID(data.ResourceID.ValueString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.Diagnostics.AddError(
|
resp.Diagnostics.AddError(
|
||||||
"Unexpected error parsing Proxmox HA resource identifier",
|
"Unexpected error parsing Proxmox HA resource identifier",
|
||||||
@ -207,7 +208,7 @@ func (r *haresourceResource) Update(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resID, err := customtypes.ParseHAResourceID(state.ID.ValueString())
|
resID, err := proxmoxtypes.ParseHAResourceID(state.ID.ValueString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.Diagnostics.AddError(
|
resp.Diagnostics.AddError(
|
||||||
"Unexpected error parsing Proxmox HA resource identifier",
|
"Unexpected error parsing Proxmox HA resource identifier",
|
||||||
@ -246,7 +247,7 @@ func (r *haresourceResource) Delete(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resID, err := customtypes.ParseHAResourceID(data.ID.ValueString())
|
resID, err := proxmoxtypes.ParseHAResourceID(data.ID.ValueString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.Diagnostics.AddError(
|
resp.Diagnostics.AddError(
|
||||||
"Unexpected error parsing Proxmox HA resource identifier",
|
"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) {
|
func (r *haresourceResource) read(ctx context.Context, data *haresourceModel) (bool, diag.Diagnostics) {
|
||||||
var diags diag.Diagnostics
|
var diags diag.Diagnostics
|
||||||
|
|
||||||
resID, err := customtypes.ParseHAResourceID(data.ID.ValueString())
|
resID, err := proxmoxtypes.ParseHAResourceID(data.ID.ValueString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
diags.AddError(
|
diags.AddError(
|
||||||
"Unexpected error parsing Proxmox HA resource identifier",
|
"Unexpected error parsing Proxmox HA resource identifier",
|
||||||
|
@ -24,9 +24,11 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
"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"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmox/nodes"
|
"github.com/bpg/terraform-provider-proxmox/proxmox/nodes"
|
||||||
|
proxmoxtypes "github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -37,16 +39,16 @@ var (
|
|||||||
|
|
||||||
type linuxBridgeResourceModel struct {
|
type linuxBridgeResourceModel struct {
|
||||||
// Base attributes
|
// Base attributes
|
||||||
ID types.String `tfsdk:"id"`
|
ID types.String `tfsdk:"id"`
|
||||||
NodeName types.String `tfsdk:"node_name"`
|
NodeName types.String `tfsdk:"node_name"`
|
||||||
Name types.String `tfsdk:"name"`
|
Name types.String `tfsdk:"name"`
|
||||||
Address pvetypes.IPCIDRValue `tfsdk:"address"`
|
Address customtypes.IPCIDRValue `tfsdk:"address"`
|
||||||
Gateway pvetypes.IPAddrValue `tfsdk:"gateway"`
|
Gateway customtypes.IPAddrValue `tfsdk:"gateway"`
|
||||||
Address6 pvetypes.IPCIDRValue `tfsdk:"address6"`
|
Address6 customtypes.IPCIDRValue `tfsdk:"address6"`
|
||||||
Gateway6 pvetypes.IPAddrValue `tfsdk:"gateway6"`
|
Gateway6 customtypes.IPAddrValue `tfsdk:"gateway6"`
|
||||||
Autostart types.Bool `tfsdk:"autostart"`
|
Autostart types.Bool `tfsdk:"autostart"`
|
||||||
MTU types.Int64 `tfsdk:"mtu"`
|
MTU types.Int64 `tfsdk:"mtu"`
|
||||||
Comment types.String `tfsdk:"comment"`
|
Comment types.String `tfsdk:"comment"`
|
||||||
// Linux bridge attributes
|
// Linux bridge attributes
|
||||||
Ports []types.String `tfsdk:"ports"`
|
Ports []types.String `tfsdk:"ports"`
|
||||||
VLANAware types.Bool `tfsdk:"vlan_aware"`
|
VLANAware types.Bool `tfsdk:"vlan_aware"`
|
||||||
@ -57,7 +59,7 @@ func (m *linuxBridgeResourceModel) exportToNetworkInterfaceCreateUpdateBody() *n
|
|||||||
body := &nodes.NetworkInterfaceCreateUpdateRequestBody{
|
body := &nodes.NetworkInterfaceCreateUpdateRequestBody{
|
||||||
Iface: m.Name.ValueString(),
|
Iface: m.Name.ValueString(),
|
||||||
Type: "bridge",
|
Type: "bridge",
|
||||||
Autostart: pvetypes.CustomBool(m.Autostart.ValueBool()).Pointer(),
|
Autostart: proxmoxtypes.CustomBool(m.Autostart.ValueBool()).Pointer(),
|
||||||
}
|
}
|
||||||
|
|
||||||
body.CIDR = m.Address.ValueStringPointer()
|
body.CIDR = m.Address.ValueStringPointer()
|
||||||
@ -87,7 +89,7 @@ func (m *linuxBridgeResourceModel) exportToNetworkInterfaceCreateUpdateBody() *n
|
|||||||
}
|
}
|
||||||
|
|
||||||
if m.VLANAware.ValueBool() {
|
if m.VLANAware.ValueBool() {
|
||||||
body.BridgeVLANAware = pvetypes.CustomBool(true).Pointer()
|
body.BridgeVLANAware = proxmoxtypes.CustomBool(true).Pointer()
|
||||||
}
|
}
|
||||||
|
|
||||||
return body
|
return body
|
||||||
@ -97,10 +99,10 @@ func (m *linuxBridgeResourceModel) importFromNetworkInterfaceList(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
iface *nodes.NetworkInterfaceListResponseData,
|
iface *nodes.NetworkInterfaceListResponseData,
|
||||||
) error {
|
) error {
|
||||||
m.Address = pvetypes.NewIPCIDRPointerValue(iface.CIDR)
|
m.Address = customtypes.NewIPCIDRPointerValue(iface.CIDR)
|
||||||
m.Gateway = pvetypes.NewIPAddrPointerValue(iface.Gateway)
|
m.Gateway = customtypes.NewIPAddrPointerValue(iface.Gateway)
|
||||||
m.Address6 = pvetypes.NewIPCIDRPointerValue(iface.CIDR6)
|
m.Address6 = customtypes.NewIPCIDRPointerValue(iface.CIDR6)
|
||||||
m.Gateway6 = pvetypes.NewIPAddrPointerValue(iface.Gateway6)
|
m.Gateway6 = customtypes.NewIPAddrPointerValue(iface.Gateway6)
|
||||||
|
|
||||||
m.Autostart = types.BoolPointerValue(iface.Autostart.PointerBool())
|
m.Autostart = types.BoolPointerValue(iface.Autostart.PointerBool())
|
||||||
if m.Autostart.IsNull() {
|
if m.Autostart.IsNull() {
|
||||||
@ -169,13 +171,7 @@ func (r *linuxBridgeResource) Schema(
|
|||||||
Description: "Manages a Linux Bridge network interface in a Proxmox VE node.",
|
Description: "Manages a Linux Bridge network interface in a Proxmox VE node.",
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
// Base attributes
|
// Base attributes
|
||||||
"id": schema.StringAttribute{
|
"id": structure.IDAttribute("A unique identifier with format '<node name>:<iface>'"),
|
||||||
Computed: true,
|
|
||||||
PlanModifiers: []planmodifier.String{
|
|
||||||
stringplanmodifier.UseStateForUnknown(),
|
|
||||||
},
|
|
||||||
Description: "A unique identifier with format '<node name>:<iface>'",
|
|
||||||
},
|
|
||||||
"node_name": schema.StringAttribute{
|
"node_name": schema.StringAttribute{
|
||||||
Description: "The name of the node.",
|
Description: "The name of the node.",
|
||||||
Required: true,
|
Required: true,
|
||||||
@ -196,22 +192,22 @@ func (r *linuxBridgeResource) Schema(
|
|||||||
},
|
},
|
||||||
"address": schema.StringAttribute{
|
"address": schema.StringAttribute{
|
||||||
Description: "The interface IPv4/CIDR address.",
|
Description: "The interface IPv4/CIDR address.",
|
||||||
CustomType: pvetypes.IPCIDRType{},
|
CustomType: customtypes.IPCIDRType{},
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
"gateway": schema.StringAttribute{
|
"gateway": schema.StringAttribute{
|
||||||
Description: "Default gateway address.",
|
Description: "Default gateway address.",
|
||||||
CustomType: pvetypes.IPAddrType{},
|
CustomType: customtypes.IPAddrType{},
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
"address6": schema.StringAttribute{
|
"address6": schema.StringAttribute{
|
||||||
Description: "The interface IPv6/CIDR address.",
|
Description: "The interface IPv6/CIDR address.",
|
||||||
CustomType: pvetypes.IPCIDRType{},
|
CustomType: customtypes.IPCIDRType{},
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
"gateway6": schema.StringAttribute{
|
"gateway6": schema.StringAttribute{
|
||||||
Description: "Default IPv6 gateway address.",
|
Description: "Default IPv6 gateway address.",
|
||||||
CustomType: pvetypes.IPAddrType{},
|
CustomType: customtypes.IPAddrType{},
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
"autostart": schema.BoolAttribute{
|
"autostart": schema.BoolAttribute{
|
||||||
|
@ -22,9 +22,11 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
"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"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmox/nodes"
|
"github.com/bpg/terraform-provider-proxmox/proxmox/nodes"
|
||||||
|
proxmoxtypes "github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -35,16 +37,16 @@ var (
|
|||||||
|
|
||||||
type linuxVLANResourceModel struct {
|
type linuxVLANResourceModel struct {
|
||||||
// Base attributes
|
// Base attributes
|
||||||
ID types.String `tfsdk:"id"`
|
ID types.String `tfsdk:"id"`
|
||||||
NodeName types.String `tfsdk:"node_name"`
|
NodeName types.String `tfsdk:"node_name"`
|
||||||
Name types.String `tfsdk:"name"`
|
Name types.String `tfsdk:"name"`
|
||||||
Address pvetypes.IPCIDRValue `tfsdk:"address"`
|
Address customtypes.IPCIDRValue `tfsdk:"address"`
|
||||||
Gateway pvetypes.IPAddrValue `tfsdk:"gateway"`
|
Gateway customtypes.IPAddrValue `tfsdk:"gateway"`
|
||||||
Address6 pvetypes.IPCIDRValue `tfsdk:"address6"`
|
Address6 customtypes.IPCIDRValue `tfsdk:"address6"`
|
||||||
Gateway6 pvetypes.IPAddrValue `tfsdk:"gateway6"`
|
Gateway6 customtypes.IPAddrValue `tfsdk:"gateway6"`
|
||||||
Autostart types.Bool `tfsdk:"autostart"`
|
Autostart types.Bool `tfsdk:"autostart"`
|
||||||
MTU types.Int64 `tfsdk:"mtu"`
|
MTU types.Int64 `tfsdk:"mtu"`
|
||||||
Comment types.String `tfsdk:"comment"`
|
Comment types.String `tfsdk:"comment"`
|
||||||
// Linux VLAN attributes
|
// Linux VLAN attributes
|
||||||
Interface types.String `tfsdk:"interface"`
|
Interface types.String `tfsdk:"interface"`
|
||||||
VLAN types.Int64 `tfsdk:"vlan"`
|
VLAN types.Int64 `tfsdk:"vlan"`
|
||||||
@ -55,7 +57,7 @@ func (m *linuxVLANResourceModel) exportToNetworkInterfaceCreateUpdateBody() *nod
|
|||||||
body := &nodes.NetworkInterfaceCreateUpdateRequestBody{
|
body := &nodes.NetworkInterfaceCreateUpdateRequestBody{
|
||||||
Iface: m.Name.ValueString(),
|
Iface: m.Name.ValueString(),
|
||||||
Type: "vlan",
|
Type: "vlan",
|
||||||
Autostart: pvetypes.CustomBool(m.Autostart.ValueBool()).Pointer(),
|
Autostart: proxmoxtypes.CustomBool(m.Autostart.ValueBool()).Pointer(),
|
||||||
}
|
}
|
||||||
|
|
||||||
body.CIDR = m.Address.ValueStringPointer()
|
body.CIDR = m.Address.ValueStringPointer()
|
||||||
@ -80,10 +82,10 @@ func (m *linuxVLANResourceModel) exportToNetworkInterfaceCreateUpdateBody() *nod
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *linuxVLANResourceModel) importFromNetworkInterfaceList(iface *nodes.NetworkInterfaceListResponseData) {
|
func (m *linuxVLANResourceModel) importFromNetworkInterfaceList(iface *nodes.NetworkInterfaceListResponseData) {
|
||||||
m.Address = pvetypes.NewIPCIDRPointerValue(iface.CIDR)
|
m.Address = customtypes.NewIPCIDRPointerValue(iface.CIDR)
|
||||||
m.Gateway = pvetypes.NewIPAddrPointerValue(iface.Gateway)
|
m.Gateway = customtypes.NewIPAddrPointerValue(iface.Gateway)
|
||||||
m.Address6 = pvetypes.NewIPCIDRPointerValue(iface.CIDR6)
|
m.Address6 = customtypes.NewIPCIDRPointerValue(iface.CIDR6)
|
||||||
m.Gateway6 = pvetypes.NewIPAddrPointerValue(iface.Gateway6)
|
m.Gateway6 = customtypes.NewIPAddrPointerValue(iface.Gateway6)
|
||||||
m.Autostart = types.BoolPointerValue(iface.Autostart.PointerBool())
|
m.Autostart = types.BoolPointerValue(iface.Autostart.PointerBool())
|
||||||
|
|
||||||
if iface.MTU != nil {
|
if iface.MTU != nil {
|
||||||
@ -143,13 +145,7 @@ func (r *linuxVLANResource) Schema(
|
|||||||
Description: "Manages a Linux VLAN network interface in a Proxmox VE node.",
|
Description: "Manages a Linux VLAN network interface in a Proxmox VE node.",
|
||||||
Attributes: map[string]schema.Attribute{
|
Attributes: map[string]schema.Attribute{
|
||||||
// Base attributes
|
// Base attributes
|
||||||
"id": schema.StringAttribute{
|
"id": structure.IDAttribute("A unique identifier with format '<node name>:<iface>'."),
|
||||||
Computed: true,
|
|
||||||
PlanModifiers: []planmodifier.String{
|
|
||||||
stringplanmodifier.UseStateForUnknown(),
|
|
||||||
},
|
|
||||||
Description: "A unique identifier with format '<node name>:<iface>'.",
|
|
||||||
},
|
|
||||||
"node_name": schema.StringAttribute{
|
"node_name": schema.StringAttribute{
|
||||||
Description: "The name of the node.",
|
Description: "The name of the node.",
|
||||||
Required: true,
|
Required: true,
|
||||||
@ -169,22 +165,22 @@ func (r *linuxVLANResource) Schema(
|
|||||||
},
|
},
|
||||||
"address": schema.StringAttribute{
|
"address": schema.StringAttribute{
|
||||||
Description: "The interface IPv4/CIDR address.",
|
Description: "The interface IPv4/CIDR address.",
|
||||||
CustomType: pvetypes.IPCIDRType{},
|
CustomType: customtypes.IPCIDRType{},
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
"gateway": schema.StringAttribute{
|
"gateway": schema.StringAttribute{
|
||||||
Description: "Default gateway address.",
|
Description: "Default gateway address.",
|
||||||
CustomType: pvetypes.IPAddrType{},
|
CustomType: customtypes.IPAddrType{},
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
"address6": schema.StringAttribute{
|
"address6": schema.StringAttribute{
|
||||||
Description: "The interface IPv6/CIDR address.",
|
Description: "The interface IPv6/CIDR address.",
|
||||||
CustomType: pvetypes.IPCIDRType{},
|
CustomType: customtypes.IPCIDRType{},
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
"gateway6": schema.StringAttribute{
|
"gateway6": schema.StringAttribute{
|
||||||
Description: "Default IPv6 gateway address.",
|
Description: "Default IPv6 gateway address.",
|
||||||
CustomType: pvetypes.IPAddrType{},
|
CustomType: customtypes.IPAddrType{},
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
"autostart": schema.BoolAttribute{
|
"autostart": schema.BoolAttribute{
|
||||||
|
@ -13,11 +13,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// IDAttribute generates an attribute definition suitable for the always-present `id` attribute.
|
// IDAttribute generates an attribute definition suitable for the always-present `id` attribute.
|
||||||
func IDAttribute() schema.StringAttribute {
|
func IDAttribute(desc ...string) schema.StringAttribute {
|
||||||
return schema.StringAttribute{
|
attr := schema.StringAttribute{
|
||||||
Computed: true,
|
Computed: true,
|
||||||
PlanModifiers: []planmodifier.String{
|
PlanModifiers: []planmodifier.String{
|
||||||
stringplanmodifier.UseStateForUnknown(),
|
stringplanmodifier.UseStateForUnknown(),
|
||||||
},
|
},
|
||||||
|
Description: "The unique identifier for the resource.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(desc) > 0 {
|
||||||
|
attr.Description = desc[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
return attr
|
||||||
}
|
}
|
||||||
|
28
internal/validators/ha_resource_validator.go
Normal file
28
internal/validators/ha_resource_validator.go
Normal file
@ -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")
|
||||||
|
}
|
@ -7,7 +7,7 @@
|
|||||||
package access
|
package access
|
||||||
|
|
||||||
import (
|
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.
|
// ACLGetResponseBody contains the body from an access control list response.
|
||||||
|
@ -13,8 +13,8 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/internal/types"
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmox/api"
|
"github.com/bpg/terraform-provider-proxmox/proxmox/api"
|
||||||
|
"github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Client) rolesPath() string {
|
func (c *Client) rolesPath() string {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package access
|
package access
|
||||||
|
|
||||||
import (
|
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.
|
// RoleCreateRequestBody contains the data for an access group create request.
|
||||||
|
@ -14,8 +14,8 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/internal/types"
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmox/api"
|
"github.com/bpg/terraform-provider-proxmox/proxmox/api"
|
||||||
|
"github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Client) usersPath() string {
|
func (c *Client) usersPath() string {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package access
|
package access
|
||||||
|
|
||||||
import (
|
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.
|
// UserChangePasswordRequestBody contains the data for a user password change request.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
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.
|
// AuthenticationResponseBody contains the body from an authentication response.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package cluster
|
package cluster
|
||||||
|
|
||||||
import (
|
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.
|
// NextIDRequestBody contains the data for a cluster next id request.
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"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.
|
// OptionsPutRequestBody is the request body for the PUT /cluster/firewall/options API call.
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
package groups
|
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.
|
// HAGroupListResponseBody contains the body from a HA group list response.
|
||||||
type HAGroupListResponseBody struct {
|
type HAGroupListResponseBody struct {
|
||||||
|
@ -13,17 +13,17 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/internal/types"
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmox/api"
|
"github.com/bpg/terraform-provider-proxmox/proxmox/api"
|
||||||
|
types2 "github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type haResourceTypeListQuery struct {
|
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;
|
// 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`).
|
// 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}
|
options := &haResourceTypeListQuery{resType}
|
||||||
resBody := &HAResourceListResponseBody{}
|
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.
|
// 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{}
|
resBody := &HAResourceGetResponseBody{}
|
||||||
|
|
||||||
err := c.DoRequest(ctx, http.MethodGet, c.ExpandPath(url.PathEscape(id.String())), nil, resBody)
|
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.
|
// 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)
|
err := c.DoRequest(ctx, http.MethodPut, c.ExpandPath(url.PathEscape(id.String())), data, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error updating HA resource %v: %w", id, err)
|
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.
|
// 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)
|
err := c.DoRequest(ctx, http.MethodDelete, c.ExpandPath(url.PathEscape(id.String())), nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error deleting HA resource %v: %w", id, err)
|
return fmt.Errorf("error deleting HA resource %v: %w", id, err)
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
package resources
|
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.
|
// HAResourceListResponseBody contains the body from a HA resource list response.
|
||||||
type HAResourceListResponseBody struct {
|
type HAResourceListResponseBody struct {
|
||||||
@ -15,7 +17,7 @@ type HAResourceListResponseBody struct {
|
|||||||
|
|
||||||
// HAResourceListResponseData contains the data from a HA resource list response.
|
// HAResourceListResponseData contains the data from a HA resource list response.
|
||||||
type HAResourceListResponseData struct {
|
type HAResourceListResponseData struct {
|
||||||
ID types.HAResourceID `json:"sid"`
|
ID types2.HAResourceID `json:"sid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HAResourceGetResponseBody contains the body from a HA resource get response.
|
// HAResourceGetResponseBody contains the body from a HA resource get response.
|
||||||
@ -34,7 +36,7 @@ type HAResourceDataBase struct {
|
|||||||
// Maximal number of service restart attempts.
|
// Maximal number of service restart attempts.
|
||||||
MaxRestart *int64 `json:"max_restart" url:"max_restart,omitempty"`
|
MaxRestart *int64 `json:"max_restart" url:"max_restart,omitempty"`
|
||||||
// Requested resource state.
|
// 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
|
// 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 {
|
type HAResourceGetResponseData struct {
|
||||||
HAResourceDataBase
|
HAResourceDataBase
|
||||||
// Identifier of this resource
|
// Identifier of this resource
|
||||||
ID types.HAResourceID `json:"sid"`
|
ID types2.HAResourceID `json:"sid"`
|
||||||
// Type of this resource
|
// Type of this resource
|
||||||
Type types.HAResourceType `json:"type"`
|
Type types2.HAResourceType `json:"type"`
|
||||||
// SHA-1 digest of the resources' configuration.
|
// SHA-1 digest of the resources' configuration.
|
||||||
Digest *string `json:"digest,omitempty"`
|
Digest *string `json:"digest,omitempty"`
|
||||||
}
|
}
|
||||||
@ -53,9 +55,9 @@ type HAResourceGetResponseData struct {
|
|||||||
type HAResourceCreateRequestBody struct {
|
type HAResourceCreateRequestBody struct {
|
||||||
HAResourceDataBase
|
HAResourceDataBase
|
||||||
// Identifier of this resource
|
// Identifier of this resource
|
||||||
ID types.HAResourceID `url:"sid"`
|
ID types2.HAResourceID `url:"sid"`
|
||||||
// Type of this resource
|
// Type of this resource
|
||||||
Type *types.HAResourceType `url:"type,omitempty"`
|
Type *types2.HAResourceType `url:"type,omitempty"`
|
||||||
// SHA-1 digest of the resources' configuration.
|
// SHA-1 digest of the resources' configuration.
|
||||||
Digest *string `url:"comment,omitempty"`
|
Digest *string `url:"comment,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package firewall
|
package firewall
|
||||||
|
|
||||||
import (
|
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.
|
// IPSetListResponseBody contains the data from an IPSet get response.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package firewall
|
package firewall
|
||||||
|
|
||||||
import (
|
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.
|
// OptionsPutRequestBody is the request body for the PUT /cluster/firewall/options API call.
|
||||||
|
@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"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/api"
|
||||||
|
"github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Rule is an interface for the Proxmox firewall rule API.
|
// Rule is an interface for the Proxmox firewall rule API.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package nodes
|
package nodes
|
||||||
|
|
||||||
import (
|
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.
|
// CertificateDeleteRequestBody contains the data for a custom certificate delete request.
|
||||||
|
@ -13,26 +13,26 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"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.
|
// CloneRequestBody contains the data for an container clone request.
|
||||||
type CloneRequestBody struct {
|
type CloneRequestBody struct {
|
||||||
BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"`
|
BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"`
|
||||||
Description *string `json:"description,omitempty" url:"description,omitempty"`
|
Description *string `json:"description,omitempty" url:"description,omitempty"`
|
||||||
FullCopy *types.CustomBool `json:"full,omitempty" url:"full,omitempty,int"`
|
FullCopy *types2.CustomBool `json:"full,omitempty" url:"full,omitempty,int"`
|
||||||
Hostname *string `json:"hostname,omitempty" url:"hostname,omitempty"`
|
Hostname *string `json:"hostname,omitempty" url:"hostname,omitempty"`
|
||||||
PoolID *string `json:"pool,omitempty" url:"pool,omitempty"`
|
PoolID *string `json:"pool,omitempty" url:"pool,omitempty"`
|
||||||
SnapshotName *string `json:"snapname,omitempty" url:"snapname,omitempty"`
|
SnapshotName *string `json:"snapname,omitempty" url:"snapname,omitempty"`
|
||||||
TargetNodeName *string `json:"target,omitempty" url:"target,omitempty"`
|
TargetNodeName *string `json:"target,omitempty" url:"target,omitempty"`
|
||||||
TargetStorage *string `json:"storage,omitempty" url:"storage,omitempty"`
|
TargetStorage *string `json:"storage,omitempty" url:"storage,omitempty"`
|
||||||
VMIDNew int `json:"newid" url:"newid"`
|
VMIDNew int `json:"newid" url:"newid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateRequestBody contains the data for a user create request.
|
// CreateRequestBody contains the data for a user create request.
|
||||||
type CreateRequestBody struct {
|
type CreateRequestBody struct {
|
||||||
BandwidthLimit *float64 `json:"bwlimit,omitempty" url:"bwlimit,omitempty"`
|
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"`
|
ConsoleMode *string `json:"cmode,omitempty" url:"cmode,omitempty"`
|
||||||
CPUArchitecture *string `json:"arch,omitempty" url:"arch,omitempty"`
|
CPUArchitecture *string `json:"arch,omitempty" url:"arch,omitempty"`
|
||||||
CPUCores *int `json:"cores,omitempty" url:"cores,omitempty"`
|
CPUCores *int `json:"cores,omitempty" url:"cores,omitempty"`
|
||||||
@ -45,10 +45,10 @@ type CreateRequestBody struct {
|
|||||||
DNSDomain *string `json:"searchdomain,omitempty" url:"searchdomain,omitempty"`
|
DNSDomain *string `json:"searchdomain,omitempty" url:"searchdomain,omitempty"`
|
||||||
DNSServer *string `json:"nameserver,omitempty" url:"nameserver,omitempty"`
|
DNSServer *string `json:"nameserver,omitempty" url:"nameserver,omitempty"`
|
||||||
Features *CustomFeatures `json:"features,omitempty" url:"features,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"`
|
HookScript *string `json:"hookscript,omitempty" url:"hookscript,omitempty"`
|
||||||
Hostname *string `json:"hostname,omitempty" url:"hostname,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"`
|
Lock *string `json:"lock,omitempty" url:"lock,omitempty,int"`
|
||||||
MountPoints CustomMountPointArray `json:"mp,omitempty" url:"mp,omitempty,numbered"`
|
MountPoints CustomMountPointArray `json:"mp,omitempty" url:"mp,omitempty,numbered"`
|
||||||
NetworkInterfaces CustomNetworkInterfaceArray `json:"net,omitempty" url:"net,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"`
|
OSType *string `json:"ostype,omitempty" url:"ostype,omitempty"`
|
||||||
Password *string `json:"password,omitempty" url:"password,omitempty"`
|
Password *string `json:"password,omitempty" url:"password,omitempty"`
|
||||||
PoolID *string `json:"pool,omitempty" url:"pool,omitempty"`
|
PoolID *string `json:"pool,omitempty" url:"pool,omitempty"`
|
||||||
Protection *types.CustomBool `json:"protection,omitempty" url:"protection,omitempty,int"`
|
Protection *types2.CustomBool `json:"protection,omitempty" url:"protection,omitempty,int"`
|
||||||
Restore *types.CustomBool `json:"restore,omitempty" url:"restore,omitempty,int"`
|
Restore *types2.CustomBool `json:"restore,omitempty" url:"restore,omitempty,int"`
|
||||||
RootFS *CustomRootFS `json:"rootfs,omitempty" url:"rootfs,omitempty"`
|
RootFS *CustomRootFS `json:"rootfs,omitempty" url:"rootfs,omitempty"`
|
||||||
SSHKeys *CustomSSHKeys `json:"ssh-public-keys,omitempty" url:"ssh-public-keys,omitempty"`
|
SSHKeys *CustomSSHKeys `json:"ssh-public-keys,omitempty" url:"ssh-public-keys,omitempty"`
|
||||||
Start *types.CustomBool `json:"start,omitempty" url:"start,omitempty,int"`
|
Start *types2.CustomBool `json:"start,omitempty" url:"start,omitempty,int"`
|
||||||
StartOnBoot *types.CustomBool `json:"onboot,omitempty" url:"onboot,omitempty,int"`
|
StartOnBoot *types2.CustomBool `json:"onboot,omitempty" url:"onboot,omitempty,int"`
|
||||||
StartupBehavior *CustomStartupBehavior `json:"startup,omitempty" url:"startup,omitempty"`
|
StartupBehavior *CustomStartupBehavior `json:"startup,omitempty" url:"startup,omitempty"`
|
||||||
Swap *int `json:"swap,omitempty" url:"swap,omitempty"`
|
Swap *int `json:"swap,omitempty" url:"swap,omitempty"`
|
||||||
Tags *string `json:"tags,omitempty" url:"tags,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"`
|
TTY *int `json:"tty,omitempty" url:"tty,omitempty"`
|
||||||
Unique *types.CustomBool `json:"unique,omitempty" url:"unique,omitempty,int"`
|
Unique *types2.CustomBool `json:"unique,omitempty" url:"unique,omitempty,int"`
|
||||||
Unprivileged *types.CustomBool `json:"unprivileged,omitempty" url:"unprivileged,omitempty,int"`
|
Unprivileged *types2.CustomBool `json:"unprivileged,omitempty" url:"unprivileged,omitempty,int"`
|
||||||
VMID *int `json:"vmid,omitempty" url:"vmid,omitempty"`
|
VMID *int `json:"vmid,omitempty" url:"vmid,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomFeatures contains the values for the "features" property.
|
// CustomFeatures contains the values for the "features" property.
|
||||||
type CustomFeatures struct {
|
type CustomFeatures struct {
|
||||||
FUSE *types.CustomBool `json:"fuse,omitempty" url:"fuse,omitempty,int"`
|
FUSE *types2.CustomBool `json:"fuse,omitempty" url:"fuse,omitempty,int"`
|
||||||
KeyControl *types.CustomBool `json:"keyctl,omitempty" url:"keyctl,omitempty,int"`
|
KeyControl *types2.CustomBool `json:"keyctl,omitempty" url:"keyctl,omitempty,int"`
|
||||||
MountTypes *[]string `json:"mount,omitempty" url:"mount,omitempty"`
|
MountTypes *[]string `json:"mount,omitempty" url:"mount,omitempty"`
|
||||||
Nesting *types.CustomBool `json:"nesting,omitempty" url:"nesting,omitempty,int"`
|
Nesting *types2.CustomBool `json:"nesting,omitempty" url:"nesting,omitempty,int"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomMountPoint contains the values for the "mp[n]" properties.
|
// CustomMountPoint contains the values for the "mp[n]" properties.
|
||||||
type CustomMountPoint struct {
|
type CustomMountPoint struct {
|
||||||
ACL *types.CustomBool `json:"acl,omitempty" url:"acl,omitempty,int"`
|
ACL *types2.CustomBool `json:"acl,omitempty" url:"acl,omitempty,int"`
|
||||||
Backup *types.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"`
|
Backup *types2.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"`
|
||||||
DiskSize *string `json:"size,omitempty" url:"size,omitempty"` // read-only
|
DiskSize *string `json:"size,omitempty" url:"size,omitempty"` // read-only
|
||||||
Enabled bool `json:"-" url:"-"`
|
Enabled bool `json:"-" url:"-"`
|
||||||
MountOptions *[]string `json:"mountoptions,omitempty" url:"mountoptions,omitempty"`
|
MountOptions *[]string `json:"mountoptions,omitempty" url:"mountoptions,omitempty"`
|
||||||
MountPoint string `json:"mp" url:"mp"`
|
MountPoint string `json:"mp" url:"mp"`
|
||||||
Quota *types.CustomBool `json:"quota,omitempty" url:"quota,omitempty,int"`
|
Quota *types2.CustomBool `json:"quota,omitempty" url:"quota,omitempty,int"`
|
||||||
ReadOnly *types.CustomBool `json:"ro,omitempty" url:"ro,omitempty,int"`
|
ReadOnly *types2.CustomBool `json:"ro,omitempty" url:"ro,omitempty,int"`
|
||||||
Replicate *types.CustomBool `json:"replicate,omitempty" url:"replicate,omitempty,int"`
|
Replicate *types2.CustomBool `json:"replicate,omitempty" url:"replicate,omitempty,int"`
|
||||||
Shared *types.CustomBool `json:"shared,omitempty" url:"shared,omitempty,int"`
|
Shared *types2.CustomBool `json:"shared,omitempty" url:"shared,omitempty,int"`
|
||||||
Volume string `json:"volume" url:"volume"`
|
Volume string `json:"volume" url:"volume"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomMountPointArray is an array of CustomMountPoint.
|
// CustomMountPointArray is an array of CustomMountPoint.
|
||||||
@ -100,20 +100,20 @@ type CustomMountPointArray []CustomMountPoint
|
|||||||
|
|
||||||
// CustomNetworkInterface contains the values for the "net[n]" properties.
|
// CustomNetworkInterface contains the values for the "net[n]" properties.
|
||||||
type CustomNetworkInterface struct {
|
type CustomNetworkInterface struct {
|
||||||
Bridge *string `json:"bridge,omitempty" url:"bridge,omitempty"`
|
Bridge *string `json:"bridge,omitempty" url:"bridge,omitempty"`
|
||||||
Enabled bool `json:"-" url:"-"`
|
Enabled bool `json:"-" url:"-"`
|
||||||
Firewall *types.CustomBool `json:"firewall,omitempty" url:"firewall,omitempty,int"`
|
Firewall *types2.CustomBool `json:"firewall,omitempty" url:"firewall,omitempty,int"`
|
||||||
IPv4Address *string `json:"ip,omitempty" url:"ip,omitempty"`
|
IPv4Address *string `json:"ip,omitempty" url:"ip,omitempty"`
|
||||||
IPv4Gateway *string `json:"gw,omitempty" url:"gw,omitempty"`
|
IPv4Gateway *string `json:"gw,omitempty" url:"gw,omitempty"`
|
||||||
IPv6Address *string `json:"ip6,omitempty" url:"ip6,omitempty"`
|
IPv6Address *string `json:"ip6,omitempty" url:"ip6,omitempty"`
|
||||||
IPv6Gateway *string `json:"gw6,omitempty" url:"gw6,omitempty"`
|
IPv6Gateway *string `json:"gw6,omitempty" url:"gw6,omitempty"`
|
||||||
MACAddress *string `json:"hwaddr,omitempty" url:"hwaddr,omitempty"`
|
MACAddress *string `json:"hwaddr,omitempty" url:"hwaddr,omitempty"`
|
||||||
MTU *int `json:"mtu,omitempty" url:"mtu,omitempty"`
|
MTU *int `json:"mtu,omitempty" url:"mtu,omitempty"`
|
||||||
Name string `json:"name" url:"name"`
|
Name string `json:"name" url:"name"`
|
||||||
RateLimit *float64 `json:"rate,omitempty" url:"rate,omitempty"`
|
RateLimit *float64 `json:"rate,omitempty" url:"rate,omitempty"`
|
||||||
Tag *int `json:"tag,omitempty" url:"tag,omitempty"`
|
Tag *int `json:"tag,omitempty" url:"tag,omitempty"`
|
||||||
Trunks *[]int `json:"trunks,omitempty" url:"trunks,omitempty"`
|
Trunks *[]int `json:"trunks,omitempty" url:"trunks,omitempty"`
|
||||||
Type *string `json:"type,omitempty" url:"type,omitempty"`
|
Type *string `json:"type,omitempty" url:"type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomNetworkInterfaceArray is an array of CustomNetworkInterface.
|
// CustomNetworkInterfaceArray is an array of CustomNetworkInterface.
|
||||||
@ -121,14 +121,14 @@ type CustomNetworkInterfaceArray []CustomNetworkInterface
|
|||||||
|
|
||||||
// CustomRootFS contains the values for the "rootfs" property.
|
// CustomRootFS contains the values for the "rootfs" property.
|
||||||
type CustomRootFS struct {
|
type CustomRootFS struct {
|
||||||
ACL *types.CustomBool `json:"acl,omitempty" url:"acl,omitempty,int"`
|
ACL *types2.CustomBool `json:"acl,omitempty" url:"acl,omitempty,int"`
|
||||||
Size *types.DiskSize `json:"size,omitempty" url:"size,omitempty"`
|
Size *types2.DiskSize `json:"size,omitempty" url:"size,omitempty"`
|
||||||
MountOptions *[]string `json:"mountoptions,omitempty" url:"mountoptions,omitempty"`
|
MountOptions *[]string `json:"mountoptions,omitempty" url:"mountoptions,omitempty"`
|
||||||
Quota *types.CustomBool `json:"quota,omitempty" url:"quota,omitempty,int"`
|
Quota *types2.CustomBool `json:"quota,omitempty" url:"quota,omitempty,int"`
|
||||||
ReadOnly *types.CustomBool `json:"ro,omitempty" url:"ro,omitempty,int"`
|
ReadOnly *types2.CustomBool `json:"ro,omitempty" url:"ro,omitempty,int"`
|
||||||
Replicate *types.CustomBool `json:"replicate,omitempty" url:"replicate,omitempty,int"`
|
Replicate *types2.CustomBool `json:"replicate,omitempty" url:"replicate,omitempty,int"`
|
||||||
Shared *types.CustomBool `json:"shared,omitempty" url:"shared,omitempty,int"`
|
Shared *types2.CustomBool `json:"shared,omitempty" url:"shared,omitempty,int"`
|
||||||
Volume string `json:"volume" url:"volume"`
|
Volume string `json:"volume" url:"volume"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomSSHKeys contains the values for the "ssh-public-keys" property.
|
// 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.
|
// GetResponseData contains the data from a user get response.
|
||||||
type GetResponseData struct {
|
type GetResponseData struct {
|
||||||
ConsoleEnabled *types.CustomBool `json:"console,omitempty"`
|
ConsoleEnabled *types2.CustomBool `json:"console,omitempty"`
|
||||||
ConsoleMode *string `json:"cmode,omitempty"`
|
ConsoleMode *string `json:"cmode,omitempty"`
|
||||||
CPUArchitecture *string `json:"arch,omitempty"`
|
CPUArchitecture *string `json:"arch,omitempty"`
|
||||||
CPUCores *int `json:"cores,omitempty"`
|
CPUCores *int `json:"cores,omitempty"`
|
||||||
@ -167,7 +167,7 @@ type GetResponseData struct {
|
|||||||
Features *CustomFeatures `json:"features,omitempty"`
|
Features *CustomFeatures `json:"features,omitempty"`
|
||||||
HookScript *string `json:"hookscript,omitempty"`
|
HookScript *string `json:"hookscript,omitempty"`
|
||||||
Hostname *string `json:"hostname,omitempty"`
|
Hostname *string `json:"hostname,omitempty"`
|
||||||
Lock *types.CustomBool `json:"lock,omitempty"`
|
Lock *types2.CustomBool `json:"lock,omitempty"`
|
||||||
LXCConfiguration *[][2]string `json:"lxc,omitempty"`
|
LXCConfiguration *[][2]string `json:"lxc,omitempty"`
|
||||||
MountPoint0 *CustomMountPoint `json:"mp0,omitempty"`
|
MountPoint0 *CustomMountPoint `json:"mp0,omitempty"`
|
||||||
MountPoint1 *CustomMountPoint `json:"mp1,omitempty"`
|
MountPoint1 *CustomMountPoint `json:"mp1,omitempty"`
|
||||||
@ -186,15 +186,15 @@ type GetResponseData struct {
|
|||||||
NetworkInterface6 *CustomNetworkInterface `json:"net6,omitempty"`
|
NetworkInterface6 *CustomNetworkInterface `json:"net6,omitempty"`
|
||||||
NetworkInterface7 *CustomNetworkInterface `json:"net7,omitempty"`
|
NetworkInterface7 *CustomNetworkInterface `json:"net7,omitempty"`
|
||||||
OSType *string `json:"ostype,omitempty"`
|
OSType *string `json:"ostype,omitempty"`
|
||||||
Protection *types.CustomBool `json:"protection,omitempty"`
|
Protection *types2.CustomBool `json:"protection,omitempty"`
|
||||||
RootFS *CustomRootFS `json:"rootfs,omitempty"`
|
RootFS *CustomRootFS `json:"rootfs,omitempty"`
|
||||||
StartOnBoot *types.CustomBool `json:"onboot,omitempty"`
|
StartOnBoot *types2.CustomBool `json:"onboot,omitempty"`
|
||||||
StartupBehavior *CustomStartupBehavior `json:"startup,omitempty"`
|
StartupBehavior *CustomStartupBehavior `json:"startup,omitempty"`
|
||||||
Swap *int `json:"swap,omitempty"`
|
Swap *int `json:"swap,omitempty"`
|
||||||
Tags *string `json:"tags,omitempty"`
|
Tags *string `json:"tags,omitempty"`
|
||||||
Template *types.CustomBool `json:"template,omitempty"`
|
Template *types2.CustomBool `json:"template,omitempty"`
|
||||||
TTY *int `json:"tty,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.
|
// 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.
|
// ShutdownRequestBody contains the body for a container shutdown request.
|
||||||
type ShutdownRequestBody struct {
|
type ShutdownRequestBody struct {
|
||||||
ForceStop *types.CustomBool `json:"forceStop,omitempty" url:"forceStop,omitempty,int"`
|
ForceStop *types2.CustomBool `json:"forceStop,omitempty" url:"forceStop,omitempty,int"`
|
||||||
Timeout *int `json:"timeout,omitempty" url:"timeout,omitempty"`
|
Timeout *int `json:"timeout,omitempty" url:"timeout,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateRequestBody contains the data for an user update request.
|
// UpdateRequestBody contains the data for an user update request.
|
||||||
@ -564,10 +564,10 @@ func (r *CustomFeatures) UnmarshalJSON(b []byte) error {
|
|||||||
if len(v) == 2 {
|
if len(v) == 2 {
|
||||||
switch v[0] {
|
switch v[0] {
|
||||||
case "fuse":
|
case "fuse":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.FUSE = &bv
|
r.FUSE = &bv
|
||||||
case "keyctl":
|
case "keyctl":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.KeyControl = &bv
|
r.KeyControl = &bv
|
||||||
case "mount":
|
case "mount":
|
||||||
if v[1] != "" {
|
if v[1] != "" {
|
||||||
@ -578,7 +578,7 @@ func (r *CustomFeatures) UnmarshalJSON(b []byte) error {
|
|||||||
r.MountTypes = &a
|
r.MountTypes = &a
|
||||||
}
|
}
|
||||||
case "nesting":
|
case "nesting":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Nesting = &bv
|
r.Nesting = &bv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -606,10 +606,10 @@ func (r *CustomMountPoint) UnmarshalJSON(b []byte) error {
|
|||||||
} else if len(v) == 2 {
|
} else if len(v) == 2 {
|
||||||
switch v[0] {
|
switch v[0] {
|
||||||
case "acl":
|
case "acl":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.ACL = &bv
|
r.ACL = &bv
|
||||||
case "backup":
|
case "backup":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Backup = &bv
|
r.Backup = &bv
|
||||||
case "mountoptions":
|
case "mountoptions":
|
||||||
if v[1] != "" {
|
if v[1] != "" {
|
||||||
@ -622,16 +622,16 @@ func (r *CustomMountPoint) UnmarshalJSON(b []byte) error {
|
|||||||
case "mp":
|
case "mp":
|
||||||
r.MountPoint = v[1]
|
r.MountPoint = v[1]
|
||||||
case "quota":
|
case "quota":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Quota = &bv
|
r.Quota = &bv
|
||||||
case "ro":
|
case "ro":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.ReadOnly = &bv
|
r.ReadOnly = &bv
|
||||||
case "replicate":
|
case "replicate":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Replicate = &bv
|
r.Replicate = &bv
|
||||||
case "shared":
|
case "shared":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Shared = &bv
|
r.Shared = &bv
|
||||||
case "size":
|
case "size":
|
||||||
r.DiskSize = &v[1]
|
r.DiskSize = &v[1]
|
||||||
@ -664,7 +664,7 @@ func (r *CustomNetworkInterface) UnmarshalJSON(b []byte) error {
|
|||||||
case "bridge":
|
case "bridge":
|
||||||
r.Bridge = &v[1]
|
r.Bridge = &v[1]
|
||||||
case "firewall":
|
case "firewall":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Firewall = &bv
|
r.Firewall = &bv
|
||||||
case "gw":
|
case "gw":
|
||||||
r.IPv4Gateway = &v[1]
|
r.IPv4Gateway = &v[1]
|
||||||
@ -745,7 +745,7 @@ func (r *CustomRootFS) UnmarshalJSON(b []byte) error {
|
|||||||
} else if len(v) == 2 {
|
} else if len(v) == 2 {
|
||||||
switch v[0] {
|
switch v[0] {
|
||||||
case "acl":
|
case "acl":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.ACL = &bv
|
r.ACL = &bv
|
||||||
case "mountoptions":
|
case "mountoptions":
|
||||||
if v[1] != "" {
|
if v[1] != "" {
|
||||||
@ -756,19 +756,19 @@ func (r *CustomRootFS) UnmarshalJSON(b []byte) error {
|
|||||||
r.MountOptions = &a
|
r.MountOptions = &a
|
||||||
}
|
}
|
||||||
case "quota":
|
case "quota":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Quota = &bv
|
r.Quota = &bv
|
||||||
case "ro":
|
case "ro":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.ReadOnly = &bv
|
r.ReadOnly = &bv
|
||||||
case "replicate":
|
case "replicate":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Replicate = &bv
|
r.Replicate = &bv
|
||||||
case "shared":
|
case "shared":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Shared = &bv
|
r.Shared = &bv
|
||||||
case "size":
|
case "size":
|
||||||
r.Size = new(types.DiskSize)
|
r.Size = new(types2.DiskSize)
|
||||||
err := r.Size.UnmarshalJSON([]byte(v[1]))
|
err := r.Size.UnmarshalJSON([]byte(v[1]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to unmarshal disk size: %w", err)
|
return fmt.Errorf("failed to unmarshal disk size: %w", err)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package nodes
|
package nodes
|
||||||
|
|
||||||
import (
|
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.
|
// NetworkInterfaceListResponseBody contains the body from a node network interface list response.
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"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.
|
// CustomCommands contains an array of commands to execute.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package nodes
|
package nodes
|
||||||
|
|
||||||
import (
|
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.
|
// DatastoreFileListResponseBody contains the body from a datastore content list response.
|
||||||
|
@ -15,14 +15,14 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/internal/types"
|
types2 "github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CustomAgent handles QEMU agent parameters.
|
// CustomAgent handles QEMU agent parameters.
|
||||||
type CustomAgent struct {
|
type CustomAgent struct {
|
||||||
Enabled *types.CustomBool `json:"enabled,omitempty" url:"enabled,int"`
|
Enabled *types2.CustomBool `json:"enabled,omitempty" url:"enabled,int"`
|
||||||
TrimClonedDisks *types.CustomBool `json:"fstrim_cloned_disks" url:"fstrim_cloned_disks,int"`
|
TrimClonedDisks *types2.CustomBool `json:"fstrim_cloned_disks" url:"fstrim_cloned_disks,int"`
|
||||||
Type *string `json:"type" url:"type"`
|
Type *string `json:"type" url:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomAudioDevice handles QEMU audio parameters.
|
// CustomAudioDevice handles QEMU audio parameters.
|
||||||
@ -73,33 +73,33 @@ type CustomCloudInitSSHKeys []string
|
|||||||
|
|
||||||
// CustomCPUEmulation handles QEMU CPU emulation parameters.
|
// CustomCPUEmulation handles QEMU CPU emulation parameters.
|
||||||
type CustomCPUEmulation struct {
|
type CustomCPUEmulation struct {
|
||||||
Flags *[]string `json:"flags,omitempty" url:"flags,omitempty,semicolon"`
|
Flags *[]string `json:"flags,omitempty" url:"flags,omitempty,semicolon"`
|
||||||
Hidden *types.CustomBool `json:"hidden,omitempty" url:"hidden,omitempty,int"`
|
Hidden *types2.CustomBool `json:"hidden,omitempty" url:"hidden,omitempty,int"`
|
||||||
HVVendorID *string `json:"hv-vendor-id,omitempty" url:"hv-vendor-id,omitempty"`
|
HVVendorID *string `json:"hv-vendor-id,omitempty" url:"hv-vendor-id,omitempty"`
|
||||||
Type string `json:"cputype,omitempty" url:"cputype,omitempty"`
|
Type string `json:"cputype,omitempty" url:"cputype,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomEFIDisk handles QEMU EFI disk parameters.
|
// CustomEFIDisk handles QEMU EFI disk parameters.
|
||||||
type CustomEFIDisk struct {
|
type CustomEFIDisk struct {
|
||||||
FileVolume string `json:"file" url:"file"`
|
FileVolume string `json:"file" url:"file"`
|
||||||
Format *string `json:"format,omitempty" url:"format,omitempty"`
|
Format *string `json:"format,omitempty" url:"format,omitempty"`
|
||||||
Type *string `json:"efitype,omitempty" url:"efitype,omitempty"`
|
Type *string `json:"efitype,omitempty" url:"efitype,omitempty"`
|
||||||
PreEnrolledKeys *types.CustomBool `json:"pre-enrolled-keys,omitempty" url:"pre-enrolled-keys,omitempty,int"`
|
PreEnrolledKeys *types2.CustomBool `json:"pre-enrolled-keys,omitempty" url:"pre-enrolled-keys,omitempty,int"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomNetworkDevice handles QEMU network device parameters.
|
// CustomNetworkDevice handles QEMU network device parameters.
|
||||||
type CustomNetworkDevice struct {
|
type CustomNetworkDevice struct {
|
||||||
Model string `json:"model" url:"model"`
|
Model string `json:"model" url:"model"`
|
||||||
Bridge *string `json:"bridge,omitempty" url:"bridge,omitempty"`
|
Bridge *string `json:"bridge,omitempty" url:"bridge,omitempty"`
|
||||||
Enabled bool `json:"-" url:"-"`
|
Enabled bool `json:"-" url:"-"`
|
||||||
Firewall *types.CustomBool `json:"firewall,omitempty" url:"firewall,omitempty,int"`
|
Firewall *types2.CustomBool `json:"firewall,omitempty" url:"firewall,omitempty,int"`
|
||||||
LinkDown *types.CustomBool `json:"link_down,omitempty" url:"link_down,omitempty,int"`
|
LinkDown *types2.CustomBool `json:"link_down,omitempty" url:"link_down,omitempty,int"`
|
||||||
MACAddress *string `json:"macaddr,omitempty" url:"macaddr,omitempty"`
|
MACAddress *string `json:"macaddr,omitempty" url:"macaddr,omitempty"`
|
||||||
Queues *int `json:"queues,omitempty" url:"queues,omitempty"`
|
Queues *int `json:"queues,omitempty" url:"queues,omitempty"`
|
||||||
RateLimit *float64 `json:"rate,omitempty" url:"rate,omitempty"`
|
RateLimit *float64 `json:"rate,omitempty" url:"rate,omitempty"`
|
||||||
Tag *int `json:"tag,omitempty" url:"tag,omitempty"`
|
Tag *int `json:"tag,omitempty" url:"tag,omitempty"`
|
||||||
MTU *int `json:"mtu,omitempty" url:"mtu,omitempty"`
|
MTU *int `json:"mtu,omitempty" url:"mtu,omitempty"`
|
||||||
Trunks []int `json:"trunks,omitempty" url:"trunks,omitempty"`
|
Trunks []int `json:"trunks,omitempty" url:"trunks,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomNetworkDevices handles QEMU network device parameters.
|
// CustomNetworkDevices handles QEMU network device parameters.
|
||||||
@ -118,13 +118,13 @@ type CustomNUMADevices []CustomNUMADevice
|
|||||||
|
|
||||||
// CustomPCIDevice handles QEMU host PCI device mapping parameters.
|
// CustomPCIDevice handles QEMU host PCI device mapping parameters.
|
||||||
type CustomPCIDevice struct {
|
type CustomPCIDevice struct {
|
||||||
DeviceIDs *[]string `json:"host,omitempty" url:"host,omitempty,semicolon"`
|
DeviceIDs *[]string `json:"host,omitempty" url:"host,omitempty,semicolon"`
|
||||||
Mapping *string `json:"mapping,omitempty" url:"mapping,omitempty"`
|
Mapping *string `json:"mapping,omitempty" url:"mapping,omitempty"`
|
||||||
MDev *string `json:"mdev,omitempty" url:"mdev,omitempty"`
|
MDev *string `json:"mdev,omitempty" url:"mdev,omitempty"`
|
||||||
PCIExpress *types.CustomBool `json:"pcie,omitempty" url:"pcie,omitempty,int"`
|
PCIExpress *types2.CustomBool `json:"pcie,omitempty" url:"pcie,omitempty,int"`
|
||||||
ROMBAR *types.CustomBool `json:"rombar,omitempty" url:"rombar,omitempty,int"`
|
ROMBAR *types2.CustomBool `json:"rombar,omitempty" url:"rombar,omitempty,int"`
|
||||||
ROMFile *string `json:"romfile,omitempty" url:"romfile,omitempty"`
|
ROMFile *string `json:"romfile,omitempty" url:"romfile,omitempty"`
|
||||||
XVGA *types.CustomBool `json:"x-vga,omitempty" url:"x-vga,omitempty,int"`
|
XVGA *types2.CustomBool `json:"x-vga,omitempty" url:"x-vga,omitempty,int"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomPCIDevices handles QEMU host PCI device mapping parameters.
|
// CustomPCIDevices handles QEMU host PCI device mapping parameters.
|
||||||
@ -141,20 +141,20 @@ type CustomSharedMemory struct {
|
|||||||
|
|
||||||
// CustomSMBIOS handles QEMU SMBIOS parameters.
|
// CustomSMBIOS handles QEMU SMBIOS parameters.
|
||||||
type CustomSMBIOS struct {
|
type CustomSMBIOS struct {
|
||||||
Base64 *types.CustomBool `json:"base64,omitempty" url:"base64,omitempty,int"`
|
Base64 *types2.CustomBool `json:"base64,omitempty" url:"base64,omitempty,int"`
|
||||||
Family *string `json:"family,omitempty" url:"family,omitempty"`
|
Family *string `json:"family,omitempty" url:"family,omitempty"`
|
||||||
Manufacturer *string `json:"manufacturer,omitempty" url:"manufacturer,omitempty"`
|
Manufacturer *string `json:"manufacturer,omitempty" url:"manufacturer,omitempty"`
|
||||||
Product *string `json:"product,omitempty" url:"product,omitempty"`
|
Product *string `json:"product,omitempty" url:"product,omitempty"`
|
||||||
Serial *string `json:"serial,omitempty" url:"serial,omitempty"`
|
Serial *string `json:"serial,omitempty" url:"serial,omitempty"`
|
||||||
SKU *string `json:"sku,omitempty" url:"sku,omitempty"`
|
SKU *string `json:"sku,omitempty" url:"sku,omitempty"`
|
||||||
UUID *string `json:"uuid,omitempty" url:"uuid,omitempty"`
|
UUID *string `json:"uuid,omitempty" url:"uuid,omitempty"`
|
||||||
Version *string `json:"version,omitempty" url:"version,omitempty"`
|
Version *string `json:"version,omitempty" url:"version,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomSpiceEnhancements handles QEMU spice enhancement parameters.
|
// CustomSpiceEnhancements handles QEMU spice enhancement parameters.
|
||||||
type CustomSpiceEnhancements struct {
|
type CustomSpiceEnhancements struct {
|
||||||
FolderSharing *types.CustomBool `json:"foldersharing,omitempty" url:"foldersharing,omitempty"`
|
FolderSharing *types2.CustomBool `json:"foldersharing,omitempty" url:"foldersharing,omitempty"`
|
||||||
VideoStreaming *string `json:"videostreaming,omitempty" url:"videostreaming,omitempty"`
|
VideoStreaming *string `json:"videostreaming,omitempty" url:"videostreaming,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomStartupOrder handles QEMU startup order parameters.
|
// CustomStartupOrder handles QEMU startup order parameters.
|
||||||
@ -166,21 +166,21 @@ type CustomStartupOrder struct {
|
|||||||
|
|
||||||
// CustomStorageDevice handles QEMU SATA device parameters.
|
// CustomStorageDevice handles QEMU SATA device parameters.
|
||||||
type CustomStorageDevice struct {
|
type CustomStorageDevice struct {
|
||||||
AIO *string `json:"aio,omitempty" url:"aio,omitempty"`
|
AIO *string `json:"aio,omitempty" url:"aio,omitempty"`
|
||||||
BackupEnabled *types.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"`
|
BackupEnabled *types2.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"`
|
||||||
BurstableReadSpeedMbps *int `json:"mbps_rd_max,omitempty" url:"mbps_rd_max,omitempty"`
|
BurstableReadSpeedMbps *int `json:"mbps_rd_max,omitempty" url:"mbps_rd_max,omitempty"`
|
||||||
Cache *string `json:"cache,omitempty" url:"cache,omitempty"`
|
Cache *string `json:"cache,omitempty" url:"cache,omitempty"`
|
||||||
BurstableWriteSpeedMbps *int `json:"mbps_wr_max,omitempty" url:"mbps_wr_max,omitempty"`
|
BurstableWriteSpeedMbps *int `json:"mbps_wr_max,omitempty" url:"mbps_wr_max,omitempty"`
|
||||||
Discard *string `json:"discard,omitempty" url:"discard,omitempty"`
|
Discard *string `json:"discard,omitempty" url:"discard,omitempty"`
|
||||||
Enabled bool `json:"-" url:"-"`
|
Enabled bool `json:"-" url:"-"`
|
||||||
FileVolume string `json:"file" url:"file"`
|
FileVolume string `json:"file" url:"file"`
|
||||||
Format *string `json:"format,omitempty" url:"format,omitempty"`
|
Format *string `json:"format,omitempty" url:"format,omitempty"`
|
||||||
IOThread *types.CustomBool `json:"iothread,omitempty" url:"iothread,omitempty,int"`
|
IOThread *types2.CustomBool `json:"iothread,omitempty" url:"iothread,omitempty,int"`
|
||||||
SSD *types.CustomBool `json:"ssd,omitempty" url:"ssd,omitempty,int"`
|
SSD *types2.CustomBool `json:"ssd,omitempty" url:"ssd,omitempty,int"`
|
||||||
MaxReadSpeedMbps *int `json:"mbps_rd,omitempty" url:"mbps_rd,omitempty"`
|
MaxReadSpeedMbps *int `json:"mbps_rd,omitempty" url:"mbps_rd,omitempty"`
|
||||||
MaxWriteSpeedMbps *int `json:"mbps_wr,omitempty" url:"mbps_wr,omitempty"`
|
MaxWriteSpeedMbps *int `json:"mbps_wr,omitempty" url:"mbps_wr,omitempty"`
|
||||||
Media *string `json:"media,omitempty" url:"media,omitempty"`
|
Media *string `json:"media,omitempty" url:"media,omitempty"`
|
||||||
Size *types.DiskSize `json:"size,omitempty" url:"size,omitempty"`
|
Size *types2.DiskSize `json:"size,omitempty" url:"size,omitempty"`
|
||||||
Interface *string
|
Interface *string
|
||||||
ID *string
|
ID *string
|
||||||
FileID *string
|
FileID *string
|
||||||
@ -192,8 +192,8 @@ type CustomStorageDevices map[string]CustomStorageDevice
|
|||||||
|
|
||||||
// CustomUSBDevice handles QEMU USB device parameters.
|
// CustomUSBDevice handles QEMU USB device parameters.
|
||||||
type CustomUSBDevice struct {
|
type CustomUSBDevice struct {
|
||||||
HostDevice string `json:"host" url:"host"`
|
HostDevice string `json:"host" url:"host"`
|
||||||
USB3 *types.CustomBool `json:"usb3,omitempty" url:"usb3,omitempty,int"`
|
USB3 *types2.CustomBool `json:"usb3,omitempty" url:"usb3,omitempty,int"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomUSBDevices handles QEMU USB device parameters.
|
// CustomUSBDevices handles QEMU USB device parameters.
|
||||||
@ -207,10 +207,10 @@ type CustomVGADevice struct {
|
|||||||
|
|
||||||
// CustomVirtualIODevice handles QEMU VirtIO device parameters.
|
// CustomVirtualIODevice handles QEMU VirtIO device parameters.
|
||||||
type CustomVirtualIODevice struct {
|
type CustomVirtualIODevice struct {
|
||||||
AIO *string `json:"aio,omitempty" url:"aio,omitempty"`
|
AIO *string `json:"aio,omitempty" url:"aio,omitempty"`
|
||||||
BackupEnabled *types.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"`
|
BackupEnabled *types2.CustomBool `json:"backup,omitempty" url:"backup,omitempty,int"`
|
||||||
Enabled bool `json:"-" url:"-"`
|
Enabled bool `json:"-" url:"-"`
|
||||||
FileVolume string `json:"file" url:"file"`
|
FileVolume string `json:"file" url:"file"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomVirtualIODevices handles QEMU VirtIO device parameters.
|
// CustomVirtualIODevices handles QEMU VirtIO device parameters.
|
||||||
@ -224,89 +224,89 @@ type CustomWatchdogDevice struct {
|
|||||||
|
|
||||||
// CloneRequestBody contains the data for an virtual machine clone request.
|
// CloneRequestBody contains the data for an virtual machine clone request.
|
||||||
type CloneRequestBody struct {
|
type CloneRequestBody struct {
|
||||||
BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"`
|
BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"`
|
||||||
Description *string `json:"description,omitempty" url:"description,omitempty"`
|
Description *string `json:"description,omitempty" url:"description,omitempty"`
|
||||||
FullCopy *types.CustomBool `json:"full,omitempty" url:"full,omitempty,int"`
|
FullCopy *types2.CustomBool `json:"full,omitempty" url:"full,omitempty,int"`
|
||||||
Name *string `json:"name,omitempty" url:"name,omitempty"`
|
Name *string `json:"name,omitempty" url:"name,omitempty"`
|
||||||
PoolID *string `json:"pool,omitempty" url:"pool,omitempty"`
|
PoolID *string `json:"pool,omitempty" url:"pool,omitempty"`
|
||||||
SnapshotName *string `json:"snapname,omitempty" url:"snapname,omitempty"`
|
SnapshotName *string `json:"snapname,omitempty" url:"snapname,omitempty"`
|
||||||
TargetNodeName *string `json:"target,omitempty" url:"target,omitempty"`
|
TargetNodeName *string `json:"target,omitempty" url:"target,omitempty"`
|
||||||
TargetStorage *string `json:"storage,omitempty" url:"storage,omitempty"`
|
TargetStorage *string `json:"storage,omitempty" url:"storage,omitempty"`
|
||||||
TargetStorageFormat *string `json:"format,omitempty" url:"format,omitempty"`
|
TargetStorageFormat *string `json:"format,omitempty" url:"format,omitempty"`
|
||||||
VMIDNew int `json:"newid" url:"newid"`
|
VMIDNew int `json:"newid" url:"newid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateRequestBody contains the data for a virtual machine create request.
|
// CreateRequestBody contains the data for a virtual machine create request.
|
||||||
type CreateRequestBody struct {
|
type CreateRequestBody struct {
|
||||||
ACPI *types.CustomBool `json:"acpi,omitempty" url:"acpi,omitempty,int"`
|
ACPI *types2.CustomBool `json:"acpi,omitempty" url:"acpi,omitempty,int"`
|
||||||
Agent *CustomAgent `json:"agent,omitempty" url:"agent,omitempty"`
|
Agent *CustomAgent `json:"agent,omitempty" url:"agent,omitempty"`
|
||||||
AllowReboot *types.CustomBool `json:"reboot,omitempty" url:"reboot,omitempty,int"`
|
AllowReboot *types2.CustomBool `json:"reboot,omitempty" url:"reboot,omitempty,int"`
|
||||||
AudioDevices CustomAudioDevices `json:"audio,omitempty" url:"audio,omitempty"`
|
AudioDevices CustomAudioDevices `json:"audio,omitempty" url:"audio,omitempty"`
|
||||||
Autostart *types.CustomBool `json:"autostart,omitempty" url:"autostart,omitempty,int"`
|
Autostart *types2.CustomBool `json:"autostart,omitempty" url:"autostart,omitempty,int"`
|
||||||
BackupFile *string `json:"archive,omitempty" url:"archive,omitempty"`
|
BackupFile *string `json:"archive,omitempty" url:"archive,omitempty"`
|
||||||
BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"`
|
BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"`
|
||||||
BIOS *string `json:"bios,omitempty" url:"bios,omitempty"`
|
BIOS *string `json:"bios,omitempty" url:"bios,omitempty"`
|
||||||
Boot *CustomBoot `json:"boot,omitempty" url:"boot,omitempty"`
|
Boot *CustomBoot `json:"boot,omitempty" url:"boot,omitempty"`
|
||||||
CDROM *string `json:"cdrom,omitempty" url:"cdrom,omitempty"`
|
CDROM *string `json:"cdrom,omitempty" url:"cdrom,omitempty"`
|
||||||
CloudInitConfig *CustomCloudInitConfig `json:"cloudinit,omitempty" url:"cloudinit,omitempty"`
|
CloudInitConfig *CustomCloudInitConfig `json:"cloudinit,omitempty" url:"cloudinit,omitempty"`
|
||||||
CPUArchitecture *string `json:"arch,omitempty" url:"arch,omitempty"`
|
CPUArchitecture *string `json:"arch,omitempty" url:"arch,omitempty"`
|
||||||
CPUCores *int `json:"cores,omitempty" url:"cores,omitempty"`
|
CPUCores *int `json:"cores,omitempty" url:"cores,omitempty"`
|
||||||
CPUEmulation *CustomCPUEmulation `json:"cpu,omitempty" url:"cpu,omitempty"`
|
CPUEmulation *CustomCPUEmulation `json:"cpu,omitempty" url:"cpu,omitempty"`
|
||||||
CPULimit *int `json:"cpulimit,omitempty" url:"cpulimit,omitempty"`
|
CPULimit *int `json:"cpulimit,omitempty" url:"cpulimit,omitempty"`
|
||||||
CPUSockets *int `json:"sockets,omitempty" url:"sockets,omitempty"`
|
CPUSockets *int `json:"sockets,omitempty" url:"sockets,omitempty"`
|
||||||
CPUUnits *int `json:"cpuunits,omitempty" url:"cpuunits,omitempty"`
|
CPUUnits *int `json:"cpuunits,omitempty" url:"cpuunits,omitempty"`
|
||||||
DedicatedMemory *int `json:"memory,omitempty" url:"memory,omitempty"`
|
DedicatedMemory *int `json:"memory,omitempty" url:"memory,omitempty"`
|
||||||
Delete []string `json:"delete,omitempty" url:"delete,omitempty,comma"`
|
Delete []string `json:"delete,omitempty" url:"delete,omitempty,comma"`
|
||||||
DeletionProtection *types.CustomBool `json:"protection,omitempty" url:"force,omitempty,int"`
|
DeletionProtection *types2.CustomBool `json:"protection,omitempty" url:"force,omitempty,int"`
|
||||||
Description *string `json:"description,omitempty" url:"description,omitempty"`
|
Description *string `json:"description,omitempty" url:"description,omitempty"`
|
||||||
EFIDisk *CustomEFIDisk `json:"efidisk0,omitempty" url:"efidisk0,omitempty"`
|
EFIDisk *CustomEFIDisk `json:"efidisk0,omitempty" url:"efidisk0,omitempty"`
|
||||||
FloatingMemory *int `json:"balloon,omitempty" url:"balloon,omitempty"`
|
FloatingMemory *int `json:"balloon,omitempty" url:"balloon,omitempty"`
|
||||||
FloatingMemoryShares *int `json:"shares,omitempty" url:"shares,omitempty"`
|
FloatingMemoryShares *int `json:"shares,omitempty" url:"shares,omitempty"`
|
||||||
Freeze *types.CustomBool `json:"freeze,omitempty" url:"freeze,omitempty,int"`
|
Freeze *types2.CustomBool `json:"freeze,omitempty" url:"freeze,omitempty,int"`
|
||||||
HookScript *string `json:"hookscript,omitempty" url:"hookscript,omitempty"`
|
HookScript *string `json:"hookscript,omitempty" url:"hookscript,omitempty"`
|
||||||
Hotplug types.CustomCommaSeparatedList `json:"hotplug,omitempty" url:"hotplug,omitempty,comma"`
|
Hotplug types2.CustomCommaSeparatedList `json:"hotplug,omitempty" url:"hotplug,omitempty,comma"`
|
||||||
Hugepages *string `json:"hugepages,omitempty" url:"hugepages,omitempty"`
|
Hugepages *string `json:"hugepages,omitempty" url:"hugepages,omitempty"`
|
||||||
IDEDevices CustomStorageDevices `json:"ide,omitempty" url:",omitempty"`
|
IDEDevices CustomStorageDevices `json:"ide,omitempty" url:",omitempty"`
|
||||||
KeyboardLayout *string `json:"keyboard,omitempty" url:"keyboard,omitempty"`
|
KeyboardLayout *string `json:"keyboard,omitempty" url:"keyboard,omitempty"`
|
||||||
KVMArguments *string `json:"args,omitempty" url:"args,omitempty,space"`
|
KVMArguments *string `json:"args,omitempty" url:"args,omitempty,space"`
|
||||||
KVMEnabled *types.CustomBool `json:"kvm,omitempty" url:"kvm,omitempty,int"`
|
KVMEnabled *types2.CustomBool `json:"kvm,omitempty" url:"kvm,omitempty,int"`
|
||||||
LocalTime *types.CustomBool `json:"localtime,omitempty" url:"localtime,omitempty,int"`
|
LocalTime *types2.CustomBool `json:"localtime,omitempty" url:"localtime,omitempty,int"`
|
||||||
Lock *string `json:"lock,omitempty" url:"lock,omitempty"`
|
Lock *string `json:"lock,omitempty" url:"lock,omitempty"`
|
||||||
Machine *string `json:"machine,omitempty" url:"machine,omitempty"`
|
Machine *string `json:"machine,omitempty" url:"machine,omitempty"`
|
||||||
MigrateDowntime *float64 `json:"migrate_downtime,omitempty" url:"migrate_downtime,omitempty"`
|
MigrateDowntime *float64 `json:"migrate_downtime,omitempty" url:"migrate_downtime,omitempty"`
|
||||||
MigrateSpeed *int `json:"migrate_speed,omitempty" url:"migrate_speed,omitempty"`
|
MigrateSpeed *int `json:"migrate_speed,omitempty" url:"migrate_speed,omitempty"`
|
||||||
Name *string `json:"name,omitempty" url:"name,omitempty"`
|
Name *string `json:"name,omitempty" url:"name,omitempty"`
|
||||||
NetworkDevices CustomNetworkDevices `json:"net,omitempty" url:"net,omitempty"`
|
NetworkDevices CustomNetworkDevices `json:"net,omitempty" url:"net,omitempty"`
|
||||||
NUMADevices CustomNUMADevices `json:"numa_devices,omitempty" url:"numa,omitempty"`
|
NUMADevices CustomNUMADevices `json:"numa_devices,omitempty" url:"numa,omitempty"`
|
||||||
NUMAEnabled *types.CustomBool `json:"numa,omitempty" url:"numa,omitempty,int"`
|
NUMAEnabled *types2.CustomBool `json:"numa,omitempty" url:"numa,omitempty,int"`
|
||||||
OSType *string `json:"ostype,omitempty" url:"ostype,omitempty"`
|
OSType *string `json:"ostype,omitempty" url:"ostype,omitempty"`
|
||||||
Overwrite *types.CustomBool `json:"force,omitempty" url:"force,omitempty,int"`
|
Overwrite *types2.CustomBool `json:"force,omitempty" url:"force,omitempty,int"`
|
||||||
PCIDevices CustomPCIDevices `json:"hostpci,omitempty" url:"hostpci,omitempty"`
|
PCIDevices CustomPCIDevices `json:"hostpci,omitempty" url:"hostpci,omitempty"`
|
||||||
PoolID *string `json:"pool,omitempty" url:"pool,omitempty"`
|
PoolID *string `json:"pool,omitempty" url:"pool,omitempty"`
|
||||||
Revert *string `json:"revert,omitempty" url:"revert,omitempty"`
|
Revert *string `json:"revert,omitempty" url:"revert,omitempty"`
|
||||||
SATADevices CustomStorageDevices `json:"sata,omitempty" url:"sata,omitempty"`
|
SATADevices CustomStorageDevices `json:"sata,omitempty" url:"sata,omitempty"`
|
||||||
SCSIDevices CustomStorageDevices `json:"scsi,omitempty" url:"scsi,omitempty"`
|
SCSIDevices CustomStorageDevices `json:"scsi,omitempty" url:"scsi,omitempty"`
|
||||||
SCSIHardware *string `json:"scsihw,omitempty" url:"scsihw,omitempty"`
|
SCSIHardware *string `json:"scsihw,omitempty" url:"scsihw,omitempty"`
|
||||||
SerialDevices CustomSerialDevices `json:"serial,omitempty" url:"serial,omitempty"`
|
SerialDevices CustomSerialDevices `json:"serial,omitempty" url:"serial,omitempty"`
|
||||||
SharedMemory *CustomSharedMemory `json:"ivshmem,omitempty" url:"ivshmem,omitempty"`
|
SharedMemory *CustomSharedMemory `json:"ivshmem,omitempty" url:"ivshmem,omitempty"`
|
||||||
SkipLock *types.CustomBool `json:"skiplock,omitempty" url:"skiplock,omitempty,int"`
|
SkipLock *types2.CustomBool `json:"skiplock,omitempty" url:"skiplock,omitempty,int"`
|
||||||
SMBIOS *CustomSMBIOS `json:"smbios1,omitempty" url:"smbios1,omitempty"`
|
SMBIOS *CustomSMBIOS `json:"smbios1,omitempty" url:"smbios1,omitempty"`
|
||||||
SpiceEnhancements *CustomSpiceEnhancements `json:"spice_enhancements,omitempty" url:"spice_enhancements,omitempty"`
|
SpiceEnhancements *CustomSpiceEnhancements `json:"spice_enhancements,omitempty" url:"spice_enhancements,omitempty"`
|
||||||
StartDate *string `json:"startdate,omitempty" url:"startdate,omitempty"`
|
StartDate *string `json:"startdate,omitempty" url:"startdate,omitempty"`
|
||||||
StartOnBoot *types.CustomBool `json:"onboot,omitempty" url:"onboot,omitempty,int"`
|
StartOnBoot *types2.CustomBool `json:"onboot,omitempty" url:"onboot,omitempty,int"`
|
||||||
StartupOrder *CustomStartupOrder `json:"startup,omitempty" url:"startup,omitempty"`
|
StartupOrder *CustomStartupOrder `json:"startup,omitempty" url:"startup,omitempty"`
|
||||||
TabletDeviceEnabled *types.CustomBool `json:"tablet,omitempty" url:"tablet,omitempty,int"`
|
TabletDeviceEnabled *types2.CustomBool `json:"tablet,omitempty" url:"tablet,omitempty,int"`
|
||||||
Tags *string `json:"tags,omitempty" url:"tags,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"`
|
||||||
TimeDriftFixEnabled *types.CustomBool `json:"tdf,omitempty" url:"tdf,omitempty,int"`
|
TimeDriftFixEnabled *types2.CustomBool `json:"tdf,omitempty" url:"tdf,omitempty,int"`
|
||||||
USBDevices CustomUSBDevices `json:"usb,omitempty" url:"usb,omitempty"`
|
USBDevices CustomUSBDevices `json:"usb,omitempty" url:"usb,omitempty"`
|
||||||
VGADevice *CustomVGADevice `json:"vga,omitempty" url:"vga,omitempty"`
|
VGADevice *CustomVGADevice `json:"vga,omitempty" url:"vga,omitempty"`
|
||||||
VirtualCPUCount *int `json:"vcpus,omitempty" url:"vcpus,omitempty"`
|
VirtualCPUCount *int `json:"vcpus,omitempty" url:"vcpus,omitempty"`
|
||||||
VirtualIODevices CustomStorageDevices `json:"virtio,omitempty" url:"virtio,omitempty"`
|
VirtualIODevices CustomStorageDevices `json:"virtio,omitempty" url:"virtio,omitempty"`
|
||||||
VMGenerationID *string `json:"vmgenid,omitempty" url:"vmgenid,omitempty"`
|
VMGenerationID *string `json:"vmgenid,omitempty" url:"vmgenid,omitempty"`
|
||||||
VMID *int `json:"vmid,omitempty" url:"vmid,omitempty"`
|
VMID *int `json:"vmid,omitempty" url:"vmid,omitempty"`
|
||||||
VMStateDatastoreID *string `json:"vmstatestorage,omitempty" url:"vmstatestorage,omitempty"`
|
VMStateDatastoreID *string `json:"vmstatestorage,omitempty" url:"vmstatestorage,omitempty"`
|
||||||
WatchdogDevice *CustomWatchdogDevice `json:"watchdog,omitempty" url:"watchdog,omitempty"`
|
WatchdogDevice *CustomWatchdogDevice `json:"watchdog,omitempty" url:"watchdog,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateResponseBody contains the body from a create response.
|
// 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.
|
// GetResponseData contains the data from an virtual machine get response.
|
||||||
type GetResponseData struct {
|
type GetResponseData struct {
|
||||||
ACPI *types.CustomBool `json:"acpi,omitempty"`
|
ACPI *types2.CustomBool `json:"acpi,omitempty"`
|
||||||
Agent *CustomAgent `json:"agent,omitempty"`
|
Agent *CustomAgent `json:"agent,omitempty"`
|
||||||
AllowReboot *types.CustomBool `json:"reboot,omitempty"`
|
AllowReboot *types2.CustomBool `json:"reboot,omitempty"`
|
||||||
AudioDevice *CustomAudioDevice `json:"audio0,omitempty"`
|
AudioDevice *CustomAudioDevice `json:"audio0,omitempty"`
|
||||||
Autostart *types.CustomBool `json:"autostart,omitempty"`
|
Autostart *types2.CustomBool `json:"autostart,omitempty"`
|
||||||
BackupFile *string `json:"archive,omitempty"`
|
BackupFile *string `json:"archive,omitempty"`
|
||||||
BandwidthLimit *int `json:"bwlimit,omitempty"`
|
BandwidthLimit *int `json:"bwlimit,omitempty"`
|
||||||
BIOS *string `json:"bios,omitempty"`
|
BIOS *string `json:"bios,omitempty"`
|
||||||
BootDisk *string `json:"bootdisk,omitempty"`
|
BootDisk *string `json:"bootdisk,omitempty"`
|
||||||
BootOrder *string `json:"boot,omitempty"`
|
BootOrder *string `json:"boot,omitempty"`
|
||||||
CDROM *string `json:"cdrom,omitempty"`
|
CDROM *string `json:"cdrom,omitempty"`
|
||||||
CloudInitDNSDomain *string `json:"searchdomain,omitempty"`
|
CloudInitDNSDomain *string `json:"searchdomain,omitempty"`
|
||||||
CloudInitDNSServer *string `json:"nameserver,omitempty"`
|
CloudInitDNSServer *string `json:"nameserver,omitempty"`
|
||||||
CloudInitFiles *CustomCloudInitFiles `json:"cicustom,omitempty"`
|
CloudInitFiles *CustomCloudInitFiles `json:"cicustom,omitempty"`
|
||||||
CloudInitPassword *string `json:"cipassword,omitempty"`
|
CloudInitPassword *string `json:"cipassword,omitempty"`
|
||||||
CloudInitSSHKeys *CustomCloudInitSSHKeys `json:"sshkeys,omitempty"`
|
CloudInitSSHKeys *CustomCloudInitSSHKeys `json:"sshkeys,omitempty"`
|
||||||
CloudInitType *string `json:"citype,omitempty"`
|
CloudInitType *string `json:"citype,omitempty"`
|
||||||
CloudInitUsername *string `json:"ciuser,omitempty"`
|
CloudInitUsername *string `json:"ciuser,omitempty"`
|
||||||
CPUArchitecture *string `json:"arch,omitempty"`
|
CPUArchitecture *string `json:"arch,omitempty"`
|
||||||
CPUCores *int `json:"cores,omitempty"`
|
CPUCores *int `json:"cores,omitempty"`
|
||||||
CPUEmulation *CustomCPUEmulation `json:"cpu,omitempty"`
|
CPUEmulation *CustomCPUEmulation `json:"cpu,omitempty"`
|
||||||
CPULimit *int `json:"cpulimit,omitempty"`
|
CPULimit *int `json:"cpulimit,omitempty"`
|
||||||
CPUSockets *int `json:"sockets,omitempty"`
|
CPUSockets *int `json:"sockets,omitempty"`
|
||||||
CPUUnits *int `json:"cpuunits,omitempty"`
|
CPUUnits *int `json:"cpuunits,omitempty"`
|
||||||
DedicatedMemory *int `json:"memory,omitempty"`
|
DedicatedMemory *int `json:"memory,omitempty"`
|
||||||
DeletionProtection *types.CustomBool `json:"protection,omitempty"`
|
DeletionProtection *types2.CustomBool `json:"protection,omitempty"`
|
||||||
Description *string `json:"description,omitempty"`
|
Description *string `json:"description,omitempty"`
|
||||||
EFIDisk *CustomEFIDisk `json:"efidisk0,omitempty"`
|
EFIDisk *CustomEFIDisk `json:"efidisk0,omitempty"`
|
||||||
FloatingMemory *int `json:"balloon,omitempty"`
|
FloatingMemory *int `json:"balloon,omitempty"`
|
||||||
FloatingMemoryShares *int `json:"shares,omitempty"`
|
FloatingMemoryShares *int `json:"shares,omitempty"`
|
||||||
Freeze *types.CustomBool `json:"freeze,omitempty"`
|
Freeze *types2.CustomBool `json:"freeze,omitempty"`
|
||||||
HookScript *string `json:"hookscript,omitempty"`
|
HookScript *string `json:"hookscript,omitempty"`
|
||||||
Hotplug *types.CustomCommaSeparatedList `json:"hotplug,omitempty"`
|
Hotplug *types2.CustomCommaSeparatedList `json:"hotplug,omitempty"`
|
||||||
Hugepages *string `json:"hugepages,omitempty"`
|
Hugepages *string `json:"hugepages,omitempty"`
|
||||||
IDEDevice0 *CustomStorageDevice `json:"ide0,omitempty"`
|
IDEDevice0 *CustomStorageDevice `json:"ide0,omitempty"`
|
||||||
IDEDevice1 *CustomStorageDevice `json:"ide1,omitempty"`
|
IDEDevice1 *CustomStorageDevice `json:"ide1,omitempty"`
|
||||||
IDEDevice2 *CustomStorageDevice `json:"ide2,omitempty"`
|
IDEDevice2 *CustomStorageDevice `json:"ide2,omitempty"`
|
||||||
IDEDevice3 *CustomStorageDevice `json:"ide3,omitempty"`
|
IDEDevice3 *CustomStorageDevice `json:"ide3,omitempty"`
|
||||||
IPConfig0 *CustomCloudInitIPConfig `json:"ipconfig0,omitempty"`
|
IPConfig0 *CustomCloudInitIPConfig `json:"ipconfig0,omitempty"`
|
||||||
IPConfig1 *CustomCloudInitIPConfig `json:"ipconfig1,omitempty"`
|
IPConfig1 *CustomCloudInitIPConfig `json:"ipconfig1,omitempty"`
|
||||||
IPConfig2 *CustomCloudInitIPConfig `json:"ipconfig2,omitempty"`
|
IPConfig2 *CustomCloudInitIPConfig `json:"ipconfig2,omitempty"`
|
||||||
IPConfig3 *CustomCloudInitIPConfig `json:"ipconfig3,omitempty"`
|
IPConfig3 *CustomCloudInitIPConfig `json:"ipconfig3,omitempty"`
|
||||||
IPConfig4 *CustomCloudInitIPConfig `json:"ipconfig4,omitempty"`
|
IPConfig4 *CustomCloudInitIPConfig `json:"ipconfig4,omitempty"`
|
||||||
IPConfig5 *CustomCloudInitIPConfig `json:"ipconfig5,omitempty"`
|
IPConfig5 *CustomCloudInitIPConfig `json:"ipconfig5,omitempty"`
|
||||||
IPConfig6 *CustomCloudInitIPConfig `json:"ipconfig6,omitempty"`
|
IPConfig6 *CustomCloudInitIPConfig `json:"ipconfig6,omitempty"`
|
||||||
IPConfig7 *CustomCloudInitIPConfig `json:"ipconfig7,omitempty"`
|
IPConfig7 *CustomCloudInitIPConfig `json:"ipconfig7,omitempty"`
|
||||||
KeyboardLayout *string `json:"keyboard,omitempty"`
|
KeyboardLayout *string `json:"keyboard,omitempty"`
|
||||||
KVMArguments *string `json:"args,omitempty"`
|
KVMArguments *string `json:"args,omitempty"`
|
||||||
KVMEnabled *types.CustomBool `json:"kvm,omitempty"`
|
KVMEnabled *types2.CustomBool `json:"kvm,omitempty"`
|
||||||
LocalTime *types.CustomBool `json:"localtime,omitempty"`
|
LocalTime *types2.CustomBool `json:"localtime,omitempty"`
|
||||||
Lock *string `json:"lock,omitempty"`
|
Lock *string `json:"lock,omitempty"`
|
||||||
Machine *string `json:"machine,omitempty"`
|
Machine *string `json:"machine,omitempty"`
|
||||||
MigrateDowntime *float64 `json:"migrate_downtime,omitempty"`
|
MigrateDowntime *float64 `json:"migrate_downtime,omitempty"`
|
||||||
MigrateSpeed *int `json:"migrate_speed,omitempty"`
|
MigrateSpeed *int `json:"migrate_speed,omitempty"`
|
||||||
Name *string `json:"name,omitempty"`
|
Name *string `json:"name,omitempty"`
|
||||||
NetworkDevice0 *CustomNetworkDevice `json:"net0,omitempty"`
|
NetworkDevice0 *CustomNetworkDevice `json:"net0,omitempty"`
|
||||||
NetworkDevice1 *CustomNetworkDevice `json:"net1,omitempty"`
|
NetworkDevice1 *CustomNetworkDevice `json:"net1,omitempty"`
|
||||||
NetworkDevice2 *CustomNetworkDevice `json:"net2,omitempty"`
|
NetworkDevice2 *CustomNetworkDevice `json:"net2,omitempty"`
|
||||||
NetworkDevice3 *CustomNetworkDevice `json:"net3,omitempty"`
|
NetworkDevice3 *CustomNetworkDevice `json:"net3,omitempty"`
|
||||||
NetworkDevice4 *CustomNetworkDevice `json:"net4,omitempty"`
|
NetworkDevice4 *CustomNetworkDevice `json:"net4,omitempty"`
|
||||||
NetworkDevice5 *CustomNetworkDevice `json:"net5,omitempty"`
|
NetworkDevice5 *CustomNetworkDevice `json:"net5,omitempty"`
|
||||||
NetworkDevice6 *CustomNetworkDevice `json:"net6,omitempty"`
|
NetworkDevice6 *CustomNetworkDevice `json:"net6,omitempty"`
|
||||||
NetworkDevice7 *CustomNetworkDevice `json:"net7,omitempty"`
|
NetworkDevice7 *CustomNetworkDevice `json:"net7,omitempty"`
|
||||||
NUMADevices *CustomNUMADevices `json:"numa_devices,omitempty"`
|
NUMADevices *CustomNUMADevices `json:"numa_devices,omitempty"`
|
||||||
NUMAEnabled *types.CustomBool `json:"numa,omitempty"`
|
NUMAEnabled *types2.CustomBool `json:"numa,omitempty"`
|
||||||
OSType *string `json:"ostype,omitempty"`
|
OSType *string `json:"ostype,omitempty"`
|
||||||
Overwrite *types.CustomBool `json:"force,omitempty"`
|
Overwrite *types2.CustomBool `json:"force,omitempty"`
|
||||||
PCIDevice0 *CustomPCIDevice `json:"hostpci0,omitempty"`
|
PCIDevice0 *CustomPCIDevice `json:"hostpci0,omitempty"`
|
||||||
PCIDevice1 *CustomPCIDevice `json:"hostpci1,omitempty"`
|
PCIDevice1 *CustomPCIDevice `json:"hostpci1,omitempty"`
|
||||||
PCIDevice2 *CustomPCIDevice `json:"hostpci2,omitempty"`
|
PCIDevice2 *CustomPCIDevice `json:"hostpci2,omitempty"`
|
||||||
PCIDevice3 *CustomPCIDevice `json:"hostpci3,omitempty"`
|
PCIDevice3 *CustomPCIDevice `json:"hostpci3,omitempty"`
|
||||||
PoolID *string `json:"pool,omitempty" url:"pool,omitempty"`
|
PoolID *string `json:"pool,omitempty" url:"pool,omitempty"`
|
||||||
Revert *string `json:"revert,omitempty"`
|
Revert *string `json:"revert,omitempty"`
|
||||||
SATADevice0 *CustomStorageDevice `json:"sata0,omitempty"`
|
SATADevice0 *CustomStorageDevice `json:"sata0,omitempty"`
|
||||||
SATADevice1 *CustomStorageDevice `json:"sata1,omitempty"`
|
SATADevice1 *CustomStorageDevice `json:"sata1,omitempty"`
|
||||||
SATADevice2 *CustomStorageDevice `json:"sata2,omitempty"`
|
SATADevice2 *CustomStorageDevice `json:"sata2,omitempty"`
|
||||||
SATADevice3 *CustomStorageDevice `json:"sata3,omitempty"`
|
SATADevice3 *CustomStorageDevice `json:"sata3,omitempty"`
|
||||||
SATADevice4 *CustomStorageDevice `json:"sata4,omitempty"`
|
SATADevice4 *CustomStorageDevice `json:"sata4,omitempty"`
|
||||||
SATADevice5 *CustomStorageDevice `json:"sata5,omitempty"`
|
SATADevice5 *CustomStorageDevice `json:"sata5,omitempty"`
|
||||||
SCSIDevice0 *CustomStorageDevice `json:"scsi0,omitempty"`
|
SCSIDevice0 *CustomStorageDevice `json:"scsi0,omitempty"`
|
||||||
SCSIDevice1 *CustomStorageDevice `json:"scsi1,omitempty"`
|
SCSIDevice1 *CustomStorageDevice `json:"scsi1,omitempty"`
|
||||||
SCSIDevice2 *CustomStorageDevice `json:"scsi2,omitempty"`
|
SCSIDevice2 *CustomStorageDevice `json:"scsi2,omitempty"`
|
||||||
SCSIDevice3 *CustomStorageDevice `json:"scsi3,omitempty"`
|
SCSIDevice3 *CustomStorageDevice `json:"scsi3,omitempty"`
|
||||||
SCSIDevice4 *CustomStorageDevice `json:"scsi4,omitempty"`
|
SCSIDevice4 *CustomStorageDevice `json:"scsi4,omitempty"`
|
||||||
SCSIDevice5 *CustomStorageDevice `json:"scsi5,omitempty"`
|
SCSIDevice5 *CustomStorageDevice `json:"scsi5,omitempty"`
|
||||||
SCSIDevice6 *CustomStorageDevice `json:"scsi6,omitempty"`
|
SCSIDevice6 *CustomStorageDevice `json:"scsi6,omitempty"`
|
||||||
SCSIDevice7 *CustomStorageDevice `json:"scsi7,omitempty"`
|
SCSIDevice7 *CustomStorageDevice `json:"scsi7,omitempty"`
|
||||||
SCSIDevice8 *CustomStorageDevice `json:"scsi8,omitempty"`
|
SCSIDevice8 *CustomStorageDevice `json:"scsi8,omitempty"`
|
||||||
SCSIDevice9 *CustomStorageDevice `json:"scsi9,omitempty"`
|
SCSIDevice9 *CustomStorageDevice `json:"scsi9,omitempty"`
|
||||||
SCSIDevice10 *CustomStorageDevice `json:"scsi10,omitempty"`
|
SCSIDevice10 *CustomStorageDevice `json:"scsi10,omitempty"`
|
||||||
SCSIDevice11 *CustomStorageDevice `json:"scsi11,omitempty"`
|
SCSIDevice11 *CustomStorageDevice `json:"scsi11,omitempty"`
|
||||||
SCSIDevice12 *CustomStorageDevice `json:"scsi12,omitempty"`
|
SCSIDevice12 *CustomStorageDevice `json:"scsi12,omitempty"`
|
||||||
SCSIDevice13 *CustomStorageDevice `json:"scsi13,omitempty"`
|
SCSIDevice13 *CustomStorageDevice `json:"scsi13,omitempty"`
|
||||||
SCSIHardware *string `json:"scsihw,omitempty"`
|
SCSIHardware *string `json:"scsihw,omitempty"`
|
||||||
SerialDevice0 *string `json:"serial0,omitempty"`
|
SerialDevice0 *string `json:"serial0,omitempty"`
|
||||||
SerialDevice1 *string `json:"serial1,omitempty"`
|
SerialDevice1 *string `json:"serial1,omitempty"`
|
||||||
SerialDevice2 *string `json:"serial2,omitempty"`
|
SerialDevice2 *string `json:"serial2,omitempty"`
|
||||||
SerialDevice3 *string `json:"serial3,omitempty"`
|
SerialDevice3 *string `json:"serial3,omitempty"`
|
||||||
SharedMemory *CustomSharedMemory `json:"ivshmem,omitempty"`
|
SharedMemory *CustomSharedMemory `json:"ivshmem,omitempty"`
|
||||||
SkipLock *types.CustomBool `json:"skiplock,omitempty"`
|
SkipLock *types2.CustomBool `json:"skiplock,omitempty"`
|
||||||
SMBIOS *CustomSMBIOS `json:"smbios1,omitempty"`
|
SMBIOS *CustomSMBIOS `json:"smbios1,omitempty"`
|
||||||
SpiceEnhancements *CustomSpiceEnhancements `json:"spice_enhancements,omitempty"`
|
SpiceEnhancements *CustomSpiceEnhancements `json:"spice_enhancements,omitempty"`
|
||||||
StartDate *string `json:"startdate,omitempty"`
|
StartDate *string `json:"startdate,omitempty"`
|
||||||
StartOnBoot *types.CustomBool `json:"onboot,omitempty"`
|
StartOnBoot *types2.CustomBool `json:"onboot,omitempty"`
|
||||||
StartupOrder *CustomStartupOrder `json:"startup,omitempty"`
|
StartupOrder *CustomStartupOrder `json:"startup,omitempty"`
|
||||||
TabletDeviceEnabled *types.CustomBool `json:"tablet,omitempty"`
|
TabletDeviceEnabled *types2.CustomBool `json:"tablet,omitempty"`
|
||||||
Tags *string `json:"tags,omitempty"`
|
Tags *string `json:"tags,omitempty"`
|
||||||
Template *types.CustomBool `json:"template,omitempty"`
|
Template *types2.CustomBool `json:"template,omitempty"`
|
||||||
TimeDriftFixEnabled *types.CustomBool `json:"tdf,omitempty"`
|
TimeDriftFixEnabled *types2.CustomBool `json:"tdf,omitempty"`
|
||||||
USBDevices *CustomUSBDevices `json:"usb,omitempty"`
|
USBDevices *CustomUSBDevices `json:"usb,omitempty"`
|
||||||
VGADevice *CustomVGADevice `json:"vga,omitempty"`
|
VGADevice *CustomVGADevice `json:"vga,omitempty"`
|
||||||
VirtualCPUCount *int `json:"vcpus,omitempty"`
|
VirtualCPUCount *int `json:"vcpus,omitempty"`
|
||||||
VirtualIODevice0 *CustomStorageDevice `json:"virtio0,omitempty"`
|
VirtualIODevice0 *CustomStorageDevice `json:"virtio0,omitempty"`
|
||||||
VirtualIODevice1 *CustomStorageDevice `json:"virtio1,omitempty"`
|
VirtualIODevice1 *CustomStorageDevice `json:"virtio1,omitempty"`
|
||||||
VirtualIODevice2 *CustomStorageDevice `json:"virtio2,omitempty"`
|
VirtualIODevice2 *CustomStorageDevice `json:"virtio2,omitempty"`
|
||||||
VirtualIODevice3 *CustomStorageDevice `json:"virtio3,omitempty"`
|
VirtualIODevice3 *CustomStorageDevice `json:"virtio3,omitempty"`
|
||||||
VirtualIODevice4 *CustomStorageDevice `json:"virtio4,omitempty"`
|
VirtualIODevice4 *CustomStorageDevice `json:"virtio4,omitempty"`
|
||||||
VirtualIODevice5 *CustomStorageDevice `json:"virtio5,omitempty"`
|
VirtualIODevice5 *CustomStorageDevice `json:"virtio5,omitempty"`
|
||||||
VirtualIODevice6 *CustomStorageDevice `json:"virtio6,omitempty"`
|
VirtualIODevice6 *CustomStorageDevice `json:"virtio6,omitempty"`
|
||||||
VirtualIODevice7 *CustomStorageDevice `json:"virtio7,omitempty"`
|
VirtualIODevice7 *CustomStorageDevice `json:"virtio7,omitempty"`
|
||||||
VirtualIODevice8 *CustomStorageDevice `json:"virtio8,omitempty"`
|
VirtualIODevice8 *CustomStorageDevice `json:"virtio8,omitempty"`
|
||||||
VirtualIODevice9 *CustomStorageDevice `json:"virtio9,omitempty"`
|
VirtualIODevice9 *CustomStorageDevice `json:"virtio9,omitempty"`
|
||||||
VirtualIODevice10 *CustomStorageDevice `json:"virtio10,omitempty"`
|
VirtualIODevice10 *CustomStorageDevice `json:"virtio10,omitempty"`
|
||||||
VirtualIODevice11 *CustomStorageDevice `json:"virtio11,omitempty"`
|
VirtualIODevice11 *CustomStorageDevice `json:"virtio11,omitempty"`
|
||||||
VirtualIODevice12 *CustomStorageDevice `json:"virtio12,omitempty"`
|
VirtualIODevice12 *CustomStorageDevice `json:"virtio12,omitempty"`
|
||||||
VirtualIODevice13 *CustomStorageDevice `json:"virtio13,omitempty"`
|
VirtualIODevice13 *CustomStorageDevice `json:"virtio13,omitempty"`
|
||||||
VirtualIODevice14 *CustomStorageDevice `json:"virtio14,omitempty"`
|
VirtualIODevice14 *CustomStorageDevice `json:"virtio14,omitempty"`
|
||||||
VirtualIODevice15 *CustomStorageDevice `json:"virtio15,omitempty"`
|
VirtualIODevice15 *CustomStorageDevice `json:"virtio15,omitempty"`
|
||||||
VMGenerationID *string `json:"vmgenid,omitempty"`
|
VMGenerationID *string `json:"vmgenid,omitempty"`
|
||||||
VMStateDatastoreID *string `json:"vmstatestorage,omitempty"`
|
VMStateDatastoreID *string `json:"vmstatestorage,omitempty"`
|
||||||
WatchdogDevice *CustomWatchdogDevice `json:"watchdog,omitempty"`
|
WatchdogDevice *CustomWatchdogDevice `json:"watchdog,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStatusResponseBody contains the body from a VM get status response.
|
// 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.
|
// GetStatusResponseData contains the data from a VM get status response.
|
||||||
type GetStatusResponseData struct {
|
type GetStatusResponseData struct {
|
||||||
AgentEnabled *types.CustomBool `json:"agent,omitempty"`
|
AgentEnabled *types2.CustomBool `json:"agent,omitempty"`
|
||||||
CPUCount *float64 `json:"cpus,omitempty"`
|
CPUCount *float64 `json:"cpus,omitempty"`
|
||||||
Lock *string `json:"lock,omitempty"`
|
Lock *string `json:"lock,omitempty"`
|
||||||
MemoryAllocation *int `json:"maxmem,omitempty"`
|
MemoryAllocation *int `json:"maxmem,omitempty"`
|
||||||
Name *string `json:"name,omitempty"`
|
Name *string `json:"name,omitempty"`
|
||||||
PID *int `json:"pid,omitempty"`
|
PID *int `json:"pid,omitempty"`
|
||||||
QMPStatus *string `json:"qmpstatus,omitempty"`
|
QMPStatus *string `json:"qmpstatus,omitempty"`
|
||||||
RootDiskSize *int `json:"maxdisk,omitempty"`
|
RootDiskSize *int `json:"maxdisk,omitempty"`
|
||||||
SpiceSupport *types.CustomBool `json:"spice,omitempty"`
|
SpiceSupport *types2.CustomBool `json:"spice,omitempty"`
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"`
|
||||||
Tags *string `json:"tags,omitempty"`
|
Tags *string `json:"tags,omitempty"`
|
||||||
Uptime *int `json:"uptime,omitempty"`
|
Uptime *int `json:"uptime,omitempty"`
|
||||||
VMID *int `json:"vmid,omitempty"`
|
VMID *int `json:"vmid,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListResponseBody contains the body from a virtual machine list response.
|
// 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.
|
// MigrateRequestBody contains the body for a VM migration request.
|
||||||
type MigrateRequestBody struct {
|
type MigrateRequestBody struct {
|
||||||
OnlineMigration *types.CustomBool `json:"online,omitempty" url:"online,omitempty,int"`
|
OnlineMigration *types2.CustomBool `json:"online,omitempty" url:"online,omitempty,int"`
|
||||||
TargetNode string `json:"target" url:"target"`
|
TargetNode string `json:"target" url:"target"`
|
||||||
TargetStorage *string `json:"targetstorage,omitempty" url:"targetstorage,omitempty"`
|
TargetStorage *string `json:"targetstorage,omitempty" url:"targetstorage,omitempty"`
|
||||||
WithLocalDisks *types.CustomBool `json:"with-local-disks,omitempty" url:"with-local-disks,omitempty,int"`
|
WithLocalDisks *types2.CustomBool `json:"with-local-disks,omitempty" url:"with-local-disks,omitempty,int"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MigrateResponseBody contains the body from a VM migrate response.
|
// 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.
|
// MoveDiskRequestBody contains the body for a VM move disk request.
|
||||||
type MoveDiskRequestBody struct {
|
type MoveDiskRequestBody struct {
|
||||||
BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"`
|
BandwidthLimit *int `json:"bwlimit,omitempty" url:"bwlimit,omitempty"`
|
||||||
DeleteOriginalDisk *types.CustomBool `json:"delete,omitempty" url:"delete,omitempty,int"`
|
DeleteOriginalDisk *types2.CustomBool `json:"delete,omitempty" url:"delete,omitempty,int"`
|
||||||
Digest *string `json:"digest,omitempty" url:"digest,omitempty"`
|
Digest *string `json:"digest,omitempty" url:"digest,omitempty"`
|
||||||
Disk string `json:"disk" url:"disk"`
|
Disk string `json:"disk" url:"disk"`
|
||||||
TargetStorage string `json:"storage" url:"storage"`
|
TargetStorage string `json:"storage" url:"storage"`
|
||||||
TargetStorageFormat *string `json:"format,omitempty" url:"format,omitempty"`
|
TargetStorageFormat *string `json:"format,omitempty" url:"format,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveDiskResponseBody contains the body from a VM move disk response.
|
// 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.
|
// ResizeDiskRequestBody contains the body for a VM resize disk request.
|
||||||
type ResizeDiskRequestBody struct {
|
type ResizeDiskRequestBody struct {
|
||||||
Digest *string `json:"digest,omitempty" url:"digest,omitempty"`
|
Digest *string `json:"digest,omitempty" url:"digest,omitempty"`
|
||||||
Disk string `json:"disk" url:"disk"`
|
Disk string `json:"disk" url:"disk"`
|
||||||
Size types.DiskSize `json:"size" url:"size"`
|
Size types2.DiskSize `json:"size" url:"size"`
|
||||||
SkipLock *types.CustomBool `json:"skiplock,omitempty" url:"skiplock,omitempty,int"`
|
SkipLock *types2.CustomBool `json:"skiplock,omitempty" url:"skiplock,omitempty,int"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShutdownRequestBody contains the body for a VM shutdown request.
|
// ShutdownRequestBody contains the body for a VM shutdown request.
|
||||||
type ShutdownRequestBody struct {
|
type ShutdownRequestBody struct {
|
||||||
ForceStop *types.CustomBool `json:"forceStop,omitempty" url:"forceStop,omitempty,int"`
|
ForceStop *types2.CustomBool `json:"forceStop,omitempty" url:"forceStop,omitempty,int"`
|
||||||
KeepActive *types.CustomBool `json:"keepActive,omitempty" url:"keepActive,omitempty,int"`
|
KeepActive *types2.CustomBool `json:"keepActive,omitempty" url:"keepActive,omitempty,int"`
|
||||||
SkipLock *types.CustomBool `json:"skipLock,omitempty" url:"skipLock,omitempty,int"`
|
SkipLock *types2.CustomBool `json:"skipLock,omitempty" url:"skipLock,omitempty,int"`
|
||||||
Timeout *int `json:"timeout,omitempty" url:"timeout,omitempty"`
|
Timeout *int `json:"timeout,omitempty" url:"timeout,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShutdownResponseBody contains the body from a VM shutdown response.
|
// 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), "=")
|
v := strings.Split(strings.TrimSpace(p), "=")
|
||||||
|
|
||||||
if len(v) == 1 {
|
if len(v) == 1 {
|
||||||
enabled := types.CustomBool(v[0] == "1")
|
enabled := types2.CustomBool(v[0] == "1")
|
||||||
r.Enabled = &enabled
|
r.Enabled = &enabled
|
||||||
} else if len(v) == 2 {
|
} else if len(v) == 2 {
|
||||||
switch v[0] {
|
switch v[0] {
|
||||||
case "enabled":
|
case "enabled":
|
||||||
enabled := types.CustomBool(v[1] == "1")
|
enabled := types2.CustomBool(v[1] == "1")
|
||||||
r.Enabled = &enabled
|
r.Enabled = &enabled
|
||||||
case "fstrim_cloned_disks":
|
case "fstrim_cloned_disks":
|
||||||
fstrim := types.CustomBool(v[1] == "1")
|
fstrim := types2.CustomBool(v[1] == "1")
|
||||||
r.TrimClonedDisks = &fstrim
|
r.TrimClonedDisks = &fstrim
|
||||||
case "type":
|
case "type":
|
||||||
r.Type = &v[1]
|
r.Type = &v[1]
|
||||||
@ -1475,7 +1475,7 @@ func (r *CustomCPUEmulation) UnmarshalJSON(b []byte) error {
|
|||||||
r.Flags = &f
|
r.Flags = &f
|
||||||
}
|
}
|
||||||
case "hidden":
|
case "hidden":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Hidden = &bv
|
r.Hidden = &bv
|
||||||
case "hv-vendor-id":
|
case "hv-vendor-id":
|
||||||
r.HVVendorID = &v[1]
|
r.HVVendorID = &v[1]
|
||||||
@ -1513,7 +1513,7 @@ func (r *CustomEFIDisk) UnmarshalJSON(b []byte) error {
|
|||||||
t := strings.ToLower(v[1])
|
t := strings.ToLower(v[1])
|
||||||
r.Type = &t
|
r.Type = &t
|
||||||
case "pre-enrolled-keys":
|
case "pre-enrolled-keys":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.PreEnrolledKeys = &bv
|
r.PreEnrolledKeys = &bv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1541,10 +1541,10 @@ func (r *CustomNetworkDevice) UnmarshalJSON(b []byte) error {
|
|||||||
case "bridge":
|
case "bridge":
|
||||||
r.Bridge = &v[1]
|
r.Bridge = &v[1]
|
||||||
case "firewall":
|
case "firewall":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.Firewall = &bv
|
r.Firewall = &bv
|
||||||
case "link_down":
|
case "link_down":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.LinkDown = &bv
|
r.LinkDown = &bv
|
||||||
case "macaddr":
|
case "macaddr":
|
||||||
r.MACAddress = &v[1]
|
r.MACAddress = &v[1]
|
||||||
@ -1629,15 +1629,15 @@ func (r *CustomPCIDevice) UnmarshalJSON(b []byte) error {
|
|||||||
case "mdev":
|
case "mdev":
|
||||||
r.MDev = &v[1]
|
r.MDev = &v[1]
|
||||||
case "pcie":
|
case "pcie":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.PCIExpress = &bv
|
r.PCIExpress = &bv
|
||||||
case "rombar":
|
case "rombar":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.ROMBAR = &bv
|
r.ROMBAR = &bv
|
||||||
case "romfile":
|
case "romfile":
|
||||||
r.ROMFile = &v[1]
|
r.ROMFile = &v[1]
|
||||||
case "x-vga":
|
case "x-vga":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.XVGA = &bv
|
r.XVGA = &bv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1693,7 +1693,7 @@ func (r *CustomSMBIOS) UnmarshalJSON(b []byte) error {
|
|||||||
if len(v) == 2 {
|
if len(v) == 2 {
|
||||||
switch v[0] {
|
switch v[0] {
|
||||||
case "base64":
|
case "base64":
|
||||||
base64 := types.CustomBool(v[1] == "1")
|
base64 := types2.CustomBool(v[1] == "1")
|
||||||
r.Base64 = &base64
|
r.Base64 = &base64
|
||||||
case "family":
|
case "family":
|
||||||
r.Family = &v[1]
|
r.Family = &v[1]
|
||||||
@ -1787,7 +1787,7 @@ func (r *CustomStorageDevice) UnmarshalJSON(b []byte) error {
|
|||||||
r.AIO = &v[1]
|
r.AIO = &v[1]
|
||||||
|
|
||||||
case "backup":
|
case "backup":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.BackupEnabled = &bv
|
r.BackupEnabled = &bv
|
||||||
|
|
||||||
case "file":
|
case "file":
|
||||||
@ -1825,7 +1825,7 @@ func (r *CustomStorageDevice) UnmarshalJSON(b []byte) error {
|
|||||||
r.Media = &v[1]
|
r.Media = &v[1]
|
||||||
|
|
||||||
case "size":
|
case "size":
|
||||||
r.Size = new(types.DiskSize)
|
r.Size = new(types2.DiskSize)
|
||||||
err := r.Size.UnmarshalJSON([]byte(v[1]))
|
err := r.Size.UnmarshalJSON([]byte(v[1]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to unmarshal disk size: %w", err)
|
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]
|
r.Format = &v[1]
|
||||||
|
|
||||||
case "iothread":
|
case "iothread":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.IOThread = &bv
|
r.IOThread = &bv
|
||||||
|
|
||||||
case "ssd":
|
case "ssd":
|
||||||
bv := types.CustomBool(v[1] == "1")
|
bv := types2.CustomBool(v[1] == "1")
|
||||||
r.SSD = &bv
|
r.SSD = &bv
|
||||||
|
|
||||||
case "discard":
|
case "discard":
|
||||||
|
@ -11,13 +11,13 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestCustomStorageDevice_UnmarshalJSON(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
ds8gig := types.DiskSizeFromGigabytes(8)
|
ds8gig := types2.DiskSizeFromGigabytes(8)
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
line string
|
line string
|
||||||
@ -28,26 +28,26 @@ func TestCustomStorageDevice_UnmarshalJSON(t *testing.T) {
|
|||||||
name: "simple volume",
|
name: "simple volume",
|
||||||
line: `"local-lvm:vm-2041-disk-0,discard=on,ssd=1,iothread=1,size=8G,cache=writeback"`,
|
line: `"local-lvm:vm-2041-disk-0,discard=on,ssd=1,iothread=1,size=8G,cache=writeback"`,
|
||||||
want: &CustomStorageDevice{
|
want: &CustomStorageDevice{
|
||||||
Cache: types.StrPtr("writeback"),
|
Cache: types2.StrPtr("writeback"),
|
||||||
Discard: types.StrPtr("on"),
|
Discard: types2.StrPtr("on"),
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
FileVolume: "local-lvm:vm-2041-disk-0",
|
FileVolume: "local-lvm:vm-2041-disk-0",
|
||||||
IOThread: types.BoolPtr(true),
|
IOThread: types2.BoolPtr(true),
|
||||||
Size: &ds8gig,
|
Size: &ds8gig,
|
||||||
SSD: types.BoolPtr(true),
|
SSD: types2.BoolPtr(true),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "raw volume type",
|
name: "raw volume type",
|
||||||
line: `"nfs:2041/vm-2041-disk-0.raw,discard=ignore,ssd=1,iothread=1,size=8G"`,
|
line: `"nfs:2041/vm-2041-disk-0.raw,discard=ignore,ssd=1,iothread=1,size=8G"`,
|
||||||
want: &CustomStorageDevice{
|
want: &CustomStorageDevice{
|
||||||
Discard: types.StrPtr("ignore"),
|
Discard: types2.StrPtr("ignore"),
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
FileVolume: "nfs:2041/vm-2041-disk-0.raw",
|
FileVolume: "nfs:2041/vm-2041-disk-0.raw",
|
||||||
Format: types.StrPtr("raw"),
|
Format: types2.StrPtr("raw"),
|
||||||
IOThread: types.BoolPtr(true),
|
IOThread: types2.BoolPtr(true),
|
||||||
Size: &ds8gig,
|
Size: &ds8gig,
|
||||||
SSD: types.BoolPtr(true),
|
SSD: types2.BoolPtr(true),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -80,10 +80,10 @@ func TestCustomPCIDevice_UnmarshalJSON(t *testing.T) {
|
|||||||
want: &CustomPCIDevice{
|
want: &CustomPCIDevice{
|
||||||
DeviceIDs: &[]string{"0000:81:00.2"},
|
DeviceIDs: &[]string{"0000:81:00.2"},
|
||||||
MDev: nil,
|
MDev: nil,
|
||||||
PCIExpress: types.BoolPtr(false),
|
PCIExpress: types2.BoolPtr(false),
|
||||||
ROMBAR: types.BoolPtr(true),
|
ROMBAR: types2.BoolPtr(true),
|
||||||
ROMFile: nil,
|
ROMFile: nil,
|
||||||
XVGA: types.BoolPtr(false),
|
XVGA: types2.BoolPtr(false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -92,10 +92,10 @@ func TestCustomPCIDevice_UnmarshalJSON(t *testing.T) {
|
|||||||
want: &CustomPCIDevice{
|
want: &CustomPCIDevice{
|
||||||
DeviceIDs: &[]string{"81:00.4"},
|
DeviceIDs: &[]string{"81:00.4"},
|
||||||
MDev: nil,
|
MDev: nil,
|
||||||
PCIExpress: types.BoolPtr(false),
|
PCIExpress: types2.BoolPtr(false),
|
||||||
ROMBAR: types.BoolPtr(true),
|
ROMBAR: types2.BoolPtr(true),
|
||||||
ROMFile: nil,
|
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"`,
|
line: `"mapping=mappeddevice,pcie=0,rombar=1,x-vga=0"`,
|
||||||
want: &CustomPCIDevice{
|
want: &CustomPCIDevice{
|
||||||
DeviceIDs: nil,
|
DeviceIDs: nil,
|
||||||
Mapping: types.StrPtr("mappeddevice"),
|
Mapping: types2.StrPtr("mappeddevice"),
|
||||||
MDev: nil,
|
MDev: nil,
|
||||||
PCIExpress: types.BoolPtr(false),
|
PCIExpress: types2.BoolPtr(false),
|
||||||
ROMBAR: types.BoolPtr(true),
|
ROMBAR: types2.BoolPtr(true),
|
||||||
ROMFile: nil,
|
ROMFile: nil,
|
||||||
XVGA: types.BoolPtr(false),
|
XVGA: types2.BoolPtr(false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
package pools
|
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.
|
// PoolCreateRequestBody contains the data for a pool create request.
|
||||||
type PoolCreateRequestBody struct {
|
type PoolCreateRequestBody struct {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
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.
|
// DatastoreGetResponseBody contains the body from a datastore get response.
|
||||||
|
@ -14,10 +14,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
"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
|
// 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
|
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.
|
// String converts a HAResourceID value into a string.
|
||||||
func (rid HAResourceID) String() string {
|
func (rid HAResourceID) String() string {
|
||||||
return fmt.Sprintf("%s:%s", rid.Type, rid.Name)
|
return fmt.Sprintf("%s:%s", rid.Type, rid.Name)
|
@ -12,10 +12,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
|
|
||||||
"github.com/bpg/terraform-provider-proxmox/internal/validators"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// HAResourceState represents the requested state of a HA resource.
|
// 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.
|
// String converts a HAResourceState value into a string.
|
||||||
func (s HAResourceState) String() string {
|
func (s HAResourceState) String() string {
|
||||||
switch s {
|
switch s {
|
@ -12,13 +12,10 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
"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
|
type HAResourceType int
|
||||||
|
|
||||||
// Ensure various interfaces are supported by the HA resource type type.
|
// 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.
|
// String converts a HAResourceType value into a string.
|
||||||
func (t HAResourceType) String() string {
|
func (t HAResourceType) String() string {
|
||||||
switch t {
|
switch t {
|
@ -15,8 +15,8 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"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/nodes"
|
||||||
|
"github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"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/cluster/firewall"
|
||||||
|
"github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator"
|
||||||
)
|
)
|
||||||
|
@ -17,8 +17,8 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
"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"
|
"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"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure"
|
||||||
@ -801,7 +801,7 @@ func containerCreateClone(ctx context.Context, d *schema.ResourceData, m interfa
|
|||||||
vmID = *vmIDNew
|
vmID = *vmIDNew
|
||||||
}
|
}
|
||||||
|
|
||||||
fullCopy := types.CustomBool(true)
|
fullCopy := types2.CustomBool(true)
|
||||||
|
|
||||||
cloneBody := &containers.CloneRequestBody{
|
cloneBody := &containers.CloneRequestBody{
|
||||||
FullCopy: &fullCopy,
|
FullCopy: &fullCopy,
|
||||||
@ -854,7 +854,7 @@ func containerCreateClone(ctx context.Context, d *schema.ResourceData, m interfa
|
|||||||
if len(console) > 0 {
|
if len(console) > 0 {
|
||||||
consoleBlock := console[0].(map[string]interface{})
|
consoleBlock := console[0].(map[string]interface{})
|
||||||
|
|
||||||
consoleEnabled := types.CustomBool(
|
consoleEnabled := types2.CustomBool(
|
||||||
consoleBlock[mkResourceVirtualEnvironmentContainerConsoleEnabled].(bool),
|
consoleBlock[mkResourceVirtualEnvironmentContainerConsoleEnabled].(bool),
|
||||||
)
|
)
|
||||||
consoleMode := consoleBlock[mkResourceVirtualEnvironmentContainerConsoleMode].(string)
|
consoleMode := consoleBlock[mkResourceVirtualEnvironmentContainerConsoleMode].(string)
|
||||||
@ -1009,7 +1009,7 @@ func containerCreateClone(ctx context.Context, d *schema.ResourceData, m interfa
|
|||||||
|
|
||||||
bridge := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceBridge].(string)
|
bridge := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceBridge].(string)
|
||||||
enabled := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceEnabled].(bool)
|
enabled := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceEnabled].(bool)
|
||||||
firewall := types.CustomBool(
|
firewall := types2.CustomBool(
|
||||||
networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceFirewall].(bool),
|
networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceFirewall].(bool),
|
||||||
)
|
)
|
||||||
macAddress := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceMACAddress].(string)
|
macAddress := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceMACAddress].(string)
|
||||||
@ -1093,7 +1093,7 @@ func containerCreateClone(ctx context.Context, d *schema.ResourceData, m interfa
|
|||||||
updateBody.Tags = &tagString
|
updateBody.Tags = &tagString
|
||||||
}
|
}
|
||||||
|
|
||||||
template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool))
|
template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool))
|
||||||
|
|
||||||
//nolint:gosimple
|
//nolint:gosimple
|
||||||
if template != dvResourceVirtualEnvironmentContainerTemplate {
|
if template != dvResourceVirtualEnvironmentContainerTemplate {
|
||||||
@ -1135,7 +1135,7 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
consoleEnabled := types.CustomBool(
|
consoleEnabled := types2.CustomBool(
|
||||||
consoleBlock[mkResourceVirtualEnvironmentContainerConsoleEnabled].(bool),
|
consoleBlock[mkResourceVirtualEnvironmentContainerConsoleEnabled].(bool),
|
||||||
)
|
)
|
||||||
consoleMode := consoleBlock[mkResourceVirtualEnvironmentContainerConsoleMode].(string)
|
consoleMode := consoleBlock[mkResourceVirtualEnvironmentContainerConsoleMode].(string)
|
||||||
@ -1193,7 +1193,7 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
nesting := types.CustomBool(featuresBlock[mkResourceVirtualEnvironmentContainerFeaturesNesting].(bool))
|
nesting := types2.CustomBool(featuresBlock[mkResourceVirtualEnvironmentContainerFeaturesNesting].(bool))
|
||||||
features := containers.CustomFeatures{
|
features := containers.CustomFeatures{
|
||||||
Nesting: &nesting,
|
Nesting: &nesting,
|
||||||
}
|
}
|
||||||
@ -1304,14 +1304,14 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
|
|||||||
mountPointMap := mp.(map[string]interface{})
|
mountPointMap := mp.(map[string]interface{})
|
||||||
mountPointObject := containers.CustomMountPoint{}
|
mountPointObject := containers.CustomMountPoint{}
|
||||||
|
|
||||||
acl := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointACL].(bool))
|
acl := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointACL].(bool))
|
||||||
backup := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointBackup].(bool))
|
backup := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointBackup].(bool))
|
||||||
mountOptions := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointMountOptions].([]interface{})
|
mountOptions := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointMountOptions].([]interface{})
|
||||||
path := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointPath].(string)
|
path := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointPath].(string)
|
||||||
quota := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointQuota].(bool))
|
quota := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointQuota].(bool))
|
||||||
readOnly := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReadOnly].(bool))
|
readOnly := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReadOnly].(bool))
|
||||||
replicate := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReplicate].(bool))
|
replicate := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReplicate].(bool))
|
||||||
shared := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointShared].(bool))
|
shared := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointShared].(bool))
|
||||||
size := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointSize].(string)
|
size := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointSize].(string)
|
||||||
volume := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointVolume].(string)
|
volume := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointVolume].(string)
|
||||||
|
|
||||||
@ -1324,9 +1324,9 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
|
|||||||
mountPointObject.Shared = &shared
|
mountPointObject.Shared = &shared
|
||||||
|
|
||||||
if len(size) > 0 {
|
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 {
|
if err != nil {
|
||||||
return diag.Errorf("invalid disk size: %s", err.Error())
|
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)
|
operatingSystemType := operatingSystemBlock[mkResourceVirtualEnvironmentContainerOperatingSystemType].(string)
|
||||||
|
|
||||||
poolID := d.Get(mkResourceVirtualEnvironmentContainerPoolID).(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{})
|
tags := d.Get(mkResourceVirtualEnvironmentContainerTags).([]interface{})
|
||||||
template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool))
|
template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool))
|
||||||
unprivileged := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerUnprivileged).(bool))
|
unprivileged := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerUnprivileged).(bool))
|
||||||
vmID := d.Get(mkResourceVirtualEnvironmentContainerVMID).(int)
|
vmID := d.Get(mkResourceVirtualEnvironmentContainerVMID).(int)
|
||||||
|
|
||||||
if vmID == -1 {
|
if vmID == -1 {
|
||||||
@ -1750,7 +1750,7 @@ func containerRead(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
|||||||
}
|
}
|
||||||
} else if len(currentConsole) > 0 ||
|
} else if len(currentConsole) > 0 ||
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
console[mkResourceVirtualEnvironmentContainerConsoleEnabled] != types.CustomBool(dvResourceVirtualEnvironmentContainerConsoleEnabled) ||
|
console[mkResourceVirtualEnvironmentContainerConsoleEnabled] != types2.CustomBool(dvResourceVirtualEnvironmentContainerConsoleEnabled) ||
|
||||||
console[mkResourceVirtualEnvironmentContainerConsoleMode] != dvResourceVirtualEnvironmentContainerConsoleMode ||
|
console[mkResourceVirtualEnvironmentContainerConsoleMode] != dvResourceVirtualEnvironmentContainerConsoleMode ||
|
||||||
console[mkResourceVirtualEnvironmentContainerConsoleTTYCount] != dvResourceVirtualEnvironmentContainerConsoleTTYCount {
|
console[mkResourceVirtualEnvironmentContainerConsoleTTYCount] != dvResourceVirtualEnvironmentContainerConsoleTTYCount {
|
||||||
err := d.Set(mkResourceVirtualEnvironmentContainerConsole, []interface{}{console})
|
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)
|
description := d.Get(mkResourceVirtualEnvironmentContainerDescription).(string)
|
||||||
updateBody.Description = &description
|
updateBody.Description = &description
|
||||||
|
|
||||||
template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool))
|
template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentContainerTemplate).(bool))
|
||||||
|
|
||||||
if d.HasChange(mkResourceVirtualEnvironmentContainerTemplate) {
|
if d.HasChange(mkResourceVirtualEnvironmentContainerTemplate) {
|
||||||
updateBody.Template = &template
|
updateBody.Template = &template
|
||||||
@ -2285,7 +2285,7 @@ func containerUpdate(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
consoleEnabled := types.CustomBool(
|
consoleEnabled := types2.CustomBool(
|
||||||
consoleBlock[mkResourceVirtualEnvironmentContainerConsoleEnabled].(bool),
|
consoleBlock[mkResourceVirtualEnvironmentContainerConsoleEnabled].(bool),
|
||||||
)
|
)
|
||||||
consoleMode := consoleBlock[mkResourceVirtualEnvironmentContainerConsoleMode].(string)
|
consoleMode := consoleBlock[mkResourceVirtualEnvironmentContainerConsoleMode].(string)
|
||||||
@ -2429,14 +2429,14 @@ func containerUpdate(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
mountPointMap := mp.(map[string]interface{})
|
mountPointMap := mp.(map[string]interface{})
|
||||||
mountPointObject := containers.CustomMountPoint{}
|
mountPointObject := containers.CustomMountPoint{}
|
||||||
|
|
||||||
acl := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointACL].(bool))
|
acl := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointACL].(bool))
|
||||||
backup := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointBackup].(bool))
|
backup := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointBackup].(bool))
|
||||||
mountOptions := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointMountOptions].([]interface{})
|
mountOptions := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointMountOptions].([]interface{})
|
||||||
path := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointPath].(string)
|
path := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointPath].(string)
|
||||||
quota := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointQuota].(bool))
|
quota := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointQuota].(bool))
|
||||||
readOnly := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReadOnly].(bool))
|
readOnly := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReadOnly].(bool))
|
||||||
replicate := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReplicate].(bool))
|
replicate := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointReplicate].(bool))
|
||||||
shared := types.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointShared].(bool))
|
shared := types2.CustomBool(mountPointMap[mkResourceVirtualEnvironmentContainerMountPointShared].(bool))
|
||||||
volume := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointVolume].(string)
|
volume := mountPointMap[mkResourceVirtualEnvironmentContainerMountPointVolume].(string)
|
||||||
|
|
||||||
mountPointObject.ACL = &acl
|
mountPointObject.ACL = &acl
|
||||||
@ -2490,7 +2490,7 @@ func containerUpdate(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
|
|
||||||
bridge := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceBridge].(string)
|
bridge := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceBridge].(string)
|
||||||
enabled := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceEnabled].(bool)
|
enabled := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceEnabled].(bool)
|
||||||
firewall := types.CustomBool(
|
firewall := types2.CustomBool(
|
||||||
networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceFirewall].(bool),
|
networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceFirewall].(bool),
|
||||||
)
|
)
|
||||||
macAddress := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceMACAddress].(string)
|
macAddress := networkInterfaceMap[mkResourceVirtualEnvironmentContainerNetworkInterfaceMACAddress].(string)
|
||||||
@ -2606,7 +2606,7 @@ func containerUpdate(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
return diag.FromErr(e)
|
return diag.FromErr(e)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
forceStop := types.CustomBool(true)
|
forceStop := types2.CustomBool(true)
|
||||||
shutdownTimeout := 300
|
shutdownTimeout := 300
|
||||||
|
|
||||||
e = containerAPI.ShutdownContainer(ctx, &containers.ShutdownRequestBody{
|
e = containerAPI.ShutdownContainer(ctx, &containers.ShutdownRequestBody{
|
||||||
@ -2666,7 +2666,7 @@ func containerDelete(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
}
|
}
|
||||||
|
|
||||||
if status.Status != "stopped" {
|
if status.Status != "stopped" {
|
||||||
forceStop := types.CustomBool(true)
|
forceStop := types2.CustomBool(true)
|
||||||
shutdownTimeout := 300
|
shutdownTimeout := 300
|
||||||
|
|
||||||
err = containerAPI.ShutdownContainer(
|
err = containerAPI.ShutdownContainer(
|
||||||
|
@ -13,8 +13,8 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"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/firewall"
|
||||||
|
"github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"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/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/resource/validator"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure"
|
||||||
)
|
)
|
||||||
|
@ -16,8 +16,8 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
"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/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/resource/validator"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure"
|
||||||
)
|
)
|
||||||
|
@ -13,8 +13,8 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"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/access"
|
||||||
|
"github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"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/access"
|
||||||
|
"github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
"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/access"
|
||||||
|
"github.com/bpg/terraform-provider-proxmox/proxmox/types"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
"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.
|
// FileFormat returns a schema validation function for a file format.
|
||||||
|
@ -25,10 +25,10 @@ import (
|
|||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
"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/cluster"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmox/nodes/vms"
|
"github.com/bpg/terraform-provider-proxmox/proxmox/nodes/vms"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmox/pools"
|
"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"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator"
|
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/resource/validator"
|
||||||
"github.com/bpg/terraform-provider-proxmox/proxmoxtf/structure"
|
"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 {
|
func vmShutdown(ctx context.Context, vmAPI *vms.Client, d *schema.ResourceData) diag.Diagnostics {
|
||||||
tflog.Debug(ctx, "Shutting down VM")
|
tflog.Debug(ctx, "Shutting down VM")
|
||||||
|
|
||||||
forceStop := types.CustomBool(true)
|
forceStop := types2.CustomBool(true)
|
||||||
shutdownTimeout := d.Get(mkResourceVirtualEnvironmentVMTimeoutShutdownVM).(int)
|
shutdownTimeout := d.Get(mkResourceVirtualEnvironmentVMTimeoutShutdownVM).(int)
|
||||||
|
|
||||||
e := vmAPI.ShutdownVM(ctx, &vms.ShutdownRequestBody{
|
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{
|
cloneBody := &vms.CloneRequestBody{
|
||||||
FullCopy: &fullCopy,
|
FullCopy: &fullCopy,
|
||||||
@ -1752,7 +1752,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Migrate to target node
|
// Migrate to target node
|
||||||
withLocalDisks := types.CustomBool(true)
|
withLocalDisks := types2.CustomBool(true)
|
||||||
migrateBody := &vms.MigrateRequestBody{
|
migrateBody := &vms.MigrateRequestBody{
|
||||||
TargetNode: nodeName,
|
TargetNode: nodeName,
|
||||||
WithLocalDisks: &withLocalDisks,
|
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.
|
// 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{})
|
agent := d.Get(mkResourceVirtualEnvironmentVMAgent).([]interface{})
|
||||||
audioDevices := vmGetAudioDeviceList(d)
|
audioDevices := vmGetAudioDeviceList(d)
|
||||||
|
|
||||||
@ -1802,9 +1802,9 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
|||||||
networkDevice := d.Get(mkResourceVirtualEnvironmentVMNetworkDevice).([]interface{})
|
networkDevice := d.Get(mkResourceVirtualEnvironmentVMNetworkDevice).([]interface{})
|
||||||
operatingSystem := d.Get(mkResourceVirtualEnvironmentVMOperatingSystem).([]interface{})
|
operatingSystem := d.Get(mkResourceVirtualEnvironmentVMOperatingSystem).([]interface{})
|
||||||
serialDevice := d.Get(mkResourceVirtualEnvironmentVMSerialDevice).([]interface{})
|
serialDevice := d.Get(mkResourceVirtualEnvironmentVMSerialDevice).([]interface{})
|
||||||
onBoot := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool))
|
onBoot := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool))
|
||||||
tabletDevice := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool))
|
tabletDevice := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool))
|
||||||
template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool))
|
template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool))
|
||||||
vga := d.Get(mkResourceVirtualEnvironmentVMVGA).([]interface{})
|
vga := d.Get(mkResourceVirtualEnvironmentVMVGA).([]interface{})
|
||||||
|
|
||||||
updateBody := &vms.UpdateRequestBody{
|
updateBody := &vms.UpdateRequestBody{
|
||||||
@ -1823,10 +1823,10 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
|||||||
if len(agent) > 0 {
|
if len(agent) > 0 {
|
||||||
agentBlock := agent[0].(map[string]interface{})
|
agentBlock := agent[0].(map[string]interface{})
|
||||||
|
|
||||||
agentEnabled := types.CustomBool(
|
agentEnabled := types2.CustomBool(
|
||||||
agentBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool),
|
agentBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool),
|
||||||
)
|
)
|
||||||
agentTrim := types.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool))
|
agentTrim := types2.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool))
|
||||||
agentType := agentBlock[mkResourceVirtualEnvironmentVMAgentType].(string)
|
agentType := agentBlock[mkResourceVirtualEnvironmentVMAgentType].(string)
|
||||||
|
|
||||||
updateBody.Agent = &vms.CustomAgent{
|
updateBody.Agent = &vms.CustomAgent{
|
||||||
@ -1892,7 +1892,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
|||||||
cpuCores := cpuBlock[mkResourceVirtualEnvironmentVMCPUCores].(int)
|
cpuCores := cpuBlock[mkResourceVirtualEnvironmentVMCPUCores].(int)
|
||||||
cpuFlags := cpuBlock[mkResourceVirtualEnvironmentVMCPUFlags].([]interface{})
|
cpuFlags := cpuBlock[mkResourceVirtualEnvironmentVMCPUFlags].([]interface{})
|
||||||
cpuHotplugged := cpuBlock[mkResourceVirtualEnvironmentVMCPUHotplugged].(int)
|
cpuHotplugged := cpuBlock[mkResourceVirtualEnvironmentVMCPUHotplugged].(int)
|
||||||
cpuNUMA := types.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool))
|
cpuNUMA := types2.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool))
|
||||||
cpuSockets := cpuBlock[mkResourceVirtualEnvironmentVMCPUSockets].(int)
|
cpuSockets := cpuBlock[mkResourceVirtualEnvironmentVMCPUSockets].(int)
|
||||||
cpuType := cpuBlock[mkResourceVirtualEnvironmentVMCPUType].(string)
|
cpuType := cpuBlock[mkResourceVirtualEnvironmentVMCPUType].(string)
|
||||||
cpuUnits := cpuBlock[mkResourceVirtualEnvironmentVMCPUUnits].(int)
|
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{
|
diskMoveBody := &vms.MoveDiskRequestBody{
|
||||||
DeleteOriginalDisk: &deleteOriginalDisk,
|
DeleteOriginalDisk: &deleteOriginalDisk,
|
||||||
@ -2137,7 +2137,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
|||||||
|
|
||||||
diskResizeBody := &vms.ResizeDiskRequestBody{
|
diskResizeBody := &vms.ResizeDiskRequestBody{
|
||||||
Disk: diskInterface,
|
Disk: diskInterface,
|
||||||
Size: types.DiskSizeFromGigabytes(diskSize),
|
Size: types2.DiskSizeFromGigabytes(diskSize),
|
||||||
}
|
}
|
||||||
|
|
||||||
moveDisk := false
|
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{
|
diskMoveBody := &vms.MoveDiskRequestBody{
|
||||||
DeleteOriginalDisk: &deleteOriginalDisk,
|
DeleteOriginalDisk: &deleteOriginalDisk,
|
||||||
@ -2239,7 +2239,7 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
|
|
||||||
resource := VM()
|
resource := VM()
|
||||||
|
|
||||||
acpi := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMACPI).(bool))
|
acpi := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMACPI).(bool))
|
||||||
|
|
||||||
agentBlock, err := structure.GetSchemaBlock(
|
agentBlock, err := structure.GetSchemaBlock(
|
||||||
resource,
|
resource,
|
||||||
@ -2252,10 +2252,10 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
agentEnabled := types.CustomBool(
|
agentEnabled := types2.CustomBool(
|
||||||
agentBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool),
|
agentBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool),
|
||||||
)
|
)
|
||||||
agentTrim := types.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool))
|
agentTrim := types2.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool))
|
||||||
agentType := agentBlock[mkResourceVirtualEnvironmentVMAgentType].(string)
|
agentType := agentBlock[mkResourceVirtualEnvironmentVMAgentType].(string)
|
||||||
|
|
||||||
kvmArguments := d.Get(mkResourceVirtualEnvironmentVMKVMArguments).(string)
|
kvmArguments := d.Get(mkResourceVirtualEnvironmentVMKVMArguments).(string)
|
||||||
@ -2303,7 +2303,7 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
cpuFlags := cpuBlock[mkResourceVirtualEnvironmentVMCPUFlags].([]interface{})
|
cpuFlags := cpuBlock[mkResourceVirtualEnvironmentVMCPUFlags].([]interface{})
|
||||||
cpuHotplugged := cpuBlock[mkResourceVirtualEnvironmentVMCPUHotplugged].(int)
|
cpuHotplugged := cpuBlock[mkResourceVirtualEnvironmentVMCPUHotplugged].(int)
|
||||||
cpuSockets := cpuBlock[mkResourceVirtualEnvironmentVMCPUSockets].(int)
|
cpuSockets := cpuBlock[mkResourceVirtualEnvironmentVMCPUSockets].(int)
|
||||||
cpuNUMA := types.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool))
|
cpuNUMA := types2.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool))
|
||||||
cpuType := cpuBlock[mkResourceVirtualEnvironmentVMCPUType].(string)
|
cpuType := cpuBlock[mkResourceVirtualEnvironmentVMCPUType].(string)
|
||||||
cpuUnits := cpuBlock[mkResourceVirtualEnvironmentVMCPUUnits].(int)
|
cpuUnits := cpuBlock[mkResourceVirtualEnvironmentVMCPUUnits].(int)
|
||||||
|
|
||||||
@ -2322,7 +2322,7 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
datastoreID, _ := block[mkResourceVirtualEnvironmentVMEFIDiskDatastoreID].(string)
|
datastoreID, _ := block[mkResourceVirtualEnvironmentVMEFIDiskDatastoreID].(string)
|
||||||
fileFormat, _ := block[mkResourceVirtualEnvironmentVMEFIDiskFileFormat].(string)
|
fileFormat, _ := block[mkResourceVirtualEnvironmentVMEFIDiskFileFormat].(string)
|
||||||
efiType, _ := block[mkResourceVirtualEnvironmentVMEFIDiskType].(string)
|
efiType, _ := block[mkResourceVirtualEnvironmentVMEFIDiskType].(string)
|
||||||
preEnrolledKeys := types.CustomBool(block[mkResourceVirtualEnvironmentVMEFIDiskPreEnrolledKeys].(bool))
|
preEnrolledKeys := types2.CustomBool(block[mkResourceVirtualEnvironmentVMEFIDiskPreEnrolledKeys].(bool))
|
||||||
|
|
||||||
if fileFormat == "" {
|
if fileFormat == "" {
|
||||||
fileFormat = dvResourceVirtualEnvironmentVMEFIDiskFileFormat
|
fileFormat = dvResourceVirtualEnvironmentVMEFIDiskFileFormat
|
||||||
@ -2404,9 +2404,9 @@ func vmCreateCustom(ctx context.Context, d *schema.ResourceData, m interface{})
|
|||||||
|
|
||||||
startupOrder := vmGetStartupOrder(d)
|
startupOrder := vmGetStartupOrder(d)
|
||||||
|
|
||||||
onBoot := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool))
|
onBoot := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool))
|
||||||
tabletDevice := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool))
|
tabletDevice := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool))
|
||||||
template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool))
|
template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool))
|
||||||
|
|
||||||
vgaDevice, err := vmGetVGADeviceObject(d)
|
vgaDevice, err := vmGetVGADeviceObject(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -2633,8 +2633,8 @@ func vmCreateCustomDisks(ctx context.Context, d *schema.ResourceData, m interfac
|
|||||||
size, _ := block[mkResourceVirtualEnvironmentVMDiskSize].(int)
|
size, _ := block[mkResourceVirtualEnvironmentVMDiskSize].(int)
|
||||||
speed := block[mkResourceVirtualEnvironmentVMDiskSpeed].([]interface{})
|
speed := block[mkResourceVirtualEnvironmentVMDiskSpeed].([]interface{})
|
||||||
diskInterface, _ := block[mkResourceVirtualEnvironmentVMDiskInterface].(string)
|
diskInterface, _ := block[mkResourceVirtualEnvironmentVMDiskInterface].(string)
|
||||||
ioThread := types.CustomBool(block[mkResourceVirtualEnvironmentVMDiskIOThread].(bool))
|
ioThread := types2.CustomBool(block[mkResourceVirtualEnvironmentVMDiskIOThread].(bool))
|
||||||
ssd := types.CustomBool(block[mkResourceVirtualEnvironmentVMDiskSSD].(bool))
|
ssd := types2.CustomBool(block[mkResourceVirtualEnvironmentVMDiskSSD].(bool))
|
||||||
discard, _ := block[mkResourceVirtualEnvironmentVMDiskDiscard].(string)
|
discard, _ := block[mkResourceVirtualEnvironmentVMDiskDiscard].(string)
|
||||||
cache, _ := block[mkResourceVirtualEnvironmentVMDiskCache].(string)
|
cache, _ := block[mkResourceVirtualEnvironmentVMDiskCache].(string)
|
||||||
|
|
||||||
@ -2998,8 +2998,8 @@ func vmGetDiskDeviceObjects(
|
|||||||
fileID, _ := block[mkResourceVirtualEnvironmentVMDiskFileID].(string)
|
fileID, _ := block[mkResourceVirtualEnvironmentVMDiskFileID].(string)
|
||||||
size, _ := block[mkResourceVirtualEnvironmentVMDiskSize].(int)
|
size, _ := block[mkResourceVirtualEnvironmentVMDiskSize].(int)
|
||||||
diskInterface, _ := block[mkResourceVirtualEnvironmentVMDiskInterface].(string)
|
diskInterface, _ := block[mkResourceVirtualEnvironmentVMDiskInterface].(string)
|
||||||
ioThread := types.CustomBool(block[mkResourceVirtualEnvironmentVMDiskIOThread].(bool))
|
ioThread := types2.CustomBool(block[mkResourceVirtualEnvironmentVMDiskIOThread].(bool))
|
||||||
ssd := types.CustomBool(block[mkResourceVirtualEnvironmentVMDiskSSD].(bool))
|
ssd := types2.CustomBool(block[mkResourceVirtualEnvironmentVMDiskSSD].(bool))
|
||||||
discard := block[mkResourceVirtualEnvironmentVMDiskDiscard].(string)
|
discard := block[mkResourceVirtualEnvironmentVMDiskDiscard].(string)
|
||||||
cache := block[mkResourceVirtualEnvironmentVMDiskCache].(string)
|
cache := block[mkResourceVirtualEnvironmentVMDiskCache].(string)
|
||||||
|
|
||||||
@ -3027,7 +3027,7 @@ func vmGetDiskDeviceObjects(
|
|||||||
diskDevice.Interface = &diskInterface
|
diskDevice.Interface = &diskInterface
|
||||||
diskDevice.Format = &fileFormat
|
diskDevice.Format = &fileFormat
|
||||||
diskDevice.FileID = &fileID
|
diskDevice.FileID = &fileID
|
||||||
diskSize := types.DiskSizeFromGigabytes(size)
|
diskSize := types2.DiskSizeFromGigabytes(size)
|
||||||
diskDevice.Size = &diskSize
|
diskDevice.Size = &diskSize
|
||||||
diskDevice.SizeInt = &size
|
diskDevice.SizeInt = &size
|
||||||
diskDevice.IOThread = &ioThread
|
diskDevice.IOThread = &ioThread
|
||||||
@ -3100,7 +3100,7 @@ func vmGetEfiDisk(d *schema.ResourceData, disk []interface{}) *vms.CustomEFIDisk
|
|||||||
datastoreID, _ := block[mkResourceVirtualEnvironmentVMEFIDiskDatastoreID].(string)
|
datastoreID, _ := block[mkResourceVirtualEnvironmentVMEFIDiskDatastoreID].(string)
|
||||||
fileFormat, _ := block[mkResourceVirtualEnvironmentVMEFIDiskFileFormat].(string)
|
fileFormat, _ := block[mkResourceVirtualEnvironmentVMEFIDiskFileFormat].(string)
|
||||||
efiType, _ := block[mkResourceVirtualEnvironmentVMEFIDiskType].(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
|
// special case for efi disk, the size is ignored, see docs for more info
|
||||||
efiDiskConfig.FileVolume = fmt.Sprintf("%s:1", datastoreID)
|
efiDiskConfig.FileVolume = fmt.Sprintf("%s:1", datastoreID)
|
||||||
@ -3131,7 +3131,7 @@ func vmGetEfiDiskAsStorageDevice(d *schema.ResourceData, disk []interface{}) (*v
|
|||||||
}
|
}
|
||||||
|
|
||||||
if efiDisk.Type != nil {
|
if efiDisk.Type != nil {
|
||||||
ds, err := types.ParseDiskSize(*efiDisk.Type)
|
ds, err := types2.ParseDiskSize(*efiDisk.Type)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid efi disk type: %s", err.Error())
|
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)
|
ids, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceID].(string)
|
||||||
mdev, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceMDev].(string)
|
mdev, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceMDev].(string)
|
||||||
pcie := types.CustomBool(block[mkResourceVirtualEnvironmentVMHostPCIDevicePCIE].(bool))
|
pcie := types2.CustomBool(block[mkResourceVirtualEnvironmentVMHostPCIDevicePCIE].(bool))
|
||||||
rombar := types.CustomBool(
|
rombar := types2.CustomBool(
|
||||||
block[mkResourceVirtualEnvironmentVMHostPCIDeviceROMBAR].(bool),
|
block[mkResourceVirtualEnvironmentVMHostPCIDeviceROMBAR].(bool),
|
||||||
)
|
)
|
||||||
romfile, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceROMFile].(string)
|
romfile, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceROMFile].(string)
|
||||||
xvga := types.CustomBool(block[mkResourceVirtualEnvironmentVMHostPCIDeviceXVGA].(bool))
|
xvga := types2.CustomBool(block[mkResourceVirtualEnvironmentVMHostPCIDeviceXVGA].(bool))
|
||||||
mapping, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceMapping].(string)
|
mapping, _ := block[mkResourceVirtualEnvironmentVMHostPCIDeviceMapping].(string)
|
||||||
|
|
||||||
device := vms.CustomPCIDevice{
|
device := vms.CustomPCIDevice{
|
||||||
@ -3199,7 +3199,7 @@ func vmGetNetworkDeviceObjects(d *schema.ResourceData) vms.CustomNetworkDevices
|
|||||||
|
|
||||||
bridge := block[mkResourceVirtualEnvironmentVMNetworkDeviceBridge].(string)
|
bridge := block[mkResourceVirtualEnvironmentVMNetworkDeviceBridge].(string)
|
||||||
enabled := block[mkResourceVirtualEnvironmentVMNetworkDeviceEnabled].(bool)
|
enabled := block[mkResourceVirtualEnvironmentVMNetworkDeviceEnabled].(bool)
|
||||||
firewall := types.CustomBool(block[mkResourceVirtualEnvironmentVMNetworkDeviceFirewall].(bool))
|
firewall := types2.CustomBool(block[mkResourceVirtualEnvironmentVMNetworkDeviceFirewall].(bool))
|
||||||
macAddress := block[mkResourceVirtualEnvironmentVMNetworkDeviceMACAddress].(string)
|
macAddress := block[mkResourceVirtualEnvironmentVMNetworkDeviceMACAddress].(string)
|
||||||
model := block[mkResourceVirtualEnvironmentVMNetworkDeviceModel].(string)
|
model := block[mkResourceVirtualEnvironmentVMNetworkDeviceModel].(string)
|
||||||
rateLimit := block[mkResourceVirtualEnvironmentVMNetworkDeviceRateLimit].(float64)
|
rateLimit := block[mkResourceVirtualEnvironmentVMNetworkDeviceRateLimit].(float64)
|
||||||
@ -3275,7 +3275,7 @@ func vmGetSMBIOS(d *schema.ResourceData) *vms.CustomSMBIOS {
|
|||||||
//nolint:nestif
|
//nolint:nestif
|
||||||
if len(smbiosSections) > 0 {
|
if len(smbiosSections) > 0 {
|
||||||
smbiosBlock := smbiosSections[0].(map[string]interface{})
|
smbiosBlock := smbiosSections[0].(map[string]interface{})
|
||||||
b64 := types.CustomBool(true)
|
b64 := types2.CustomBool(true)
|
||||||
family, _ := smbiosBlock[mkResourceVirtualEnvironmentVMSMBIOSFamily].(string)
|
family, _ := smbiosBlock[mkResourceVirtualEnvironmentVMSMBIOSFamily].(string)
|
||||||
manufacturer, _ := smbiosBlock[mkResourceVirtualEnvironmentVMSMBIOSManufacturer].(string)
|
manufacturer, _ := smbiosBlock[mkResourceVirtualEnvironmentVMSMBIOSManufacturer].(string)
|
||||||
product, _ := smbiosBlock[mkResourceVirtualEnvironmentVMSMBIOSProduct].(string)
|
product, _ := smbiosBlock[mkResourceVirtualEnvironmentVMSMBIOSProduct].(string)
|
||||||
@ -3323,7 +3323,7 @@ func vmGetSMBIOS(d *schema.ResourceData) *vms.CustomSMBIOS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if smbios.UUID == nil || *smbios.UUID == "" {
|
if smbios.UUID == nil || *smbios.UUID == "" {
|
||||||
smbios.UUID = types.StrPtr(uuid.New().String())
|
smbios.UUID = types2.StrPtr(uuid.New().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return &smbios
|
return &smbios
|
||||||
@ -3405,7 +3405,7 @@ func vmGetVGADeviceObject(d *schema.ResourceData) (*vms.CustomVGADevice, error)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
vgaEnabled := types.CustomBool(vgaBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool))
|
vgaEnabled := types2.CustomBool(vgaBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool))
|
||||||
vgaMemory := vgaBlock[mkResourceVirtualEnvironmentVMVGAMemory].(int)
|
vgaMemory := vgaBlock[mkResourceVirtualEnvironmentVMVGAMemory].(int)
|
||||||
vgaType := vgaBlock[mkResourceVirtualEnvironmentVMVGAType].(string)
|
vgaType := vgaBlock[mkResourceVirtualEnvironmentVMVGAType].(string)
|
||||||
|
|
||||||
@ -4857,12 +4857,12 @@ func vmUpdatePool(
|
|||||||
|
|
||||||
oldPool := oldPoolValue.(string)
|
oldPool := oldPoolValue.(string)
|
||||||
newPool := newPoolValue.(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))
|
tflog.Debug(ctx, fmt.Sprintf("Moving VM %d from pool '%s' to pool '%s'", vmID, oldPool, newPool))
|
||||||
|
|
||||||
if oldPool != "" {
|
if oldPool != "" {
|
||||||
trueValue := types.CustomBool(true)
|
trueValue := types2.CustomBool(true)
|
||||||
poolUpdate := &pools.PoolUpdateRequestBody{
|
poolUpdate := &pools.PoolUpdateRequestBody{
|
||||||
VMs: &vmList,
|
VMs: &vmList,
|
||||||
Delete: &trueValue,
|
Delete: &trueValue,
|
||||||
@ -4914,7 +4914,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
vmAPI := api.Node(oldNodeName).VM(vmID)
|
vmAPI := api.Node(oldNodeName).VM(vmID)
|
||||||
|
|
||||||
migrateTimeout := d.Get(mkResourceVirtualEnvironmentVMTimeoutMigrate).(int)
|
migrateTimeout := d.Get(mkResourceVirtualEnvironmentVMTimeoutMigrate).(int)
|
||||||
trueValue := types.CustomBool(true)
|
trueValue := types2.CustomBool(true)
|
||||||
migrateBody := &vms.MigrateRequestBody{
|
migrateBody := &vms.MigrateRequestBody{
|
||||||
TargetNode: nodeName,
|
TargetNode: nodeName,
|
||||||
WithLocalDisks: &trueValue,
|
WithLocalDisks: &trueValue,
|
||||||
@ -4958,7 +4958,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
|
|
||||||
// Prepare the new primitive configuration values.
|
// Prepare the new primitive configuration values.
|
||||||
if d.HasChange(mkResourceVirtualEnvironmentVMACPI) {
|
if d.HasChange(mkResourceVirtualEnvironmentVMACPI) {
|
||||||
acpi := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMACPI).(bool))
|
acpi := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMACPI).(bool))
|
||||||
updateBody.ACPI = &acpi
|
updateBody.ACPI = &acpi
|
||||||
rebootRequired = true
|
rebootRequired = true
|
||||||
}
|
}
|
||||||
@ -4981,7 +4981,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange(mkResourceVirtualEnvironmentVMOnBoot) {
|
if d.HasChange(mkResourceVirtualEnvironmentVMOnBoot) {
|
||||||
startOnBoot := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool))
|
startOnBoot := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMOnBoot).(bool))
|
||||||
updateBody.StartOnBoot = &startOnBoot
|
updateBody.StartOnBoot = &startOnBoot
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5011,12 +5011,12 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
}
|
}
|
||||||
|
|
||||||
if d.HasChange(mkResourceVirtualEnvironmentVMTabletDevice) {
|
if d.HasChange(mkResourceVirtualEnvironmentVMTabletDevice) {
|
||||||
tabletDevice := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool))
|
tabletDevice := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTabletDevice).(bool))
|
||||||
updateBody.TabletDeviceEnabled = &tabletDevice
|
updateBody.TabletDeviceEnabled = &tabletDevice
|
||||||
rebootRequired = true
|
rebootRequired = true
|
||||||
}
|
}
|
||||||
|
|
||||||
template := types.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool))
|
template := types2.CustomBool(d.Get(mkResourceVirtualEnvironmentVMTemplate).(bool))
|
||||||
|
|
||||||
if d.HasChange(mkResourceVirtualEnvironmentVMTemplate) {
|
if d.HasChange(mkResourceVirtualEnvironmentVMTemplate) {
|
||||||
updateBody.Template = &template
|
updateBody.Template = &template
|
||||||
@ -5036,10 +5036,10 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
return diag.FromErr(err)
|
return diag.FromErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
agentEnabled := types.CustomBool(
|
agentEnabled := types2.CustomBool(
|
||||||
agentBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool),
|
agentBlock[mkResourceVirtualEnvironmentVMAgentEnabled].(bool),
|
||||||
)
|
)
|
||||||
agentTrim := types.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool))
|
agentTrim := types2.CustomBool(agentBlock[mkResourceVirtualEnvironmentVMAgentTrim].(bool))
|
||||||
agentType := agentBlock[mkResourceVirtualEnvironmentVMAgentType].(string)
|
agentType := agentBlock[mkResourceVirtualEnvironmentVMAgentType].(string)
|
||||||
|
|
||||||
updateBody.Agent = &vms.CustomAgent{
|
updateBody.Agent = &vms.CustomAgent{
|
||||||
@ -5151,7 +5151,7 @@ func vmUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.D
|
|||||||
cpuCores := cpuBlock[mkResourceVirtualEnvironmentVMCPUCores].(int)
|
cpuCores := cpuBlock[mkResourceVirtualEnvironmentVMCPUCores].(int)
|
||||||
cpuFlags := cpuBlock[mkResourceVirtualEnvironmentVMCPUFlags].([]interface{})
|
cpuFlags := cpuBlock[mkResourceVirtualEnvironmentVMCPUFlags].([]interface{})
|
||||||
cpuHotplugged := cpuBlock[mkResourceVirtualEnvironmentVMCPUHotplugged].(int)
|
cpuHotplugged := cpuBlock[mkResourceVirtualEnvironmentVMCPUHotplugged].(int)
|
||||||
cpuNUMA := types.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool))
|
cpuNUMA := types2.CustomBool(cpuBlock[mkResourceVirtualEnvironmentVMCPUNUMA].(bool))
|
||||||
cpuSockets := cpuBlock[mkResourceVirtualEnvironmentVMCPUSockets].(int)
|
cpuSockets := cpuBlock[mkResourceVirtualEnvironmentVMCPUSockets].(int)
|
||||||
cpuType := cpuBlock[mkResourceVirtualEnvironmentVMCPUType].(string)
|
cpuType := cpuBlock[mkResourceVirtualEnvironmentVMCPUType].(string)
|
||||||
cpuUnits := cpuBlock[mkResourceVirtualEnvironmentVMCPUUnits].(int)
|
cpuUnits := cpuBlock[mkResourceVirtualEnvironmentVMCPUUnits].(int)
|
||||||
@ -5568,7 +5568,7 @@ func vmUpdateDiskLocationAndSize(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if *oldDisk.ID != *diskNewEntries[prefix][oldKey].ID {
|
if *oldDisk.ID != *diskNewEntries[prefix][oldKey].ID {
|
||||||
deleteOriginalDisk := types.CustomBool(true)
|
deleteOriginalDisk := types2.CustomBool(true)
|
||||||
|
|
||||||
diskMoveBodies = append(
|
diskMoveBodies = append(
|
||||||
diskMoveBodies,
|
diskMoveBodies,
|
||||||
|
Loading…
Reference in New Issue
Block a user