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