line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2016 CentralNic Ltd. All rights reserved. This program is |
2
|
|
|
|
|
|
|
# free software; you can redistribute it and/or modify it under the same |
3
|
|
|
|
|
|
|
# terms as Perl itself. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# $Id$ |
6
|
|
|
|
|
|
|
package Net::EPP::Frame::Command::Create::Domain; |
7
|
1
|
|
|
1
|
|
4
|
use base qw(Net::EPP::Frame::Command::Create); |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
57
|
|
8
|
1
|
|
|
1
|
|
3
|
use Net::EPP::Frame::ObjectSpec; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
12
|
|
9
|
1
|
|
|
1
|
|
2
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
557
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=pod |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Net::EPP::Frame::Command::Create::Domain - an instance of L |
16
|
|
|
|
|
|
|
for domain objects. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Net::EPP::Frame::Command::Create::Domain; |
21
|
|
|
|
|
|
|
use strict; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $create = Net::EPP::Frame::Command::Create::Domain->new; |
24
|
|
|
|
|
|
|
$create->setDomain('example.uk.com); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
print $create->toString(1); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This results in an XML document like this: |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
33
|
|
|
|
|
|
|
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 |
34
|
|
|
|
|
|
|
epp-1.0.xsd"> |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0" |
39
|
|
|
|
|
|
|
xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0 |
40
|
|
|
|
|
|
|
contact-1.0.xsd"> |
41
|
|
|
|
|
|
|
example-1.tldE/domain:name> |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
0cf1b8f7e14547d26f03b7641660c641d9e79f45 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 OBJECT HIERARCHY |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
L |
51
|
|
|
|
|
|
|
+----L |
52
|
|
|
|
|
|
|
+----L |
53
|
|
|
|
|
|
|
+----L |
54
|
|
|
|
|
|
|
+----L |
55
|
|
|
|
|
|
|
+----L |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new { |
60
|
0
|
|
|
0
|
0
|
|
my $package = shift; |
61
|
0
|
|
|
|
|
|
my $self = bless($package->SUPER::new('create'), $package); |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$self->addObject(Net::EPP::Frame::ObjectSpec->spec('domain')); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return $self; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 METHODS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my $element = $frame->setDomain($domain_name); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This sets the name of the object to be created. Returns the |
75
|
|
|
|
|
|
|
Cdomain:nameE> element. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub setDomain { |
80
|
0
|
|
|
0
|
0
|
|
my ($self, $domain) = @_; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my $name = $self->createElement('domain:name'); |
83
|
0
|
|
|
|
|
|
$name->appendText($domain); |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($name); |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
return 1; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub setPeriod { |
91
|
0
|
|
|
0
|
0
|
|
my ($self, $period, $unit) = @_; |
92
|
|
|
|
|
|
|
|
93
|
0
|
0
|
0
|
|
|
|
$unit = 'y' if (!defined($unit) || $unit eq ''); |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my $el = $self->createElement('domain:period'); |
96
|
0
|
|
|
|
|
|
$el->setAttribute('unit', $unit); |
97
|
0
|
|
|
|
|
|
$el->appendText(int($period)); |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($el); |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
return 1; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub setRegistrant { |
105
|
0
|
|
|
0
|
0
|
|
my ($self, $contact) = @_; |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
my $registrant = $self->createElement('domain:registrant'); |
108
|
0
|
|
|
|
|
|
$registrant->appendText($contact); |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($registrant); |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
return 1; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub setContacts { |
116
|
0
|
|
|
0
|
0
|
|
my ($self, $contacts) = @_; |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
foreach my $type (keys(%{$contacts})) { |
|
0
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
my $contact = $self->createElement('domain:contact'); |
120
|
0
|
|
|
|
|
|
$contact->setAttribute('type', $type); |
121
|
0
|
|
|
|
|
|
$contact->appendText($contacts->{$type}); |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($contact); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
return 1; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# |
130
|
|
|
|
|
|
|
# Type of elements of @ns depends on NS model used by EPP server. |
131
|
|
|
|
|
|
|
# hostObj model: |
132
|
|
|
|
|
|
|
# each element is a name of NS host object |
133
|
|
|
|
|
|
|
# hostAttr model: |
134
|
|
|
|
|
|
|
# each element is a hashref: |
135
|
|
|
|
|
|
|
# { |
136
|
|
|
|
|
|
|
# name => 'ns1.example.com, |
137
|
|
|
|
|
|
|
# addrs => [ |
138
|
|
|
|
|
|
|
# { version => 'v4', addr => '192.168.0.10', }, |
139
|
|
|
|
|
|
|
# { version => 'v4', addr => '192.168.0.20', }, |
140
|
|
|
|
|
|
|
# ... |
141
|
|
|
|
|
|
|
# ]; |
142
|
|
|
|
|
|
|
# } |
143
|
|
|
|
|
|
|
# |
144
|
|
|
|
|
|
|
sub setNS { |
145
|
0
|
|
|
0
|
0
|
|
my ($self, @ns) = @_; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
0
|
0
|
|
|
|
|
if ( ref $ns[0] eq 'HASH' ) { |
149
|
0
|
|
|
|
|
|
$self->addHostAttrNS(@ns); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
else { |
152
|
0
|
|
|
|
|
|
$self->addHostObjNS(@ns); |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
0
|
|
|
|
|
|
return 1; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub addHostAttrNS { |
159
|
0
|
|
|
0
|
0
|
|
my ($self, @ns) = @_; |
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
my $ns = $self->createElement('domain:ns'); |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
# Adding attributes |
164
|
0
|
|
|
|
|
|
foreach my $host (@ns) { |
165
|
0
|
|
|
|
|
|
my $hostAttr = $self->createElement('domain:hostAttr'); |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
# Adding NS name |
168
|
0
|
|
|
|
|
|
my $hostName = $self->createElement('domain:hostName'); |
169
|
0
|
|
|
|
|
|
$hostName->appendText( $host->{name} ); |
170
|
0
|
|
|
|
|
|
$hostAttr->appendChild($hostName); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
# Adding IP addresses |
173
|
0
|
0
|
0
|
|
|
|
if ( exists $host->{addrs} && ref $host->{addrs} eq 'ARRAY' ) { |
174
|
0
|
|
|
|
|
|
foreach my $addr ( @{ $host->{addrs} } ) { |
|
0
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
my $hostAddr = $self->createElement('domain:hostAddr'); |
176
|
0
|
|
|
|
|
|
$hostAddr->appendText( $addr->{addr} ); |
177
|
0
|
|
|
|
|
|
$hostAddr->setAttribute( ip => $addr->{version} ); |
178
|
0
|
|
|
|
|
|
$hostAttr->appendChild($hostAddr); |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# Adding host info to frame |
183
|
0
|
|
|
|
|
|
$ns->appendChild($hostAttr); |
184
|
|
|
|
|
|
|
} |
185
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($ns); |
186
|
0
|
|
|
|
|
|
return 1; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub addHostObjNS { |
190
|
0
|
|
|
0
|
0
|
|
my ($self, @ns) = @_; |
191
|
|
|
|
|
|
|
|
192
|
0
|
|
|
|
|
|
my $ns = $self->createElement('domain:ns'); |
193
|
0
|
|
|
|
|
|
foreach my $host (@ns) { |
194
|
0
|
|
|
|
|
|
my $el = $self->createElement('domain:hostObj'); |
195
|
0
|
|
|
|
|
|
$el->appendText($host); |
196
|
0
|
|
|
|
|
|
$ns->appendChild($el); |
197
|
|
|
|
|
|
|
} |
198
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($ns); |
199
|
0
|
|
|
|
|
|
return 1; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub setAuthInfo { |
203
|
0
|
|
|
0
|
0
|
|
my ($self, $authInfo) = @_; |
204
|
0
|
|
|
|
|
|
my $el = $self->addEl('authInfo'); |
205
|
0
|
|
|
|
|
|
my $pw = $self->createElement('domain:pw'); |
206
|
0
|
|
|
|
|
|
$pw->appendText($authInfo); |
207
|
0
|
|
|
|
|
|
$el->appendChild($pw); |
208
|
0
|
|
|
|
|
|
return $el; |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub appendStatus { |
212
|
0
|
|
|
0
|
0
|
|
my ($self, $status) = @_; |
213
|
0
|
|
|
|
|
|
return $self->addEl('status', $status); |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
sub addEl { |
217
|
0
|
|
|
0
|
0
|
|
my ($self, $name, $value) = @_; |
218
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
|
my $el = $self->createElement('domain:'.$name); |
220
|
0
|
0
|
|
|
|
|
$el->appendText($value) if defined($value); |
221
|
|
|
|
|
|
|
|
222
|
0
|
|
|
|
|
|
$self->getNode('create')->getChildNodes->shift->appendChild($el); |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
return $el; |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=pod |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head1 AUTHOR |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
CentralNic Ltd (http://www.centralnic.com/). |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head1 COPYRIGHT |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
This module is (c) 2016 CentralNic Ltd. This module is free software; you can |
237
|
|
|
|
|
|
|
redistribute it and/or modify it under the same terms as Perl itself. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head1 SEE ALSO |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=over |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=item * L |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=back |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=cut |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
1; |