CacheDNS ':register';
use HTTP::Request::Common;
use VM::EC2::Error;
use Carp 'croak','carp';
use JSON;
our $VERSION = '1.28';
our $AUTOLOAD;
our @CARP_NOT = qw(VM::EC2::Image VM::EC2::Volume
ndpoint?" . join '&', @param;
my $response = $self->ua->request($request);
return JSON::decode_json($response->content);
}
=head2 $url = $ec2->login_url(-credentials => $credentials, -issue
JSON string that can be passed to
VM::EC2->get_federation_token(), or other AWS libraries.
=head1 STRING OVERLOADING
When used in a string context, this object will interpolate into the
policy JSON
text. In addition,
please see DISCLAIMER.txt for disclaimers of warranty.
=cut
use strict;
use JSON;
use VM::EC2;
use Carp 'croak';
use overload
'""' => 'as_string',
fallback => 1;
su
cal $self->{statements};
$self->deny('*');
return $self->as_string;
}
my $json = JSON->new();
$json->canonical(1);
return $json->encode({Statement => \@list});
}
1;
Same thing, faster to type.
-policy A VM::EC2::Security::Policy object, or a JSON string
complying with the IAM policy syntax.
The duration must be no shorte
oken from its JSON representation (e.g. as returned
# from instance metadata of an instance that is assigned an IAM role
my $token = VM::EC2::Security::Credentials->new_from_json($json);
# open a
ew_from_json {
my $class = shift;
my ($data,$endpoint) = @_;
eval "require JSON; 1" or die "no JSON module installed: $@"
unless JSON->can('decode');
my $hash = JSON::from_json($data)
AWSEC2/latest/UserGuide/UsingIAM.html.
Note that these routines require installation of the perl JSON module, and will
cause a fatal error if this module cannot be loaded.
iam_info --
{/^\d+=(.+)/ && $1} @keys;
}
sub iam_info {
my $self = shift;
$self->_load_json;
return JSON::from_json($self->fetch('iam/info'));
}
sub iam_role {
my $self = shift;
return $self
_from_json');
return VM::EC2::Security::Credentials->new_from_json($data,$self->endpoint);
}
sub _load_json {
return if JSON->can('decode');
eval "require JSON; 1" or croak "no JSON modul