line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::EPP::Frame::Command::Update::Host; |
2
|
1
|
|
|
1
|
|
8
|
use base qw(Net::EPP::Frame::Command::Update); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
102
|
|
3
|
1
|
|
|
1
|
|
10
|
use Net::EPP::Frame::ObjectSpec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
681
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=pod |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::EPP::Frame::Command::Update::Host - an instance of L |
11
|
|
|
|
|
|
|
for host objects. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Net::EPP::Frame::Command::Update::Host; |
16
|
|
|
|
|
|
|
use strict; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $info = Net::EPP::Frame::Command::Update::Host->new; |
19
|
|
|
|
|
|
|
$info->setHost('ns0.example.tld'); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
print $info->toString(1); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This results in an XML document like this: |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
28
|
|
|
|
|
|
|
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 |
29
|
|
|
|
|
|
|
epp-1.0.xsd"> |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
xmlns:host="urn:ietf:params:xml:ns:host-1.0" |
34
|
|
|
|
|
|
|
xsi:schemaLocation="urn:ietf:params:xml:ns:host-1.0 |
35
|
|
|
|
|
|
|
host-1.0.xsd"> |
36
|
|
|
|
|
|
|
example-1.tldE/host:name> |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
0cf1b8f7e14547d26f03b7641660c641d9e79f45 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 OBJECT HIERARCHY |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
L |
46
|
|
|
|
|
|
|
+----L |
47
|
|
|
|
|
|
|
+----L |
48
|
|
|
|
|
|
|
+----L |
49
|
|
|
|
|
|
|
+----L |
50
|
|
|
|
|
|
|
+----L |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub new { |
55
|
0
|
|
|
0
|
1
|
|
my $package = shift; |
56
|
0
|
|
|
|
|
|
my $self = bless($package->SUPER::new('update'), $package); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my $host = $self->addObject(Net::EPP::Frame::ObjectSpec->spec('host')); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# 'chg' element's contents are not optional for hosts, so we'll add |
61
|
|
|
|
|
|
|
# this element only when we plan to use it (accessor is overriden) |
62
|
0
|
|
|
|
|
|
foreach my $grp (qw(add rem)) { |
63
|
0
|
|
|
|
|
|
my $el = $self->createElement(sprintf('host:%s', $grp)); |
64
|
0
|
|
|
|
|
|
$self->getNode('update')->getChildNodes->shift->appendChild($el); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return $self; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=pod |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 METHODS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$frame->setHost($host_name); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This specifies the host object to be updated. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub setHost { |
81
|
0
|
|
|
0
|
0
|
|
my ($self, $host) = @_; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my $name = $self->createElement('host:name'); |
84
|
0
|
|
|
|
|
|
$name->appendText($host); |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $n = $self->getNode('update')->getChildNodes->shift; |
87
|
0
|
|
|
|
|
|
$n->insertBefore($name, $n->firstChild); |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
return 1; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=pod |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$frame->addStatus($type, $info); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Add a status of $type with the optional extra $info. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub addStatus { |
101
|
0
|
|
|
0
|
0
|
|
my ($self, $type, $info) = @_; |
102
|
0
|
|
|
|
|
|
my $status = $self->createElement('host:status'); |
103
|
0
|
|
|
|
|
|
$status->setAttribute('s', $type); |
104
|
0
|
|
|
|
|
|
$status->setAttribute('lang', 'en'); |
105
|
0
|
0
|
|
|
|
|
if ($info) { |
106
|
0
|
|
|
|
|
|
$status->appendText($info); |
107
|
|
|
|
|
|
|
} |
108
|
0
|
|
|
|
|
|
$self->getElementsByLocalName('host:add')->shift->appendChild($status); |
109
|
0
|
|
|
|
|
|
return 1; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=pod |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
$frame->remStatus($type); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Remove a status of $type. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub remStatus { |
121
|
0
|
|
|
0
|
0
|
|
my ($self, $type) = @_; |
122
|
0
|
|
|
|
|
|
my $status = $self->createElement('host:status'); |
123
|
0
|
|
|
|
|
|
$status->setAttribute('s', $type); |
124
|
0
|
|
|
|
|
|
$self->getElementsByLocalName('host:rem')->shift->appendChild($status); |
125
|
0
|
|
|
|
|
|
return 1; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=pod |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
$frame->addAddr({ 'ip' => '10.0.0.1', 'version' => 'v4' }); |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Add a set of IP addresses to the host object. EPP supports multiple |
134
|
|
|
|
|
|
|
addresses of different versions. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub addAddr { |
139
|
0
|
|
|
0
|
0
|
|
my ($self, @addr) = @_; |
140
|
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
|
foreach my $ip (@addr) { |
142
|
0
|
|
|
|
|
|
my $el = $self->createElement('host:addr'); |
143
|
0
|
|
|
|
|
|
$el->appendText($ip->{ip}); |
144
|
0
|
|
|
|
|
|
$el->setAttribute('ip', $ip->{version}); |
145
|
0
|
|
|
|
|
|
$self->getElementsByLocalName('host:add')->shift->appendChild($el); |
146
|
|
|
|
|
|
|
} |
147
|
0
|
|
|
|
|
|
return 1; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=pod |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
$frame->remAddr({ 'ip' => '10.0.0.2', 'version' => 'v4' }); |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Remove a set of IP addresses from the host object. EPP supports multiple |
155
|
|
|
|
|
|
|
addresses of different versions. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub remAddr { |
160
|
0
|
|
|
0
|
0
|
|
my ($self, @addr) = @_; |
161
|
|
|
|
|
|
|
|
162
|
0
|
|
|
|
|
|
foreach my $ip (@addr) { |
163
|
0
|
|
|
|
|
|
my $el = $self->createElement('host:addr'); |
164
|
0
|
|
|
|
|
|
$el->appendText($ip->{ip}); |
165
|
0
|
|
|
|
|
|
$el->setAttribute('ip', $ip->{version}); |
166
|
0
|
|
|
|
|
|
$self->getElementsByLocalName('host:rem')->shift->appendChild($el); |
167
|
|
|
|
|
|
|
} |
168
|
0
|
|
|
|
|
|
return 1; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=pod |
173
|
|
|
|
|
|
|
my $el = $frame->chg; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Lazy-building of 'host:chg'element. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
178
|
|
|
|
|
|
|
sub chg { |
179
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
180
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
my $chg = $self->getElementsByLocalName('host:chg')->shift; |
182
|
0
|
0
|
|
|
|
|
if ( $chg ) { |
183
|
0
|
|
|
|
|
|
return $chg; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
else { |
186
|
0
|
|
|
|
|
|
my $el = $self->createElement('host:chg'); |
187
|
0
|
|
|
|
|
|
$self->getNode('update')->getChildNodes->shift->appendChild($el); |
188
|
0
|
|
|
|
|
|
return $el; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=pod |
193
|
|
|
|
|
|
|
$frame->chgName('ns2.example.com'); |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Change a name of host. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=cut |
198
|
|
|
|
|
|
|
sub chgName { |
199
|
0
|
|
|
0
|
0
|
|
my ($self, $name) = @_; |
200
|
0
|
|
|
|
|
|
my $el = $self->createElement('host:name'); |
201
|
0
|
|
|
|
|
|
$el->appendText($name); |
202
|
0
|
|
|
|
|
|
$self->chg->appendChild($el); |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
1; |