| 1 | package Zenoss::Router::Device; | ||
| 2 | use strict; | ||
| 3 | |||
| 4 | use Moose::Role; | ||
| 5 | with 'Zenoss::Router::Tree', 'Zenoss::MetaHelper'; | ||
| 6 | requires '_router_request', '_check_args'; | ||
| 7 | __PACKAGE__->_INSTALL_META_METHODS; | ||
| 8 | |||
| 9 | #************************************************************************** | ||
| 10 | # Attributes | ||
| 11 | #************************************************************************** | ||
| 12 | has DEVICE_LOCATION => ( | ||
| 13 | is => 'ro', | ||
| 14 | isa => 'Str', | ||
| 15 | default => 'zport/dmd/device_router', | ||
| 16 | init_arg => undef, | ||
| 17 | ); | ||
| 18 | |||
| 19 | has DEVICE_ACTION => ( | ||
| 20 | is => 'ro', | ||
| 21 | isa => 'Str', | ||
| 22 | default => 'DeviceRouter', | ||
| 23 | init_arg => undef, | ||
| 24 | ); | ||
| 25 | |||
| 26 | #************************************************************************** | ||
| 27 | # Public Functions | ||
| 28 | #************************************************************************** | ||
| 29 | #====================================================================== | ||
| 30 | # device_addLocationNode | ||
| 31 | #====================================================================== | ||
| 32 | sub device_addLocationNode { | ||
| 33 | my ($self, $args) = @_; | ||
| 34 | $args = {} if !$args; | ||
| 35 | |||
| 36 | # Argument definition | ||
| 37 | my $definition = { | ||
| 38 | required => ['type', 'contextUid', 'id'], | ||
| 39 | }; | ||
| 40 | |||
| 41 | # Check the args | ||
| 42 | $self->_check_args($args, $definition); | ||
| 43 | |||
| 44 | # Route the request | ||
| 45 | $self->_router_request( | ||
| 46 | { | ||
| 47 | location => $self->DEVICE_LOCATION, | ||
| 48 | action => $self->DEVICE_ACTION, | ||
| 49 | method => 'addLocationNode', | ||
| 50 | data => [$args], | ||
| 51 | } | ||
| 52 | ); | ||
| 53 | } # END device_addLocationNode | ||
| 54 | |||
| 55 | #====================================================================== | ||
| 56 | # device_getTree | ||
| 57 | #====================================================================== | ||
| 58 | sub device_getTree { | ||
| 59 | my ($self, $args) = @_; | ||
| 60 | $args = {} if !$args; | ||
| 61 | |||
| 62 | # Argument definition | ||
| 63 | my $definition = { | ||
| 64 | required => ['id'], | ||
| 65 | }; | ||
| 66 | |||
| 67 | # Check the args | ||
| 68 | $self->_check_args($args, $definition); | ||
| 69 | |||
| 70 | # Route the request | ||
| 71 | $self->_router_request( | ||
| 72 | { | ||
| 73 | location => $self->DEVICE_LOCATION, | ||
| 74 | action => $self->DEVICE_ACTION, | ||
| 75 | method => 'getTree', | ||
| 76 | data => [$args], | ||
| 77 | } | ||
| 78 | ); | ||
| 79 | } # END device_getTree | ||
| 80 | |||
| 81 | #====================================================================== | ||
| 82 | # device_getComponents | ||
| 83 | #====================================================================== | ||
| 84 | sub device_getComponents { | ||
| 85 | my ($self, $args) = @_; | ||
| 86 | $args = {} if !$args; | ||
| 87 | |||
| 88 | # Argument definition | ||
| 89 | my $definition = { | ||
| 90 | defaults => { | ||
| 91 | start => 0, | ||
| 92 | limit => 50, | ||
| 93 | sort => 'name', | ||
| 94 | dir => 'ASC', | ||
| 95 | }, | ||
| 96 | required => ['uid'], | ||
| 97 | }; | ||
| 98 | |||
| 99 | # Check the args | ||
| 100 | $self->_check_args($args, $definition); | ||
| 101 | |||
| 102 | # Route the request | ||
| 103 | $self->_router_request( | ||
| 104 | { | ||
| 105 | location => $self->DEVICE_LOCATION, | ||
| 106 | action => $self->DEVICE_ACTION, | ||
| 107 | method => 'getComponents', | ||
| 108 | data => [$args], | ||
| 109 | } | ||
| 110 | ); | ||
| 111 | } # END device_getComponents | ||
| 112 | |||
| 113 | #====================================================================== | ||
| 114 | # device_getComponentTree | ||
| 115 | #====================================================================== | ||
| 116 | sub device_getComponentTree { | ||
| 117 | my ($self, $args) = @_; | ||
| 118 | $args = {} if !$args; | ||
| 119 | |||
| 120 | # Argument definition | ||
| 121 | my $definition = {}; | ||
| 122 | |||
| 123 | # Check the args | ||
| 124 | $self->_check_args($args, $definition); | ||
| 125 | |||
| 126 | # Route the request | ||
| 127 | $self->_router_request( | ||
| 128 | { | ||
| 129 | location => $self->DEVICE_LOCATION, | ||
| 130 | action => $self->DEVICE_ACTION, | ||
| 131 | method => 'getComponentTree', | ||
| 132 | data => [$args], | ||
| 133 | } | ||
| 134 | ); | ||
| 135 | } # END device_getComponentTree | ||
| 136 | |||
| 137 | #====================================================================== | ||
| 138 | # device_findComponentIndex | ||
| 139 | #====================================================================== | ||
| 140 | sub device_findComponentIndex { | ||
| 141 | my ($self, $args) = @_; | ||
| 142 | $args = {} if !$args; | ||
| 143 | |||
| 144 | # Argument definition | ||
| 145 | my $definition = { | ||
| 146 | defaults => { | ||
| 147 | sort => 'name', | ||
| 148 | dir => 'ASC', | ||
| 149 | }, | ||
| 150 | required => ['componentUid'], | ||
| 151 | }; | ||
| 152 | |||
| 153 | # Check the args | ||
| 154 | $self->_check_args($args, $definition); | ||
| 155 | |||
| 156 | # Route the request | ||
| 157 | $self->_router_request( | ||
| 158 | { | ||
| 159 | location => $self->DEVICE_LOCATION, | ||
| 160 | action => $self->DEVICE_ACTION, | ||
| 161 | method => 'findComponentIndex', | ||
| 162 | data => [$args], | ||
| 163 | } | ||
| 164 | ); | ||
| 165 | } # END device_findComponentIndex | ||
| 166 | |||
| 167 | #====================================================================== | ||
| 168 | # device_getForm | ||
| 169 | #====================================================================== | ||
| 170 | sub device_getForm { | ||
| 171 | my ($self, $args) = @_; | ||
| 172 | $args = {} if !$args; | ||
| 173 | |||
| 174 | # Argument definition | ||
| 175 | my $definition = { | ||
| 176 | required => ['uid'], | ||
| 177 | }; | ||
| 178 | |||
| 179 | # Check the args | ||
| 180 | $self->_check_args($args, $definition); | ||
| 181 | |||
| 182 | # Route the request | ||
| 183 | $self->_router_request( | ||
| 184 | { | ||
| 185 | location => $self->DEVICE_LOCATION, | ||
| 186 | action => $self->DEVICE_ACTION, | ||
| 187 | method => 'getForm', | ||
| 188 | data => [$args], | ||
| 189 | } | ||
| 190 | ); | ||
| 191 | } # END device_getForm | ||
| 192 | |||
| 193 | #====================================================================== | ||
| 194 | # device_getInfo | ||
| 195 | #====================================================================== | ||
| 196 | sub device_getInfo { | ||
| 197 | my ($self, $args) = @_; | ||
| 198 | $args = {} if !$args; | ||
| 199 | |||
| 200 | # Argument definition | ||
| 201 | my $definition = { | ||
| 202 | required => ['uid'], | ||
| 203 | }; | ||
| 204 | |||
| 205 | # Check the args | ||
| 206 | $self->_check_args($args, $definition); | ||
| 207 | |||
| 208 | # Route the request | ||
| 209 | $self->_router_request( | ||
| 210 | { | ||
| 211 | location => $self->DEVICE_LOCATION, | ||
| 212 | action => $self->DEVICE_ACTION, | ||
| 213 | method => 'getInfo', | ||
| 214 | data => [$args], | ||
| 215 | } | ||
| 216 | ); | ||
| 217 | } # END device_getInfo | ||
| 218 | |||
| 219 | #====================================================================== | ||
| 220 | # device_setInfo | ||
| 221 | #====================================================================== | ||
| 222 | sub device_setInfo { | ||
| 223 | my ($self, $args) = @_; | ||
| 224 | $args = {} if !$args; | ||
| 225 | |||
| 226 | # Argument definition | ||
| 227 | my $definition = { | ||
| 228 | required => ['uid'], | ||
| 229 | }; | ||
| 230 | |||
| 231 | # Check the args | ||
| 232 | $self->_check_args($args, $definition); | ||
| 233 | |||
| 234 | # Route the request | ||
| 235 | $self->_router_request( | ||
| 236 | { | ||
| 237 | location => $self->DEVICE_LOCATION, | ||
| 238 | action => $self->DEVICE_ACTION, | ||
| 239 | method => 'setInfo', | ||
| 240 | data => [$args], | ||
| 241 | } | ||
| 242 | ); | ||
| 243 | } # END device_setInfo | ||
| 244 | |||
| 245 | #====================================================================== | ||
| 246 | # device_setProductInfo | ||
| 247 | #====================================================================== | ||
| 248 | sub device_setProductInfo { | ||
| 249 | my ($self, $args) = @_; | ||
| 250 | $args = {} if !$args; | ||
| 251 | |||
| 252 | # Argument definition | ||
| 253 | my $definition = { | ||
| 254 | required => ['uid'], | ||
| 255 | }; | ||
| 256 | |||
| 257 | # Check the args | ||
| 258 | $self->_check_args($args, $definition); | ||
| 259 | |||
| 260 | # Route the request | ||
| 261 | $self->_router_request( | ||
| 262 | { | ||
| 263 | location => $self->DEVICE_LOCATION, | ||
| 264 | action => $self->DEVICE_ACTION, | ||
| 265 | method => 'setProductInfo', | ||
| 266 | data => [$args], | ||
| 267 | } | ||
| 268 | ); | ||
| 269 | } # END device_setProductInfo | ||
| 270 | |||
| 271 | #====================================================================== | ||
| 272 | # device_getDevices | ||
| 273 | #====================================================================== | ||
| 274 | sub device_getDevices { | ||
| 275 | my ($self, $args, $test) = @_; | ||
| 276 | $args = {} if !$args; | ||
| 277 | |||
| 278 | # Argument definition | ||
| 279 | my $definition = { | ||
| 280 | defaults => { | ||
| 281 | start => 0, | ||
| 282 | limit => 50, | ||
| 283 | sort => 'name', | ||
| 284 | dir => 'ASC', | ||
| 285 | } | ||
| 286 | }; | ||
| 287 | |||
| 288 | # Check the args | ||
| 289 | $self->_check_args($args, $definition); | ||
| 290 | |||
| 291 | # Route the request | ||
| 292 | $self->_router_request( | ||
| 293 | { | ||
| 294 | location => $self->DEVICE_LOCATION, | ||
| 295 | action => $self->DEVICE_ACTION, | ||
| 296 | method => 'getDevices', | ||
| 297 | data => [$args], | ||
| 298 | } | ||
| 299 | ); | ||
| 300 | } # END device_getDevices | ||
| 301 | |||
| 302 | #====================================================================== | ||
| 303 | # device_moveDevices | ||
| 304 | #====================================================================== | ||
| 305 | sub device_moveDevices { | ||
| 306 | my ($self, $args) = @_; | ||
| 307 | $args = {} if !$args; | ||
| 308 | |||
| 309 | # Argument definition | ||
| 310 | my $definition = { | ||
| 311 | defaults => { | ||
| 312 | sort => 'name', | ||
| 313 | dir => 'ASC', | ||
| 314 | }, | ||
| 315 | required => ['uids', 'target', 'hashcheck'], | ||
| 316 | }; | ||
| 317 | |||
| 318 | # Check the args | ||
| 319 | $self->_check_args($args, $definition); | ||
| 320 | |||
| 321 | # Route the request | ||
| 322 | $self->_router_request( | ||
| 323 | { | ||
| 324 | location => $self->DEVICE_LOCATION, | ||
| 325 | action => $self->DEVICE_ACTION, | ||
| 326 | method => 'moveDevices', | ||
| 327 | data => [$args], | ||
| 328 | } | ||
| 329 | ); | ||
| 330 | } # END device_moveDevices | ||
| 331 | |||
| 332 | #====================================================================== | ||
| 333 | # device_pushChanges | ||
| 334 | #====================================================================== | ||
| 335 | sub device_pushChanges { | ||
| 336 | my ($self, $args) = @_; | ||
| 337 | $args = {} if !$args; | ||
| 338 | |||
| 339 | # Argument definition | ||
| 340 | my $definition = { | ||
| 341 | defaults => { | ||
| 342 | sort => 'name', | ||
| 343 | dir => 'ASC', | ||
| 344 | }, | ||
| 345 | required => ['uids', 'hashcheck'], | ||
| 346 | }; | ||
| 347 | |||
| 348 | # Check the args | ||
| 349 | $self->_check_args($args, $definition); | ||
| 350 | |||
| 351 | # Route the request | ||
| 352 | $self->_router_request( | ||
| 353 | { | ||
| 354 | location => $self->DEVICE_LOCATION, | ||
| 355 | action => $self->DEVICE_ACTION, | ||
| 356 | method => 'pushChanges', | ||
| 357 | data => [$args], | ||
| 358 | } | ||
| 359 | ); | ||
| 360 | } # END device_pushChanges | ||
| 361 | |||
| 362 | |||
| 363 | #====================================================================== | ||
| 364 | # device_lockDevices | ||
| 365 | #====================================================================== | ||
| 366 | sub device_lockDevices { | ||
| 367 | my ($self, $args) = @_; | ||
| 368 | $args = {} if !$args; | ||
| 369 | |||
| 370 | # Argument definition | ||
| 371 | my $definition = { | ||
| 372 | defaults => { | ||
| 373 | updates => JSON::false, | ||
| 374 | deletion => JSON::false, | ||
| 375 | sendevent => JSON::false, | ||
| 376 | sort => 'name', | ||
| 377 | dir => 'ASC', | ||
| 378 | }, | ||
| 379 | required => ['uids', 'hashcheck'], | ||
| 380 | }; | ||
| 381 | |||
| 382 | # Check the args | ||
| 383 | $self->_check_args($args, $definition); | ||
| 384 | |||
| 385 | # Route the request | ||
| 386 | $self->_router_request( | ||
| 387 | { | ||
| 388 | location => $self->DEVICE_LOCATION, | ||
| 389 | action => $self->DEVICE_ACTION, | ||
| 390 | method => 'lockDevices', | ||
| 391 | data => [$args], | ||
| 392 | } | ||
| 393 | ); | ||
| 394 | } # END device_lockDevices | ||
| 395 | |||
| 396 | #====================================================================== | ||
| 397 | # device_resetIp | ||
| 398 | #====================================================================== | ||
| 399 | sub device_resetIp { | ||
| 400 | my ($self, $args) = @_; | ||
| 401 | $args = {} if !$args; | ||
| 402 | |||
| 403 | # Argument definition | ||
| 404 | my $definition = { | ||
| 405 | defaults => { | ||
| 406 | sort => 'name', | ||
| 407 | dir => 'ASC', | ||
| 408 | ip => '', | ||
| 409 | }, | ||
| 410 | required => ['uids', 'hashcheck'], | ||
| 411 | }; | ||
| 412 | |||
| 413 | # Check the args | ||
| 414 | $self->_check_args($args, $definition); | ||
| 415 | |||
| 416 | # Route the request | ||
| 417 | $self->_router_request( | ||
| 418 | { | ||
| 419 | location => $self->DEVICE_LOCATION, | ||
| 420 | action => $self->DEVICE_ACTION, | ||
| 421 | method => 'resetIp', | ||
| 422 | data => [$args], | ||
| 423 | } | ||
| 424 | ); | ||
| 425 | } # END device_resetIp | ||
| 426 | |||
| 427 | #====================================================================== | ||
| 428 | # device_resetCommunity | ||
| 429 | #====================================================================== | ||
| 430 | sub device_resetCommunity { | ||
| 431 | my ($self, $args) = @_; | ||
| 432 | $args = {} if !$args; | ||
| 433 | |||
| 434 | # Argument definition | ||
| 435 | my $definition = { | ||
| 436 | defaults => { | ||
| 437 | sort => 'name', | ||
| 438 | dir => 'ASC', | ||
| 439 | }, | ||
| 440 | required => ['uids', 'hashcheck'], | ||
| 441 | }; | ||
| 442 | |||
| 443 | # Check the args | ||
| 444 | $self->_check_args($args, $definition); | ||
| 445 | |||
| 446 | # Route the request | ||
| 447 | $self->_router_request( | ||
| 448 | { | ||
| 449 | location => $self->DEVICE_LOCATION, | ||
| 450 | action => $self->DEVICE_ACTION, | ||
| 451 | method => 'resetCommunity', | ||
| 452 | data => [$args], | ||
| 453 | } | ||
| 454 | ); | ||
| 455 | } # END device_resetCommunity | ||
| 456 | |||
| 457 | #====================================================================== | ||
| 458 | # device_setProductionState | ||
| 459 | #====================================================================== | ||
| 460 | sub device_setProductionState { | ||
| 461 | my ($self, $args) = @_; | ||
| 462 | $args = {} if !$args; | ||
| 463 | |||
| 464 | # Argument definition | ||
| 465 | my $definition = { | ||
| 466 | defaults => { | ||
| 467 | sort => 'name', | ||
| 468 | dir => 'ASC', | ||
| 469 | }, | ||
| 470 | required => ['uids', 'prodState', 'hashcheck'], | ||
| 471 | }; | ||
| 472 | |||
| 473 | # Check the args | ||
| 474 | $self->_check_args($args, $definition); | ||
| 475 | |||
| 476 | # Route the request | ||
| 477 | $self->_router_request( | ||
| 478 | { | ||
| 479 | location => $self->DEVICE_LOCATION, | ||
| 480 | action => $self->DEVICE_ACTION, | ||
| 481 | method => 'setProductionState', | ||
| 482 | data => [$args], | ||
| 483 | } | ||
| 484 | ); | ||
| 485 | } # END device_setProductionState | ||
| 486 | |||
| 487 | #====================================================================== | ||
| 488 | # device_setPriority | ||
| 489 | #====================================================================== | ||
| 490 | sub device_setPriority { | ||
| 491 | my ($self, $args) = @_; | ||
| 492 | $args = {} if !$args; | ||
| 493 | |||
| 494 | # Argument definition | ||
| 495 | my $definition = { | ||
| 496 | defaults => { | ||
| 497 | sort => 'name', | ||
| 498 | dir => 'ASC', | ||
| 499 | }, | ||
| 500 | required => ['uids', 'priority', 'hashcheck'], | ||
| 501 | }; | ||
| 502 | |||
| 503 | # Check the args | ||
| 504 | $self->_check_args($args, $definition); | ||
| 505 | |||
| 506 | # Route the request | ||
| 507 | $self->_router_request( | ||
| 508 | { | ||
| 509 | location => $self->DEVICE_LOCATION, | ||
| 510 | action => $self->DEVICE_ACTION, | ||
| 511 | method => 'device_setPriority', | ||
| 512 | data => [$args], | ||
| 513 | } | ||
| 514 | ); | ||
| 515 | } # END device_setPriority | ||
| 516 | |||
| 517 | #====================================================================== | ||
| 518 | # device_setCollector | ||
| 519 | #====================================================================== | ||
| 520 | sub device_setCollector { | ||
| 521 | my ($self, $args) = @_; | ||
| 522 | $args = {} if !$args; | ||
| 523 | |||
| 524 | # Argument definition | ||
| 525 | my $definition = { | ||
| 526 | defaults => { | ||
| 527 | sort => 'name', | ||
| 528 | dir => 'ASC', | ||
| 529 | }, | ||
| 530 | required => ['uids', 'collector', 'hashcheck'], | ||
| 531 | }; | ||
| 532 | |||
| 533 | # Check the args | ||
| 534 | $self->_check_args($args, $definition); | ||
| 535 | |||
| 536 | # Route the request | ||
| 537 | $self->_router_request( | ||
| 538 | { | ||
| 539 | location => $self->DEVICE_LOCATION, | ||
| 540 | action => $self->DEVICE_ACTION, | ||
| 541 | method => 'setCollector', | ||
| 542 | data => [$args], | ||
| 543 | } | ||
| 544 | ); | ||
| 545 | } # END device_setCollector | ||
| 546 | |||
| 547 | #====================================================================== | ||
| 548 | # device_setComponentsMonitored | ||
| 549 | #====================================================================== | ||
| 550 | sub device_setComponentsMonitored { | ||
| 551 | my ($self, $args) = @_; | ||
| 552 | $args = {} if !$args; | ||
| 553 | |||
| 554 | # Argument definition | ||
| 555 | my $definition = { | ||
| 556 | defaults => { | ||
| 557 | monitor => JSON::false, | ||
| 558 | start => 0, | ||
| 559 | limit => 50, | ||
| 560 | sort => 'name', | ||
| 561 | dir => 'ASC', | ||
| 562 | }, | ||
| 563 | required => ['uids', 'hashcheck'], | ||
| 564 | }; | ||
| 565 | |||
| 566 | # Check the args | ||
| 567 | $self->_check_args($args, $definition); | ||
| 568 | |||
| 569 | # Route the request | ||
| 570 | $self->_router_request( | ||
| 571 | { | ||
| 572 | location => $self->DEVICE_LOCATION, | ||
| 573 | action => $self->DEVICE_ACTION, | ||
| 574 | method => 'setComponentsMonitored', | ||
| 575 | data => [$args], | ||
| 576 | } | ||
| 577 | ); | ||
| 578 | } # END device_setComponentsMonitored | ||
| 579 | |||
| 580 | #====================================================================== | ||
| 581 | # device_lockComponents | ||
| 582 | #====================================================================== | ||
| 583 | sub device_lockComponents { | ||
| 584 | my ($self, $args) = @_; | ||
| 585 | $args = {} if !$args; | ||
| 586 | |||
| 587 | # Argument definition | ||
| 588 | my $definition = { | ||
| 589 | defaults => { | ||
| 590 | updates => JSON::false, | ||
| 591 | deletion => JSON::false, | ||
| 592 | sendEvent => JSON::false, | ||
| 593 | start => 0, | ||
| 594 | limit => 50, | ||
| 595 | sort => 'name', | ||
| 596 | dir => 'ASC', | ||
| 597 | }, | ||
| 598 | required => ['uids', 'hashcheck'], | ||
| 599 | }; | ||
| 600 | |||
| 601 | # Check the args | ||
| 602 | $self->_check_args($args, $definition); | ||
| 603 | |||
| 604 | # Route the request | ||
| 605 | $self->_router_request( | ||
| 606 | { | ||
| 607 | location => $self->DEVICE_LOCATION, | ||
| 608 | action => $self->DEVICE_ACTION, | ||
| 609 | method => 'lockComponents', | ||
| 610 | data => [$args], | ||
| 611 | } | ||
| 612 | ); | ||
| 613 | } # END device_lockComponents | ||
| 614 | |||
| 615 | #====================================================================== | ||
| 616 | # device_deleteComponents | ||
| 617 | #====================================================================== | ||
| 618 | sub device_deleteComponents { | ||
| 619 | my ($self, $args) = @_; | ||
| 620 | $args = {} if !$args; | ||
| 621 | |||
| 622 | # Argument definition | ||
| 623 | my $definition = { | ||
| 624 | defaults => { | ||
| 625 | start => 0, | ||
| 626 | limit => 50, | ||
| 627 | sort => 'name', | ||
| 628 | dir => 'ASC', | ||
| 629 | }, | ||
| 630 | required => ['uids', 'hashcheck'], | ||
| 631 | }; | ||
| 632 | |||
| 633 | # Check the args | ||
| 634 | $self->_check_args($args, $definition); | ||
| 635 | |||
| 636 | # Route the request | ||
| 637 | $self->_router_request( | ||
| 638 | { | ||
| 639 | location => $self->DEVICE_LOCATION, | ||
| 640 | action => $self->DEVICE_ACTION, | ||
| 641 | method => 'deleteComponents', | ||
| 642 | data => [$args], | ||
| 643 | } | ||
| 644 | ); | ||
| 645 | } # END device_deleteComponents | ||
| 646 | |||
| 647 | #====================================================================== | ||
| 648 | # device_removeDevices | ||
| 649 | #====================================================================== | ||
| 650 | sub device_removeDevices { | ||
| 651 | my ($self, $args) = @_; | ||
| 652 | $args = {} if !$args; | ||
| 653 | |||
| 654 | # Argument definition | ||
| 655 | my $definition = { | ||
| 656 | defaults => { | ||
| 657 | action => 'remove', | ||
| 658 | sort => 'name', | ||
| 659 | dir => 'ASC', | ||
| 660 | }, | ||
| 661 | required => ['uids', 'hashcheck'], | ||
| 662 | }; | ||
| 663 | |||
| 664 | # Check the args | ||
| 665 | $self->_check_args($args, $definition); | ||
| 666 | |||
| 667 | # Route the request | ||
| 668 | $self->_router_request( | ||
| 669 | { | ||
| 670 | location => $self->DEVICE_LOCATION, | ||
| 671 | action => $self->DEVICE_ACTION, | ||
| 672 | method => 'removeDevices', | ||
| 673 | data => [$args], | ||
| 674 | } | ||
| 675 | ); | ||
| 676 | } # END device_removeDevices | ||
| 677 | |||
| 678 | #====================================================================== | ||
| 679 | # device_getEvents | ||
| 680 | #====================================================================== | ||
| 681 | sub device_getEvents { | ||
| 682 | my ($self, $args) = @_; | ||
| 683 | $args = {} if !$args; | ||
| 684 | |||
| 685 | # Argument definition | ||
| 686 | my $definition = { | ||
| 687 | required => ['uid'], | ||
| 688 | }; | ||
| 689 | |||
| 690 | # Check the args | ||
| 691 | $self->_check_args($args, $definition); | ||
| 692 | |||
| 693 | # Route the request | ||
| 694 | $self->_router_request( | ||
| 695 | { | ||
| 696 | location => $self->DEVICE_LOCATION, | ||
| 697 | action => $self->DEVICE_ACTION, | ||
| 698 | method => 'getEvents', | ||
| 699 | data => [$args], | ||
| 700 | } | ||
| 701 | ); | ||
| 702 | } # END device_getEvents | ||
| 703 | |||
| 704 | #====================================================================== | ||
| 705 | # device_loadRanges | ||
| 706 | #====================================================================== | ||
| 707 | sub device_loadRanges { | ||
| 708 | my ($self, $args) = @_; | ||
| 709 | $args = {} if !$args; | ||
| 710 | |||
| 711 | # Argument definition | ||
| 712 | my $definition = { | ||
| 713 | defaults => { | ||
| 714 | sort => 'name', | ||
| 715 | dir => 'ASC', | ||
| 716 | }, | ||
| 717 | required => ['ranges', 'hashcheck'], | ||
| 718 | }; | ||
| 719 | |||
| 720 | # Check the args | ||
| 721 | $self->_check_args($args, $definition); | ||
| 722 | |||
| 723 | # Route the request | ||
| 724 | $self->_router_request( | ||
| 725 | { | ||
| 726 | location => $self->DEVICE_LOCATION, | ||
| 727 | action => $self->DEVICE_ACTION, | ||
| 728 | method => 'loadRanges', | ||
| 729 | data => [$args], | ||
| 730 | } | ||
| 731 | ); | ||
| 732 | } # END device_loadRanges | ||
| 733 | |||
| 734 | #====================================================================== | ||
| 735 | # device_loadComponentRanges | ||
| 736 | #====================================================================== | ||
| 737 | sub device_loadComponentRanges { | ||
| 738 | my ($self, $args) = @_; | ||
| 739 | $args = {} if !$args; | ||
| 740 | |||
| 741 | # Argument definition | ||
| 742 | my $definition = { | ||
| 743 | defaults => { | ||
| 744 | start => 0, | ||
| 745 | sort => 'name', | ||
| 746 | dir => 'ASC', | ||
| 747 | }, | ||
| 748 | required => ['ranges', 'hashcheck'], | ||
| 749 | }; | ||
| 750 | |||
| 751 | # Check the args | ||
| 752 | $self->_check_args($args, $definition); | ||
| 753 | |||
| 754 | # Route the request | ||
| 755 | $self->_router_request( | ||
| 756 | { | ||
| 757 | location => $self->DEVICE_LOCATION, | ||
| 758 | action => $self->DEVICE_ACTION, | ||
| 759 | method => 'loadComponentRanges', | ||
| 760 | data => [$args], | ||
| 761 | } | ||
| 762 | ); | ||
| 763 | } # END device_loadComponentRanges | ||
| 764 | |||
| 765 | #====================================================================== | ||
| 766 | # device_getUserCommands | ||
| 767 | #====================================================================== | ||
| 768 | sub device_getUserCommands { | ||
| 769 | my ($self, $args) = @_; | ||
| 770 | $args = {} if !$args; | ||
| 771 | |||
| 772 | # Argument definition | ||
| 773 | my $definition = { | ||
| 774 | required => ['uid'], | ||
| 775 | }; | ||
| 776 | |||
| 777 | # Check the args | ||
| 778 | $self->_check_args($args, $definition); | ||
| 779 | |||
| 780 | # Route the request | ||
| 781 | $self->_router_request( | ||
| 782 | { | ||
| 783 | location => $self->DEVICE_LOCATION, | ||
| 784 | action => $self->DEVICE_ACTION, | ||
| 785 | method => 'getUserCommands', | ||
| 786 | data => [$args], | ||
| 787 | } | ||
| 788 | ); | ||
| 789 | } # END device_getUserCommands | ||
| 790 | |||
| 791 | #====================================================================== | ||
| 792 | # device_getProductionStates | ||
| 793 | #====================================================================== | ||
| 794 | sub device_getProductionStates { | ||
| 795 | my ($self, $args) = @_; | ||
| 796 | $args = {} if !$args; | ||
| 797 | |||
| 798 | # Argument definition | ||
| 799 | my $definition = {}; | ||
| 800 | |||
| 801 | # Check the args | ||
| 802 | $self->_check_args($args, $definition); | ||
| 803 | |||
| 804 | # Route the request | ||
| 805 | $self->_router_request( | ||
| 806 | { | ||
| 807 | location => $self->DEVICE_LOCATION, | ||
| 808 | action => $self->DEVICE_ACTION, | ||
| 809 | method => 'getProductionStates', | ||
| 810 | data => [$args], | ||
| 811 | } | ||
| 812 | ); | ||
| 813 | } # END device_getProductionStates | ||
| 814 | |||
| 815 | #====================================================================== | ||
| 816 | # device_getPriorities | ||
| 817 | #====================================================================== | ||
| 818 | sub device_getPriorities { | ||
| 819 | my ($self, $args) = @_; | ||
| 820 | $args = {} if !$args; | ||
| 821 | |||
| 822 | # Argument definition | ||
| 823 | my $definition = {}; | ||
| 824 | |||
| 825 | # Check the args | ||
| 826 | $self->_check_args($args, $definition); | ||
| 827 | |||
| 828 | # Route the request | ||
| 829 | $self->_router_request( | ||
| 830 | { | ||
| 831 | location => $self->DEVICE_LOCATION, | ||
| 832 | action => $self->DEVICE_ACTION, | ||
| 833 | method => 'getPriorities', | ||
| 834 | data => [$args], | ||
| 835 | } | ||
| 836 | ); | ||
| 837 | } # END device_getPriorities | ||
| 838 | |||
| 839 | #====================================================================== | ||
| 840 | # device_getCollectors | ||
| 841 | #====================================================================== | ||
| 842 | sub device_getCollectors { | ||
| 843 | my ($self, $args) = @_; | ||
| 844 | $args = {} if !$args; | ||
| 845 | |||
| 846 | # Argument definition | ||
| 847 | my $definition = {}; | ||
| 848 | |||
| 849 | # Check the args | ||
| 850 | $self->_check_args($args, $definition); | ||
| 851 | |||
| 852 | # Route the request | ||
| 853 | $self->_router_request( | ||
| 854 | { | ||
| 855 | location => $self->DEVICE_LOCATION, | ||
| 856 | action => $self->DEVICE_ACTION, | ||
| 857 | method => 'getCollectors', | ||
| 858 | data => [$args], | ||
| 859 | } | ||
| 860 | ); | ||
| 861 | } # END device_getCollectors | ||
| 862 | |||
| 863 | #====================================================================== | ||
| 864 | # device_getDeviceClasses | ||
| 865 | #====================================================================== | ||
| 866 | sub device_getDeviceClasses { | ||
| 867 | my ($self, $args) = @_; | ||
| 868 | $args = {} if !$args; | ||
| 869 | |||
| 870 | # Argument definition | ||
| 871 | my $definition = {}; | ||
| 872 | |||
| 873 | # Check the args | ||
| 874 | $self->_check_args($args, $definition); | ||
| 875 | |||
| 876 | # Route the request | ||
| 877 | $self->_router_request( | ||
| 878 | { | ||
| 879 | location => $self->DEVICE_LOCATION, | ||
| 880 | action => $self->DEVICE_ACTION, | ||
| 881 | method => 'getDeviceClasses', | ||
| 882 | data => [$args], | ||
| 883 | } | ||
| 884 | ); | ||
| 885 | } # END device_getDeviceClasses | ||
| 886 | |||
| 887 | #====================================================================== | ||
| 888 | # device_getManufacturerNames | ||
| 889 | #====================================================================== | ||
| 890 | sub device_getManufacturerNames { | ||
| 891 | my ($self, $args) = @_; | ||
| 892 | $args = {} if !$args; | ||
| 893 | |||
| 894 | # Argument definition | ||
| 895 | my $definition = {}; | ||
| 896 | |||
| 897 | # Check the args | ||
| 898 | $self->_check_args($args, $definition); | ||
| 899 | |||
| 900 | # Route the request | ||
| 901 | $self->_router_request( | ||
| 902 | { | ||
| 903 | location => $self->DEVICE_LOCATION, | ||
| 904 | action => $self->DEVICE_ACTION, | ||
| 905 | method => 'getManufacturerNames', | ||
| 906 | data => [$args], | ||
| 907 | } | ||
| 908 | ); | ||
| 909 | } # END device_getManufacturerNames | ||
| 910 | |||
| 911 | #====================================================================== | ||
| 912 | # device_getHardwareProductNames | ||
| 913 | #====================================================================== | ||
| 914 | sub device_getHardwareProductNames { | ||
| 915 | my ($self, $args) = @_; | ||
| 916 | $args = {} if !$args; | ||
| 917 | |||
| 918 | # Argument definition | ||
| 919 | my $definition = { | ||
| 920 | defaults => { | ||
| 921 | manufacturer => '', | ||
| 922 | } | ||
| 923 | }; | ||
| 924 | |||
| 925 | # Check the args | ||
| 926 | $self->_check_args($args, $definition); | ||
| 927 | |||
| 928 | # Route the request | ||
| 929 | $self->_router_request( | ||
| 930 | { | ||
| 931 | location => $self->DEVICE_LOCATION, | ||
| 932 | action => $self->DEVICE_ACTION, | ||
| 933 | method => 'getHardwareProductNames', | ||
| 934 | data => [$args], | ||
| 935 | } | ||
| 936 | ); | ||
| 937 | } # END device_getHardwareProductNames | ||
| 938 | |||
| 939 | #====================================================================== | ||
| 940 | # device_getOSProductNames | ||
| 941 | #====================================================================== | ||
| 942 | sub device_getOSProductNames { | ||
| 943 | my ($self, $args) = @_; | ||
| 944 | $args = {} if !$args; | ||
| 945 | |||
| 946 | # Argument definition | ||
| 947 | my $definition = { | ||
| 948 | defaults => { | ||
| 949 | manufacturer => '', | ||
| 950 | } | ||
| 951 | }; | ||
| 952 | |||
| 953 | # Check the args | ||
| 954 | $self->_check_args($args, $definition); | ||
| 955 | |||
| 956 | # Route the request | ||
| 957 | $self->_router_request( | ||
| 958 | { | ||
| 959 | location => $self->DEVICE_LOCATION, | ||
| 960 | action => $self->DEVICE_ACTION, | ||
| 961 | method => 'getOSProductNames', | ||
| 962 | data => [$args], | ||
| 963 | } | ||
| 964 | ); | ||
| 965 | } # END device_getOSProductNames | ||
| 966 | |||
| 967 | #====================================================================== | ||
| 968 | # device_addDevice | ||
| 969 | #====================================================================== | ||
| 970 | sub device_addDevice { | ||
| 971 | my ($self, $args) = @_; | ||
| 972 | $args = {} if !$args; | ||
| 973 | |||
| 974 | # Argument definition | ||
| 975 | my $definition = { | ||
| 976 | defaults => { | ||
| 977 | snmpCommunity => '', | ||
| 978 | snmpPort => 161, | ||
| 979 | collector => 'localhost', | ||
| 980 | rackSlot => 0, | ||
| 981 | productionState => 1000, | ||
| 982 | comments => '', | ||
| 983 | hwManufacturer => '', | ||
| 984 | hwProductName => '', | ||
| 985 | osManufacturer => '', | ||
| 986 | osProductName => '', | ||
| 987 | priority => 3, | ||
| 988 | tag => '', | ||
| 989 | serialNumber => '', | ||
| 990 | }, | ||
| 991 | required => ['deviceName', 'deviceClass'] | ||
| 992 | }; | ||
| 993 | |||
| 994 | # Check the args | ||
| 995 | $self->_check_args($args, $definition); | ||
| 996 | |||
| 997 | # Route the request | ||
| 998 | $self->_router_request( | ||
| 999 | { | ||
| 1000 | location => $self->DEVICE_LOCATION, | ||
| 1001 | action => $self->DEVICE_ACTION, | ||
| 1002 | method => 'addDevice', | ||
| 1003 | data => [$args], | ||
| 1004 | } | ||
| 1005 | ); | ||
| 1006 | } # END device_addDevice | ||
| 1007 | |||
| 1008 | #====================================================================== | ||
| 1009 | # device_addLocalTemplate | ||
| 1010 | #====================================================================== | ||
| 1011 | sub device_addLocalTemplate { | ||
| 1012 | my ($self, $args) = @_; | ||
| 1013 | $args = {} if !$args; | ||
| 1014 | |||
| 1015 | # Argument definition | ||
| 1016 | my $definition = { | ||
| 1017 | required => ['deviceUid', 'templateId'], | ||
| 1018 | }; | ||
| 1019 | |||
| 1020 | # Check the args | ||
| 1021 | $self->_check_args($args, $definition); | ||
| 1022 | |||
| 1023 | # Route the request | ||
| 1024 | $self->_router_request( | ||
| 1025 | { | ||
| 1026 | location => $self->DEVICE_LOCATION, | ||
| 1027 | action => $self->DEVICE_ACTION, | ||
| 1028 | method => 'addLocalTemplate', | ||
| 1029 | data => [$args], | ||
| 1030 | } | ||
| 1031 | ); | ||
| 1032 | } # END device_addLocalTemplate | ||
| 1033 | |||
| 1034 | #====================================================================== | ||
| 1035 | # device_removeLocalTemplate | ||
| 1036 | #====================================================================== | ||
| 1037 | sub device_removeLocalTemplate { | ||
| 1038 | my ($self, $args) = @_; | ||
| 1039 | $args = {} if !$args; | ||
| 1040 | |||
| 1041 | # Argument definition | ||
| 1042 | my $definition = { | ||
| 1043 | required => ['deviceUid', 'templateId'], | ||
| 1044 | }; | ||
| 1045 | |||
| 1046 | # Check the args | ||
| 1047 | $self->_check_args($args, $definition); | ||
| 1048 | |||
| 1049 | # Route the request | ||
| 1050 | $self->_router_request( | ||
| 1051 | { | ||
| 1052 | location => $self->DEVICE_LOCATION, | ||
| 1053 | action => $self->DEVICE_ACTION, | ||
| 1054 | method => 'removeLocalTemplate', | ||
| 1055 | data => [$args], | ||
| 1056 | } | ||
| 1057 | ); | ||
| 1058 | } # END device_removeLocalTemplate | ||
| 1059 | |||
| 1060 | #====================================================================== | ||
| 1061 | # device_getLocalTemplates | ||
| 1062 | #====================================================================== | ||
| 1063 | sub device_getLocalTemplates { | ||
| 1064 | my ($self, $args) = @_; | ||
| 1065 | $args = {} if !$args; | ||
| 1066 | |||
| 1067 | # Argument definition | ||
| 1068 | my $definition = { | ||
| 1069 | defaults => { | ||
| 1070 | query => JSON::null | ||
| 1071 | }, | ||
| 1072 | required => ['uid'], | ||
| 1073 | }; | ||
| 1074 | |||
| 1075 | # Check the args | ||
| 1076 | $self->_check_args($args, $definition); | ||
| 1077 | |||
| 1078 | # Route the request | ||
| 1079 | $self->_router_request( | ||
| 1080 | { | ||
| 1081 | location => $self->DEVICE_LOCATION, | ||
| 1082 | action => $self->DEVICE_ACTION, | ||
| 1083 | method => 'getLocalTemplates', | ||
| 1084 | data => [$args], | ||
| 1085 | } | ||
| 1086 | ); | ||
| 1087 | } # END device_getLocalTemplates | ||
| 1088 | |||
| 1089 | #====================================================================== | ||
| 1090 | # device_getTemplates | ||
| 1091 | #====================================================================== | ||
| 1092 | sub device_getTemplates { | ||
| 1093 | my ($self, $args) = @_; | ||
| 1094 | $args = {} if !$args; | ||
| 1095 | |||
| 1096 | # Argument definition | ||
| 1097 | my $definition = { | ||
| 1098 | required => ['id'], | ||
| 1099 | }; | ||
| 1100 | |||
| 1101 | # Check the args | ||
| 1102 | $self->_check_args($args, $definition); | ||
| 1103 | |||
| 1104 | # Route the request | ||
| 1105 | $self->_router_request( | ||
| 1106 | { | ||
| 1107 | location => $self->DEVICE_LOCATION, | ||
| 1108 | action => $self->DEVICE_ACTION, | ||
| 1109 | method => 'getTemplates', | ||
| 1110 | data => [$args], | ||
| 1111 | } | ||
| 1112 | ); | ||
| 1113 | } # END device_getTemplates | ||
| 1114 | |||
| 1115 | #====================================================================== | ||
| 1116 | # device_getUnboundTemplates | ||
| 1117 | #====================================================================== | ||
| 1118 | sub device_getUnboundTemplates { | ||
| 1119 | my ($self, $args) = @_; | ||
| 1120 | $args = {} if !$args; | ||
| 1121 | |||
| 1122 | # Argument definition | ||
| 1123 | my $definition = { | ||
| 1124 | required => ['uid'], | ||
| 1125 | }; | ||
| 1126 | |||
| 1127 | # Check the args | ||
| 1128 | $self->_check_args($args, $definition); | ||
| 1129 | |||
| 1130 | # Route the request | ||
| 1131 | $self->_router_request( | ||
| 1132 | { | ||
| 1133 | location => $self->DEVICE_LOCATION, | ||
| 1134 | action => $self->DEVICE_ACTION, | ||
| 1135 | method => 'getUnboundTemplates', | ||
| 1136 | data => [$args], | ||
| 1137 | } | ||
| 1138 | ); | ||
| 1139 | } # END device_getUnboundTemplates | ||
| 1140 | |||
| 1141 | #====================================================================== | ||
| 1142 | # device_getBoundTemplates | ||
| 1143 | #====================================================================== | ||
| 1144 | sub device_getBoundTemplates { | ||
| 1145 | my ($self, $args) = @_; | ||
| 1146 | $args = {} if !$args; | ||
| 1147 | |||
| 1148 | # Argument definition | ||
| 1149 | my $definition = { | ||
| 1150 | required => ['uid'], | ||
| 1151 | }; | ||
| 1152 | |||
| 1153 | # Check the args | ||
| 1154 | $self->_check_args($args, $definition); | ||
| 1155 | |||
| 1156 | # Route the request | ||
| 1157 | $self->_router_request( | ||
| 1158 | { | ||
| 1159 | location => $self->DEVICE_LOCATION, | ||
| 1160 | action => $self->DEVICE_ACTION, | ||
| 1161 | method => 'getBoundTemplates', | ||
| 1162 | data => [$args], | ||
| 1163 | } | ||
| 1164 | ); | ||
| 1165 | } # END device_getBoundTemplates | ||
| 1166 | |||
| 1167 | #====================================================================== | ||
| 1168 | # device_setBoundTemplates | ||
| 1169 | #====================================================================== | ||
| 1170 | sub device_setBoundTemplates { | ||
| 1171 | my ($self, $args) = @_; | ||
| 1172 | $args = {} if !$args; | ||
| 1173 | |||
| 1174 | # Argument definition | ||
| 1175 | my $definition = { | ||
| 1176 | required => ['uid', 'templateIds'], | ||
| 1177 | }; | ||
| 1178 | |||
| 1179 | # Check the args | ||
| 1180 | $self->_check_args($args, $definition); | ||
| 1181 | |||
| 1182 | # Route the request | ||
| 1183 | $self->_router_request( | ||
| 1184 | { | ||
| 1185 | location => $self->DEVICE_LOCATION, | ||
| 1186 | action => $self->DEVICE_ACTION, | ||
| 1187 | method => 'setBoundTemplates', | ||
| 1188 | data => [$args], | ||
| 1189 | } | ||
| 1190 | ); | ||
| 1191 | } # END device_setBoundTemplates | ||
| 1192 | |||
| 1193 | #====================================================================== | ||
| 1194 | # device_resetBoundTemplates | ||
| 1195 | #====================================================================== | ||
| 1196 | sub device_resetBoundTemplates { | ||
| 1197 | my ($self, $args) = @_; | ||
| 1198 | $args = {} if !$args; | ||
| 1199 | |||
| 1200 | # Argument definition | ||
| 1201 | my $definition = { | ||
| 1202 | required => ['uid'], | ||
| 1203 | }; | ||
| 1204 | |||
| 1205 | # Check the args | ||
| 1206 | $self->_check_args($args, $definition); | ||
| 1207 | |||
| 1208 | # Route the request | ||
| 1209 | $self->_router_request( | ||
| 1210 | { | ||
| 1211 | location => $self->DEVICE_LOCATION, | ||
| 1212 | action => $self->DEVICE_ACTION, | ||
| 1213 | method => 'resetBoundTemplates', | ||
| 1214 | data => [$args], | ||
| 1215 | } | ||
| 1216 | ); | ||
| 1217 | } # END device_resetBoundTemplates | ||
| 1218 | |||
| 1219 | #====================================================================== | ||
| 1220 | # device_bindOrUnbindTemplate | ||
| 1221 | #====================================================================== | ||
| 1222 | sub device_bindOrUnbindTemplate { | ||
| 1223 | my ($self, $args) = @_; | ||
| 1224 | $args = {} if !$args; | ||
| 1225 | |||
| 1226 | # Argument definition | ||
| 1227 | my $definition = { | ||
| 1228 | required => ['uid', 'templateUid'], | ||
| 1229 | }; | ||
| 1230 | |||
| 1231 | # Check the args | ||
| 1232 | $self->_check_args($args, $definition); | ||
| 1233 | |||
| 1234 | # Route the request | ||
| 1235 | $self->_router_request( | ||
| 1236 | { | ||
| 1237 | location => $self->DEVICE_LOCATION, | ||
| 1238 | action => $self->DEVICE_ACTION, | ||
| 1239 | method => 'bindOrUnbindTemplate', | ||
| 1240 | data => [$args], | ||
| 1241 | } | ||
| 1242 | ); | ||
| 1243 | } # END device_bindOrUnbindTemplate | ||
| 1244 | |||
| 1245 | #====================================================================== | ||
| 1246 | # device_getOverridableTemplates | ||
| 1247 | #====================================================================== | ||
| 1248 | sub device_getOverridableTemplates { | ||
| 1249 | my ($self, $args) = @_; | ||
| 1250 | $args = {} if !$args; | ||
| 1251 | |||
| 1252 | # Argument definition | ||
| 1253 | my $definition = { | ||
| 1254 | defaults => { | ||
| 1255 | query => JSON::null | ||
| 1256 | }, | ||
| 1257 | required => ['uid'], | ||
| 1258 | }; | ||
| 1259 | |||
| 1260 | # Check the args | ||
| 1261 | $self->_check_args($args, $definition); | ||
| 1262 | |||
| 1263 | # Route the request | ||
| 1264 | $self->_router_request( | ||
| 1265 | { | ||
| 1266 | location => $self->DEVICE_LOCATION, | ||
| 1267 | action => $self->DEVICE_ACTION, | ||
| 1268 | method => 'getOverridableTemplates', | ||
| 1269 | data => [$args], | ||
| 1270 | } | ||
| 1271 | ); | ||
| 1272 | } # END device_getOverridableTemplates | ||
| 1273 | |||
| 1274 | #====================================================================== | ||
| 1275 | # device_clearGeocodeCache | ||
| 1276 | #====================================================================== | ||
| 1277 | sub device_clearGeocodeCache { | ||
| 1278 | my ($self, $args) = @_; | ||
| 1279 | $args = {} if !$args; | ||
| 1280 | |||
| 1281 | # Argument definition | ||
| 1282 | my $definition = {}; | ||
| 1283 | |||
| 1284 | # Check the args | ||
| 1285 | $self->_check_args($args, $definition); | ||
| 1286 | |||
| 1287 | # Route the request | ||
| 1288 | $self->_router_request( | ||
| 1289 | { | ||
| 1290 | location => $self->DEVICE_LOCATION, | ||
| 1291 | action => $self->DEVICE_ACTION, | ||
| 1292 | method => 'clearGeocodeCache', | ||
| 1293 | data => [$args], | ||
| 1294 | } | ||
| 1295 | ); | ||
| 1296 | } # END device_clearGeocodeCache | ||
| 1297 | |||
| 1298 | #====================================================================== | ||
| 1299 | # device_getGraphDefs | ||
| 1300 | #====================================================================== | ||
| 1301 | sub device_getGraphDefs { | ||
| 1302 | my ($self, $args) = @_; | ||
| 1303 | $args = {} if !$args; | ||
| 1304 | |||
| 1305 | # Argument definition | ||
| 1306 | my $definition = { | ||
| 1307 | required => ['uid'], | ||
| 1308 | }; | ||
| 1309 | |||
| 1310 | # Check the args | ||
| 1311 | $self->_check_args($args, $definition); | ||
| 1312 | |||
| 1313 | # Route the request | ||
| 1314 | $self->_router_request( | ||
| 1315 | { | ||
| 1316 | location => $self->DEVICE_LOCATION, | ||
| 1317 | action => $self->DEVICE_ACTION, | ||
| 1318 | method => 'getGraphDefs', | ||
| 1319 | data => [$args], | ||
| 1320 | } | ||
| 1321 | ); | ||
| 1322 | } # END device_getGraphDefs | ||
| 1323 | |||
| 1324 | #====================================================================== | ||
| 1325 | # device_getGroups | ||
| 1326 | #====================================================================== | ||
| 1327 | sub device_getGroups { | ||
| 1328 | my ($self, $args) = @_; | ||
| 1329 | $args = {} if !$args; | ||
| 1330 | |||
| 1331 | # Argument definition | ||
| 1332 | my $definition = {}; | ||
| 1333 | |||
| 1334 | # Check the args | ||
| 1335 | $self->_check_args($args, $definition); | ||
| 1336 | |||
| 1337 | # Route the request | ||
| 1338 | $self->_router_request( | ||
| 1339 | { | ||
| 1340 | location => $self->DEVICE_LOCATION, | ||
| 1341 | action => $self->DEVICE_ACTION, | ||
| 1342 | method => 'getGroups', | ||
| 1343 | data => [$args], | ||
| 1344 | } | ||
| 1345 | ); | ||
| 1346 | } # END device_getGroups | ||
| 1347 | |||
| 1348 | #====================================================================== | ||
| 1349 | # device_getLocations | ||
| 1350 | #====================================================================== | ||
| 1351 | sub device_getLocations { | ||
| 1352 | my ($self, $args) = @_; | ||
| 1353 | $args = {} if !$args; | ||
| 1354 | |||
| 1355 | # Argument definition | ||
| 1356 | my $definition = {}; | ||
| 1357 | |||
| 1358 | # Check the args | ||
| 1359 | $self->_check_args($args, $definition); | ||
| 1360 | |||
| 1361 | # Route the request | ||
| 1362 | $self->_router_request( | ||
| 1363 | { | ||
| 1364 | location => $self->DEVICE_LOCATION, | ||
| 1365 | action => $self->DEVICE_ACTION, | ||
| 1366 | method => 'getLocations', | ||
| 1367 | data => [$args], | ||
| 1368 | } | ||
| 1369 | ); | ||
| 1370 | } # END device_getLocations | ||
| 1371 | |||
| 1372 | #====================================================================== | ||
| 1373 | # device_getModifications | ||
| 1374 | #====================================================================== | ||
| 1375 | sub device_getModifications { | ||
| 1376 | my ($self, $args) = @_; | ||
| 1377 | $args = {} if !$args; | ||
| 1378 | |||
| 1379 | # Argument definition | ||
| 1380 | my $definition = { | ||
| 1381 | defaults => { | ||
| 1382 | types => JSON::null | ||
| 1383 | }, | ||
| 1384 | required => ['id'], | ||
| 1385 | }; | ||
| 1386 | |||
| 1387 | # Check the args | ||
| 1388 | $self->_check_args($args, $definition); | ||
| 1389 | |||
| 1390 | # Route the request | ||
| 1391 | $self->_router_request( | ||
| 1392 | { | ||
| 1393 | location => $self->DEVICE_LOCATION, | ||
| 1394 | action => $self->DEVICE_ACTION, | ||
| 1395 | method => 'getModifications', | ||
| 1396 | data => [$args], | ||
| 1397 | } | ||
| 1398 | ); | ||
| 1399 | } # END device_getModifications | ||
| 1400 | |||
| 1401 | #====================================================================== | ||
| 1402 | # device_getSystems | ||
| 1403 | #====================================================================== | ||
| 1404 | sub device_getSystems { | ||
| 1405 | my ($self, $args) = @_; | ||
| 1406 | $args = {} if !$args; | ||
| 1407 | |||
| 1408 | # Argument definition | ||
| 1409 | my $definition = {}; | ||
| 1410 | |||
| 1411 | # Check the args | ||
| 1412 | $self->_check_args($args, $definition); | ||
| 1413 | |||
| 1414 | # Route the request | ||
| 1415 | $self->_router_request( | ||
| 1416 | { | ||
| 1417 | location => $self->DEVICE_LOCATION, | ||
| 1418 | action => $self->DEVICE_ACTION, | ||
| 1419 | method => 'getSystems', | ||
| 1420 | data => [$args], | ||
| 1421 | } | ||
| 1422 | ); | ||
| 1423 | } # END device_getSystems | ||
| 1424 | |||
| 1425 | #====================================================================== | ||
| 1426 | # device_getZenProperties | ||
| 1427 | #====================================================================== | ||
| 1428 | sub device_getZenProperties { | ||
| 1429 | my ($self, $args) = @_; | ||
| 1430 | $args = {} if !$args; | ||
| 1431 | |||
| 1432 | # Argument definition | ||
| 1433 | my $definition = { | ||
| 1434 | defaults => { | ||
| 1435 | start => 0, | ||
| 1436 | dir => 'ASC', | ||
| 1437 | }, | ||
| 1438 | required => ['uid'], | ||
| 1439 | }; | ||
| 1440 | |||
| 1441 | # Check the args | ||
| 1442 | $self->_check_args($args, $definition); | ||
| 1443 | |||
| 1444 | # Route the request | ||
| 1445 | $self->_router_request( | ||
| 1446 | { | ||
| 1447 | location => $self->DEVICE_LOCATION, | ||
| 1448 | action => $self->DEVICE_ACTION, | ||
| 1449 | method => 'getZenProperties', | ||
| 1450 | data => [$args], | ||
| 1451 | } | ||
| 1452 | ); | ||
| 1453 | } # END device_getZenProperties | ||
| 1454 | |||
| 1455 | #====================================================================== | ||
| 1456 | # device_getZenProperty | ||
| 1457 | #====================================================================== | ||
| 1458 | sub device_getZenProperty { | ||
| 1459 | my ($self, $args) = @_; | ||
| 1460 | $args = {} if !$args; | ||
| 1461 | |||
| 1462 | # Argument definition | ||
| 1463 | my $definition = { | ||
| 1464 | required => ['uid', 'zProperty'], | ||
| 1465 | }; | ||
| 1466 | |||
| 1467 | # Check the args | ||
| 1468 | $self->_check_args($args, $definition); | ||
| 1469 | |||
| 1470 | # Route the request | ||
| 1471 | $self->_router_request( | ||
| 1472 | { | ||
| 1473 | location => $self->DEVICE_LOCATION, | ||
| 1474 | action => $self->DEVICE_ACTION, | ||
| 1475 | method => 'getZenProperty', | ||
| 1476 | data => [$args], | ||
| 1477 | } | ||
| 1478 | ); | ||
| 1479 | } # END device_getZenProperty | ||
| 1480 | |||
| 1481 | #====================================================================== | ||
| 1482 | # device_deleteZenProperty | ||
| 1483 | #====================================================================== | ||
| 1484 | sub device_deleteZenProperty { | ||
| 1485 | my ($self, $args) = @_; | ||
| 1486 | $args = {} if !$args; | ||
| 1487 | |||
| 1488 | # Argument definition | ||
| 1489 | my $definition = { | ||
| 1490 | required => ['uid', 'zProperty'], | ||
| 1491 | }; | ||
| 1492 | |||
| 1493 | # Check the args | ||
| 1494 | $self->_check_args($args, $definition); | ||
| 1495 | |||
| 1496 | # Route the request | ||
| 1497 | $self->_router_request( | ||
| 1498 | { | ||
| 1499 | location => $self->DEVICE_LOCATION, | ||
| 1500 | action => $self->DEVICE_ACTION, | ||
| 1501 | method => 'deleteZenProperty', | ||
| 1502 | data => [$args], | ||
| 1503 | } | ||
| 1504 | ); | ||
| 1505 | } # END device_deleteZenProperty | ||
| 1506 | |||
| 1507 | #====================================================================== | ||
| 1508 | # device_setZenProperty | ||
| 1509 | #====================================================================== | ||
| 1510 | sub device_setZenProperty { | ||
| 1511 | my ($self, $args) = @_; | ||
| 1512 | $args = {} if !$args; | ||
| 1513 | |||
| 1514 | # Argument definition | ||
| 1515 | my $definition = { | ||
| 1516 | required => ['uid', 'zProperty', 'value'], | ||
| 1517 | }; | ||
| 1518 | |||
| 1519 | # Check the args | ||
| 1520 | $self->_check_args($args, $definition); | ||
| 1521 | |||
| 1522 | # Route the request | ||
| 1523 | $self->_router_request( | ||
| 1524 | { | ||
| 1525 | location => $self->DEVICE_LOCATION, | ||
| 1526 | action => $self->DEVICE_ACTION, | ||
| 1527 | method => 'setZenProperty', | ||
| 1528 | data => [$args], | ||
| 1529 | } | ||
| 1530 | ); | ||
| 1531 | } # END device_setZenProperty | ||
| 1532 | |||
| 1533 | #************************************************************************** | ||
| 1534 | # Package end | ||
| 1535 | #************************************************************************** | ||
| 1536 | no Moose; | ||
| 1537 | |||
| 1538 | 1; | ||
| 1539 | |||
| 1540 | __END__ |