| 1 | package VM::EC2::Image::LaunchPermission; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::Region - Object describing AMI launch permissions | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use VM::EC2; | ||
| 10 | |||
| 11 | $ec2 = VM::EC2->new(...); | ||
| 12 | $image = $ec2->describe_images('ami-12345'); | ||
| 13 | @users = $image->launchPermissions; | ||
| 14 | for (@users) { | ||
| 15 | $group = $_->group; | ||
| 16 | $user = $_->userId; | ||
| 17 | } | ||
| 18 | |||
| 19 | =head1 DESCRIPTION | ||
| 20 | |||
| 21 | This object represents an Amazon machine image launch permission, and | ||
| 22 | is return by VM::EC2::Image launchPermissions(). | ||
| 23 | |||
| 24 | =head1 METHODS | ||
| 25 | |||
| 26 | These object methods are supported: | ||
| 27 | |||
| 28 | group -- Name of a group with launch permissions. Only | ||
| 29 | valid value is "all" | ||
| 30 | userId -- Name of a user with launch permissions. | ||
| 31 | |||
| 32 | =head1 STRING OVERLOADING | ||
| 33 | |||
| 34 | When used in a string context, this object will interpolate the | ||
| 35 | userId. If the userId is blank, then interpolates as the group. | ||
| 36 | |||
| 37 | =head1 SEE ALSO | ||
| 38 | |||
| 39 | L<VM::EC2> | ||
| 40 | L<VM::EC2::Generic> | ||
| 41 | L<VM::EC2::Image> | ||
| 42 | |||
| 43 | =head1 AUTHOR | ||
| 44 | |||
| 45 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 46 | |||
| 47 | Copyright (c) 2011 Ontario Institute for Cancer Research | ||
| 48 | |||
| 49 | This package and its accompanying libraries is free software; you can | ||
| 50 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 51 | version 1, or at your option, any later version) or the Artistic | ||
| 52 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 53 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 54 | |||
| 55 | =cut | ||
| 56 | |||
| 57 | use strict; | ||
| 58 | use base 'VM::EC2::Generic'; | ||
| 59 | |||
| 60 | sub primary_id {my $self = shift; $self->userId || $self->group }; | ||
| 61 | |||
| 62 | sub valid_fields { | ||
| 63 | my $self = shift; | ||
| 64 | return qw(group userId); | ||
| 65 | } | ||
| 66 | |||
| 67 | 1; |