Add Device to its own type
This commit is contained in:
parent
3eb210c9e5
commit
8383ef9bb9
1 changed files with 145 additions and 143 deletions
|
@ -17,158 +17,160 @@ import (
|
||||||
|
|
||||||
// DcimDevicesList is used for Netbox dcim_device_list return struct
|
// DcimDevicesList is used for Netbox dcim_device_list return struct
|
||||||
type DcimDevicesList struct {
|
type DcimDevicesList 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"`
|
||||||
Results []struct {
|
Results []Device `json:"results"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Device struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
DeviceType struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Manufacturer struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
DevicetypeCount int `json:"devicetype_count"`
|
||||||
|
} `json:"manufacturer"`
|
||||||
|
Model string `json:"model"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
DisplayName string `json:"display_name"`
|
||||||
|
DeviceCount int `json:"device_count"`
|
||||||
|
} `json:"device_type"`
|
||||||
|
DeviceRole struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
DeviceCount int `json:"device_count"`
|
||||||
|
VirtualmachineCount int `json:"virtualmachine_count"`
|
||||||
|
} `json:"device_role"`
|
||||||
|
Tenant struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
} `json:"tenant"`
|
||||||
|
Platform struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
DeviceCount int `json:"device_count"`
|
||||||
|
VirtualmachineCount int `json:"virtualmachine_count"`
|
||||||
|
} `json:"platform"`
|
||||||
|
Serial string `json:"serial"`
|
||||||
|
AssetTag string `json:"asset_tag"`
|
||||||
|
Site struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
} `json:"site"`
|
||||||
|
Rack struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
|
URL string `json:"url"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
DisplayName string `json:"display_name"`
|
DisplayName string `json:"display_name"`
|
||||||
DeviceType struct {
|
DeviceCount int `json:"device_count"`
|
||||||
ID int `json:"id"`
|
} `json:"rack"`
|
||||||
URL string `json:"url"`
|
Position int `json:"position"`
|
||||||
Manufacturer struct {
|
Face struct {
|
||||||
ID int `json:"id"`
|
Label string `json:"label"`
|
||||||
URL string `json:"url"`
|
Value string `json:"value"`
|
||||||
Name string `json:"name"`
|
} `json:"face"`
|
||||||
Slug string `json:"slug"`
|
ParentDevice struct {
|
||||||
DevicetypeCount int `json:"devicetype_count"`
|
ID int `json:"id"`
|
||||||
} `json:"manufacturer"`
|
URL string `json:"url"`
|
||||||
Model string `json:"model"`
|
Name string `json:"name"`
|
||||||
Slug string `json:"slug"`
|
DisplayName string `json:"display_name"`
|
||||||
DisplayName string `json:"display_name"`
|
} `json:"parent_device"`
|
||||||
DeviceCount int `json:"device_count"`
|
Status struct {
|
||||||
} `json:"device_type"`
|
Label string `json:"label"`
|
||||||
DeviceRole struct {
|
Value string `json:"value"`
|
||||||
ID int `json:"id"`
|
} `json:"status"`
|
||||||
URL string `json:"url"`
|
PrimaryIP struct {
|
||||||
Name string `json:"name"`
|
ID int `json:"id"`
|
||||||
Slug string `json:"slug"`
|
URL string `json:"url"`
|
||||||
DeviceCount int `json:"device_count"`
|
Family int `json:"family"`
|
||||||
VirtualmachineCount int `json:"virtualmachine_count"`
|
Address string `json:"address"`
|
||||||
} `json:"device_role"`
|
} `json:"primary_ip"`
|
||||||
Tenant struct {
|
PrimaryIP4 struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Name string `json:"name"`
|
Family int `json:"family"`
|
||||||
Slug string `json:"slug"`
|
Address string `json:"address"`
|
||||||
} `json:"tenant"`
|
} `json:"primary_ip4"`
|
||||||
Platform struct {
|
PrimaryIP6 struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Name string `json:"name"`
|
Family int `json:"family"`
|
||||||
Slug string `json:"slug"`
|
Address string `json:"address"`
|
||||||
DeviceCount int `json:"device_count"`
|
} `json:"primary_ip6"`
|
||||||
VirtualmachineCount int `json:"virtualmachine_count"`
|
Cluster struct {
|
||||||
} `json:"platform"`
|
ID int `json:"id"`
|
||||||
Serial string `json:"serial"`
|
URL string `json:"url"`
|
||||||
AssetTag string `json:"asset_tag"`
|
Name string `json:"name"`
|
||||||
Site struct {
|
VirtualmachineCount int `json:"virtualmachine_count"`
|
||||||
ID int `json:"id"`
|
} `json:"cluster"`
|
||||||
URL string `json:"url"`
|
VirtualChassis struct {
|
||||||
Name string `json:"name"`
|
ID int `json:"id"`
|
||||||
Slug string `json:"slug"`
|
URL string `json:"url"`
|
||||||
} `json:"site"`
|
Master struct {
|
||||||
Rack struct {
|
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
DisplayName string `json:"display_name"`
|
DisplayName string `json:"display_name"`
|
||||||
DeviceCount int `json:"device_count"`
|
} `json:"master"`
|
||||||
} `json:"rack"`
|
MemberCount int `json:"member_count"`
|
||||||
Position int `json:"position"`
|
} `json:"virtual_chassis"`
|
||||||
Face struct {
|
VcPosition int `json:"vc_position"`
|
||||||
|
VcPriority int `json:"vc_priority"`
|
||||||
|
Comments string `json:"comments"`
|
||||||
|
// LocalContextData string `json:"local_context_data"`
|
||||||
|
Tags []struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
Color string `json:"color"`
|
||||||
|
} `json:"tags"`
|
||||||
|
CustomFields struct {
|
||||||
|
DcimDeviceBelongsToService struct {
|
||||||
|
Value int `json:"value"`
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
Value string `json:"value"`
|
} `json:"dcim_device_belongs_to_service"`
|
||||||
} `json:"face"`
|
DcimDeviceCendotid string `json:"dcim_device_cendotid"`
|
||||||
ParentDevice struct {
|
DcimDeviceExposedToInternet struct {
|
||||||
ID int `json:"id"`
|
Value int `json:"value"`
|
||||||
URL string `json:"url"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
DisplayName string `json:"display_name"`
|
|
||||||
} `json:"parent_device"`
|
|
||||||
Status struct {
|
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
Value string `json:"value"`
|
} `json:"dcim_device_exposed_to_internet"`
|
||||||
} `json:"status"`
|
DcimDeviceImportOsVersion bool `json:"dcim_device_import_os_version"`
|
||||||
PrimaryIP struct {
|
DcimDeviceOsVersion interface{} `json:"dcim_device_os_version"`
|
||||||
ID int `json:"id"`
|
DcimDevicesImportInterfaces interface{} `json:"dcim_devices_import_interfaces"`
|
||||||
URL string `json:"url"`
|
DcimDeviceImportvlan bool `json:"dcim_device_importvlan"`
|
||||||
Family int `json:"family"`
|
DcimDeviceL2Domain interface{} `json:"dcim_device_l2domain"`
|
||||||
Address string `json:"address"`
|
DcimDeviceCountTrunkVlans interface{} `json:"dcim_device_count_trunk_vlans"`
|
||||||
} `json:"primary_ip"`
|
DcimDeviceLogicalportsDeviceLimit interface{} `json:"dcim_device_logicalports_device_limit"`
|
||||||
PrimaryIP4 struct {
|
DcimDeviceLogicalportsActiveNum interface{} `json:"dcim_device_logicalports_active_num"`
|
||||||
ID int `json:"id"`
|
DcimDeviceLogicalportsConfiguredNum interface{} `json:"dcim_device_logicalports_configured_num"`
|
||||||
URL string `json:"url"`
|
DcimDeviceCountTimesLastRun interface{} `json:"dcim_device_count_times_last_run"`
|
||||||
Family int `json:"family"`
|
DcimDeviceImportVrfs interface{} `json:"dcim_device_import_vrfs"`
|
||||||
Address string `json:"address"`
|
DcimDeviceVrfTag interface{} `json:"dcim_device_vrf_tag"`
|
||||||
} `json:"primary_ip4"`
|
DcimDevicePod interface{} `json:"dcim_device_pod"`
|
||||||
PrimaryIP6 struct {
|
} `json:"custom_fields"`
|
||||||
ID int `json:"id"`
|
ConfigContext struct {
|
||||||
URL string `json:"url"`
|
AdditionalProp1 string `json:"additionalProp1"`
|
||||||
Family int `json:"family"`
|
AdditionalProp2 string `json:"additionalProp2"`
|
||||||
Address string `json:"address"`
|
AdditionalProp3 string `json:"additionalProp3"`
|
||||||
} `json:"primary_ip6"`
|
} `json:"config_context"`
|
||||||
Cluster struct {
|
Created string `json:"created"`
|
||||||
ID int `json:"id"`
|
LastUpdated time.Time `json:"last_updated"`
|
||||||
URL string `json:"url"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
VirtualmachineCount int `json:"virtualmachine_count"`
|
|
||||||
} `json:"cluster"`
|
|
||||||
VirtualChassis struct {
|
|
||||||
ID int `json:"id"`
|
|
||||||
URL string `json:"url"`
|
|
||||||
Master struct {
|
|
||||||
ID int `json:"id"`
|
|
||||||
URL string `json:"url"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
DisplayName string `json:"display_name"`
|
|
||||||
} `json:"master"`
|
|
||||||
MemberCount int `json:"member_count"`
|
|
||||||
} `json:"virtual_chassis"`
|
|
||||||
VcPosition int `json:"vc_position"`
|
|
||||||
VcPriority int `json:"vc_priority"`
|
|
||||||
Comments string `json:"comments"`
|
|
||||||
// LocalContextData string `json:"local_context_data"`
|
|
||||||
Tags []struct {
|
|
||||||
ID int `json:"id"`
|
|
||||||
URL string `json:"url"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Slug string `json:"slug"`
|
|
||||||
Color string `json:"color"`
|
|
||||||
} `json:"tags"`
|
|
||||||
CustomFields struct {
|
|
||||||
DcimDeviceBelongsToService struct {
|
|
||||||
Value int `json:"value"`
|
|
||||||
Label string `json:"label"`
|
|
||||||
} `json:"dcim_device_belongs_to_service"`
|
|
||||||
DcimDeviceCendotid string `json:"dcim_device_cendotid"`
|
|
||||||
DcimDeviceExposedToInternet struct {
|
|
||||||
Value int `json:"value"`
|
|
||||||
Label string `json:"label"`
|
|
||||||
} `json:"dcim_device_exposed_to_internet"`
|
|
||||||
DcimDeviceImportOsVersion bool `json:"dcim_device_import_os_version"`
|
|
||||||
DcimDeviceOsVersion interface{} `json:"dcim_device_os_version"`
|
|
||||||
DcimDevicesImportInterfaces interface{} `json:"dcim_devices_import_interfaces"`
|
|
||||||
DcimDeviceImportvlan bool `json:"dcim_device_importvlan"`
|
|
||||||
DcimDeviceL2Domain interface{} `json:"dcim_device_l2domain"`
|
|
||||||
DcimDeviceCountTrunkVlans interface{} `json:"dcim_device_count_trunk_vlans"`
|
|
||||||
DcimDeviceLogicalportsDeviceLimit interface{} `json:"dcim_device_logicalports_device_limit"`
|
|
||||||
DcimDeviceLogicalportsActiveNum interface{} `json:"dcim_device_logicalports_active_num"`
|
|
||||||
DcimDeviceLogicalportsConfiguredNum interface{} `json:"dcim_device_logicalports_configured_num"`
|
|
||||||
DcimDeviceCountTimesLastRun interface{} `json:"dcim_device_count_times_last_run"`
|
|
||||||
DcimDeviceImportVrfs interface{} `json:"dcim_device_import_vrfs"`
|
|
||||||
DcimDeviceVrfTag interface{} `json:"dcim_device_vrf_tag"`
|
|
||||||
DcimDevicePod interface{} `json:"dcim_device_pod"`
|
|
||||||
} `json:"custom_fields"`
|
|
||||||
ConfigContext struct {
|
|
||||||
AdditionalProp1 string `json:"additionalProp1"`
|
|
||||||
AdditionalProp2 string `json:"additionalProp2"`
|
|
||||||
AdditionalProp3 string `json:"additionalProp3"`
|
|
||||||
} `json:"config_context"`
|
|
||||||
Created string `json:"created"`
|
|
||||||
LastUpdated time.Time `json:"last_updated"`
|
|
||||||
} `json:"results"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type DcimCreateDevice struct {
|
type DcimCreateDevice struct {
|
||||||
|
|
Loading…
Reference in a new issue