]>
iEval git - webservice-scaleway.git/blob - t/real.t
29df623fb4faea6fb9a69e2723b3d7f603d8be19
5 use WebService
::Scaleway
;
10 plan skip_all
=> 't/api_key file missing' unless -f
't/api_key';
14 open my $akf, '<', 't/api_key';
18 my $sw = WebService
::Scaleway
->new($token);
20 my $org = $sw->organizations;
21 my $user = $sw->user($org->users->[0]->{id
});
22 note
'This token belongs to ', $user->fullname, ' <', $user->email, '>';
24 my $ip = $sw->create_ip($org);
25 note
"Created new ip $ip with address ", $ip->address;
26 is
$sw->ip($ip)->address, $ip->address, 'get_ip';
28 ok
grep ({$_->address eq $ip->address} @ips), 'list_ips';
30 my $vol = $sw->create_volume('testvol', $org, 'l_ssd', 50_000_000_000
);
31 note
"Created new volume $vol with name ", $vol->name;
32 is
$sw->volume($vol)->name, $vol->name, 'get_volume';
33 my @vols = $sw->volumes;
34 ok
grep ({$_->name eq $vol->name} @vols), 'list_volumes';
36 my ($debian) = grep { $_->name =~ /debian jessie/i } $sw->images;
37 my $srv = $sw->create_server('mysrv', $org, $debian, {1 => $vol->id});
38 note
"Created new server $srv with name ", $srv->name;
39 is
$sw->server($srv)->name, $srv->name, 'get_server';
40 $srv->{name
} = 'testsrv';
41 $sw->update_server($srv);
42 is
$sw->server($srv)->name, $srv->name, 'update_server';
43 my @srvs = $sw->servers;
44 ok
grep ({$_->name eq $srv->name} @srvs), 'list_servers';
45 note
"This server can: ", join ' ', $sw->server_actions($srv);
47 ## Snapshots are quite expensive
48 #my $snp = $sw->create_snapshot('mysnap', $org, $vol);
49 #note "Created new snapshot $snp with name ", $snp->name;
50 #is $sw->snapshot($snp)->name, $snp->name, 'get_snapshot';
51 #$snp->{name} = 'testsnap';
52 #$sw->update_snapshot($snp);
53 #is $sw->snapshot($snp)->name, $snp->name, 'update_snapshot';
55 @vols = map { $_->{id
} } values %{$srv->volumes};
56 $sw->delete_server($srv);
58 $sw->delete_volume($_) for @vols;
This page took 0.062608 seconds and 5 git commands to generate.