| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::DNSMadeEasy::ManagedDomain; |
|
2
|
|
|
|
|
|
|
our $VERSION = '0.100'; |
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GETTY'; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: A managed domain in the DNSMadeEasy API |
|
5
|
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
81
|
use Moo; |
|
|
8
|
|
|
|
|
21
|
|
|
|
8
|
|
|
|
|
70
|
|
|
7
|
8
|
|
|
8
|
|
7601
|
use String::CamelSnakeKebab qw/lower_camel_case/; |
|
|
8
|
|
|
|
|
87892
|
|
|
|
8
|
|
|
|
|
60
|
|
|
8
|
8
|
|
|
8
|
|
7673
|
use WWW::DNSMadeEasy::ManagedDomain::Record; |
|
|
8
|
|
|
|
|
42
|
|
|
|
8
|
|
|
|
|
9043
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has dme => ( |
|
11
|
|
|
|
|
|
|
is => 'ro', |
|
12
|
|
|
|
|
|
|
required => 1, |
|
13
|
|
|
|
|
|
|
handles => { |
|
14
|
|
|
|
|
|
|
request => 'request', |
|
15
|
|
|
|
|
|
|
path => 'domain_path', |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has name => (is => 'ro', required => 1); |
|
20
|
|
|
|
|
|
|
has as_hashref => (is => 'rw', builder => 1, lazy => 1, clearer => 1); |
|
21
|
|
|
|
|
|
|
has response => (is => 'rw', builder => 1, lazy => 1, clearer => 1); |
|
22
|
|
|
|
|
|
|
|
|
23
|
6
|
|
|
6
|
|
207
|
sub _build_as_hashref { shift->response->as_hashref } |
|
24
|
6
|
|
|
6
|
|
217
|
sub _build_response { $_[0]->request(GET => $_[0]->path . 'id/' . $_[0]->name) } |
|
25
|
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
1
|
0
|
sub active_third_parties { shift->as_hashref->{activeThirdParties} } |
|
27
|
0
|
|
|
0
|
1
|
0
|
sub created { shift->as_hashref->{created} } |
|
28
|
0
|
|
|
0
|
1
|
0
|
sub delegate_name_servers { shift->as_hashref->{delegateNameServers} } |
|
29
|
0
|
|
|
0
|
1
|
0
|
sub folder_id { shift->as_hashref->{folderId} } |
|
30
|
0
|
|
|
0
|
1
|
0
|
sub gtd_enabled { shift->as_hashref->{gtdEnabled} } |
|
31
|
7
|
|
|
7
|
1
|
9910
|
sub id { shift->as_hashref->{id} } |
|
32
|
0
|
|
|
0
|
1
|
0
|
sub name_servers { shift->as_hashref->{nameServers} } |
|
33
|
0
|
|
|
0
|
1
|
0
|
sub pending_action_id { shift->as_hashref->{pendingActionId} } |
|
34
|
0
|
|
|
0
|
1
|
0
|
sub process_multi { shift->as_hashref->{processMulti} } |
|
35
|
0
|
|
|
0
|
1
|
0
|
sub updated { shift->as_hashref->{updated} } |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub delete { |
|
38
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
|
39
|
0
|
|
|
|
|
0
|
$self->request(DELETE => $self->path . $self->id); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub update { |
|
43
|
0
|
|
|
0
|
1
|
0
|
my ($self, $data) = @_; |
|
44
|
0
|
|
|
|
|
0
|
$self->clear_as_hashref; |
|
45
|
0
|
|
|
|
|
0
|
my $res = $self->request(PUT => $self->path . $self->id, $data); |
|
46
|
0
|
|
|
|
|
0
|
$self->response($res); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub wait_for_delete { |
|
50
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
|
51
|
0
|
|
|
|
|
0
|
while (1) { |
|
52
|
0
|
|
|
|
|
0
|
$self->clear_response; |
|
53
|
0
|
|
|
|
|
0
|
$self->clear_as_hashref; |
|
54
|
0
|
|
|
|
|
0
|
eval { $self->response() }; |
|
|
0
|
|
|
|
|
0
|
|
|
55
|
0
|
0
|
0
|
|
|
0
|
last if $@ && $@ =~ /(404|400)/; |
|
56
|
0
|
|
|
|
|
0
|
sleep 10; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub wait_for_pending_action { |
|
61
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
|
62
|
0
|
|
|
|
|
0
|
while (1) { |
|
63
|
0
|
|
|
|
|
0
|
$self->clear_response; |
|
64
|
0
|
|
|
|
|
0
|
$self->clear_as_hashref; |
|
65
|
0
|
0
|
|
|
|
0
|
last if $self->pending_action_id == 0; |
|
66
|
0
|
|
|
|
|
0
|
sleep 10; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# |
|
71
|
|
|
|
|
|
|
# RECORDS |
|
72
|
|
|
|
|
|
|
# |
|
73
|
|
|
|
|
|
|
|
|
74
|
5
|
|
|
5
|
0
|
203
|
sub records_path { $_[0]->path . $_[0]->id . '/records/' } |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub create_record { |
|
77
|
1
|
|
|
1
|
0
|
43
|
my ( $self, %data ) = @_; |
|
78
|
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
2
|
my %req; |
|
80
|
1
|
|
|
|
|
5
|
for my $old (keys %data) { |
|
81
|
5
|
|
|
|
|
12
|
my $new = lower_camel_case($old); |
|
82
|
5
|
|
|
|
|
101
|
$req{$new} = $data{$old}; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
1
|
|
|
|
|
5
|
return WWW::DNSMadeEasy::ManagedDomain::Record->new( |
|
86
|
|
|
|
|
|
|
response => $self->request(POST => $self->records_path, \%req), |
|
87
|
|
|
|
|
|
|
domain => $self, |
|
88
|
|
|
|
|
|
|
); |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# TODO |
|
92
|
|
|
|
|
|
|
# - do multiple gets when max number of records is reached |
|
93
|
|
|
|
|
|
|
# - save the request as part of the Record obj |
|
94
|
|
|
|
|
|
|
sub records { |
|
95
|
3
|
|
|
3
|
1
|
1967
|
my ($self, %args) = @_; |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# TODO should switch to URI->query_form() but that requires changing DME->request() |
|
98
|
3
|
|
|
|
|
17
|
my $path = $self->records_path; |
|
99
|
3
|
50
|
33
|
|
|
181
|
$path .= '?type=' . $args{type} if defined $args{type} && !defined $args{name}; |
|
100
|
3
|
50
|
33
|
|
|
14
|
$path .= '?recordName=' . $args{name} if defined $args{name} && !defined $args{type}; |
|
101
|
|
|
|
|
|
|
$path .= '?recordName=' . $args{name} . |
|
102
|
3
|
50
|
33
|
|
|
16
|
'&type=' . $args{type} if defined $args{name} && defined $args{type}; |
|
103
|
|
|
|
|
|
|
|
|
104
|
3
|
|
|
|
|
119
|
my $arrayref = $self->request(GET => $path)->data->{data}; |
|
105
|
|
|
|
|
|
|
|
|
106
|
3
|
|
|
|
|
171
|
my @records; |
|
107
|
3
|
|
|
|
|
14
|
for my $hashref (@$arrayref) { |
|
108
|
6
|
|
|
|
|
5609
|
push @records, WWW::DNSMadeEasy::ManagedDomain::Record |
|
109
|
|
|
|
|
|
|
->new(as_hashref => $hashref, domain => $self); |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
3
|
|
|
|
|
64
|
return @records; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
__END__ |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=pod |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=encoding UTF-8 |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 NAME |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
WWW::DNSMadeEasy::ManagedDomain - A managed domain in the DNSMadeEasy API |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 VERSION |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
version 0.100 |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 METHODS |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 delete() |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 update(%data) |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 records(%data) |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
my @records = $domain->records(); # Returns all records |
|
140
|
|
|
|
|
|
|
my @records = $domain->records(type => 'CNAME'); # Returns all CNAME records |
|
141
|
|
|
|
|
|
|
my @records = $domain->records(name => 'www'); # Returns all wwww records |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Returns a list of L<WWW::DNSMadeEasy::ManagedDomain::Record> objects. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 response |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Returns the response for this object |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 as_hashref |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Returns json response data as a hashref |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 name |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 active_third_parties |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 created |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 delegate_name_servers |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 folder_id |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 gtd_enabled |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 id |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 name_servers |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head2 pending_action_id |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 process_multi |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 updated |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 METHODS |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 MANAGED DOMAIN ATTRIBUTES |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 SUPPORT |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
IRC |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Join #duckduckgo on irc.freenode.net and highlight Getty or /msg me. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Repository |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
http://github.com/Getty/p5-www-dnsmadeeasy |
|
188
|
|
|
|
|
|
|
Pull request and additional contributors are welcome |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Issue Tracker |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
http://github.com/Getty/p5-www-dnsmadeeasy/issues |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head1 SUPPORT |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 Source Code |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
The code is open to the world, and available for you to hack on. Please feel free to browse it and play |
|
201
|
|
|
|
|
|
|
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull |
|
202
|
|
|
|
|
|
|
from your repository :) |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
L<https://github.com/Getty/p5-www-dnsmadeeasy> |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
git clone https://github.com/Getty/p5-www-dnsmadeeasy.git |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head1 AUTHOR |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudssus.de> |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
This software is copyright (c) 2012 by L<Torsten Raudssus|https://raudssus.de/>. |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
217
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=cut |