| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
2
|
|
|
|
|
|
|
# vim: ai ts=4 sts=4 et sw=4 |
|
3
|
|
|
|
|
|
|
# Net::BaruwaAPI Perl bindings for the Baruwa REST API |
|
4
|
|
|
|
|
|
|
# Copyright (C) 2015-2019 Andrew Colin Kissa |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public |
|
7
|
|
|
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
8
|
|
|
|
|
|
|
# You can obtain one at http://mozilla.org/MPL/2.0/. |
|
9
|
|
|
|
|
|
|
package Net::BaruwaAPI; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# use utf8; |
|
12
|
17
|
|
|
17
|
|
1131714
|
use feature 'state'; |
|
|
17
|
|
|
|
|
174
|
|
|
|
17
|
|
|
|
|
1959
|
|
|
13
|
17
|
|
|
17
|
|
7074
|
use JSON::MaybeXS; |
|
|
17
|
|
|
|
|
121296
|
|
|
|
17
|
|
|
|
|
915
|
|
|
14
|
17
|
|
|
17
|
|
7512
|
use HTTP::Request; |
|
|
17
|
|
|
|
|
347202
|
|
|
|
17
|
|
|
|
|
890
|
|
|
15
|
17
|
|
|
17
|
|
147
|
use Carp qw/croak/; |
|
|
17
|
|
|
|
|
34
|
|
|
|
17
|
|
|
|
|
1139
|
|
|
16
|
17
|
|
|
17
|
|
11431
|
use LWP::UserAgent; |
|
|
17
|
|
|
|
|
406456
|
|
|
|
17
|
|
|
|
|
693
|
|
|
17
|
17
|
|
|
17
|
|
9026
|
use Type::Params qw/compile/; |
|
|
17
|
|
|
|
|
1359522
|
|
|
|
17
|
|
|
|
|
174
|
|
|
18
|
17
|
|
|
17
|
|
4175
|
use Types::Standard qw(Str InstanceOf Object Int Bool Dict Num ArrayRef); |
|
|
17
|
|
|
|
|
46
|
|
|
|
17
|
|
|
|
|
78
|
|
|
19
|
17
|
|
|
17
|
|
30244
|
use Moo; |
|
|
17
|
|
|
|
|
166646
|
|
|
|
17
|
|
|
|
|
99
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
|
22
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:DATOPDOG'; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $api_path = '/api/v1'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'api_url' => (is => 'ro', isa => Str, predicate => 'has_api_url', required => 1); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has 'api_token' => (is => 'ro', isa => Str, predicate => 'has_api_token', required => 1); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has 'ua' => ( |
|
31
|
|
|
|
|
|
|
isa => InstanceOf['LWP::UserAgent'], |
|
32
|
|
|
|
|
|
|
is => 'ro', |
|
33
|
|
|
|
|
|
|
lazy => 1, |
|
34
|
|
|
|
|
|
|
default => sub { |
|
35
|
|
|
|
|
|
|
LWP::UserAgent->new( |
|
36
|
|
|
|
|
|
|
agent => "BaruwaAPI-Perl", |
|
37
|
|
|
|
|
|
|
cookie_jar => {}, |
|
38
|
|
|
|
|
|
|
keep_alive => 4, |
|
39
|
|
|
|
|
|
|
timeout => 60, |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
}, |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has 'json' => ( |
|
45
|
|
|
|
|
|
|
is => 'ro', |
|
46
|
|
|
|
|
|
|
isa => Object, |
|
47
|
|
|
|
|
|
|
lazy => 1, |
|
48
|
|
|
|
|
|
|
default => sub { |
|
49
|
|
|
|
|
|
|
return JSON::MaybeXS->new( utf8 => 1 ); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _call { |
|
54
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
|
55
|
0
|
|
|
|
|
0
|
my $request_method = shift @_; |
|
56
|
0
|
|
|
|
|
0
|
my $url = shift @_; |
|
57
|
0
|
|
|
|
|
0
|
my $data = shift @_; |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
0
|
my $ua = $self->ua; |
|
60
|
0
|
|
|
|
|
0
|
$ua->default_header('Authorization', "Bearer " . $self->api_token); |
|
61
|
0
|
|
|
|
|
0
|
$url = $self->api_url . $url; |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
0
|
my $req = HTTP::Request->new( $request_method, $url ); |
|
64
|
0
|
|
|
|
|
0
|
$req->accept_decodable; |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
0
|
if ($data) { |
|
67
|
0
|
|
|
|
|
0
|
$req->content($data); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
0
|
|
|
|
|
0
|
$req->header( 'Content-Length' => length $req->content ); |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
0
|
my $res = $ua->request($req); |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
0
|
0
|
|
|
0
|
if ($res->header('Content-Type') and $res->header('Content-Type') =~ 'application/json') { |
|
74
|
0
|
|
|
|
|
0
|
my $json = $res->decoded_content; |
|
75
|
0
|
|
|
|
|
0
|
$data = eval { $self->json->decode($json) }; |
|
|
0
|
|
|
|
|
0
|
|
|
76
|
0
|
0
|
|
|
|
0
|
unless ($data) { |
|
77
|
0
|
0
|
|
|
|
0
|
die unless $res->is_error; |
|
78
|
0
|
|
|
|
|
0
|
$data = { code => $res->code, message => $res->message }; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
} else { |
|
81
|
0
|
|
|
|
|
0
|
$data = { code => $res->code, message => $res->message }; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
0
|
0
|
0
|
|
|
0
|
if (not $res->is_success and ref $data eq 'HASH' and exists $data->{message}) { |
|
|
|
|
0
|
|
|
|
|
|
85
|
0
|
|
|
|
|
0
|
my $message = $data->{message}; |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
0
|
|
|
|
0
|
if (exists $data->{errors}) { |
|
88
|
0
|
|
|
|
|
0
|
$message .= ': '.join(' - ', map { $_->{message} } grep { exists $_->{message} } @{ $data->{errors} }); |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
89
|
|
|
|
|
|
|
} |
|
90
|
0
|
|
|
|
|
0
|
croak $message; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
0
|
|
|
|
|
0
|
return $data; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub get_users { |
|
97
|
1
|
|
|
1
|
1
|
2129
|
state $check = compile(Object); |
|
98
|
1
|
|
|
|
|
666
|
my ($self) = $check->(@_); |
|
99
|
1
|
|
|
|
|
13
|
return $self->_call('GET', "$api_path/users"); |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub get_user { |
|
103
|
1
|
|
|
1
|
1
|
1161
|
state $check = compile(Object, Int); |
|
104
|
1
|
|
|
|
|
1021
|
my ($self, $userid) = $check->(@_); |
|
105
|
1
|
|
|
|
|
20
|
return $self->_call('GET', "$api_path/users/$userid"); |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub create_user { |
|
109
|
1
|
|
|
1
|
1
|
4614
|
state $check = compile(Object, |
|
110
|
|
|
|
|
|
|
Dict[ |
|
111
|
|
|
|
|
|
|
username => Str, |
|
112
|
|
|
|
|
|
|
firstname => Str, |
|
113
|
|
|
|
|
|
|
lastname => Str, |
|
114
|
|
|
|
|
|
|
password1 => Str, |
|
115
|
|
|
|
|
|
|
password2 => Str, |
|
116
|
|
|
|
|
|
|
email => Str, |
|
117
|
|
|
|
|
|
|
timezone => Str, |
|
118
|
|
|
|
|
|
|
account_type => Int, |
|
119
|
|
|
|
|
|
|
domains => Int, |
|
120
|
|
|
|
|
|
|
active => Bool, |
|
121
|
|
|
|
|
|
|
send_report => Bool, |
|
122
|
|
|
|
|
|
|
spam_checks => Bool, |
|
123
|
|
|
|
|
|
|
low_score => Num, |
|
124
|
|
|
|
|
|
|
high_score => Num, |
|
125
|
|
|
|
|
|
|
block_macros => Bool, |
|
126
|
|
|
|
|
|
|
]); |
|
127
|
1
|
|
|
|
|
26918
|
my ($self, $data) = $check->(@_); |
|
128
|
1
|
|
|
|
|
235
|
return $self->_call('POST', "$api_path/users", $data); |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub update_user { |
|
132
|
1
|
|
|
1
|
1
|
1120
|
state $check = compile(Object, |
|
133
|
|
|
|
|
|
|
Dict[ |
|
134
|
|
|
|
|
|
|
username => Str, |
|
135
|
|
|
|
|
|
|
firstname => Str, |
|
136
|
|
|
|
|
|
|
lastname => Str, |
|
137
|
|
|
|
|
|
|
email => Str, |
|
138
|
|
|
|
|
|
|
timezone => Str, |
|
139
|
|
|
|
|
|
|
domains => Int, |
|
140
|
|
|
|
|
|
|
active => Bool, |
|
141
|
|
|
|
|
|
|
send_report => Bool, |
|
142
|
|
|
|
|
|
|
spam_checks => Bool, |
|
143
|
|
|
|
|
|
|
low_score => Num, |
|
144
|
|
|
|
|
|
|
high_score => Num, |
|
145
|
|
|
|
|
|
|
block_macros => Bool, |
|
146
|
|
|
|
|
|
|
]); |
|
147
|
1
|
|
|
|
|
18873
|
my ($self, $data) = $check->(@_); |
|
148
|
1
|
|
|
|
|
197
|
return $self->_call('PUT', "$api_path/users", $data); |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub delete_user { |
|
152
|
1
|
|
|
1
|
1
|
1232
|
state $check = compile(Object, |
|
153
|
|
|
|
|
|
|
Dict[ |
|
154
|
|
|
|
|
|
|
username => Str, |
|
155
|
|
|
|
|
|
|
firstname => Str, |
|
156
|
|
|
|
|
|
|
lastname => Str, |
|
157
|
|
|
|
|
|
|
email => Str, |
|
158
|
|
|
|
|
|
|
timezone => Str, |
|
159
|
|
|
|
|
|
|
domains => Int, |
|
160
|
|
|
|
|
|
|
active => Bool, |
|
161
|
|
|
|
|
|
|
send_report => Bool, |
|
162
|
|
|
|
|
|
|
spam_checks => Bool, |
|
163
|
|
|
|
|
|
|
low_score => Num, |
|
164
|
|
|
|
|
|
|
high_score => Num, |
|
165
|
|
|
|
|
|
|
block_macros => Bool, |
|
166
|
|
|
|
|
|
|
]); |
|
167
|
1
|
|
|
|
|
18509
|
my ($self, $data) = $check->(@_); |
|
168
|
|
|
|
|
|
|
# my ($self, $data) = @_; |
|
169
|
1
|
|
|
|
|
247
|
return $self->_call('DELETE', "$api_path/users", $data); |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub set_user_passwd { |
|
173
|
1
|
|
|
1
|
1
|
1361
|
state $check = compile(Object, Int, |
|
174
|
|
|
|
|
|
|
Dict[ |
|
175
|
|
|
|
|
|
|
password1 => Str, |
|
176
|
|
|
|
|
|
|
password2 => Str, |
|
177
|
|
|
|
|
|
|
]); |
|
178
|
1
|
|
|
|
|
5226
|
my ($self, $userid, $data) = $check->(@_); |
|
179
|
1
|
|
|
|
|
123
|
return $self->_call('POST', "$api_path/users/chpw/$userid"); |
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub get_aliases { |
|
183
|
1
|
|
|
1
|
1
|
4862
|
state $check = compile(Object, Int); |
|
184
|
1
|
|
|
|
|
1353
|
my ($self, $addressid) = $check->(@_); |
|
185
|
1
|
|
|
|
|
44
|
return $self->_call('GET', "$api_path/aliasaddresses/$addressid"); |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub create_alias { |
|
189
|
1
|
|
|
1
|
1
|
1353
|
state $check = compile(Object, Int, |
|
190
|
|
|
|
|
|
|
Dict[ |
|
191
|
|
|
|
|
|
|
address => Str, |
|
192
|
|
|
|
|
|
|
enabled => Bool, |
|
193
|
|
|
|
|
|
|
]); |
|
194
|
1
|
|
|
|
|
8657
|
my ($self, $userid, $data) = $check->(@_); |
|
195
|
1
|
|
|
|
|
121
|
return $self->_call('POST', "$api_path/aliasaddresses/$userid", $data); |
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub update_alias { |
|
199
|
1
|
|
|
1
|
1
|
1265
|
state $check = compile(Object, Int, |
|
200
|
|
|
|
|
|
|
Dict[ |
|
201
|
|
|
|
|
|
|
address => Str, |
|
202
|
|
|
|
|
|
|
enabled => Bool, |
|
203
|
|
|
|
|
|
|
]); |
|
204
|
1
|
|
|
|
|
4692
|
my ($self, $addressid, $data) = $check->(@_); |
|
205
|
1
|
|
|
|
|
118
|
return $self->_call('PUT', "$api_path/aliasaddresses/$addressid", $data); |
|
206
|
|
|
|
|
|
|
} |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub delete_alias { |
|
209
|
1
|
|
|
1
|
1
|
1203
|
state $check = compile(Object, Int, |
|
210
|
|
|
|
|
|
|
Dict[ |
|
211
|
|
|
|
|
|
|
address => Str, |
|
212
|
|
|
|
|
|
|
enabled => Bool, |
|
213
|
|
|
|
|
|
|
]); |
|
214
|
1
|
|
|
|
|
4642
|
my ($self, $addressid, $data) = $check->(@_); |
|
215
|
1
|
|
|
|
|
120
|
return $self->_call('DELETE', "$api_path/aliasaddresses/$addressid", $data); |
|
216
|
|
|
|
|
|
|
} |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub get_domains { |
|
219
|
1
|
|
|
1
|
1
|
4606
|
state $check = compile(Object); |
|
220
|
1
|
|
|
|
|
938
|
my ($self) = $check->(@_); |
|
221
|
1
|
|
|
|
|
23
|
return $self->_call('GET', "$api_path/domains"); |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
sub get_domain { |
|
225
|
1
|
|
|
1
|
1
|
1257
|
state $check = compile(Object, Int); |
|
226
|
1
|
|
|
|
|
1083
|
my ($self, $domainid) = $check->(@_); |
|
227
|
1
|
|
|
|
|
21
|
return $self->_call('GET', "$api_path/domains/$domainid"); |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
sub get_domain_by_name { |
|
231
|
1
|
|
|
1
|
0
|
1104
|
state $check = compile(Object, Str); |
|
232
|
1
|
|
|
|
|
1001
|
my ($self, $domain_name) = $check->(@_); |
|
233
|
1
|
|
|
|
|
21
|
return $self->_call('GET', "$api_path/domains/byname/$domain_name"); |
|
234
|
|
|
|
|
|
|
} |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
sub create_domain { |
|
237
|
1
|
|
|
1
|
1
|
1177
|
state $check = compile(Object, |
|
238
|
|
|
|
|
|
|
Dict[ |
|
239
|
|
|
|
|
|
|
name => Str, |
|
240
|
|
|
|
|
|
|
site_url => Str, |
|
241
|
|
|
|
|
|
|
status => Bool, |
|
242
|
|
|
|
|
|
|
accept_inbound => Bool, |
|
243
|
|
|
|
|
|
|
discard_mail => Bool, |
|
244
|
|
|
|
|
|
|
smtp_callout => Bool, |
|
245
|
|
|
|
|
|
|
ldap_callout => Bool, |
|
246
|
|
|
|
|
|
|
virus_checks => Bool, |
|
247
|
|
|
|
|
|
|
virus_checks_at_smtp => Bool, |
|
248
|
|
|
|
|
|
|
block_macros => Bool, |
|
249
|
|
|
|
|
|
|
spam_checks => Bool, |
|
250
|
|
|
|
|
|
|
spam_actions => Num, |
|
251
|
|
|
|
|
|
|
highspam_actions => Num, |
|
252
|
|
|
|
|
|
|
virus_actions => Num, |
|
253
|
|
|
|
|
|
|
low_score => Num, |
|
254
|
|
|
|
|
|
|
high_score => Num, |
|
255
|
|
|
|
|
|
|
message_size => Str, |
|
256
|
|
|
|
|
|
|
delivery_mode => Num, |
|
257
|
|
|
|
|
|
|
language => Str, |
|
258
|
|
|
|
|
|
|
timezone => Str, |
|
259
|
|
|
|
|
|
|
report_every => Num, |
|
260
|
|
|
|
|
|
|
organizations => Num |
|
261
|
|
|
|
|
|
|
]); |
|
262
|
1
|
|
|
|
|
36285
|
my ($self, $data) = $check->(@_); |
|
263
|
1
|
|
|
|
|
320
|
return $self->_call('POST', "$api_path/domains", $data); |
|
264
|
|
|
|
|
|
|
} |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
sub update_domain { |
|
267
|
1
|
|
|
1
|
1
|
1396
|
state $check = compile(Object, Int, |
|
268
|
|
|
|
|
|
|
Dict[ |
|
269
|
|
|
|
|
|
|
name => Str, |
|
270
|
|
|
|
|
|
|
site_url => Str, |
|
271
|
|
|
|
|
|
|
status => Bool, |
|
272
|
|
|
|
|
|
|
accept_inbound => Bool, |
|
273
|
|
|
|
|
|
|
discard_mail => Bool, |
|
274
|
|
|
|
|
|
|
smtp_callout => Bool, |
|
275
|
|
|
|
|
|
|
ldap_callout => Bool, |
|
276
|
|
|
|
|
|
|
virus_checks => Bool, |
|
277
|
|
|
|
|
|
|
virus_checks_at_smtp => Bool, |
|
278
|
|
|
|
|
|
|
block_macros => Bool, |
|
279
|
|
|
|
|
|
|
spam_checks => Bool, |
|
280
|
|
|
|
|
|
|
spam_actions => Num, |
|
281
|
|
|
|
|
|
|
highspam_actions => Num, |
|
282
|
|
|
|
|
|
|
virus_actions => Num, |
|
283
|
|
|
|
|
|
|
low_score => Num, |
|
284
|
|
|
|
|
|
|
high_score => Num, |
|
285
|
|
|
|
|
|
|
message_size => Str, |
|
286
|
|
|
|
|
|
|
delivery_mode => Num, |
|
287
|
|
|
|
|
|
|
language => Str, |
|
288
|
|
|
|
|
|
|
timezone => Str, |
|
289
|
|
|
|
|
|
|
report_every => Num, |
|
290
|
|
|
|
|
|
|
organizations => Num |
|
291
|
|
|
|
|
|
|
]); |
|
292
|
1
|
|
|
|
|
32712
|
my ($self, $domainid, $data) = $check->(@_); |
|
293
|
1
|
|
|
|
|
298
|
return $self->_call('PUT', "$api_path/domains/$domainid", $data); |
|
294
|
|
|
|
|
|
|
} |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
sub delete_domain { |
|
297
|
1
|
|
|
1
|
1
|
1435
|
state $check = compile(Object, Int); |
|
298
|
1
|
|
|
|
|
1004
|
my ($self, $domainid) = $check->(@_); |
|
299
|
1
|
|
|
|
|
21
|
return $self->_call('DELETE', "$api_path/domains/$domainid"); |
|
300
|
|
|
|
|
|
|
} |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
sub get_domainaliases { |
|
303
|
1
|
|
|
1
|
1
|
4593
|
state $check = compile(Object, Int); |
|
304
|
1
|
|
|
|
|
1309
|
my ($self, $domainid) = $check->(@_); |
|
305
|
1
|
|
|
|
|
33
|
return $self->_call('GET', "$api_path/domainaliases/$domainid"); |
|
306
|
|
|
|
|
|
|
} |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
sub get_domainalias { |
|
309
|
1
|
|
|
1
|
1
|
1218
|
state $check = compile(Object, Int, Int); |
|
310
|
1
|
|
|
|
|
1434
|
my ($self, $domainid, $aliasid) = $check->(@_); |
|
311
|
1
|
|
|
|
|
26
|
return $self->_call('GET', "$api_path/domainaliases/$domainid/$aliasid"); |
|
312
|
|
|
|
|
|
|
} |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
sub create_domainalias { |
|
315
|
1
|
|
|
1
|
1
|
1152
|
state $check = compile(Object, Int, |
|
316
|
|
|
|
|
|
|
Dict[ |
|
317
|
|
|
|
|
|
|
name => Str, |
|
318
|
|
|
|
|
|
|
status => Bool, |
|
319
|
|
|
|
|
|
|
accept_inbound => Bool, |
|
320
|
|
|
|
|
|
|
domain => Int |
|
321
|
|
|
|
|
|
|
]); |
|
322
|
1
|
|
|
|
|
11321
|
my ($self, $domainid, $data) = $check->(@_); |
|
323
|
1
|
|
|
|
|
142
|
return $self->_call('POST', "$api_path/domainaliases/$domainid", $data); |
|
324
|
|
|
|
|
|
|
} |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
sub update_domainalias { |
|
327
|
1
|
|
|
1
|
1
|
1328
|
state $check = compile(Object, Int, Int, |
|
328
|
|
|
|
|
|
|
Dict[ |
|
329
|
|
|
|
|
|
|
name => Str, |
|
330
|
|
|
|
|
|
|
status => Bool, |
|
331
|
|
|
|
|
|
|
accept_inbound => Bool, |
|
332
|
|
|
|
|
|
|
domain => Int |
|
333
|
|
|
|
|
|
|
]); |
|
334
|
1
|
|
|
|
|
8031
|
my ($self, $domainid, $aliasid, $data) = $check->(@_); |
|
335
|
1
|
|
|
|
|
146
|
return $self->_call('PUT', "$api_path/domainaliases/$domainid/$aliasid", $data); |
|
336
|
|
|
|
|
|
|
} |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
sub delete_domainalias { |
|
339
|
1
|
|
|
1
|
1
|
1278
|
state $check = compile(Object, Int, Int, |
|
340
|
|
|
|
|
|
|
Dict[ |
|
341
|
|
|
|
|
|
|
name => Str, |
|
342
|
|
|
|
|
|
|
status => Bool, |
|
343
|
|
|
|
|
|
|
accept_inbound => Bool, |
|
344
|
|
|
|
|
|
|
domain => Int |
|
345
|
|
|
|
|
|
|
]); |
|
346
|
1
|
|
|
|
|
8078
|
my ($self, $domainid, $aliasid, $data) = $check->(@_); |
|
347
|
1
|
|
|
|
|
145
|
return $self->_call('DELETE', "$api_path/domainaliases/$domainid/$aliasid", $data); |
|
348
|
|
|
|
|
|
|
} |
|
349
|
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
sub get_deliveryservers { |
|
351
|
1
|
|
|
1
|
1
|
4258
|
state $check = compile(Object, Int); |
|
352
|
1
|
|
|
|
|
1242
|
my ($self, $domainid) = $check->(@_); |
|
353
|
1
|
|
|
|
|
31
|
return $self->_call('GET', "$api_path/deliveryservers/$domainid"); |
|
354
|
|
|
|
|
|
|
} |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
sub get_deliveryserver { |
|
357
|
1
|
|
|
1
|
1
|
1186
|
state $check = compile(Object, Int, Int); |
|
358
|
1
|
|
|
|
|
1365
|
my ($self, $domainid, $serverid) = $check->(@_); |
|
359
|
1
|
|
|
|
|
25
|
return $self->_call('GET', "$api_path/deliveryservers/$domainid/$serverid"); |
|
360
|
|
|
|
|
|
|
} |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
sub create_deliveryserver { |
|
363
|
1
|
|
|
1
|
1
|
1532
|
state $check = compile(Object, Int, |
|
364
|
|
|
|
|
|
|
Dict[ |
|
365
|
|
|
|
|
|
|
address => Str, |
|
366
|
|
|
|
|
|
|
protocol => Int, |
|
367
|
|
|
|
|
|
|
port => Int, |
|
368
|
|
|
|
|
|
|
require_tls => Bool, |
|
369
|
|
|
|
|
|
|
verification_only => Bool, |
|
370
|
|
|
|
|
|
|
enabled => Bool |
|
371
|
|
|
|
|
|
|
]); |
|
372
|
1
|
|
|
|
|
13934
|
my ($self, $domainid, $data) = $check->(@_); |
|
373
|
1
|
|
|
|
|
143
|
return $self->_call('POST', "$api_path/deliveryservers/$domainid", $data); |
|
374
|
|
|
|
|
|
|
} |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sub update_deliveryserver { |
|
377
|
1
|
|
|
1
|
1
|
1511
|
state $check = compile(Object, Int, Int, |
|
378
|
|
|
|
|
|
|
Dict[ |
|
379
|
|
|
|
|
|
|
address => Str, |
|
380
|
|
|
|
|
|
|
protocol => Int, |
|
381
|
|
|
|
|
|
|
port => Int, |
|
382
|
|
|
|
|
|
|
require_tls => Bool, |
|
383
|
|
|
|
|
|
|
verification_only => Bool, |
|
384
|
|
|
|
|
|
|
enabled => Bool |
|
385
|
|
|
|
|
|
|
]); |
|
386
|
1
|
|
|
|
|
10816
|
my ($self, $domainid, $serverid, $data) = $check->(@_); |
|
387
|
1
|
|
|
|
|
155
|
return $self->_call('PUT', "$api_path/deliveryservers/$domainid/$serverid", $data); |
|
388
|
|
|
|
|
|
|
} |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
sub delete_deliveryserver { |
|
391
|
1
|
|
|
1
|
1
|
1522
|
state $check = compile(Object, Int, Int, |
|
392
|
|
|
|
|
|
|
Dict[ |
|
393
|
|
|
|
|
|
|
address => Str, |
|
394
|
|
|
|
|
|
|
protocol => Int, |
|
395
|
|
|
|
|
|
|
port => Int, |
|
396
|
|
|
|
|
|
|
require_tls => Bool, |
|
397
|
|
|
|
|
|
|
verification_only => Bool, |
|
398
|
|
|
|
|
|
|
enabled => Bool |
|
399
|
|
|
|
|
|
|
]); |
|
400
|
1
|
|
|
|
|
10787
|
my ($self, $domainid, $serverid, $data) = $check->(@_); |
|
401
|
1
|
|
|
|
|
149
|
return $self->_call('DELETE', "$api_path/deliveryservers/$domainid/$serverid", $data); |
|
402
|
|
|
|
|
|
|
} |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
sub get_user_deliveryservers { |
|
405
|
1
|
|
|
1
|
1
|
3885
|
state $check = compile(Object, Int); |
|
406
|
1
|
|
|
|
|
1047
|
my ($self, $domainid) = $check->(@_); |
|
407
|
1
|
|
|
|
|
24
|
return $self->_call('GET', "$api_path/userdeliveryservers/$domainid"); |
|
408
|
|
|
|
|
|
|
} |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
sub get_user_deliveryserver { |
|
411
|
1
|
|
|
1
|
1
|
1195
|
state $check = compile(Object, Int, Int); |
|
412
|
1
|
|
|
|
|
1156
|
my ($self, $domainid, $serverid) = $check->(@_); |
|
413
|
1
|
|
|
|
|
20
|
return $self->_call('GET', "$api_path/userdeliveryservers/$domainid/$serverid"); |
|
414
|
|
|
|
|
|
|
} |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
sub create_user_deliveryserver { |
|
417
|
1
|
|
|
1
|
1
|
1151
|
state $check = compile(Object, Int, |
|
418
|
|
|
|
|
|
|
Dict[ |
|
419
|
|
|
|
|
|
|
address => Str, |
|
420
|
|
|
|
|
|
|
protocol => Int, |
|
421
|
|
|
|
|
|
|
port => Int, |
|
422
|
|
|
|
|
|
|
require_tls => Bool, |
|
423
|
|
|
|
|
|
|
verification_only => Bool, |
|
424
|
|
|
|
|
|
|
enabled => Bool |
|
425
|
|
|
|
|
|
|
]); |
|
426
|
1
|
|
|
|
|
11230
|
my ($self, $domainid, $data) = $check->(@_); |
|
427
|
1
|
|
|
|
|
119
|
return $self->_call('POST', "$api_path/userdeliveryservers/$domainid", $data); |
|
428
|
|
|
|
|
|
|
} |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
sub update_user_deliveryserver { |
|
431
|
1
|
|
|
1
|
1
|
1188
|
state $check = compile(Object, Int, Int, |
|
432
|
|
|
|
|
|
|
Dict[ |
|
433
|
|
|
|
|
|
|
address => Str, |
|
434
|
|
|
|
|
|
|
protocol => Int, |
|
435
|
|
|
|
|
|
|
port => Int, |
|
436
|
|
|
|
|
|
|
require_tls => Bool, |
|
437
|
|
|
|
|
|
|
verification_only => Bool, |
|
438
|
|
|
|
|
|
|
enabled => Bool |
|
439
|
|
|
|
|
|
|
]); |
|
440
|
1
|
|
|
|
|
8728
|
my ($self, $domainid, $serverid, $data) = $check->(@_); |
|
441
|
1
|
|
|
|
|
123
|
return $self->_call('PUT', "$api_path/userdeliveryservers/$domainid/$serverid", $data); |
|
442
|
|
|
|
|
|
|
} |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
sub delete_user_deliveryserver { |
|
445
|
1
|
|
|
1
|
1
|
1222
|
state $check = compile(Object, Int, Int, |
|
446
|
|
|
|
|
|
|
Dict[ |
|
447
|
|
|
|
|
|
|
address => Str, |
|
448
|
|
|
|
|
|
|
protocol => Int, |
|
449
|
|
|
|
|
|
|
port => Int, |
|
450
|
|
|
|
|
|
|
require_tls => Bool, |
|
451
|
|
|
|
|
|
|
verification_only => Bool, |
|
452
|
|
|
|
|
|
|
enabled => Bool |
|
453
|
|
|
|
|
|
|
]); |
|
454
|
1
|
|
|
|
|
9125
|
my ($self, $domainid, $serverid, $data) = $check->(@_); |
|
455
|
1
|
|
|
|
|
129
|
return $self->_call('DELETE', "$api_path/userdeliveryservers/$domainid/$serverid", $data); |
|
456
|
|
|
|
|
|
|
} |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
sub get_domain_smarthosts { |
|
459
|
1
|
|
|
1
|
1
|
14881
|
state $check = compile(Object, Int); |
|
460
|
1
|
|
|
|
|
1336
|
my ($self, $domainid) = $check->(@_); |
|
461
|
1
|
|
|
|
|
35
|
return $self->_call('GET', "$api_path/domains/smarthosts/$domainid"); |
|
462
|
|
|
|
|
|
|
} |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
sub get_domain_smarthost { |
|
465
|
2
|
|
|
2
|
1
|
2310
|
state $check = compile(Object, Int, Int); |
|
466
|
2
|
|
|
|
|
1432
|
my ($self, $domainid, $serverid) = $check->(@_); |
|
467
|
2
|
|
|
|
|
48
|
return $self->_call('GET', "$api_path/domains/smarthosts/$domainid/$serverid"); |
|
468
|
|
|
|
|
|
|
} |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
sub create_domain_smarthost { |
|
471
|
1
|
|
|
1
|
1
|
1132
|
state $check = compile(Object, Int, |
|
472
|
|
|
|
|
|
|
Dict[ |
|
473
|
|
|
|
|
|
|
address => Str, |
|
474
|
|
|
|
|
|
|
username => Str, |
|
475
|
|
|
|
|
|
|
password => Str, |
|
476
|
|
|
|
|
|
|
port => Int, |
|
477
|
|
|
|
|
|
|
require_tls => Bool, |
|
478
|
|
|
|
|
|
|
enabled => Bool, |
|
479
|
|
|
|
|
|
|
description => Str, |
|
480
|
|
|
|
|
|
|
]); |
|
481
|
1
|
|
|
|
|
16733
|
my ($self, $domainid, $data) = $check->(@_); |
|
482
|
1
|
|
|
|
|
172
|
return $self->_call('POST', "$api_path/domains/smarthosts/$domainid", $data); |
|
483
|
|
|
|
|
|
|
} |
|
484
|
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
sub update_domain_smarthost { |
|
486
|
1
|
|
|
1
|
1
|
13166
|
state $check = compile(Object, Int, Int, |
|
487
|
|
|
|
|
|
|
Dict[ |
|
488
|
|
|
|
|
|
|
address => Str, |
|
489
|
|
|
|
|
|
|
username => Str, |
|
490
|
|
|
|
|
|
|
password => Str, |
|
491
|
|
|
|
|
|
|
port => Int, |
|
492
|
|
|
|
|
|
|
require_tls => Bool, |
|
493
|
|
|
|
|
|
|
enabled => Bool, |
|
494
|
|
|
|
|
|
|
description => Str, |
|
495
|
|
|
|
|
|
|
]); |
|
496
|
1
|
|
|
|
|
12812
|
my ($self, $domainid, $serverid, $data) = $check->(@_); |
|
497
|
1
|
|
|
|
|
179
|
return $self->_call('PUT', "$api_path/domains/smarthosts/$domainid/$serverid", $data); |
|
498
|
|
|
|
|
|
|
} |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
sub delete_domain_smarthost { |
|
501
|
1
|
|
|
1
|
1
|
1325
|
state $check = compile(Object, Int, Int, |
|
502
|
|
|
|
|
|
|
Dict[ |
|
503
|
|
|
|
|
|
|
address => Str, |
|
504
|
|
|
|
|
|
|
username => Str, |
|
505
|
|
|
|
|
|
|
password => Str, |
|
506
|
|
|
|
|
|
|
port => Int, |
|
507
|
|
|
|
|
|
|
require_tls => Bool, |
|
508
|
|
|
|
|
|
|
enabled => Bool, |
|
509
|
|
|
|
|
|
|
description => Str, |
|
510
|
|
|
|
|
|
|
]); |
|
511
|
1
|
|
|
|
|
13212
|
my ($self, $domainid, $serverid, $data) = $check->(@_); |
|
512
|
1
|
|
|
|
|
210
|
return $self->_call('DELETE', "$api_path/domains/smarthosts/$domainid/$serverid", $data); |
|
513
|
|
|
|
|
|
|
} |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
sub get_org_smarthosts { |
|
516
|
1
|
|
|
1
|
1
|
4150
|
state $check = compile(Object, Int); |
|
517
|
1
|
|
|
|
|
1044
|
my ($self, $orgid) = $check->(@_); |
|
518
|
1
|
|
|
|
|
24
|
return $self->_call('GET', "$api_path/organizations/smarthosts/$orgid"); |
|
519
|
|
|
|
|
|
|
} |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
sub get_org_smarthost { |
|
522
|
2
|
|
|
2
|
1
|
2354
|
state $check = compile(Object, Int, Int); |
|
523
|
2
|
|
|
|
|
1124
|
my ($self, $orgid, $serverid) = $check->(@_); |
|
524
|
2
|
|
|
|
|
37
|
return $self->_call('GET', "$api_path/organizations/smarthosts/$orgid/$serverid"); |
|
525
|
|
|
|
|
|
|
} |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
sub create_org_smarthost { |
|
528
|
1
|
|
|
1
|
1
|
1125
|
state $check = compile(Object, Int, |
|
529
|
|
|
|
|
|
|
Dict[ |
|
530
|
|
|
|
|
|
|
address => Str, |
|
531
|
|
|
|
|
|
|
username => Str, |
|
532
|
|
|
|
|
|
|
password => Str, |
|
533
|
|
|
|
|
|
|
port => Int, |
|
534
|
|
|
|
|
|
|
require_tls => Bool, |
|
535
|
|
|
|
|
|
|
enabled => Bool, |
|
536
|
|
|
|
|
|
|
description => Str, |
|
537
|
|
|
|
|
|
|
]); |
|
538
|
1
|
|
|
|
|
12817
|
my ($self, $orgid, $data) = $check->(@_); |
|
539
|
1
|
|
|
|
|
141
|
return $self->_call('POST', "$api_path/organizations/smarthosts/$orgid", $data); |
|
540
|
|
|
|
|
|
|
} |
|
541
|
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
sub update_org_smarthost { |
|
543
|
1
|
|
|
1
|
1
|
1425
|
state $check = compile(Object, Int, Int, |
|
544
|
|
|
|
|
|
|
Dict[ |
|
545
|
|
|
|
|
|
|
address => Str, |
|
546
|
|
|
|
|
|
|
username => Str, |
|
547
|
|
|
|
|
|
|
password => Str, |
|
548
|
|
|
|
|
|
|
port => Int, |
|
549
|
|
|
|
|
|
|
require_tls => Bool, |
|
550
|
|
|
|
|
|
|
enabled => Bool, |
|
551
|
|
|
|
|
|
|
description => Str, |
|
552
|
|
|
|
|
|
|
]); |
|
553
|
1
|
|
|
|
|
10231
|
my ($self, $orgid, $serverid, $data) = $check->(@_); |
|
554
|
1
|
|
|
|
|
290
|
return $self->_call('PUT', "$api_path/organizations/smarthosts/$orgid/$serverid", $data); |
|
555
|
|
|
|
|
|
|
} |
|
556
|
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
sub delete_org_smarthost { |
|
558
|
1
|
|
|
1
|
1
|
1374
|
state $check = compile(Object, Int, Int, |
|
559
|
|
|
|
|
|
|
Dict[ |
|
560
|
|
|
|
|
|
|
address => Str, |
|
561
|
|
|
|
|
|
|
username => Str, |
|
562
|
|
|
|
|
|
|
password => Str, |
|
563
|
|
|
|
|
|
|
port => Int, |
|
564
|
|
|
|
|
|
|
require_tls => Bool, |
|
565
|
|
|
|
|
|
|
enabled => Bool, |
|
566
|
|
|
|
|
|
|
description => Str, |
|
567
|
|
|
|
|
|
|
]); |
|
568
|
1
|
|
|
|
|
10044
|
my ($self, $orgid, $serverid, $data) = $check->(@_); |
|
569
|
1
|
|
|
|
|
135
|
return $self->_call('DELETE', "$api_path/organizations/smarthosts/$orgid/$serverid", $data); |
|
570
|
|
|
|
|
|
|
} |
|
571
|
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
sub get_fallbackservers { |
|
573
|
1
|
|
|
1
|
1
|
3916
|
state $check = compile(Object, Int); |
|
574
|
1
|
|
|
|
|
1155
|
my ($self, $orgid) = $check->(@_); |
|
575
|
1
|
|
|
|
|
29
|
return $self->_call('GET', "$api_path/fallbackservers/$orgid"); |
|
576
|
|
|
|
|
|
|
} |
|
577
|
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
sub get_fallbackserver { |
|
579
|
1
|
|
|
1
|
1
|
1049
|
state $check = compile(Object, Int); |
|
580
|
1
|
|
|
|
|
868
|
my ($self, $serverid) = $check->(@_); |
|
581
|
1
|
|
|
|
|
18
|
return $self->_call('GET', "$api_path/fallbackservers/$serverid"); |
|
582
|
|
|
|
|
|
|
} |
|
583
|
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
sub create_fallbackserver { |
|
585
|
1
|
|
|
1
|
1
|
949
|
state $check = compile(Object, Int, |
|
586
|
|
|
|
|
|
|
Dict[ |
|
587
|
|
|
|
|
|
|
address => Str, |
|
588
|
|
|
|
|
|
|
protocol => Int, |
|
589
|
|
|
|
|
|
|
port => Int, |
|
590
|
|
|
|
|
|
|
require_tls => Bool, |
|
591
|
|
|
|
|
|
|
verification_only => Bool, |
|
592
|
|
|
|
|
|
|
enabled => Bool |
|
593
|
|
|
|
|
|
|
]); |
|
594
|
1
|
|
|
|
|
11543
|
my ($self, $orgid, $data) = $check->(@_); |
|
595
|
1
|
|
|
|
|
124
|
return $self->_call('POST', "$api_path/fallbackservers/$orgid", $data); |
|
596
|
|
|
|
|
|
|
} |
|
597
|
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
sub update_fallbackserver { |
|
599
|
1
|
|
|
1
|
1
|
1039
|
state $check = compile(Object, Int, |
|
600
|
|
|
|
|
|
|
Dict[ |
|
601
|
|
|
|
|
|
|
address => Str, |
|
602
|
|
|
|
|
|
|
protocol => Int, |
|
603
|
|
|
|
|
|
|
port => Int, |
|
604
|
|
|
|
|
|
|
require_tls => Bool, |
|
605
|
|
|
|
|
|
|
verification_only => Bool, |
|
606
|
|
|
|
|
|
|
enabled => Bool |
|
607
|
|
|
|
|
|
|
]); |
|
608
|
1
|
|
|
|
|
8525
|
my ($self, $serverid, $data) = $check->(@_); |
|
609
|
1
|
|
|
|
|
122
|
return $self->_call('PUT', "$api_path/fallbackservers/$serverid", $data); |
|
610
|
|
|
|
|
|
|
} |
|
611
|
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
sub delete_fallbackserver { |
|
613
|
1
|
|
|
1
|
1
|
997
|
state $check = compile(Object, Int, |
|
614
|
|
|
|
|
|
|
Dict[ |
|
615
|
|
|
|
|
|
|
address => Str, |
|
616
|
|
|
|
|
|
|
protocol => Int, |
|
617
|
|
|
|
|
|
|
port => Int, |
|
618
|
|
|
|
|
|
|
require_tls => Bool, |
|
619
|
|
|
|
|
|
|
verification_only => Bool, |
|
620
|
|
|
|
|
|
|
enabled => Bool |
|
621
|
|
|
|
|
|
|
]); |
|
622
|
1
|
|
|
|
|
8646
|
my ($self, $serverid, $data) = $check->(@_); |
|
623
|
1
|
|
|
|
|
137
|
return $self->_call('DELETE', "$api_path/fallbackservers/$serverid", $data); |
|
624
|
|
|
|
|
|
|
} |
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
sub get_authservers { |
|
627
|
1
|
|
|
1
|
1
|
4347
|
state $check = compile(Object, Int); |
|
628
|
1
|
|
|
|
|
1228
|
my ($self, $domainid) = $check->(@_); |
|
629
|
1
|
|
|
|
|
30
|
return $self->_call('GET', "$api_path/authservers/$domainid"); |
|
630
|
|
|
|
|
|
|
} |
|
631
|
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
sub get_authserver { |
|
633
|
1
|
|
|
1
|
1
|
2097
|
state $check = compile(Object, Int, Int); |
|
634
|
1
|
|
|
|
|
1476
|
my ($self, $domainid, $serverid) = $check->(@_); |
|
635
|
1
|
|
|
|
|
25
|
return $self->_call('GET', "$api_path/authservers/$domainid/$serverid"); |
|
636
|
|
|
|
|
|
|
} |
|
637
|
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
sub create_authserver { |
|
639
|
1
|
|
|
1
|
1
|
1185
|
state $check = compile(Object, Int, |
|
640
|
|
|
|
|
|
|
Dict[ |
|
641
|
|
|
|
|
|
|
address => Str, |
|
642
|
|
|
|
|
|
|
protocol => Int, |
|
643
|
|
|
|
|
|
|
port => Int, |
|
644
|
|
|
|
|
|
|
enabled => Bool, |
|
645
|
|
|
|
|
|
|
split_address => Bool, |
|
646
|
|
|
|
|
|
|
user_map_template => Str |
|
647
|
|
|
|
|
|
|
]); |
|
648
|
1
|
|
|
|
|
14390
|
my ($self, $domainid, $data) = $check->(@_); |
|
649
|
1
|
|
|
|
|
148
|
return $self->_call('POST', "$api_path/authservers/$domainid", $data); |
|
650
|
|
|
|
|
|
|
} |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
sub update_authserver { |
|
653
|
1
|
|
|
1
|
1
|
1177
|
state $check = compile(Object, Int, Int, |
|
654
|
|
|
|
|
|
|
Dict[ |
|
655
|
|
|
|
|
|
|
address => Str, |
|
656
|
|
|
|
|
|
|
protocol => Int, |
|
657
|
|
|
|
|
|
|
port => Int, |
|
658
|
|
|
|
|
|
|
enabled => Bool, |
|
659
|
|
|
|
|
|
|
split_address => Bool, |
|
660
|
|
|
|
|
|
|
user_map_template => Str |
|
661
|
|
|
|
|
|
|
]); |
|
662
|
1
|
|
|
|
|
11220
|
my ($self, $domainid, $serverid, $data) = $check->(@_); |
|
663
|
1
|
|
|
|
|
151
|
return $self->_call('PUT', "$api_path/authservers/$domainid/$serverid", $data); |
|
664
|
|
|
|
|
|
|
} |
|
665
|
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
sub delete_authserver { |
|
667
|
1
|
|
|
1
|
1
|
1253
|
state $check = compile(Object, Int, Int, |
|
668
|
|
|
|
|
|
|
Dict[ |
|
669
|
|
|
|
|
|
|
address => Str, |
|
670
|
|
|
|
|
|
|
protocol => Int, |
|
671
|
|
|
|
|
|
|
port => Int, |
|
672
|
|
|
|
|
|
|
enabled => Bool, |
|
673
|
|
|
|
|
|
|
split_address => Bool, |
|
674
|
|
|
|
|
|
|
user_map_template => Str |
|
675
|
|
|
|
|
|
|
]); |
|
676
|
1
|
|
|
|
|
11276
|
my ($self, $domainid, $serverid, $data) = $check->(@_); |
|
677
|
1
|
|
|
|
|
149
|
return $self->_call('DELETE', "$api_path/authservers/$domainid/$serverid", $data); |
|
678
|
|
|
|
|
|
|
} |
|
679
|
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
sub get_ldapsettings { |
|
681
|
1
|
|
|
1
|
1
|
4588
|
state $check = compile(Object, Int, Int, Int); |
|
682
|
1
|
|
|
|
|
2034
|
my ($self, $domainid, $serverid, $settingsid) = $check->(@_); |
|
683
|
1
|
|
|
|
|
40
|
return $self->_call('GET', "$api_path/ldapsettings/$domainid/$serverid/$settingsid"); |
|
684
|
|
|
|
|
|
|
} |
|
685
|
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
sub create_ldapsettings { |
|
687
|
1
|
|
|
1
|
1
|
1260
|
state $check = compile(Object, Int, Int, |
|
688
|
|
|
|
|
|
|
Dict[ |
|
689
|
|
|
|
|
|
|
basedn => Str, |
|
690
|
|
|
|
|
|
|
nameattribute => Str, |
|
691
|
|
|
|
|
|
|
emailattribute => Str, |
|
692
|
|
|
|
|
|
|
binddn => Str, |
|
693
|
|
|
|
|
|
|
bindpw => Str, |
|
694
|
|
|
|
|
|
|
usetls => Bool, |
|
695
|
|
|
|
|
|
|
usesearch => Bool, |
|
696
|
|
|
|
|
|
|
searchfilter => Str, |
|
697
|
|
|
|
|
|
|
search_scope => Str, |
|
698
|
|
|
|
|
|
|
emailsearchfilter => Str, |
|
699
|
|
|
|
|
|
|
emailsearch_scope => Str |
|
700
|
|
|
|
|
|
|
]); |
|
701
|
1
|
|
|
|
|
21007
|
my ($self, $domainid, $serverid, $data) = $check->(@_); |
|
702
|
1
|
|
|
|
|
226
|
return $self->_call('POST', "$api_path/ldapsettings/$domainid/$serverid", $data); |
|
703
|
|
|
|
|
|
|
} |
|
704
|
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
sub update_ldapsettings { |
|
706
|
1
|
|
|
1
|
1
|
1420
|
state $check = compile(Object, Int, Int, Int, |
|
707
|
|
|
|
|
|
|
Dict[ |
|
708
|
|
|
|
|
|
|
basedn => Str, |
|
709
|
|
|
|
|
|
|
nameattribute => Str, |
|
710
|
|
|
|
|
|
|
emailattribute => Str, |
|
711
|
|
|
|
|
|
|
binddn => Str, |
|
712
|
|
|
|
|
|
|
bindpw => Str, |
|
713
|
|
|
|
|
|
|
usetls => Bool, |
|
714
|
|
|
|
|
|
|
usesearch => Bool, |
|
715
|
|
|
|
|
|
|
searchfilter => Str, |
|
716
|
|
|
|
|
|
|
search_scope => Str, |
|
717
|
|
|
|
|
|
|
emailsearchfilter => Str, |
|
718
|
|
|
|
|
|
|
emailsearch_scope => Str |
|
719
|
|
|
|
|
|
|
]); |
|
720
|
1
|
|
|
|
|
17460
|
my ($self, $domainid, $serverid, $settingsid, $data) = $check->(@_); |
|
721
|
1
|
|
|
|
|
194
|
return $self->_call('PUT', "$api_path/ldapsettings/$domainid/$serverid/$settingsid", $data); |
|
722
|
|
|
|
|
|
|
} |
|
723
|
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
sub delete_ldapsettings { |
|
725
|
1
|
|
|
1
|
1
|
1247
|
state $check = compile(Object, Int, Int, Int, |
|
726
|
|
|
|
|
|
|
Dict[ |
|
727
|
|
|
|
|
|
|
basedn => Str, |
|
728
|
|
|
|
|
|
|
nameattribute => Str, |
|
729
|
|
|
|
|
|
|
emailattribute => Str, |
|
730
|
|
|
|
|
|
|
binddn => Str, |
|
731
|
|
|
|
|
|
|
bindpw => Str, |
|
732
|
|
|
|
|
|
|
usetls => Bool, |
|
733
|
|
|
|
|
|
|
usesearch => Bool, |
|
734
|
|
|
|
|
|
|
searchfilter => Str, |
|
735
|
|
|
|
|
|
|
search_scope => Str, |
|
736
|
|
|
|
|
|
|
emailsearchfilter => Str, |
|
737
|
|
|
|
|
|
|
emailsearch_scope => Str |
|
738
|
|
|
|
|
|
|
]); |
|
739
|
1
|
|
|
|
|
17370
|
my ($self, $domainid, $serverid, $settingsid, $data) = $check->(@_); |
|
740
|
1
|
|
|
|
|
192
|
return $self->_call('DELETE', "$api_path/ldapsettings/$domainid/$serverid/$settingsid", $data); |
|
741
|
|
|
|
|
|
|
} |
|
742
|
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
sub get_radiussettings { |
|
744
|
1
|
|
|
1
|
1
|
17056
|
state $check = compile(Object, Int, Int, Int); |
|
745
|
1
|
|
|
|
|
2464
|
my ($self, $domainid, $serverid, $settingsid) = $check->(@_); |
|
746
|
1
|
|
|
|
|
135
|
return $self->_call('GET', "$api_path/radiussettings/$domainid/$serverid/$settingsid"); |
|
747
|
|
|
|
|
|
|
} |
|
748
|
|
|
|
|
|
|
|
|
749
|
|
|
|
|
|
|
sub create_radiussettings { |
|
750
|
1
|
|
|
1
|
1
|
5770
|
state $check = compile(Object, Int, Int, |
|
751
|
|
|
|
|
|
|
Dict[ |
|
752
|
|
|
|
|
|
|
secret => Str, |
|
753
|
|
|
|
|
|
|
timeout => Int |
|
754
|
|
|
|
|
|
|
]); |
|
755
|
1
|
|
|
|
|
16680
|
my ($self, $domainid, $serverid, $data) = $check->(@_); |
|
756
|
1
|
|
|
|
|
141
|
return $self->_call('POST', "$api_path/radiussettings/$domainid/$serverid", $data); |
|
757
|
|
|
|
|
|
|
} |
|
758
|
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
sub update_radiussettings { |
|
760
|
1
|
|
|
1
|
1
|
1234
|
state $check = compile(Object, Int, Int, Int, |
|
761
|
|
|
|
|
|
|
Dict[ |
|
762
|
|
|
|
|
|
|
secret => Str, |
|
763
|
|
|
|
|
|
|
timeout => Int |
|
764
|
|
|
|
|
|
|
]); |
|
765
|
1
|
|
|
|
|
6173
|
my ($self, $domainid, $serverid, $settingsid, $data) = $check->(@_); |
|
766
|
1
|
|
|
|
|
129
|
return $self->_call('PUT', "$api_path/radiussettings/$domainid/$serverid/$settingsid", $data); |
|
767
|
|
|
|
|
|
|
} |
|
768
|
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
sub delete_radiussettings { |
|
770
|
1
|
|
|
1
|
1
|
1153
|
state $check = compile(Object, Int, Int, Int, |
|
771
|
|
|
|
|
|
|
Dict[ |
|
772
|
|
|
|
|
|
|
secret => Str, |
|
773
|
|
|
|
|
|
|
timeout => Int |
|
774
|
|
|
|
|
|
|
]); |
|
775
|
1
|
|
|
|
|
5540
|
my ($self, $domainid, $serverid, $settingsid, $data) = $check->(@_); |
|
776
|
1
|
|
|
|
|
123
|
return $self->_call('DELETE', "$api_path/radiussettings/$domainid/$serverid/$settingsid", $data); |
|
777
|
|
|
|
|
|
|
} |
|
778
|
|
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
sub get_organizations { |
|
780
|
1
|
|
|
1
|
1
|
1110
|
state $check = compile(Object); |
|
781
|
1
|
|
|
|
|
552
|
my ($self) = $check->(@_); |
|
782
|
1
|
|
|
|
|
11
|
return $self->_call('GET', "$api_path/organizations"); |
|
783
|
|
|
|
|
|
|
} |
|
784
|
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
sub get_organization { |
|
786
|
1
|
|
|
1
|
1
|
920
|
state $check = compile(Object, Int); |
|
787
|
1
|
|
|
|
|
909
|
my ($self, $orgid) = $check->(@_); |
|
788
|
1
|
|
|
|
|
19
|
return $self->_call('GET', "$api_path/organizations/$orgid"); |
|
789
|
|
|
|
|
|
|
} |
|
790
|
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
sub create_organization { |
|
792
|
1
|
|
|
1
|
1
|
3845
|
state $check = compile(Object, |
|
793
|
|
|
|
|
|
|
Dict[ |
|
794
|
|
|
|
|
|
|
name => Str, |
|
795
|
|
|
|
|
|
|
domains => ArrayRef, |
|
796
|
|
|
|
|
|
|
admins => ArrayRef |
|
797
|
|
|
|
|
|
|
]); |
|
798
|
1
|
|
|
|
|
8142
|
my ($self, $data) = $check->(@_); |
|
799
|
1
|
|
|
|
|
118
|
return $self->_call('POST', "$api_path/organizations", $data); |
|
800
|
|
|
|
|
|
|
} |
|
801
|
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
sub update_organization { |
|
803
|
1
|
|
|
1
|
1
|
984
|
state $check = compile(Object, Int, |
|
804
|
|
|
|
|
|
|
Dict[ |
|
805
|
|
|
|
|
|
|
name => Str, |
|
806
|
|
|
|
|
|
|
domains => ArrayRef, |
|
807
|
|
|
|
|
|
|
admins => ArrayRef |
|
808
|
|
|
|
|
|
|
]); |
|
809
|
1
|
|
|
|
|
5421
|
my ($self, $orgid, $data) = $check->(@_); |
|
810
|
1
|
|
|
|
|
108
|
return $self->_call('PUT', "$api_path/organizations/$orgid", $data); |
|
811
|
|
|
|
|
|
|
} |
|
812
|
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
sub delete_organization { |
|
814
|
1
|
|
|
1
|
1
|
1026
|
state $check = compile(Object, Int); |
|
815
|
1
|
|
|
|
|
836
|
my ($self, $orgid) = $check->(@_); |
|
816
|
1
|
|
|
|
|
18
|
return $self->_call('DELETE', "$api_path/organizations/$orgid"); |
|
817
|
|
|
|
|
|
|
} |
|
818
|
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
sub get_relay { |
|
820
|
1
|
|
|
1
|
1
|
1231
|
state $check = compile(Object, Int); |
|
821
|
1
|
|
|
|
|
883
|
my ($self, $relayid) = $check->(@_); |
|
822
|
1
|
|
|
|
|
17
|
return $self->_call('GET', "$api_path/relays/$relayid"); |
|
823
|
|
|
|
|
|
|
} |
|
824
|
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
sub create_relay { |
|
826
|
1
|
|
|
1
|
1
|
4089
|
state $check = compile(Object, Int, |
|
827
|
|
|
|
|
|
|
Dict[ |
|
828
|
|
|
|
|
|
|
address => Str, |
|
829
|
|
|
|
|
|
|
username => Str, |
|
830
|
|
|
|
|
|
|
enabled => Bool, |
|
831
|
|
|
|
|
|
|
require_tls => Bool, |
|
832
|
|
|
|
|
|
|
password1 => Str, |
|
833
|
|
|
|
|
|
|
password2 => Str, |
|
834
|
|
|
|
|
|
|
description => Str, |
|
835
|
|
|
|
|
|
|
low_score => Num, |
|
836
|
|
|
|
|
|
|
high_score => Num, |
|
837
|
|
|
|
|
|
|
spam_actions => Int, |
|
838
|
|
|
|
|
|
|
highspam_actions => Int, |
|
839
|
|
|
|
|
|
|
block_macros => Bool, |
|
840
|
|
|
|
|
|
|
ratelimit => Int |
|
841
|
|
|
|
|
|
|
]); |
|
842
|
1
|
|
|
|
|
21790
|
my ($self, $orgid, $data) = $check->(@_); |
|
843
|
1
|
|
|
|
|
244
|
return $self->_call('POST', "$api_path/relays/$orgid", $data); |
|
844
|
|
|
|
|
|
|
} |
|
845
|
|
|
|
|
|
|
|
|
846
|
|
|
|
|
|
|
sub update_relay { |
|
847
|
1
|
|
|
1
|
1
|
898
|
state $check = compile(Object, Int, |
|
848
|
|
|
|
|
|
|
Dict[ |
|
849
|
|
|
|
|
|
|
address => Str, |
|
850
|
|
|
|
|
|
|
username => Str, |
|
851
|
|
|
|
|
|
|
enabled => Bool, |
|
852
|
|
|
|
|
|
|
require_tls => Bool, |
|
853
|
|
|
|
|
|
|
password1 => Str, |
|
854
|
|
|
|
|
|
|
password2 => Str, |
|
855
|
|
|
|
|
|
|
description => Str, |
|
856
|
|
|
|
|
|
|
low_score => Num, |
|
857
|
|
|
|
|
|
|
high_score => Num, |
|
858
|
|
|
|
|
|
|
spam_actions => Int, |
|
859
|
|
|
|
|
|
|
highspam_actions => Int, |
|
860
|
|
|
|
|
|
|
block_macros => Bool, |
|
861
|
|
|
|
|
|
|
ratelimit => Int |
|
862
|
|
|
|
|
|
|
]); |
|
863
|
1
|
|
|
|
|
18580
|
my ($self, $relayid, $data) = $check->(@_); |
|
864
|
1
|
|
|
|
|
203
|
return $self->_call('PUT', "$api_path/relays/$relayid", $data); |
|
865
|
|
|
|
|
|
|
} |
|
866
|
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
sub delete_relay { |
|
868
|
1
|
|
|
1
|
1
|
1639
|
state $check = compile(Object, Int, |
|
869
|
|
|
|
|
|
|
Dict[ |
|
870
|
|
|
|
|
|
|
address => Str, |
|
871
|
|
|
|
|
|
|
username => Str, |
|
872
|
|
|
|
|
|
|
enabled => Bool, |
|
873
|
|
|
|
|
|
|
require_tls => Bool, |
|
874
|
|
|
|
|
|
|
password1 => Str, |
|
875
|
|
|
|
|
|
|
password2 => Str, |
|
876
|
|
|
|
|
|
|
description => Str, |
|
877
|
|
|
|
|
|
|
low_score => Num, |
|
878
|
|
|
|
|
|
|
high_score => Num, |
|
879
|
|
|
|
|
|
|
spam_actions => Int, |
|
880
|
|
|
|
|
|
|
highspam_actions => Int, |
|
881
|
|
|
|
|
|
|
block_macros => Bool, |
|
882
|
|
|
|
|
|
|
ratelimit => Int |
|
883
|
|
|
|
|
|
|
]); |
|
884
|
1
|
|
|
|
|
18095
|
my ($self, $relayid, $data) = $check->(@_); |
|
885
|
1
|
|
|
|
|
174
|
return $self->_call('DELETE', "$api_path/relays/$relayid", $data); |
|
886
|
|
|
|
|
|
|
} |
|
887
|
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
sub get_status { |
|
889
|
1
|
|
|
1
|
1
|
3816
|
state $check = compile(Object); |
|
890
|
1
|
|
|
|
|
798
|
my ($self) = $check->(@_); |
|
891
|
1
|
|
|
|
|
20
|
return $self->_call('GET', "$api_path/status"); |
|
892
|
|
|
|
|
|
|
} |
|
893
|
|
|
|
|
|
|
|
|
894
|
17
|
|
|
17
|
|
138190
|
no Moo; |
|
|
17
|
|
|
|
|
43
|
|
|
|
17
|
|
|
|
|
132
|
|
|
895
|
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
1; |
|
897
|
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
__END__ |