App-Netdisco
view release on metacpan or search on metacpan
lib/App/Netdisco/Web/Plugin/Search/Device.pm view on Meta::CPAN
package App::Netdisco::Web::Plugin::Search::Device;
use Dancer ':syntax';
use Dancer::Plugin::DBIC;
use Dancer::Plugin::Auth::Extensible;
use List::MoreUtils ();
use App::Netdisco::Web::Plugin;
my @DEFAULT_FIELDS = qw/ip dns name location model os_ver serial chassis_id/;
register_search_tab({
tag => 'device',
label => 'Device',
provides_csv => 1,
api_endpoint => 1,
api_parameters => [
q => {
description => 'Partial match of Device contact, serial, chassis ID, module serials, location, name, description, dns, or any IP alias. Optional if "limit" and "offset" are both given, to return all devices.',
},
name => {
description => 'Partial match of the Device name',
},
location => {
description => 'Partial match of the Device location',
},
dns => {
description => 'Partial match of any of the Device IP aliases',
},
ip => {
description => 'IP or IP Prefix within which the Device must have an interface address',
},
description => {
description => 'Partial match of the Device description',
},
mac => {
description => 'MAC Address of the Device or any of its Interfaces',
},
model => {
description => 'Exact match of the Device model',
},
os => {
description => 'Exact match of the Device operating system',
},
os_ver => {
description => 'Exact match of the Device operating system version',
},
vendor => {
description => 'Exact match of the Device vendor',
},
layers => {
description => 'OSI Layer which the device must support',
},
matchall => {
description => 'If true, all fields (except "q") must match the Device',
type => 'boolean',
default => 'false',
},
fields => {
description => 'Comma-separated list of fields to return. Default: ip,dns,name,location,model,os_ver,serial,chassis_id. Any Device table column is valid (e.g. vendor,os,layers,last_discover,last_macsuck,last_arpnip). Use "all" for every colum...
},
seeallcolumns => {
description => 'Deprecated, use fields=all instead. If true and "fields" is not given, all columns of the Device will be shown.',
type => 'boolean',
default => 'false',
},
limit => {
description => 'Maximum number of devices to return. Required, along with "offset", if neither "q" nor any filter parameter is given.',
},
offset => {
description => 'Number of devices to skip (for paging). Default: 0.',
},
],
});
# device with various properties or a default match-all
( run in 1.197 second using v1.01-cache-2.11-cpan-9789f410c06 )