Fix wrong path for secret get-session-key

This commit is contained in:
Kalle Carlbark 2021-11-27 23:31:44 +01:00
parent 47dc036112
commit 03799c289d
No known key found for this signature in database
17 changed files with 31 additions and 22 deletions

View File

@ -96,11 +96,10 @@ type Circuits struct {
UpstreamSpeed int `json:"upstream_speed"`
XconnectID string `json:"xconnect_id"`
} `json:"termination_z"`
Comments string `json:"comments"`
Tags []string `json:"tags"`
CustomFields struct {
} `json:"custom_fields"`
Created string `json:"created"`
LastUpdated time.Time `json:"last_updated"`
Comments string `json:"comments"`
Tags []string `json:"tags"`
CustomFields struct{} `json:"custom_fields"`
Created string `json:"created"`
LastUpdated time.Time `json:"last_updated"`
} `json:"results"`
}

View File

@ -114,7 +114,7 @@ type ClusterFilter struct {
Tag string `schema:"tag,omitempty"`
}
const clustersPath = "/virtualization/clusters"
const clustersPath = virtualizationPath + "/clusters"
// List clusters. ClusterFilter is used to list based on filter queries.
func (s *ClustersService) List(ctx context.Context, f *ClusterFilter) (*Clusters, error) {

View File

@ -43,7 +43,7 @@ type DeviceRoleFilter struct {
Q string `schema:"q,omitempty"`
}
const deviceRolesPath = "/dcim/device-roles"
const deviceRolesPath = dcimPath + "/device-roles"
// List deviceroles. DeviceRoleFilter is used to list based on filter queries.
func (s *DeviceRolesService) List(ctx context.Context, f *DeviceRoleFilter) (*DeviceRoles, error) {

View File

@ -70,7 +70,7 @@ type DeviceTypeFilter struct {
Tag string `schema:"tag,omitempty"`
}
const deviceTypesPath = "/dcim/device-types"
const deviceTypesPath = dcimPath + "/device-types"
// List device-types. DeviceTypeFilter is used to list based on filter queries.
func (s *DeviceTypesService) List(ctx context.Context, f *DeviceTypeFilter) (*DeviceTypes, error) {

View File

@ -310,7 +310,7 @@ type DeviceFilter struct {
Tag string `schema:"tag,omitempty"`
}
const devicesPath = "/dcim/devices"
const devicesPath = dcimPath + "/devices"
// List devices. DeviceFilter is used to list based on filter queries.
func (s *DevicesService) List(ctx context.Context, f *DeviceFilter) (*Devices, error) {

View File

@ -112,7 +112,7 @@ type InterfaceFilter struct {
VLAN string `schema:"vlan,omitempty"`
}
const interfacesPath = "/dcim/interfaces"
const interfacesPath = dcimPath + "/interfaces"
// List devices. DeviceFilter is used to list based on filter queries.
func (s *InterfacesService) List(ctx context.Context, f *InterfaceFilter) (*Interfaces, error) {

View File

@ -58,7 +58,7 @@ type InventoryItemFilter struct {
Device string `schema:"device"`
}
const inventoryItemsPath = "/dcim/inventory-items"
const inventoryItemsPath = dcimPath + "/inventory-items"
// List inventory-items. InventoryItemFilter is used to list based on filter queries.
func (s *InventoryItemsService) List(ctx context.Context, f *InventoryItemFilter) (*InventoryItems, error) {

View File

@ -105,6 +105,16 @@ type service struct {
client *Client
}
const (
circuitsPath = "/circuits"
dcimPath = "/dcim"
extrasPath = "/extras"
ipamPath = "/ipam"
tenancyPath = "/tenancy"
usersPath = "/users"
virtualizationPath = "/virtualization"
)
// NetBoxSessionKey sets the session key for secrets retrieval
type NetBoxSessionKey struct {
XSessionKey string `json:"session_key"`

View File

@ -126,7 +126,7 @@ type PrefixFilter struct {
Status string `schema:"status,omitempty"`
}
const prefixesPath = "/ipam/prefixes"
const prefixesPath = ipamPath + "/prefixes"
// List prefixes. PrefixFilter is used to list based on filter queries.
func (s *PrefixesService) List(ctx context.Context, f *PrefixFilter) (*Prefixes, error) {

View File

@ -52,7 +52,7 @@ type RearPortFilter struct {
Device string `schema:"device,omitempty"`
}
const rearPortsPath = "/dcim/rear-ports"
const rearPortsPath = dcimPath + "/rear-ports"
// List rearports. RearPortFilter is used to list based on filter queries.
func (s *RearPortsService) List(ctx context.Context, f *RearPortFilter) (*RearPorts, error) {

View File

@ -65,7 +65,7 @@ type SecretFilter struct {
Tag string `schema:"tag,omitempty"`
}
const secretsPath = "/secrets/secrets"
const secretsPath = "/secrets"
// List secrets. SecretsFilter is used to list based on filter queries.
func (s *SecretsService) List(ctx context.Context, f *SecretFilter) (*Secrets, error) {
@ -87,7 +87,7 @@ func (s *SecretsService) List(ctx context.Context, f *SecretFilter) (*Secrets, e
}
query = form.Encode()
req, err = s.client.newRequest(ctx, "GET", secretsPath, query, nil)
req, err = s.client.newRequest(ctx, "GET", secretsPath+"/secrets", query, nil)
if err != nil {
return &secrets, err
}

View File

@ -60,7 +60,7 @@ type SiteGroupFilter struct {
Tag string `schema:"tag,omitempty"`
}
const siteGroupsPath = "/dcim/site-groups"
const siteGroupsPath = dcimPath + "/site-groups"
// List sitegroups. SiteGroupFilter is used to list based on filter queries.
func (s *SiteGroupsService) List(ctx context.Context, f *SiteGroupFilter) (*SiteGroups, error) {

View File

@ -101,7 +101,7 @@ type SiteFilter struct {
Tag string `schema:"tag,omitempty"`
}
const sitesPath = "/dcim/sites"
const sitesPath = dcimPath + "/sites"
// List sites. SiteFilter is used to list based on filter queries.
func (s *SitesService) List(ctx context.Context, f *SiteFilter) (*Sites, error) {

View File

@ -75,7 +75,7 @@ type TenantFilter struct {
Tag string `schema:"tag,omitempty"`
}
const tenantsPath = "/tenancy/tenants"
const tenantsPath = tenancyPath + "/tenants"
// List tenants. TenantFilter is used to list based on filter queries.
func (s *TenantsService) List(ctx context.Context, f *TenantFilter) (*Tenants, error) {

View File

@ -85,7 +85,7 @@ type NewVirtualMachine struct {
LastUpdated time.Time `json:"last_updated"`
}
const virtualMachinesPath = "/virtualization/virtual-machines"
const virtualMachinesPath = virtualizationPath + "/virtual-machines"
// Create a virtual-machine
func (s *VirtualMachinesService) Create(ctx context.Context, c *NewVirtualMachine) error {

View File

@ -102,7 +102,7 @@ type VLANFilter struct {
Tag string `schema:"tag,omitempty"`
}
const vlansPath = "/ipam/vlans"
const vlansPath = ipamPath + "/vlans"
// List vlans. VLANFilter is used to list based on filter queries.
func (s *VLANsService) List(ctx context.Context, f *VLANFilter) (*VLANs, error) {

View File

@ -68,7 +68,7 @@ type VRFFilter struct {
Tag string `schema:"tag,omitempty"`
}
const vrfsPath = "/ipam/vrfs"
const vrfsPath = ipamPath + "/vrfs"
// List vrfs. VRFFilter is used to list based on filter queries.
func (s *VRFsService) List(ctx context.Context, f *VRFFilter) (*VRFs, error) {