From: Marius Gavrilescu Date: Mon, 21 Sep 2015 17:18:13 +0000 (+0300) Subject: Improve POD X-Git-Tag: 0.001001~2 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=d06a69ab1154d516b940c41b6f0bdca7a97f0fec;p=webservice-scaleway.git Improve POD --- diff --git a/lib/WebService/Scaleway.pm b/lib/WebService/Scaleway.pm index 9c327e6..4545952 100644 --- a/lib/WebService/Scaleway.pm +++ b/lib/WebService/Scaleway.pm @@ -207,7 +207,10 @@ WebService::Scaleway - Perl interface to Scaleway cloud server provider API my $ip = $sw->create_ip($org); my $vol = $sw->create_volume('testvol', $org, 'l_ssd', 50_000_000_000); my ($debian) = grep { $_->name =~ /debian jessie/i } $sw->images; - my $srv = $sw->create_server('testsrv', $org, $debian, {1 => {%$vol}}); + my $srv = $sw->create_server('testsrv', $org, $debian, {1 => $vol->id}); + + # Now we have a server, an IP, and two volumes (the root volume with + # Debian Jessie, and the extra volume we just created). # Change the server name $srv->{name} = 'Debian'; @@ -312,9 +315,13 @@ Official documentation: L(I<$id>) and B(I<$id>). @@ -378,8 +385,9 @@ Official documentation: L. When using positional parameters, you can pass a resource in blessed -hashref format where a resource ID is expected. The function will call -C<< ->id >> on the resouce automatically. +hashref format where a resource ID is expected, unless the method's +documentation says otherwise. Most of these methods require an organization ID. You can obtain it with the B method described above. @@ -489,11 +497,23 @@ Creates and returns a new server. I<$name> is the server name. I<$organization> is the organization ID. I<$image> is the image ID. I<$volumes> is a "sparse array" (hashref -from indexes to volumes, indexed from 1) of volumes. I<$tags> is an -optional arrayref of tags. - -Note that the volumes must be unblessed hashrefs. If I<$vol> is a -volume, you can use this idiom: C<< $volumes = {1 => {%$vol}} >>. +from indexes to volume IDs, indexed from 1) of B volumes (that +is, volumes other than the root volume). I<$tags> is an optional +arrayref of tags. + +For the I<$volumes> parameter you can pass hashrefs that describe +volumes instead of volume IDs. This will create new volumes. The +hashrefs are (presumably) passed to B. An example +inspired by the official documentation: + + $volumes = { 1 => { + name => "vol_demo", + organization => "ecc1c86a-eabb-43a7-9c0a-77e371753c0a", + size => 10_000_000_000, + volume_type => "l_sdd", + }}; + +Note that there B be any blessed hashrefs inside I<$volumes>. Official documentation: L.