diff --git a/virtual_machines.go b/virtual_machines.go index c2b4a83..2204bb5 100644 --- a/virtual_machines.go +++ b/virtual_machines.go @@ -77,25 +77,25 @@ type VirtualMachines struct { // NewVirtualMachine is used to create new VirtualizationVirtualMachines type NewVirtualMachine struct { - CustomFields struct{} `json:"custom_fields"` - Status string `json:"status"` - LocalContextData string `json:"local_context_data"` - Comments string `json:"comments"` - Name string `json:"name"` - Tags []struct { - Name string `json:"name"` - Slug string `json:"slug"` - Color string `json:"color"` - } `json:"tags"` - Platform int `json:"platform"` - PrimaryIP4 int `json:"primary_ip4"` - Vcpus int `json:"vcpus"` - Memory int `json:"memory"` - Disk int `json:"disk"` - Role int `json:"role"` - Cluster int `json:"cluster"` - Tenant int `json:"tenant"` - PrimaryIP6 int `json:"primary_ip6"` + CustomFields *struct{} `json:"custom_fields,omitempty"` + Status string `json:"status"` + LocalContextData string `json:"local_context_data,omitempty"` + Comments string `json:"comments,omitempty"` + Name string `json:"name"` + Tags *[]struct { + Name string `json:"name,omitempty"` + Slug string `json:"slug,omitempty"` + Color string `json:"color,omitempty"` + } `json:"tags,omitempty"` + Platform int `json:"platform,omitempty"` + PrimaryIP4 int `json:"primary_ip4,omitempty"` + VCPUs int `json:"vcpus,omitempty"` + Memory int `json:"memory,omitempty"` + Disk int `json:"disk,omitempty"` + Role int `json:"role,omitempty"` + Cluster int `json:"cluster,omitempty"` + Tenant int `json:"tenant,omitempty"` + PrimaryIP6 int `json:"primary_ip6,omitempty"` } // 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"` } -const virtualMachinesPath = virtualizationPath + "/virtual-machines" +const virtualMachinesPath = virtualizationPath + "/virtual-machines/" // List secrets. SecretsFilter is used to list based on filter queries. 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 encoder := schema.NewEncoder() - form := url.Values{} err = encoder.Encode(f, form) if err != nil {