GoMetaLint cleanup.
This commit is contained in:
parent
d7bf99be52
commit
8b437fcdbb
6 changed files with 34 additions and 26 deletions
|
@ -20,6 +20,7 @@ type NetBox struct {
|
|||
InsecureSkipVerify bool
|
||||
}
|
||||
|
||||
// NetBoxSessionKey sets the session key for secrets retrieval
|
||||
type NetBoxSessionKey struct {
|
||||
XSessionKey string `json:"session_key"`
|
||||
}
|
||||
|
@ -31,6 +32,7 @@ func (n *NetBox) New(root, token string, TLSSkipVerify bool) {
|
|||
n.InsecureSkipVerify = TLSSkipVerify
|
||||
}
|
||||
|
||||
// FetchSessionKey fetches sessionkey
|
||||
func (n *NetBox) FetchSessionKey(privatekey string) error {
|
||||
|
||||
form := url.Values{}
|
||||
|
|
|
@ -31,8 +31,8 @@ type DcimInterfacesCreate struct {
|
|||
Label string `json:"label,omitempty"`
|
||||
} `json:"cable,omitempty"`
|
||||
Mode int `json:"mode,omitempty"`
|
||||
UntaggedVlan int `json:"untagged_vlan,omitempty"`
|
||||
TaggedVlans []int `json:"tagged_vlans,omitempty"`
|
||||
UntaggedVLAN int `json:"untagged_vlan,omitempty"`
|
||||
TaggedVLANs []int `json:"tagged_vlans,omitempty"`
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -81,8 +81,8 @@ type DcimInterfacesList struct {
|
|||
ConnectionStatus interface{} `json:"connection_status,omitempty"`
|
||||
Cable interface{} `json:"cable,omitempty"`
|
||||
Mode interface{} `json:"mode,omitempty"`
|
||||
UntaggedVlan interface{} `json:"untagged_vlan,omitempty"`
|
||||
TaggedVlans []interface{} `json:"tagged_vlans,omitempty"`
|
||||
UntaggedVLAN interface{} `json:"untagged_vlan,omitempty"`
|
||||
TaggedVLANs []interface{} `json:"tagged_vlans,omitempty"`
|
||||
Tags []interface{} `json:"tags,omitempty"`
|
||||
CountIpaddresses int `json:"count_ipaddresses,omitempty"`
|
||||
} `json:"results,omitempty"`
|
||||
|
@ -110,8 +110,8 @@ type InterfaceFilter struct {
|
|||
LagID string `schema:"lag_id,omitempty"`
|
||||
MacAddress string `schema:"mac_address,omitempty"`
|
||||
Tag string `schema:"tag,omitempty"`
|
||||
VlanID string `schema:"vlan_id,omitempty"`
|
||||
Vlan string `schema:"vlan,omitempty"`
|
||||
VLANID string `schema:"vlan_id,omitempty"`
|
||||
VLAN string `schema:"vlan,omitempty"`
|
||||
}
|
||||
|
||||
// ListInterfaces returns Netbox dcim_interfaces_list
|
||||
|
|
|
@ -31,7 +31,7 @@ type IpamPrefixesCreate struct {
|
|||
} `json:"custom_fields"`
|
||||
}
|
||||
|
||||
// IpamPrefixList is used for the return value from NetBox API ipam_prefixes_list
|
||||
// IpamPrefixesList is used for the return value from NetBox API ipam_prefixes_list
|
||||
type IpamPrefixesList struct {
|
||||
Count int `json:"count"`
|
||||
Next string `json:"next"`
|
||||
|
@ -112,9 +112,9 @@ type PrefixFilter struct {
|
|||
WithinInclude string `schema:"within_include,omitempty"`
|
||||
Contains string `schema:"contains,omitempty"`
|
||||
MaskLength string `schema:"mask_length,omitempty"`
|
||||
VrfId string `schema:"vrf_id,omitempty"`
|
||||
VrfID string `schema:"vrf_id,omitempty"`
|
||||
Vrf string `schema:"vrf,omitempty"`
|
||||
RegionId string `schema:"region_id,omitempty"`
|
||||
RegionID string `schema:"region_id,omitempty"`
|
||||
Region string `schema:"region,omitempty"`
|
||||
SiteID string `schema:"site_id,omitempty"`
|
||||
Site string `schema:"site,omitempty"`
|
||||
|
@ -123,7 +123,7 @@ type PrefixFilter struct {
|
|||
Status string `schema:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ListVrfs returns Netbox ipam_prefixes_list
|
||||
// ListPrefixes returns Netbox ipam_prefixes_list
|
||||
func (n *NetBox) ListPrefixes(i *IpamPrefixesList, f *PrefixFilter) error {
|
||||
var encoder = schema.NewEncoder()
|
||||
|
||||
|
@ -174,7 +174,7 @@ func (n *NetBox) ListPrefixes(i *IpamPrefixesList, f *PrefixFilter) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// CreateVrfs creates interfaces via Netbox API ipam_prefixes_create
|
||||
// CreatePrefixes creates interfaces via Netbox API ipam_prefixes_create
|
||||
func (n *NetBox) CreatePrefixes(i *IpamPrefixesCreate) error {
|
||||
vrfData, err := json.Marshal(i)
|
||||
if err != nil {
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// SecretsList contains secrets
|
||||
type SecretsList struct {
|
||||
Count int `json:"count"`
|
||||
Next string `json:"next"`
|
||||
|
@ -44,6 +45,7 @@ type SecretsList struct {
|
|||
} `json:"results"`
|
||||
}
|
||||
|
||||
// SecretFilter is used to filter out secrets
|
||||
type SecretFilter struct {
|
||||
Offset int64 `schema:"offset,omitempty"`
|
||||
Limit int64 `schema:"limit,omitempty"`
|
||||
|
@ -60,7 +62,7 @@ type SecretFilter struct {
|
|||
Tag string `schema:"tag,omitempty"`
|
||||
}
|
||||
|
||||
// ListVirtualizationClusters returns Netbox virtualization_clusters
|
||||
// ListSecrets returns Netbox Secrets
|
||||
func (n *NetBox) ListSecrets(i *SecretsList, f *SecretFilter) error {
|
||||
var encoder = schema.NewEncoder()
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
//VirtualizationVirtualMachinesCreate is used to create new VirtualizationVirtualMachines
|
||||
type VirtualizationVirtualMachinesCreate struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
|
@ -91,6 +92,7 @@ type VirtualizationVirtualMachinesCreate struct {
|
|||
LastUpdated time.Time `json:"last_updated"`
|
||||
}
|
||||
|
||||
//VirtualizationClustersCreate is used to create new VirtualizationClusters
|
||||
type VirtualizationClustersCreate struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
|
@ -124,6 +126,7 @@ type VirtualizationClustersCreate struct {
|
|||
VirtualmachineCount int `json:"virtualmachine_count"`
|
||||
}
|
||||
|
||||
// VirtualizationClustersList is used to list VirtualizationClusters
|
||||
type VirtualizationClustersList struct {
|
||||
Count int `json:"count"`
|
||||
Next string `json:"next"`
|
||||
|
@ -162,6 +165,7 @@ type VirtualizationClustersList struct {
|
|||
} `json:"results"`
|
||||
}
|
||||
|
||||
// ClusterFilter is used to filter out VirtualizationClusters
|
||||
type ClusterFilter struct {
|
||||
Offset int64 `schema:"offset,omitempty"`
|
||||
Limit int64 `schema:"limit,omitempty"`
|
||||
|
@ -180,7 +184,7 @@ type ClusterFilter struct {
|
|||
Tag string `schema:"tag,omitempty"`
|
||||
}
|
||||
|
||||
// ListVirtualizationClusters returns Netbox virtualization_clusters
|
||||
// ListClusters returns Netbox virtualization_clusters
|
||||
func (n *NetBox) ListClusters(i *VirtualizationClustersList, f *ClusterFilter) error {
|
||||
var encoder = schema.NewEncoder()
|
||||
|
||||
|
@ -231,7 +235,7 @@ func (n *NetBox) ListClusters(i *VirtualizationClustersList, f *ClusterFilter) e
|
|||
return nil
|
||||
}
|
||||
|
||||
// CreateInterfaces creates interfaces via Netbox API dcim_interfaces_create
|
||||
// CreateVirtualMachine creates VirtualMachines via Netbox API dcim_interfaces_create
|
||||
func (n *NetBox) CreateVirtualMachine(v *VirtualizationClustersCreate) error {
|
||||
data, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
|
|
|
@ -15,8 +15,8 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// IpamVlansCreate is used for the return values from Netbox API ipam_vlans_create
|
||||
type IpamVlansCreate struct {
|
||||
// IpamVLANsCreate is used for the return values from Netbox API ipam_vlans_create
|
||||
type IpamVLANsCreate struct {
|
||||
Site int `json:"site"`
|
||||
Group int `json:"group"`
|
||||
Vid int `json:"vid"`
|
||||
|
@ -30,8 +30,8 @@ type IpamVlansCreate struct {
|
|||
} `json:"custom_fields"`
|
||||
}
|
||||
|
||||
// IpamVlanList is used for the return value from NetBox API ipam_vlans_list
|
||||
type IpamVlansList struct {
|
||||
// IpamVLANsList is used for the return value from NetBox API ipam_vlans_list
|
||||
type IpamVLANsList struct {
|
||||
Count int `json:"count"`
|
||||
Next string `json:"next"`
|
||||
Previous string `json:"previous"`
|
||||
|
@ -48,7 +48,7 @@ type IpamVlansList struct {
|
|||
URL string `json:"url"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
VlanCount int `json:"vlan_count"`
|
||||
VLANCount int `json:"vlan_count"`
|
||||
} `json:"group"`
|
||||
Vid int `json:"vid"`
|
||||
Name string `json:"name"`
|
||||
|
@ -68,7 +68,7 @@ type IpamVlansList struct {
|
|||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
PrefixCount int `json:"prefix_count"`
|
||||
VlanCount int `json:"vlan_count"`
|
||||
VLANCount int `json:"vlan_count"`
|
||||
} `json:"role"`
|
||||
Description string `json:"description"`
|
||||
Tags []string `json:"tags"`
|
||||
|
@ -81,8 +81,8 @@ type IpamVlansList struct {
|
|||
} `json:"results"`
|
||||
}
|
||||
|
||||
// VlanFilter is used to filter out returned object from Netbox API ipam_vlans_list
|
||||
type VlanFilter struct {
|
||||
// VLANFilter is used to filter out returned object from Netbox API ipam_vlans_list
|
||||
type VLANFilter struct {
|
||||
Offset int64 `schema:"offset,omitempty"`
|
||||
Limit int64 `schema:"limit,omitempty"`
|
||||
|
||||
|
@ -105,8 +105,8 @@ type VlanFilter struct {
|
|||
Tag string `schema:"tag,omitempty"`
|
||||
}
|
||||
|
||||
// ListVlans returns Netbox ipam_vlans_list
|
||||
func (n *NetBox) ListVlans(i *IpamVlansList, f *VlanFilter) error {
|
||||
// ListVLANs returns Netbox ipam_vlans_list
|
||||
func (n *NetBox) ListVLANs(i *IpamVLANsList, f *VLANFilter) error {
|
||||
var encoder = schema.NewEncoder()
|
||||
|
||||
form := url.Values{}
|
||||
|
@ -156,8 +156,8 @@ func (n *NetBox) ListVlans(i *IpamVlansList, f *VlanFilter) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// CreateVlans creates interfaces via Netbox API ipam_vlans_create
|
||||
func (n *NetBox) CreateVlans(i *IpamVlansCreate) error {
|
||||
// CreateVLANs creates interfaces via Netbox API ipam_vlans_create
|
||||
func (n *NetBox) CreateVLANs(i *IpamVLANsCreate) error {
|
||||
vrfData, err := json.Marshal(i)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue