Omit empty fields on NewVirtualMachine
This commit is contained in:
parent
e6298e598a
commit
e47de1a498
1 changed files with 20 additions and 21 deletions
|
@ -77,25 +77,25 @@ type VirtualMachines struct {
|
||||||
|
|
||||||
// NewVirtualMachine is used to create new VirtualizationVirtualMachines
|
// NewVirtualMachine is used to create new VirtualizationVirtualMachines
|
||||||
type NewVirtualMachine struct {
|
type NewVirtualMachine struct {
|
||||||
CustomFields struct{} `json:"custom_fields"`
|
CustomFields *struct{} `json:"custom_fields,omitempty"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
LocalContextData string `json:"local_context_data"`
|
LocalContextData string `json:"local_context_data,omitempty"`
|
||||||
Comments string `json:"comments"`
|
Comments string `json:"comments,omitempty"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Tags []struct {
|
Tags *[]struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name,omitempty"`
|
||||||
Slug string `json:"slug"`
|
Slug string `json:"slug,omitempty"`
|
||||||
Color string `json:"color"`
|
Color string `json:"color,omitempty"`
|
||||||
} `json:"tags"`
|
} `json:"tags,omitempty"`
|
||||||
Platform int `json:"platform"`
|
Platform int `json:"platform,omitempty"`
|
||||||
PrimaryIP4 int `json:"primary_ip4"`
|
PrimaryIP4 int `json:"primary_ip4,omitempty"`
|
||||||
Vcpus int `json:"vcpus"`
|
VCPUs int `json:"vcpus,omitempty"`
|
||||||
Memory int `json:"memory"`
|
Memory int `json:"memory,omitempty"`
|
||||||
Disk int `json:"disk"`
|
Disk int `json:"disk,omitempty"`
|
||||||
Role int `json:"role"`
|
Role int `json:"role,omitempty"`
|
||||||
Cluster int `json:"cluster"`
|
Cluster int `json:"cluster,omitempty"`
|
||||||
Tenant int `json:"tenant"`
|
Tenant int `json:"tenant,omitempty"`
|
||||||
PrimaryIP6 int `json:"primary_ip6"`
|
PrimaryIP6 int `json:"primary_ip6,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// VirtualMachineFilter is used to filter dcim_device_list query to the Netbox API
|
// VirtualMachineFilter is used to filter dcim_device_list query to the Netbox API
|
||||||
|
@ -146,7 +146,7 @@ type VirtualMachineFilter struct {
|
||||||
Limit int `schema:"limit,omitempty"`
|
Limit int `schema:"limit,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
const virtualMachinesPath = virtualizationPath + "/virtual-machines"
|
const virtualMachinesPath = virtualizationPath + "/virtual-machines/"
|
||||||
|
|
||||||
// List secrets. SecretsFilter is used to list based on filter queries.
|
// List secrets. SecretsFilter is used to list based on filter queries.
|
||||||
func (s *VirtualMachinesService) List(ctx context.Context, f *VirtualMachineFilter) (*VirtualMachines, error) {
|
func (s *VirtualMachinesService) List(ctx context.Context, f *VirtualMachineFilter) (*VirtualMachines, error) {
|
||||||
|
@ -156,7 +156,6 @@ func (s *VirtualMachinesService) List(ctx context.Context, f *VirtualMachineFilt
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
encoder := schema.NewEncoder()
|
encoder := schema.NewEncoder()
|
||||||
|
|
||||||
form := url.Values{}
|
form := url.Values{}
|
||||||
err = encoder.Encode(f, form)
|
err = encoder.Encode(f, form)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue