line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Duowan::DNS::Records; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19
|
use 5.006; |
|
1
|
|
|
|
|
50
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
6
|
1
|
|
|
1
|
|
4
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
7
|
1
|
|
|
1
|
|
4
|
use JSON; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
8
|
1
|
|
|
1
|
|
122
|
use base 'Net::Duowan::DNS::Common'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
134
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use vars qw/$VERSION/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1706
|
|
11
|
|
|
|
|
|
|
$VERSION = '1.2.0'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
15
|
0
|
|
|
|
|
|
my $psp = shift; |
16
|
0
|
|
|
|
|
|
my $token = shift; |
17
|
0
|
|
|
|
|
|
bless { psp => $psp, token => $token },$class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub fetchSize { |
21
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
22
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
25
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
26
|
0
|
|
|
|
|
|
my $act = 'rec_load_size'; |
27
|
0
|
|
|
|
|
|
my %reqs = (a=>$act,psp=>$psp, tkn=>$token, z=>$zone); |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub fetchMulti { |
33
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
34
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my %args = @_; |
37
|
0
|
|
0
|
|
|
|
my $offset = $args{offset} || 0; |
38
|
0
|
|
0
|
|
|
|
my $number = $args{number} || 100; |
39
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
40
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
41
|
0
|
|
|
|
|
|
my $act = 'rec_load_all'; |
42
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, psp=>$psp, tkn=>$token, z=>$zone, offset=>$offset, number=>$number); |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub fetchOne { |
48
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
49
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my %args = @_; |
52
|
0
|
|
0
|
|
|
|
my $rid = $args{rid} || croak "no rid provided"; |
53
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
54
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
55
|
0
|
|
|
|
|
|
my $act = 'rec_load'; |
56
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, z=>$zone, rid=>$rid, psp=>$psp, tkn=>$token); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub create { |
62
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
63
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my %args = @_; |
66
|
0
|
|
0
|
|
|
|
my $name = $args{name} || ""; |
67
|
0
|
|
0
|
|
|
|
my $type = $args{type} || croak "no record type provided"; |
68
|
0
|
|
0
|
|
|
|
my $content = $args{content} || croak "no record content provided"; |
69
|
0
|
|
0
|
|
|
|
my $isp = $args{isp} || croak "no ISP provided"; |
70
|
0
|
|
0
|
|
|
|
my $ttl = $args{ttl} || 300; |
71
|
0
|
|
0
|
|
|
|
my $prio = $args{prio} || 0; |
72
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
73
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
74
|
0
|
|
|
|
|
|
my $act = 'rec_new'; |
75
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, z=>$zone, name=>$name, type=>$type, content=>$content, |
76
|
|
|
|
|
|
|
isp=>$isp, ttl=>$ttl, prio=>$prio, psp=>$psp, tkn=>$token); |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub modify { |
82
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
83
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
my %args = @_; |
86
|
0
|
|
0
|
|
|
|
my $rid = $args{rid} || croak "no rid provided"; |
87
|
0
|
|
0
|
|
|
|
my $name = $args{name} || ""; |
88
|
0
|
|
0
|
|
|
|
my $type = $args{type} || croak "no record type provided"; |
89
|
0
|
|
0
|
|
|
|
my $content = $args{content} || croak "no record content provided"; |
90
|
0
|
|
0
|
|
|
|
my $isp = $args{isp} || croak "no ISP provided"; |
91
|
0
|
|
0
|
|
|
|
my $ttl = $args{ttl} || 300; |
92
|
0
|
|
0
|
|
|
|
my $prio = $args{prio} || 0; |
93
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
94
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
95
|
0
|
|
|
|
|
|
my $act = 'rec_edit'; |
96
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, z=>$zone, rid=>$rid, name=>$name, type=>$type, content=>$content, |
97
|
|
|
|
|
|
|
isp=>$isp, ttl=>$ttl, prio=>$prio, psp=>$psp, tkn=>$token); |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub remove { |
103
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
104
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
my %args = @_; |
107
|
0
|
|
0
|
|
|
|
my $rid = $args{rid} || croak "no rid provided"; |
108
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
109
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
110
|
0
|
|
|
|
|
|
my $act = 'rec_delete'; |
111
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, z=>$zone, rid=>$rid, psp=>$psp, tkn=>$token); |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub bulkCreate { |
117
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
118
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
my %args = @_; |
121
|
0
|
|
0
|
|
|
|
my $records = $args{records} || croak "no records provided"; |
122
|
|
|
|
|
|
|
|
123
|
0
|
0
|
|
|
|
|
unless (ref $records) { |
124
|
0
|
|
|
|
|
|
croak "records must be an array reference"; |
125
|
|
|
|
|
|
|
} |
126
|
0
|
|
|
|
|
|
$records = to_json($records); |
127
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
129
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
130
|
0
|
|
|
|
|
|
my $act = 'bulk_rec_new'; |
131
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, z=>$zone, records=>$records, psp=>$psp, tkn=>$token); |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub bulkRemove { |
137
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
138
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
139
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
my %args = @_; |
141
|
0
|
|
0
|
|
|
|
my $rids = $args{rids} || croak "no rids provided"; |
142
|
0
|
0
|
|
|
|
|
unless (ref $rids) { |
143
|
0
|
|
|
|
|
|
croak "rids must be an array reference"; |
144
|
|
|
|
|
|
|
} |
145
|
0
|
|
|
|
|
|
$rids = join ',',@$rids; |
146
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
147
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
148
|
0
|
|
|
|
|
|
my $act = 'bulk_rec_delete'; |
149
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, z=>$zone, rids=>$rids, psp=>$psp, tkn=>$token); |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub removebyHost { |
155
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
156
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
157
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
my %args = @_; |
159
|
0
|
|
0
|
|
|
|
my $name = $args{name} || ""; |
160
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
161
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
162
|
0
|
|
|
|
|
|
my $act = 'rec_delete_by_name'; |
163
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, z=>$zone, name=>$name, psp=>$psp, tkn=>$token); |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub search { |
169
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
170
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
171
|
|
|
|
|
|
|
|
172
|
0
|
|
|
|
|
|
my %args = @_; |
173
|
0
|
|
0
|
|
|
|
my $key = $args{keyword} || croak "no keyword provided"; |
174
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
175
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
176
|
0
|
|
0
|
|
|
|
my $offset = $args{offset} || 0; |
177
|
0
|
|
0
|
|
|
|
my $number = $args{number} || -1; |
178
|
0
|
|
|
|
|
|
my $act = 'rec_search'; |
179
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, z=>$zone, k=>$key, psp=>$psp, tkn=>$token, offset=>$offset, number=>$number); |
180
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub fetchbyHost { |
185
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
186
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
187
|
|
|
|
|
|
|
|
188
|
0
|
|
|
|
|
|
my %args = @_; |
189
|
0
|
|
0
|
|
|
|
my $name = $args{name} || ""; |
190
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
191
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
192
|
0
|
|
0
|
|
|
|
my $offset = $args{offset} || 0; |
193
|
0
|
|
0
|
|
|
|
my $number = $args{number} || -1; |
194
|
0
|
|
|
|
|
|
my $act = 'rec_load_by_name'; |
195
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, z=>$zone, name=>$name, psp=>$psp, tkn=>$token, offset=>$offset, number=>$number); |
196
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub fetchbyPrefix { |
201
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
202
|
0
|
|
0
|
|
|
|
my $zone = shift || croak "no zone provided"; |
203
|
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
|
my %args = @_; |
205
|
0
|
|
0
|
|
|
|
my $prefix = $args{prefix} || croak "no record prefix provided"; |
206
|
0
|
|
|
|
|
|
my $psp = $self->{psp}; |
207
|
0
|
|
|
|
|
|
my $token = $self->{token}; |
208
|
0
|
|
0
|
|
|
|
my $offset = $args{offset} || 0; |
209
|
0
|
|
0
|
|
|
|
my $number = $args{number} || -1; |
210
|
0
|
|
|
|
|
|
my $act = 'rec_load_by_prefix'; |
211
|
0
|
|
|
|
|
|
my %reqs = (a=>$act, z=>$zone, name=>$prefix, psp=>$psp, tkn=>$token, offset=>$offset, number=>$number); |
212
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
return $self->reqTemplate(%reqs); |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
1; |