changed NetBoxAPI struct to directly import NetBoxAPI client
This commit is contained in:
parent
b314297c97
commit
cb4e104962
12
client.go
12
client.go
@ -11,9 +11,9 @@ import (
|
||||
|
||||
// NetBoxAPI is the type we use to add custom functions
|
||||
type NetBoxAPI struct {
|
||||
API client.NetBoxAPI
|
||||
Token string
|
||||
URL string
|
||||
client.NetBoxAPI // API of NetBox
|
||||
Token string // Token used to access the NetBox API
|
||||
URL string // URL of this NetBox instance
|
||||
}
|
||||
|
||||
// NewNetBoxClient returns a client to NetBox at the given url,
|
||||
@ -32,9 +32,9 @@ func NewNetBoxClient(token string, url string) NetBoxAPI {
|
||||
|
||||
// create a new variable for our custom functions
|
||||
nb := NetBoxAPI{
|
||||
API: *n,
|
||||
Token: token,
|
||||
URL: url,
|
||||
NetBoxAPI: *n,
|
||||
Token: token,
|
||||
URL: url,
|
||||
}
|
||||
return nb
|
||||
}
|
||||
|
2
dcim.go
2
dcim.go
@ -28,7 +28,7 @@ func (nb NetBoxAPI) GetDevices(param dcim.DcimDevicesListParams) ([]*models.Devi
|
||||
}
|
||||
|
||||
// get devices
|
||||
devices, err := nb.API.Dcim.DcimDevicesList(¶m, nil)
|
||||
devices, err := nb.Dcim.DcimDevicesList(¶m, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
4
ipam.go
4
ipam.go
@ -28,7 +28,7 @@ func (nb NetBoxAPI) GetPrefixes(param ipam.IpamPrefixesListParams) ([]*models.Pr
|
||||
}
|
||||
|
||||
// get prefixes
|
||||
prefixes, err := nb.API.Ipam.IpamPrefixesList(¶m, nil)
|
||||
prefixes, err := nb.Ipam.IpamPrefixesList(¶m, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -81,7 +81,7 @@ func (nb NetBoxAPI) GetIPAddresses(param ipam.IpamIPAddressesListParams) ([]*mod
|
||||
}
|
||||
|
||||
// get addresses
|
||||
addresses, err := nb.API.Ipam.IpamIPAddressesList(¶m, nil)
|
||||
addresses, err := nb.Ipam.IpamIPAddressesList(¶m, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ func (nb NetBoxAPI) GetClusters(param virtualization.VirtualizationClustersListP
|
||||
}
|
||||
|
||||
// get clusters
|
||||
clusters, err := nb.API.Virtualization.VirtualizationClustersList(¶m, nil)
|
||||
clusters, err := nb.Virtualization.VirtualizationClustersList(¶m, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -80,7 +80,7 @@ func (nb NetBoxAPI) GetClusterGroups(param virtualization.VirtualizationClusterG
|
||||
}
|
||||
|
||||
// get clusterGroups
|
||||
clusterGroups, err := nb.API.Virtualization.VirtualizationClusterGroupsList(¶m, nil)
|
||||
clusterGroups, err := nb.Virtualization.VirtualizationClusterGroupsList(¶m, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user