line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# vim: set ts=3 sw=3 tw=0: |
5
|
|
|
|
|
|
|
# vim: set expandtab: |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
WebService::ProfitBricks::Nic - Manage nics. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Manage the nics of a server. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $nic = $srv->eth->new(nicName => "intern", lanId => 2); |
18
|
|
|
|
|
|
|
$nic->save; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $nic2 = $srv->eth->new(nicName => "public", lanId => 3); |
21
|
|
|
|
|
|
|
$nic2->setInternetAccess(1); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=over 4 |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
package WebService::ProfitBricks::Nic; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
1749
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
32
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
|
6
|
use WebService::ProfitBricks::Class; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
107
|
|
35
|
1
|
|
|
1
|
|
7
|
use base qw(WebService::ProfitBricks); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
75
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
attrs qw/nicId |
38
|
|
|
|
|
|
|
nicName |
39
|
|
|
|
|
|
|
serverId |
40
|
|
|
|
|
|
|
lanId |
41
|
|
|
|
|
|
|
internetAccess |
42
|
|
|
|
|
|
|
ip |
43
|
|
|
|
|
|
|
macAddress |
44
|
|
|
|
|
|
|
/; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
serializer xml => { container => "arg0" }; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
belongs_to server => "WebService::ProfitBricks::Server" => { through => "serverId" }; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item setInternetAccess($has_access) |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Set the internetAccess flags. 1 for true, 0 for false. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
sub setInternetAccess { |
57
|
|
|
|
|
|
|
my ($self, $has_access) = @_; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $ret = $self->connection->call("setInternetAccess", nicId => $self->nicId, datacenterId => $self->server->dataCenterId, lanId => $self->lanId, internetAccess => ($has_access == 1 ? "true" : "false")); |
60
|
|
|
|
|
|
|
print Dumper($ret); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=back |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
"Can't connect to bot net!"; |