| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package ArangoDB2::Admin; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 20 |  |  | 20 |  | 85 | use strict; | 
|  | 20 |  |  |  |  | 30 |  | 
|  | 20 |  |  |  |  | 644 |  | 
| 4 | 20 |  |  | 20 |  | 84 | use warnings; | 
|  | 20 |  |  |  |  | 23 |  | 
|  | 20 |  |  |  |  | 581 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 20 |  |  |  |  | 1717 | use base qw( | 
| 7 |  |  |  |  |  |  | ArangoDB2::Base | 
| 8 | 20 |  |  | 20 |  | 93 | ); | 
|  | 20 |  |  |  |  | 24 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 20 |  |  | 20 |  | 95 | use JSON::XS; | 
|  | 20 |  |  |  |  | 24 |  | 
|  | 20 |  |  |  |  | 16208 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | my $JSON = JSON::XS->new->utf8; | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | ############### | 
| 17 |  |  |  |  |  |  | # API METHODS # | 
| 18 |  |  |  |  |  |  | ############### | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | # echo | 
| 21 |  |  |  |  |  |  | # | 
| 22 |  |  |  |  |  |  | # GET /_admin/echo | 
| 23 |  |  |  |  |  |  | sub echo | 
| 24 |  |  |  |  |  |  | { | 
| 25 | 0 |  |  | 0 | 1 |  | my($self) = @_; | 
| 26 |  |  |  |  |  |  | # make request | 
| 27 | 0 |  |  |  |  |  | return $self->arango->http->get('/_admin/echo'); | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | # execute | 
| 31 |  |  |  |  |  |  | # | 
| 32 |  |  |  |  |  |  | # POST /_admin/execute | 
| 33 |  |  |  |  |  |  | sub execute | 
| 34 |  |  |  |  |  |  | { | 
| 35 | 0 |  |  | 0 | 1 |  | my($self, $args) = @_; | 
| 36 |  |  |  |  |  |  | # process args | 
| 37 | 0 |  |  |  |  |  | $args = $self->_build_args($args, ['program','returnAsJSON']); | 
| 38 | 0 |  |  |  |  |  | my $program = delete $args->{program}; | 
| 39 |  |  |  |  |  |  | # make request | 
| 40 | 0 |  |  |  |  |  | return $self->arango->http->post( | 
| 41 |  |  |  |  |  |  | '/_admin/execute', | 
| 42 |  |  |  |  |  |  | $args, | 
| 43 |  |  |  |  |  |  | $program, | 
| 44 |  |  |  |  |  |  | ); | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | # log | 
| 48 |  |  |  |  |  |  | # | 
| 49 |  |  |  |  |  |  | # GET /_admin/log | 
| 50 |  |  |  |  |  |  | sub log | 
| 51 |  |  |  |  |  |  | { | 
| 52 | 0 |  |  | 0 | 1 |  | my($self, $args) = @_; | 
| 53 |  |  |  |  |  |  | # process args | 
| 54 | 0 |  |  |  |  |  | $args = $self->_build_args($args, [qw( | 
| 55 |  |  |  |  |  |  | upto level start size offset search sort | 
| 56 |  |  |  |  |  |  | )]); | 
| 57 |  |  |  |  |  |  | # make request | 
| 58 | 0 |  |  |  |  |  | return $self->arango->http->get('/_admin/log', $args); | 
| 59 |  |  |  |  |  |  | } | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | # routingReload | 
| 62 |  |  |  |  |  |  | # | 
| 63 |  |  |  |  |  |  | # POST /_admin/routing/reload | 
| 64 |  |  |  |  |  |  | sub routingReload | 
| 65 |  |  |  |  |  |  | { | 
| 66 | 0 |  |  | 0 | 1 |  | my($self) = @_; | 
| 67 |  |  |  |  |  |  | # make request | 
| 68 | 0 |  |  |  |  |  | return $self->arango->http->post('/_admin/routing/reload'); | 
| 69 |  |  |  |  |  |  | } | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | # serverRole | 
| 72 |  |  |  |  |  |  | # | 
| 73 |  |  |  |  |  |  | # GET /_admin/server/role | 
| 74 |  |  |  |  |  |  | sub serverRole | 
| 75 |  |  |  |  |  |  | { | 
| 76 | 0 |  |  | 0 | 1 |  | my($self) = @_; | 
| 77 |  |  |  |  |  |  | # make request | 
| 78 | 0 |  |  |  |  |  | return $self->arango->http->get('/_admin/server/role'); | 
| 79 |  |  |  |  |  |  | } | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | # shutdown | 
| 82 |  |  |  |  |  |  | # | 
| 83 |  |  |  |  |  |  | # GET /_admin/shutdown | 
| 84 |  |  |  |  |  |  | sub shutdown | 
| 85 |  |  |  |  |  |  | { | 
| 86 | 0 |  |  | 0 | 1 |  | my($self) = @_; | 
| 87 |  |  |  |  |  |  | # make request | 
| 88 | 0 |  |  |  |  |  | return $self->arango->http->get('/_admin/shutdown'); | 
| 89 |  |  |  |  |  |  | } | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | # statistics | 
| 92 |  |  |  |  |  |  | # | 
| 93 |  |  |  |  |  |  | # GET /_admin/statistics | 
| 94 |  |  |  |  |  |  | sub statistics | 
| 95 |  |  |  |  |  |  | { | 
| 96 | 0 |  |  | 0 | 1 |  | my($self) = @_; | 
| 97 |  |  |  |  |  |  | # make request | 
| 98 | 0 |  |  |  |  |  | return $self->arango->http->get('/_admin/statistics'); | 
| 99 |  |  |  |  |  |  | } | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | # statisticsDescription | 
| 102 |  |  |  |  |  |  | # | 
| 103 |  |  |  |  |  |  | # GET /_admin/statistics-description | 
| 104 |  |  |  |  |  |  | sub statisticsDescription | 
| 105 |  |  |  |  |  |  | { | 
| 106 | 0 |  |  | 0 | 1 |  | my($self) = @_; | 
| 107 |  |  |  |  |  |  | # make request | 
| 108 | 0 |  |  |  |  |  | return $self->arango->http->get('/_admin/statistics-description'); | 
| 109 |  |  |  |  |  |  | } | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | # test | 
| 112 |  |  |  |  |  |  | # | 
| 113 |  |  |  |  |  |  | # POST /_admin/test | 
| 114 |  |  |  |  |  |  | sub test | 
| 115 |  |  |  |  |  |  | { | 
| 116 | 0 |  |  | 0 | 1 |  | my($self, $args) = @_; | 
| 117 |  |  |  |  |  |  | # process args | 
| 118 | 0 |  |  |  |  |  | $args = $self->_build_args($args, ['tests']); | 
| 119 |  |  |  |  |  |  | # make request | 
| 120 | 0 |  |  |  |  |  | return $self->arango->http->post('/_admin/test', $args->{tests}); | 
| 121 |  |  |  |  |  |  | } | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | # time | 
| 124 |  |  |  |  |  |  | # | 
| 125 |  |  |  |  |  |  | # GET /_admin/time | 
| 126 |  |  |  |  |  |  | sub time | 
| 127 |  |  |  |  |  |  | { | 
| 128 | 0 |  |  | 0 | 1 |  | my($self) = @_; | 
| 129 |  |  |  |  |  |  | # make request | 
| 130 | 0 |  |  |  |  |  | return $self->arango->http->get('/_admin/time'); | 
| 131 |  |  |  |  |  |  | } | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | # walFlush | 
| 134 |  |  |  |  |  |  | # | 
| 135 |  |  |  |  |  |  | # PUT /_admin/wal/flush | 
| 136 |  |  |  |  |  |  | sub walFlush | 
| 137 |  |  |  |  |  |  | { | 
| 138 | 0 |  |  | 0 | 1 |  | my($self, $args) = @_; | 
| 139 |  |  |  |  |  |  | # process args | 
| 140 | 0 |  |  |  |  |  | $args = $self->_build_args($args, ['waitForSync', 'waitForCollector']); | 
| 141 |  |  |  |  |  |  | # make request | 
| 142 | 0 |  |  |  |  |  | return $self->arango->http->put('/_admin/wal/flush', $args); | 
| 143 |  |  |  |  |  |  | } | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | # walProperties | 
| 146 |  |  |  |  |  |  | # | 
| 147 |  |  |  |  |  |  | # GET /_admin/wal/properties | 
| 148 |  |  |  |  |  |  | # PUT /_admin/wal/properties | 
| 149 |  |  |  |  |  |  | sub walProperties | 
| 150 |  |  |  |  |  |  | { | 
| 151 | 0 |  |  | 0 | 1 |  | my($self, $args) = @_; | 
| 152 |  |  |  |  |  |  | # process args | 
| 153 | 0 |  |  |  |  |  | $args = $self->_build_args($args, [qw( | 
| 154 |  |  |  |  |  |  | allowOversizeEntries logfileSize historicLogfiles | 
| 155 |  |  |  |  |  |  | reserveLogfiles throttleWait throttleWhenPending | 
| 156 |  |  |  |  |  |  | )]); | 
| 157 |  |  |  |  |  |  | # request path | 
| 158 | 0 |  |  |  |  |  | my $path = '/_admin/wal/properties'; | 
| 159 |  |  |  |  |  |  | # make request | 
| 160 | 0 | 0 |  |  |  |  | return $args | 
| 161 |  |  |  |  |  |  | ? $self->arango->http->put($path, undef, $JSON->encode($args)) | 
| 162 |  |  |  |  |  |  | : $self->arango->http->get($path); | 
| 163 |  |  |  |  |  |  | } | 
| 164 |  |  |  |  |  |  |  | 
| 165 |  |  |  |  |  |  | #################### | 
| 166 |  |  |  |  |  |  | # PROPERTY METHODS # | 
| 167 |  |  |  |  |  |  | #################### | 
| 168 |  |  |  |  |  |  |  | 
| 169 | 0 |  |  | 0 | 1 |  | sub allowOversizeEntries { shift->_get_set_bool('allowOversizeEntries', @_) } | 
| 170 | 0 |  |  | 0 | 1 |  | sub level { shift->_get_set('level', @_) } | 
| 171 | 0 |  |  | 0 | 1 |  | sub logfileSize { shift->_get_set('logfileSize', @_) } | 
| 172 | 0 |  |  | 0 | 1 |  | sub historicLogfiles { shift->_get_set('historicLogfiles', @_) } | 
| 173 | 0 |  |  | 0 | 1 |  | sub offset { shift->_get_set('offset', @_) } | 
| 174 | 0 |  |  | 0 | 1 |  | sub program { shift->_get_set('program', @_) } | 
| 175 | 0 |  |  | 0 | 1 |  | sub reserveLogfiles { shift->_get_set('reserveLogfiles', @_) } | 
| 176 | 0 |  |  | 0 | 1 |  | sub returnAsJSON { shift->_get_set_bool('returnAsJSON', @_) } | 
| 177 | 0 |  |  | 0 | 1 |  | sub search { shift->_get_set('search', @_) } | 
| 178 | 0 |  |  | 0 | 1 |  | sub size { shift->_get_set('size', @_) } | 
| 179 | 0 |  |  | 0 | 1 |  | sub sort { shift->_get_set('sort', @_) } | 
| 180 | 0 |  |  | 0 | 1 |  | sub start { shift->_get_set('start', @_) } | 
| 181 | 0 |  |  | 0 | 1 |  | sub tests { shift->_get_set('tests', @_) } | 
| 182 | 0 |  |  | 0 | 1 |  | sub throttleWait { shift->_get_set('throttleWait', @_) } | 
| 183 | 0 |  |  | 0 | 1 |  | sub throttleWhenPending { shift->_get_set('throttleWhenPending', @_) } | 
| 184 | 0 |  |  | 0 | 1 |  | sub upto { shift->_get_set('upto', @_) } | 
| 185 | 0 |  |  | 0 | 1 |  | sub waitForCollector { shift->_get_set_bool('waitForCollector', @_) } | 
| 186 | 0 |  |  | 0 | 1 |  | sub waitForSync { shift->_get_set_bool('waitForSync', @_) } | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | 1; | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | __END__ |