| 1 | package Zenoss::Router::Process; | ||
| 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 'PROCESS_LOCATION' => ( | ||
| 13 | is => 'ro', | ||
| 14 | isa => 'Str', | ||
| 15 | default => 'zport/dmd/process_router', | ||
| 16 | init_arg => undef, | ||
| 17 | ); | ||
| 18 | |||
| 19 | has 'PROCESS_ACTION' => ( | ||
| 20 | is => 'ro', | ||
| 21 | isa => 'Str', | ||
| 22 | default => 'ProcessRouter', | ||
| 23 | init_arg => undef, | ||
| 24 | ); | ||
| 25 | |||
| 26 | #************************************************************************** | ||
| 27 | # Public Functions | ||
| 28 | #************************************************************************** | ||
| 29 | #====================================================================== | ||
| 30 | # process_getTree | ||
| 31 | #====================================================================== | ||
| 32 | sub process_getTree { | ||
| 33 | my ($self, $args) = @_; | ||
| 34 | $args = {} if !$args; | ||
| 35 | |||
| 36 | # Argument definition | ||
| 37 | my $definition = { | ||
| 38 | required => ['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->PROCESS_LOCATION, | ||
| 48 | action => $self->PROCESS_ACTION, | ||
| 49 | method => 'getTree', | ||
| 50 | data => [$args], | ||
| 51 | } | ||
| 52 | ); | ||
| 53 | } # END process_getTree | ||
| 54 | |||
| 55 | #====================================================================== | ||
| 56 | # process_moveProcess | ||
| 57 | #====================================================================== | ||
| 58 | sub process_moveProcess { | ||
| 59 | my ($self, $args) = @_; | ||
| 60 | $args = {} if !$args; | ||
| 61 | |||
| 62 | # Argument definition | ||
| 63 | my $definition = { | ||
| 64 | required => ['uid', 'targetUid'], | ||
| 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->PROCESS_LOCATION, | ||
| 74 | action => $self->PROCESS_ACTION, | ||
| 75 | method => 'moveProcess', | ||
| 76 | data => [$args], | ||
| 77 | } | ||
| 78 | ); | ||
| 79 | } # END process_moveProcess | ||
| 80 | |||
| 81 | #====================================================================== | ||
| 82 | # process_getInfo | ||
| 83 | #====================================================================== | ||
| 84 | sub process_getInfo { | ||
| 85 | my ($self, $args) = @_; | ||
| 86 | $args = {} if !$args; | ||
| 87 | |||
| 88 | # Argument definition | ||
| 89 | my $definition = { | ||
| 90 | required => ['uid'], | ||
| 91 | }; | ||
| 92 | |||
| 93 | # Check the args | ||
| 94 | $self->_check_args($args, $definition); | ||
| 95 | |||
| 96 | # Route the request | ||
| 97 | $self->_router_request( | ||
| 98 | { | ||
| 99 | location => $self->PROCESS_LOCATION, | ||
| 100 | action => $self->PROCESS_ACTION, | ||
| 101 | method => 'getInfo', | ||
| 102 | data => [$args], | ||
| 103 | } | ||
| 104 | ); | ||
| 105 | } # END process_getInfo | ||
| 106 | |||
| 107 | #====================================================================== | ||
| 108 | # process_setInfo | ||
| 109 | #====================================================================== | ||
| 110 | sub process_setInfo { | ||
| 111 | my ($self, $args) = @_; | ||
| 112 | $args = {} if !$args; | ||
| 113 | |||
| 114 | # Argument definition | ||
| 115 | my $definition = { | ||
| 116 | required => ['uid'], | ||
| 117 | }; | ||
| 118 | |||
| 119 | # Check the args | ||
| 120 | $self->_check_args($args, $definition); | ||
| 121 | |||
| 122 | # Route the request | ||
| 123 | $self->_router_request( | ||
| 124 | { | ||
| 125 | location => $self->PROCESS_LOCATION, | ||
| 126 | action => $self->PROCESS_ACTION, | ||
| 127 | method => 'setInfo', | ||
| 128 | data => [$args], | ||
| 129 | } | ||
| 130 | ); | ||
| 131 | } # END process_getInfo | ||
| 132 | |||
| 133 | #====================================================================== | ||
| 134 | # process_getInstances | ||
| 135 | #====================================================================== | ||
| 136 | sub process_getInstances { | ||
| 137 | my ($self, $args) = @_; | ||
| 138 | $args = {} if !$args; | ||
| 139 | |||
| 140 | # Argument definition | ||
| 141 | my $definition = { | ||
| 142 | defaults => { | ||
| 143 | start => 0, | ||
| 144 | limit => 50, | ||
| 145 | sort => 'name', | ||
| 146 | dir => 'ASC', | ||
| 147 | }, | ||
| 148 | required => ['uid'], | ||
| 149 | }; | ||
| 150 | |||
| 151 | # Check the args | ||
| 152 | $self->_check_args($args, $definition); | ||
| 153 | |||
| 154 | # Route the request | ||
| 155 | $self->_router_request( | ||
| 156 | { | ||
| 157 | location => $self->PROCESS_LOCATION, | ||
| 158 | action => $self->PROCESS_ACTION, | ||
| 159 | method => 'getInstances', | ||
| 160 | data => [$args], | ||
| 161 | } | ||
| 162 | ); | ||
| 163 | } # END process_getInstances | ||
| 164 | |||
| 165 | #====================================================================== | ||
| 166 | # process_getSequence | ||
| 167 | #====================================================================== | ||
| 168 | sub process_getSequence { | ||
| 169 | my ($self, $args) = @_; | ||
| 170 | $args = {} if !$args; | ||
| 171 | |||
| 172 | # Argument definition | ||
| 173 | my $definition = {}; | ||
| 174 | |||
| 175 | # Check the args | ||
| 176 | $self->_check_args($args, $definition); | ||
| 177 | |||
| 178 | # Route the request | ||
| 179 | $self->_router_request( | ||
| 180 | { | ||
| 181 | location => $self->PROCESS_LOCATION, | ||
| 182 | action => $self->PROCESS_ACTION, | ||
| 183 | method => 'getSequence', | ||
| 184 | data => [$args], | ||
| 185 | } | ||
| 186 | ); | ||
| 187 | } # END process_getSequence | ||
| 188 | |||
| 189 | #====================================================================== | ||
| 190 | # process_setSequence | ||
| 191 | #====================================================================== | ||
| 192 | sub process_setSequence { | ||
| 193 | my ($self, $args) = @_; | ||
| 194 | $args = {} if !$args; | ||
| 195 | |||
| 196 | # Argument definition | ||
| 197 | my $definition = { | ||
| 198 | required => ['uids'] | ||
| 199 | }; | ||
| 200 | |||
| 201 | # Check the args | ||
| 202 | $self->_check_args($args, $definition); | ||
| 203 | |||
| 204 | # Route the request | ||
| 205 | $self->_router_request( | ||
| 206 | { | ||
| 207 | location => $self->PROCESS_LOCATION, | ||
| 208 | action => $self->PROCESS_ACTION, | ||
| 209 | method => 'setSequence', | ||
| 210 | data => [$args], | ||
| 211 | } | ||
| 212 | ); | ||
| 213 | } # END process_setSequence | ||
| 214 | |||
| 215 | #************************************************************************** | ||
| 216 | # Package end | ||
| 217 | #************************************************************************** | ||
| 218 | no Moose; | ||
| 219 | |||
| 220 | 1; | ||
| 221 | |||
| 222 | __END__ |