| 1 | #************************************************************************** | ||
| 2 | # Name: Template.pm | ||
| 3 | # | ||
| 4 | # Description: A JSON/ExtDirect interface to operations on templates | ||
| 5 | # | ||
| 6 | # Author: Patrick Baker | ||
| 7 | # | ||
| 8 | # Version: $Id$ | ||
| 9 | # | ||
| 10 | #************************************************************************** | ||
| 11 | package Zenoss::Router::Template; | ||
| 12 | use strict; | ||
| 13 | |||
| 14 | use Moose::Role; | ||
| 15 | with 'Zenoss::Router::Tree', 'Zenoss::MetaHelper'; | ||
| 16 | requires '_router_request', '_check_args'; | ||
| 17 | __PACKAGE__->_INSTALL_META_METHODS; | ||
| 18 | |||
| 19 | #************************************************************************** | ||
| 20 | # Attributes | ||
| 21 | #************************************************************************** | ||
| 22 | has 'TEMPLATE_LOCATION' => ( | ||
| 23 | is => 'ro', | ||
| 24 | isa => 'Str', | ||
| 25 | default => 'zport/dmd/template_router', | ||
| 26 | init_arg => undef, | ||
| 27 | ); | ||
| 28 | |||
| 29 | has 'TEMPLATE_ACTION' => ( | ||
| 30 | is => 'ro', | ||
| 31 | isa => 'Str', | ||
| 32 | default => 'TemplateRouter', | ||
| 33 | init_arg => undef, | ||
| 34 | ); | ||
| 35 | |||
| 36 | #************************************************************************** | ||
| 37 | # Public Functions | ||
| 38 | #************************************************************************** | ||
| 39 | #====================================================================== | ||
| 40 | # template_getTemplates | ||
| 41 | #====================================================================== | ||
| 42 | sub template_getTemplates { | ||
| 43 | my ($self, $args) = @_; | ||
| 44 | $args = {} if !$args; | ||
| 45 | |||
| 46 | # Argument definition | ||
| 47 | my $definition = { | ||
| 48 | defaults => { | ||
| 49 | id => '/zport/dmd/Devices', | ||
| 50 | } | ||
| 51 | }; | ||
| 52 | |||
| 53 | # Check the args | ||
| 54 | $self->_check_args($args, $definition); | ||
| 55 | |||
| 56 | # Route the request | ||
| 57 | $self->_router_request( | ||
| 58 | { | ||
| 59 | location => $self->TEMPLATE_LOCATION, | ||
| 60 | action => $self->TEMPLATE_ACTION, | ||
| 61 | method => 'getTemplates', | ||
| 62 | data => [$args], | ||
| 63 | } | ||
| 64 | ); | ||
| 65 | } # END template_getTemplates | ||
| 66 | |||
| 67 | #====================================================================== | ||
| 68 | # template_getDeviceClassTemplates | ||
| 69 | #====================================================================== | ||
| 70 | sub template_getDeviceClassTemplates { | ||
| 71 | my ($self, $args) = @_; | ||
| 72 | $self->_croak("getDeviceClassTemplates is broken at the Zenoss API level"); | ||
| 73 | } # END template_getDeviceClassTemplates | ||
| 74 | |||
| 75 | #====================================================================== | ||
| 76 | # template_getAddTemplateTargets | ||
| 77 | #====================================================================== | ||
| 78 | sub template_getAddTemplateTargets { | ||
| 79 | my ($self, $args) = @_; | ||
| 80 | $args = {} if !$args; | ||
| 81 | |||
| 82 | # Argument definition | ||
| 83 | my $definition = { | ||
| 84 | defaults => { | ||
| 85 | query => JSON::null, | ||
| 86 | } | ||
| 87 | }; | ||
| 88 | |||
| 89 | # Check the args | ||
| 90 | $self->_check_args($args, $definition); | ||
| 91 | |||
| 92 | # Route the request | ||
| 93 | $self->_router_request( | ||
| 94 | { | ||
| 95 | location => $self->TEMPLATE_LOCATION, | ||
| 96 | action => $self->TEMPLATE_ACTION, | ||
| 97 | method => 'getAddTemplateTargets', | ||
| 98 | data => [$args], | ||
| 99 | } | ||
| 100 | ); | ||
| 101 | } # END template_getAddTemplateTargets | ||
| 102 | |||
| 103 | #====================================================================== | ||
| 104 | # template_addTemplate | ||
| 105 | #====================================================================== | ||
| 106 | sub template_addTemplate { | ||
| 107 | my ($self, $args) = @_; | ||
| 108 | $args = {} if !$args; | ||
| 109 | |||
| 110 | # Argument definition | ||
| 111 | my $definition = { | ||
| 112 | required => ['id', 'targetUid'], | ||
| 113 | }; | ||
| 114 | |||
| 115 | # Check the args | ||
| 116 | $self->_check_args($args, $definition); | ||
| 117 | |||
| 118 | # Route the request | ||
| 119 | $self->_router_request( | ||
| 120 | { | ||
| 121 | location => $self->TEMPLATE_LOCATION, | ||
| 122 | action => $self->TEMPLATE_ACTION, | ||
| 123 | method => 'addTemplate', | ||
| 124 | data => [$args], | ||
| 125 | } | ||
| 126 | ); | ||
| 127 | } # END template_addTemplate | ||
| 128 | |||
| 129 | #====================================================================== | ||
| 130 | # template_deleteTemplate | ||
| 131 | #====================================================================== | ||
| 132 | sub template_deleteTemplate { | ||
| 133 | my ($self, $args) = @_; | ||
| 134 | $args = {} if !$args; | ||
| 135 | |||
| 136 | # Argument definition | ||
| 137 | my $definition = { | ||
| 138 | required => ['uid'], | ||
| 139 | }; | ||
| 140 | |||
| 141 | # Check the args | ||
| 142 | $self->_check_args($args, $definition); | ||
| 143 | |||
| 144 | # Route the request | ||
| 145 | $self->_router_request( | ||
| 146 | { | ||
| 147 | location => $self->TEMPLATE_LOCATION, | ||
| 148 | action => $self->TEMPLATE_ACTION, | ||
| 149 | method => 'deleteTemplate', | ||
| 150 | data => [$args], | ||
| 151 | } | ||
| 152 | ); | ||
| 153 | } # END template_deleteTemplate | ||
| 154 | |||
| 155 | #====================================================================== | ||
| 156 | # template_getThresholds | ||
| 157 | #====================================================================== | ||
| 158 | sub template_getThresholds { | ||
| 159 | my ($self, $args) = @_; | ||
| 160 | $args = {} if !$args; | ||
| 161 | |||
| 162 | # Argument definition | ||
| 163 | my $definition = { | ||
| 164 | defaults => { | ||
| 165 | query => '', | ||
| 166 | }, | ||
| 167 | required => ['uid'], | ||
| 168 | }; | ||
| 169 | |||
| 170 | # Check the args | ||
| 171 | $self->_check_args($args, $definition); | ||
| 172 | |||
| 173 | # Route the request | ||
| 174 | $self->_router_request( | ||
| 175 | { | ||
| 176 | location => $self->TEMPLATE_LOCATION, | ||
| 177 | action => $self->TEMPLATE_ACTION, | ||
| 178 | method => 'getThresholds', | ||
| 179 | data => [$args], | ||
| 180 | } | ||
| 181 | ); | ||
| 182 | } # END template_getThresholds | ||
| 183 | |||
| 184 | #====================================================================== | ||
| 185 | # template_getThresholdDetails | ||
| 186 | #====================================================================== | ||
| 187 | sub template_getThresholdDetails { | ||
| 188 | my ($self, $args) = @_; | ||
| 189 | $args = {} if !$args; | ||
| 190 | |||
| 191 | # Argument definition | ||
| 192 | my $definition = { | ||
| 193 | required => ['uid'], | ||
| 194 | }; | ||
| 195 | |||
| 196 | # Check the args | ||
| 197 | $self->_check_args($args, $definition); | ||
| 198 | |||
| 199 | # Route the request | ||
| 200 | $self->_router_request( | ||
| 201 | { | ||
| 202 | location => $self->TEMPLATE_LOCATION, | ||
| 203 | action => $self->TEMPLATE_ACTION, | ||
| 204 | method => 'getThresholdDetails', | ||
| 205 | data => [$args], | ||
| 206 | } | ||
| 207 | ); | ||
| 208 | } # END template_getThresholdDetails | ||
| 209 | |||
| 210 | #====================================================================== | ||
| 211 | # template_getDataPoints | ||
| 212 | #====================================================================== | ||
| 213 | sub template_getDataPoints { | ||
| 214 | my ($self, $args) = @_; | ||
| 215 | $args = {} if !$args; | ||
| 216 | |||
| 217 | # Argument definition | ||
| 218 | my $definition = { | ||
| 219 | defaults => { | ||
| 220 | query => JSON::null, | ||
| 221 | }, | ||
| 222 | required => ['uid'], | ||
| 223 | }; | ||
| 224 | |||
| 225 | # Check the args | ||
| 226 | $self->_check_args($args, $definition); | ||
| 227 | |||
| 228 | # Route the request | ||
| 229 | $self->_router_request( | ||
| 230 | { | ||
| 231 | location => $self->TEMPLATE_LOCATION, | ||
| 232 | action => $self->TEMPLATE_ACTION, | ||
| 233 | method => 'getDataPoints', | ||
| 234 | data => [$args], | ||
| 235 | } | ||
| 236 | ); | ||
| 237 | } # END template_getDataPoints | ||
| 238 | |||
| 239 | #====================================================================== | ||
| 240 | # template_addDataPoint | ||
| 241 | #====================================================================== | ||
| 242 | sub template_addDataPoint { | ||
| 243 | my ($self, $args) = @_; | ||
| 244 | $args = {} if !$args; | ||
| 245 | |||
| 246 | # Argument definition | ||
| 247 | my $definition = { | ||
| 248 | required => ['dataSourceUid', 'name'], | ||
| 249 | }; | ||
| 250 | |||
| 251 | # Check the args | ||
| 252 | $self->_check_args($args, $definition); | ||
| 253 | |||
| 254 | # Route the request | ||
| 255 | $self->_router_request( | ||
| 256 | { | ||
| 257 | location => $self->TEMPLATE_LOCATION, | ||
| 258 | action => $self->TEMPLATE_ACTION, | ||
| 259 | method => 'addDataPoint', | ||
| 260 | data => [$args], | ||
| 261 | } | ||
| 262 | ); | ||
| 263 | } # END template_addDataPoint | ||
| 264 | |||
| 265 | #====================================================================== | ||
| 266 | # template_addDataSource | ||
| 267 | #====================================================================== | ||
| 268 | sub template_addDataSource { | ||
| 269 | my ($self, $args) = @_; | ||
| 270 | $args = {} if !$args; | ||
| 271 | |||
| 272 | # Argument definition | ||
| 273 | my $definition = { | ||
| 274 | required => ['templateUid', 'name', 'type'], | ||
| 275 | }; | ||
| 276 | |||
| 277 | # Check the args | ||
| 278 | $self->_check_args($args, $definition); | ||
| 279 | |||
| 280 | # Route the request | ||
| 281 | $self->_router_request( | ||
| 282 | { | ||
| 283 | location => $self->TEMPLATE_LOCATION, | ||
| 284 | action => $self->TEMPLATE_ACTION, | ||
| 285 | method => 'addDataSource', | ||
| 286 | data => [$args], | ||
| 287 | } | ||
| 288 | ); | ||
| 289 | } # END template_addDataSource | ||
| 290 | |||
| 291 | #====================================================================== | ||
| 292 | # template_getDataSources | ||
| 293 | #====================================================================== | ||
| 294 | sub template_getDataSources { | ||
| 295 | my ($self, $args) = @_; | ||
| 296 | $args = {} if !$args; | ||
| 297 | |||
| 298 | # Argument definition | ||
| 299 | my $definition = { | ||
| 300 | required => ['id'], | ||
| 301 | }; | ||
| 302 | |||
| 303 | # Check the args | ||
| 304 | $self->_check_args($args, $definition); | ||
| 305 | |||
| 306 | # Route the request | ||
| 307 | $self->_router_request( | ||
| 308 | { | ||
| 309 | location => $self->TEMPLATE_LOCATION, | ||
| 310 | action => $self->TEMPLATE_ACTION, | ||
| 311 | method => 'getDataSources', | ||
| 312 | data => [$args], | ||
| 313 | } | ||
| 314 | ); | ||
| 315 | } # END template_getDataSources | ||
| 316 | |||
| 317 | #====================================================================== | ||
| 318 | # template_getDataSourceDetails | ||
| 319 | #====================================================================== | ||
| 320 | sub template_getDataSourceDetails { | ||
| 321 | my ($self, $args) = @_; | ||
| 322 | $args = {} if !$args; | ||
| 323 | |||
| 324 | # Argument definition | ||
| 325 | my $definition = { | ||
| 326 | required => ['uid'], | ||
| 327 | }; | ||
| 328 | |||
| 329 | # Check the args | ||
| 330 | $self->_check_args($args, $definition); | ||
| 331 | |||
| 332 | # Route the request | ||
| 333 | $self->_router_request( | ||
| 334 | { | ||
| 335 | location => $self->TEMPLATE_LOCATION, | ||
| 336 | action => $self->TEMPLATE_ACTION, | ||
| 337 | method => 'getDataSourceDetails', | ||
| 338 | data => [$args], | ||
| 339 | } | ||
| 340 | ); | ||
| 341 | } # END template_getDataSourceDetails | ||
| 342 | |||
| 343 | #====================================================================== | ||
| 344 | # template_getDataPointDetails | ||
| 345 | #====================================================================== | ||
| 346 | sub template_getDataPointDetails { | ||
| 347 | my ($self, $args) = @_; | ||
| 348 | $args = {} if !$args; | ||
| 349 | |||
| 350 | # Argument definition | ||
| 351 | my $definition = { | ||
| 352 | required => ['uid'], | ||
| 353 | }; | ||
| 354 | |||
| 355 | # Check the args | ||
| 356 | $self->_check_args($args, $definition); | ||
| 357 | |||
| 358 | # Route the request | ||
| 359 | $self->_router_request( | ||
| 360 | { | ||
| 361 | location => $self->TEMPLATE_LOCATION, | ||
| 362 | action => $self->TEMPLATE_ACTION, | ||
| 363 | method => 'getDataPointDetails', | ||
| 364 | data => [$args], | ||
| 365 | } | ||
| 366 | ); | ||
| 367 | } # END template_getDataPointDetails | ||
| 368 | |||
| 369 | #====================================================================== | ||
| 370 | # template_setInfo | ||
| 371 | #====================================================================== | ||
| 372 | sub template_setInfo { | ||
| 373 | my ($self, $args) = @_; | ||
| 374 | $args = {} if !$args; | ||
| 375 | |||
| 376 | # Argument definition | ||
| 377 | my $definition = { | ||
| 378 | required => ['uid'], | ||
| 379 | }; | ||
| 380 | |||
| 381 | # Check the args | ||
| 382 | $self->_check_args($args, $definition); | ||
| 383 | |||
| 384 | # Route the request | ||
| 385 | $self->_router_request( | ||
| 386 | { | ||
| 387 | location => $self->TEMPLATE_LOCATION, | ||
| 388 | action => $self->TEMPLATE_ACTION, | ||
| 389 | method => 'setInfo', | ||
| 390 | data => [$args], | ||
| 391 | } | ||
| 392 | ); | ||
| 393 | } # END template_setInfo | ||
| 394 | |||
| 395 | #====================================================================== | ||
| 396 | # template_addThreshold | ||
| 397 | #====================================================================== | ||
| 398 | sub template_addThreshold { | ||
| 399 | my ($self, $args) = @_; | ||
| 400 | $args = {} if !$args; | ||
| 401 | |||
| 402 | # Argument definition | ||
| 403 | my $definition = { | ||
| 404 | required => ['uid', 'thresholdType', 'thresholdId', 'dataPoints'], | ||
| 405 | }; | ||
| 406 | |||
| 407 | # Check the args | ||
| 408 | $self->_check_args($args, $definition); | ||
| 409 | |||
| 410 | # Route the request | ||
| 411 | $self->_router_request( | ||
| 412 | { | ||
| 413 | location => $self->TEMPLATE_LOCATION, | ||
| 414 | action => $self->TEMPLATE_ACTION, | ||
| 415 | method => 'addThreshold', | ||
| 416 | data => [$args], | ||
| 417 | } | ||
| 418 | ); | ||
| 419 | } # END template_addThreshold | ||
| 420 | |||
| 421 | #====================================================================== | ||
| 422 | # template_removeThreshold | ||
| 423 | #====================================================================== | ||
| 424 | sub template_removeThreshold { | ||
| 425 | my ($self, $args) = @_; | ||
| 426 | $args = {} if !$args; | ||
| 427 | |||
| 428 | # Argument definition | ||
| 429 | my $definition = { | ||
| 430 | required => ['uid'], | ||
| 431 | }; | ||
| 432 | |||
| 433 | # Check the args | ||
| 434 | $self->_check_args($args, $definition); | ||
| 435 | |||
| 436 | # Route the request | ||
| 437 | $self->_router_request( | ||
| 438 | { | ||
| 439 | location => $self->TEMPLATE_LOCATION, | ||
| 440 | action => $self->TEMPLATE_ACTION, | ||
| 441 | method => 'removeThreshold', | ||
| 442 | data => [$args], | ||
| 443 | } | ||
| 444 | ); | ||
| 445 | } # END template_removeThreshold | ||
| 446 | |||
| 447 | #====================================================================== | ||
| 448 | # template_getThresholdTypes | ||
| 449 | #====================================================================== | ||
| 450 | sub template_getThresholdTypes { | ||
| 451 | my ($self, $args) = @_; | ||
| 452 | $args = {} if !$args; | ||
| 453 | |||
| 454 | # Argument definition | ||
| 455 | my $definition = { | ||
| 456 | defaults => { | ||
| 457 | query => JSON::null, | ||
| 458 | }, | ||
| 459 | }; | ||
| 460 | |||
| 461 | # Check the args | ||
| 462 | $self->_check_args($args, $definition); | ||
| 463 | |||
| 464 | # Route the request | ||
| 465 | $self->_router_request( | ||
| 466 | { | ||
| 467 | location => $self->TEMPLATE_LOCATION, | ||
| 468 | action => $self->TEMPLATE_ACTION, | ||
| 469 | method => 'getThresholdTypes', | ||
| 470 | data => [$args], | ||
| 471 | } | ||
| 472 | ); | ||
| 473 | } # END template_getThresholdTypes | ||
| 474 | |||
| 475 | #====================================================================== | ||
| 476 | # template_getDataSourceTypes | ||
| 477 | #====================================================================== | ||
| 478 | sub template_getDataSourceTypes { | ||
| 479 | my ($self, $args) = @_; | ||
| 480 | $args = {} if !$args; | ||
| 481 | |||
| 482 | # Argument definition | ||
| 483 | my $definition = { | ||
| 484 | defaults => { | ||
| 485 | query => JSON::null, | ||
| 486 | }, | ||
| 487 | }; | ||
| 488 | |||
| 489 | # Check the args | ||
| 490 | $self->_check_args($args, $definition); | ||
| 491 | |||
| 492 | # Route the request | ||
| 493 | $self->_router_request( | ||
| 494 | { | ||
| 495 | location => $self->TEMPLATE_LOCATION, | ||
| 496 | action => $self->TEMPLATE_ACTION, | ||
| 497 | method => 'getDataSourceTypes', | ||
| 498 | data => [$args], | ||
| 499 | } | ||
| 500 | ); | ||
| 501 | } # END template_getDataSourceTypes | ||
| 502 | |||
| 503 | #====================================================================== | ||
| 504 | # template_getGraphs | ||
| 505 | #====================================================================== | ||
| 506 | sub template_getGraphs { | ||
| 507 | my ($self, $args) = @_; | ||
| 508 | $args = {} if !$args; | ||
| 509 | |||
| 510 | # Argument definition | ||
| 511 | my $definition = { | ||
| 512 | defaults => { | ||
| 513 | query => JSON::null, | ||
| 514 | }, | ||
| 515 | required => ['uid'], | ||
| 516 | }; | ||
| 517 | |||
| 518 | # Check the args | ||
| 519 | $self->_check_args($args, $definition); | ||
| 520 | |||
| 521 | # Route the request | ||
| 522 | $self->_router_request( | ||
| 523 | { | ||
| 524 | location => $self->TEMPLATE_LOCATION, | ||
| 525 | action => $self->TEMPLATE_ACTION, | ||
| 526 | method => 'getGraphs', | ||
| 527 | data => [$args], | ||
| 528 | } | ||
| 529 | ); | ||
| 530 | } # END template_getGraphs | ||
| 531 | |||
| 532 | #====================================================================== | ||
| 533 | # template_addDataPointToGraph | ||
| 534 | #====================================================================== | ||
| 535 | sub template_addDataPointToGraph { | ||
| 536 | my ($self, $args) = @_; | ||
| 537 | $args = {} if !$args; | ||
| 538 | |||
| 539 | # Argument definition | ||
| 540 | my $definition = { | ||
| 541 | defaults => { | ||
| 542 | includeThresholds => JSON::false, | ||
| 543 | }, | ||
| 544 | required => ['dataPointUid', 'graphUid'], | ||
| 545 | }; | ||
| 546 | |||
| 547 | # Check the args | ||
| 548 | $self->_check_args($args, $definition); | ||
| 549 | |||
| 550 | # Route the request | ||
| 551 | $self->_router_request( | ||
| 552 | { | ||
| 553 | location => $self->TEMPLATE_LOCATION, | ||
| 554 | action => $self->TEMPLATE_ACTION, | ||
| 555 | method => 'getGraphs', | ||
| 556 | data => [$args], | ||
| 557 | } | ||
| 558 | ); | ||
| 559 | } # END template_addDataPointToGraph | ||
| 560 | |||
| 561 | #====================================================================== | ||
| 562 | # template_getCopyTargets | ||
| 563 | #====================================================================== | ||
| 564 | sub template_getCopyTargets { | ||
| 565 | my ($self, $args) = @_; | ||
| 566 | $args = {} if !$args; | ||
| 567 | |||
| 568 | # Argument definition | ||
| 569 | my $definition = { | ||
| 570 | defaults => { | ||
| 571 | query => '', | ||
| 572 | }, | ||
| 573 | required => ['uid'], | ||
| 574 | }; | ||
| 575 | |||
| 576 | # Check the args | ||
| 577 | $self->_check_args($args, $definition); | ||
| 578 | |||
| 579 | # Route the request | ||
| 580 | $self->_router_request( | ||
| 581 | { | ||
| 582 | location => $self->TEMPLATE_LOCATION, | ||
| 583 | action => $self->TEMPLATE_ACTION, | ||
| 584 | method => 'getCopyTargets', | ||
| 585 | data => [$args], | ||
| 586 | } | ||
| 587 | ); | ||
| 588 | } # END template_getCopyTargets | ||
| 589 | |||
| 590 | #====================================================================== | ||
| 591 | # template_copyTemplate | ||
| 592 | #====================================================================== | ||
| 593 | sub template_copyTemplate { | ||
| 594 | my ($self, $args) = @_; | ||
| 595 | $args = {} if !$args; | ||
| 596 | |||
| 597 | # Argument definition | ||
| 598 | my $definition = { | ||
| 599 | required => ['uid', 'targetUid'], | ||
| 600 | }; | ||
| 601 | |||
| 602 | # Check the args | ||
| 603 | $self->_check_args($args, $definition); | ||
| 604 | |||
| 605 | # Route the request | ||
| 606 | $self->_router_request( | ||
| 607 | { | ||
| 608 | location => $self->TEMPLATE_LOCATION, | ||
| 609 | action => $self->TEMPLATE_ACTION, | ||
| 610 | method => 'copyTemplate', | ||
| 611 | data => [$args], | ||
| 612 | } | ||
| 613 | ); | ||
| 614 | } # END template_copyTemplate | ||
| 615 | |||
| 616 | #====================================================================== | ||
| 617 | # template_addGraphDefinition | ||
| 618 | #====================================================================== | ||
| 619 | sub template_addGraphDefinition { | ||
| 620 | my ($self, $args) = @_; | ||
| 621 | $args = {} if !$args; | ||
| 622 | |||
| 623 | # Argument definition | ||
| 624 | my $definition = { | ||
| 625 | required => ['templateUid', 'graphDefinitionId'], | ||
| 626 | }; | ||
| 627 | |||
| 628 | # Check the args | ||
| 629 | $self->_check_args($args, $definition); | ||
| 630 | |||
| 631 | # Route the request | ||
| 632 | $self->_router_request( | ||
| 633 | { | ||
| 634 | location => $self->TEMPLATE_LOCATION, | ||
| 635 | action => $self->TEMPLATE_ACTION, | ||
| 636 | method => 'addGraphDefinition', | ||
| 637 | data => [$args], | ||
| 638 | } | ||
| 639 | ); | ||
| 640 | } # END template_addGraphDefinition | ||
| 641 | |||
| 642 | #====================================================================== | ||
| 643 | # template_deleteDataSource | ||
| 644 | #====================================================================== | ||
| 645 | sub template_deleteDataSource { | ||
| 646 | my ($self, $args) = @_; | ||
| 647 | $args = {} if !$args; | ||
| 648 | |||
| 649 | # Argument definition | ||
| 650 | my $definition = { | ||
| 651 | required => ['uid'], | ||
| 652 | }; | ||
| 653 | |||
| 654 | # Check the args | ||
| 655 | $self->_check_args($args, $definition); | ||
| 656 | |||
| 657 | # Route the request | ||
| 658 | $self->_router_request( | ||
| 659 | { | ||
| 660 | location => $self->TEMPLATE_LOCATION, | ||
| 661 | action => $self->TEMPLATE_ACTION, | ||
| 662 | method => 'deleteDataSource', | ||
| 663 | data => [$args], | ||
| 664 | } | ||
| 665 | ); | ||
| 666 | } # END template_deleteDataSource | ||
| 667 | |||
| 668 | #====================================================================== | ||
| 669 | # template_deleteDataPoint | ||
| 670 | #====================================================================== | ||
| 671 | sub template_deleteDataPoint { | ||
| 672 | my ($self, $args) = @_; | ||
| 673 | $args = {} if !$args; | ||
| 674 | |||
| 675 | # Argument definition | ||
| 676 | my $definition = { | ||
| 677 | required => ['uid'], | ||
| 678 | }; | ||
| 679 | |||
| 680 | # Check the args | ||
| 681 | $self->_check_args($args, $definition); | ||
| 682 | |||
| 683 | # Route the request | ||
| 684 | $self->_router_request( | ||
| 685 | { | ||
| 686 | location => $self->TEMPLATE_LOCATION, | ||
| 687 | action => $self->TEMPLATE_ACTION, | ||
| 688 | method => 'deleteDataPoint', | ||
| 689 | data => [$args], | ||
| 690 | } | ||
| 691 | ); | ||
| 692 | } # END template_deleteDataPoint | ||
| 693 | |||
| 694 | #====================================================================== | ||
| 695 | # template_deleteGraphDefinition | ||
| 696 | #====================================================================== | ||
| 697 | sub template_deleteGraphDefinition { | ||
| 698 | my ($self, $args) = @_; | ||
| 699 | $args = {} if !$args; | ||
| 700 | |||
| 701 | # Argument definition | ||
| 702 | my $definition = { | ||
| 703 | required => ['uid'], | ||
| 704 | }; | ||
| 705 | |||
| 706 | # Check the args | ||
| 707 | $self->_check_args($args, $definition); | ||
| 708 | |||
| 709 | # Route the request | ||
| 710 | $self->_router_request( | ||
| 711 | { | ||
| 712 | location => $self->TEMPLATE_LOCATION, | ||
| 713 | action => $self->TEMPLATE_ACTION, | ||
| 714 | method => 'deleteGraphDefinition', | ||
| 715 | data => [$args], | ||
| 716 | } | ||
| 717 | ); | ||
| 718 | } # END template_deleteGraphDefinition | ||
| 719 | |||
| 720 | #====================================================================== | ||
| 721 | # template_deleteGraphPoint | ||
| 722 | #====================================================================== | ||
| 723 | sub template_deleteGraphPoint { | ||
| 724 | my ($self, $args) = @_; | ||
| 725 | $args = {} if !$args; | ||
| 726 | |||
| 727 | # Argument definition | ||
| 728 | my $definition = { | ||
| 729 | required => ['uid'], | ||
| 730 | }; | ||
| 731 | |||
| 732 | # Check the args | ||
| 733 | $self->_check_args($args, $definition); | ||
| 734 | |||
| 735 | # Route the request | ||
| 736 | $self->_router_request( | ||
| 737 | { | ||
| 738 | location => $self->TEMPLATE_LOCATION, | ||
| 739 | action => $self->TEMPLATE_ACTION, | ||
| 740 | method => 'deleteGraphPoint', | ||
| 741 | data => [$args], | ||
| 742 | } | ||
| 743 | ); | ||
| 744 | } # END template_deleteGraphPoint | ||
| 745 | |||
| 746 | #====================================================================== | ||
| 747 | # template_getGraphPoints | ||
| 748 | #====================================================================== | ||
| 749 | sub template_getGraphPoints { | ||
| 750 | my ($self, $args) = @_; | ||
| 751 | $args = {} if !$args; | ||
| 752 | |||
| 753 | # Argument definition | ||
| 754 | my $definition = { | ||
| 755 | required => ['uid'], | ||
| 756 | }; | ||
| 757 | |||
| 758 | # Check the args | ||
| 759 | $self->_check_args($args, $definition); | ||
| 760 | |||
| 761 | # Route the request | ||
| 762 | $self->_router_request( | ||
| 763 | { | ||
| 764 | location => $self->TEMPLATE_LOCATION, | ||
| 765 | action => $self->TEMPLATE_ACTION, | ||
| 766 | method => 'getGraphPoints', | ||
| 767 | data => [$args], | ||
| 768 | } | ||
| 769 | ); | ||
| 770 | } # END template_getGraphPoints | ||
| 771 | |||
| 772 | #====================================================================== | ||
| 773 | # template_getInfo | ||
| 774 | #====================================================================== | ||
| 775 | sub template_getInfo { | ||
| 776 | my ($self, $args) = @_; | ||
| 777 | $args = {} if !$args; | ||
| 778 | |||
| 779 | # Argument definition | ||
| 780 | my $definition = { | ||
| 781 | required => ['uid'], | ||
| 782 | }; | ||
| 783 | |||
| 784 | # Check the args | ||
| 785 | $self->_check_args($args, $definition); | ||
| 786 | |||
| 787 | # Route the request | ||
| 788 | $self->_router_request( | ||
| 789 | { | ||
| 790 | location => $self->TEMPLATE_LOCATION, | ||
| 791 | action => $self->TEMPLATE_ACTION, | ||
| 792 | method => 'getInfo', | ||
| 793 | data => [$args], | ||
| 794 | } | ||
| 795 | ); | ||
| 796 | } # END template_getInfo | ||
| 797 | |||
| 798 | #====================================================================== | ||
| 799 | # template_addThresholdToGraph | ||
| 800 | #====================================================================== | ||
| 801 | sub template_addThresholdToGraph { | ||
| 802 | my ($self, $args) = @_; | ||
| 803 | $args = {} if !$args; | ||
| 804 | |||
| 805 | # Argument definition | ||
| 806 | my $definition = { | ||
| 807 | required => ['graphUid', 'thresholdUid'], | ||
| 808 | }; | ||
| 809 | |||
| 810 | # Check the args | ||
| 811 | $self->_check_args($args, $definition); | ||
| 812 | |||
| 813 | # Route the request | ||
| 814 | $self->_router_request( | ||
| 815 | { | ||
| 816 | location => $self->TEMPLATE_LOCATION, | ||
| 817 | action => $self->TEMPLATE_ACTION, | ||
| 818 | method => 'addThresholdToGraph', | ||
| 819 | data => [$args], | ||
| 820 | } | ||
| 821 | ); | ||
| 822 | } # END template_addThresholdToGraph | ||
| 823 | |||
| 824 | #====================================================================== | ||
| 825 | # template_addCustomToGraph | ||
| 826 | #====================================================================== | ||
| 827 | sub template_addCustomToGraph { | ||
| 828 | my ($self, $args) = @_; | ||
| 829 | $args = {} if !$args; | ||
| 830 | |||
| 831 | # Argument definition | ||
| 832 | my $definition = { | ||
| 833 | required => ['graphUid', 'customId', 'customType'], | ||
| 834 | }; | ||
| 835 | |||
| 836 | # Check the args | ||
| 837 | $self->_check_args($args, $definition); | ||
| 838 | |||
| 839 | # Route the request | ||
| 840 | $self->_router_request( | ||
| 841 | { | ||
| 842 | location => $self->TEMPLATE_LOCATION, | ||
| 843 | action => $self->TEMPLATE_ACTION, | ||
| 844 | method => 'addCustomToGraph', | ||
| 845 | data => [$args], | ||
| 846 | } | ||
| 847 | ); | ||
| 848 | } # END template_addCustomToGraph | ||
| 849 | |||
| 850 | #====================================================================== | ||
| 851 | # template_getGraphInstructionTypes | ||
| 852 | #====================================================================== | ||
| 853 | sub template_getGraphInstructionTypes { | ||
| 854 | my ($self, $args) = @_; | ||
| 855 | $args = {} if !$args; | ||
| 856 | |||
| 857 | # Argument definition | ||
| 858 | my $definition = { | ||
| 859 | defaults => { | ||
| 860 | query => '', | ||
| 861 | } | ||
| 862 | }; | ||
| 863 | |||
| 864 | # Check the args | ||
| 865 | $self->_check_args($args, $definition); | ||
| 866 | |||
| 867 | # Route the request | ||
| 868 | $self->_router_request( | ||
| 869 | { | ||
| 870 | location => $self->TEMPLATE_LOCATION, | ||
| 871 | action => $self->TEMPLATE_ACTION, | ||
| 872 | method => 'getGraphInstructionTypes', | ||
| 873 | data => [$args], | ||
| 874 | } | ||
| 875 | ); | ||
| 876 | } # END template_getGraphInstructionTypes | ||
| 877 | |||
| 878 | #====================================================================== | ||
| 879 | # template_setGraphPointSequence | ||
| 880 | #====================================================================== | ||
| 881 | sub template_setGraphPointSequence { | ||
| 882 | my ($self, $args) = @_; | ||
| 883 | $args = {} if !$args; | ||
| 884 | |||
| 885 | # Argument definition | ||
| 886 | my $definition = { | ||
| 887 | required => ['uids'], | ||
| 888 | }; | ||
| 889 | |||
| 890 | # Check the args | ||
| 891 | $self->_check_args($args, $definition); | ||
| 892 | |||
| 893 | # Route the request | ||
| 894 | $self->_router_request( | ||
| 895 | { | ||
| 896 | location => $self->TEMPLATE_LOCATION, | ||
| 897 | action => $self->TEMPLATE_ACTION, | ||
| 898 | method => 'setGraphPointSequence', | ||
| 899 | data => [$args], | ||
| 900 | } | ||
| 901 | ); | ||
| 902 | } # END template_setGraphPointSequence | ||
| 903 | |||
| 904 | #====================================================================== | ||
| 905 | # template_getGraphDefinition | ||
| 906 | #====================================================================== | ||
| 907 | sub template_getGraphDefinition { | ||
| 908 | my ($self, $args) = @_; | ||
| 909 | $args = {} if !$args; | ||
| 910 | |||
| 911 | # Argument definition | ||
| 912 | my $definition = { | ||
| 913 | required => ['uid'], | ||
| 914 | }; | ||
| 915 | |||
| 916 | # Check the args | ||
| 917 | $self->_check_args($args, $definition); | ||
| 918 | |||
| 919 | # Route the request | ||
| 920 | $self->_router_request( | ||
| 921 | { | ||
| 922 | location => $self->TEMPLATE_LOCATION, | ||
| 923 | action => $self->TEMPLATE_ACTION, | ||
| 924 | method => 'getGraphDefinition', | ||
| 925 | data => [$args], | ||
| 926 | } | ||
| 927 | ); | ||
| 928 | } # END template_getGraphDefinition | ||
| 929 | |||
| 930 | #====================================================================== | ||
| 931 | # template_setGraphDefinition | ||
| 932 | #====================================================================== | ||
| 933 | sub template_setGraphDefinition { | ||
| 934 | my ($self, $args) = @_; | ||
| 935 | $args = {} if !$args; | ||
| 936 | |||
| 937 | # Argument definition | ||
| 938 | my $definition = { | ||
| 939 | required => ['uid'], | ||
| 940 | }; | ||
| 941 | |||
| 942 | # Check the args | ||
| 943 | $self->_check_args($args, $definition); | ||
| 944 | |||
| 945 | # Route the request | ||
| 946 | $self->_router_request( | ||
| 947 | { | ||
| 948 | location => $self->TEMPLATE_LOCATION, | ||
| 949 | action => $self->TEMPLATE_ACTION, | ||
| 950 | method => 'setGraphDefinition', | ||
| 951 | data => [$args], | ||
| 952 | } | ||
| 953 | ); | ||
| 954 | } # END template_setGraphDefinition | ||
| 955 | |||
| 956 | #====================================================================== | ||
| 957 | # template_setGraphDefinitionSequence | ||
| 958 | #====================================================================== | ||
| 959 | sub template_setGraphDefinitionSequence { | ||
| 960 | my ($self, $args) = @_; | ||
| 961 | $args = {} if !$args; | ||
| 962 | |||
| 963 | # Argument definition | ||
| 964 | my $definition = { | ||
| 965 | required => ['uids'], | ||
| 966 | }; | ||
| 967 | |||
| 968 | # Check the args | ||
| 969 | $self->_check_args($args, $definition); | ||
| 970 | |||
| 971 | # Route the request | ||
| 972 | $self->_router_request( | ||
| 973 | { | ||
| 974 | location => $self->TEMPLATE_LOCATION, | ||
| 975 | action => $self->TEMPLATE_ACTION, | ||
| 976 | method => 'setGraphDefinitionSequence', | ||
| 977 | data => [$args], | ||
| 978 | } | ||
| 979 | ); | ||
| 980 | } # END template_setGraphDefinitionSequence | ||
| 981 | |||
| 982 | #************************************************************************** | ||
| 983 | # Package end | ||
| 984 | #************************************************************************** | ||
| 985 | no Moose; | ||
| 986 | |||
| 987 | 1; | ||
| 988 | |||
| 989 | __END__ |