| 1 | package VM::EC2::REST::general; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use VM::EC2 ''; # important not to import anything! | ||
| 5 | package VM::EC2; # add methods to VM::EC2 | ||
| 6 | |||
| 7 | VM::EC2::Dispatch->register( | ||
| 8 | GetConsoleOutput => 'VM::EC2::Instance::ConsoleOutput', | ||
| 9 | DescribeAccountAttributes => 'fetch_items,accountAttributeSet,VM::EC2::AccountAttributes', | ||
| 10 | ); | ||
| 11 | |||
| 12 | |||
| 13 | my $VEP = 'VM::EC2::ParmParser'; | ||
| 14 | |||
| 15 | =head1 NAME VM::EC2::REST::general | ||
| 16 | |||
| 17 | =head1 SYNOPSIS | ||
| 18 | |||
| 19 | use VM::EC2 'general'; | ||
| 20 | |||
| 21 | =head1 METHODS | ||
| 22 | |||
| 23 | These are EC2 methods that Amazon calls "general". | ||
| 24 | |||
| 25 | Implemented: | ||
| 26 | GetConsoleOutput | ||
| 27 | DescribeAccountAttributes | ||
| 28 | |||
| 29 | Unimplemented: | ||
| 30 | (none) | ||
| 31 | |||
| 32 | =head2 $output = $ec2->get_console_output(-instance_id=>'i-12345') | ||
| 33 | |||
| 34 | =head2 $output = $ec2->get_console_output('i-12345'); | ||
| 35 | |||
| 36 | Returns the console output of the indicated instance. The output is | ||
| 37 | actually a VM::EC2::ConsoleOutput object, but it is | ||
| 38 | overloaded so that when treated as a string it will appear as a | ||
| 39 | large text string containing the console output. When treated like an | ||
| 40 | object it provides instanceId() and timestamp() methods. | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | sub get_console_output { | ||
| 45 | my $self = shift; | ||
| 46 | my %args = $VEP->args(-instance_id,@_); | ||
| 47 | $args{-instance_id} or croak "Usage: get_console_output(-instance_id=>\$id)"; | ||
| 48 | my @params = $VEP->format_parms(\%args, | ||
| 49 | { | ||
| 50 | single_parm => [ 'InstanceId' ] | ||
| 51 | } | ||
| 52 | ); | ||
| 53 | return $self->call('GetConsoleOutput',@params); | ||
| 54 | } | ||
| 55 | |||
| 56 | =head2 @attrs = $ec2->describe_account_attributes(-attribute_name => \@attr_list) | ||
| 57 | |||
| 58 | =head2 @attrs = $ec2->describe_account_attributes(@attr_list) | ||
| 59 | |||
| 60 | =head2 @attrs = $ec2->describe_account_attributes($attr) | ||
| 61 | |||
| 62 | Describes the specified attribute of your AWS account. | ||
| 63 | |||
| 64 | Require Argument: | ||
| 65 | |||
| 66 | -attribute_name The attribute to describe | ||
| 67 | |||
| 68 | Supported attributes: | ||
| 69 | |||
| 70 | supported-platforms Whether your account can launch instances into EC2-Classic | ||
| 71 | and EC2-VPC, or only into EC2-VPC. For more information, | ||
| 72 | see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-platforms.html | ||
| 73 | |||
| 74 | default-vpc ID of the default VPC for your account, or none. For more information, see | ||
| 75 | http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html | ||
| 76 | |||
| 77 | Returns an array of L<VM::EC2::AccountAttributes> objects. | ||
| 78 | |||
| 79 | =cut | ||
| 80 | |||
| 81 | sub describe_account_attributes { | ||
| 82 | my $self = shift; | ||
| 83 | my %args = $VEP->args(-attribute_name,@_); | ||
| 84 | $args{-attribute_name} or croak "describe_account_attributes(): missing -attribute_name argument"; | ||
| 85 | my @params = $VEP->format_parms(\%args, | ||
| 86 | { | ||
| 87 | list_parm => [ 'AttributeName' ] | ||
| 88 | } | ||
| 89 | ); | ||
| 90 | return $self->call('DescribeAccountAttributes',@params); | ||
| 91 | } | ||
| 92 | |||
| 93 | =head1 SEE ALSO | ||
| 94 | |||
| 95 | L<VM::EC2> | ||
| 96 | |||
| 97 | =head1 AUTHOR | ||
| 98 | |||
| 99 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 100 | |||
| 101 | Copyright (c) 2011 Ontario Institute for Cancer Research | ||
| 102 | |||
| 103 | This package and its accompanying libraries is free software; you can | ||
| 104 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 105 | version 1, or at your option, any later version) or the Artistic | ||
| 106 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 107 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | |||
| 112 | 1; |