Amazon-SQS-Simple

 view release on metacpan or  search on metacpan

lib/Amazon/SQS/Simple/Base.pm  view on Meta::CPAN

        
        my $req = HTTP::Request->new(POST => $url);
        $req->header(host => URI->new($url)->host);
        my $now = time;
        my $http_date = strftime('%Y%m%dT%H%M%SZ', gmtime($now));
        my $date = strftime('%Y%m%d', gmtime($now));
        
        $req->protocol('HTTP/1.1');
        $req->header('Date' => $http_date);
        $req->header('x-amz-target', 'AmazonSQSv20121105.' . $params->{Action});
        $req->header('content-type' => 'application/x-www-form-urlencoded;charset=utf-8');

        if ($self->{UseIAMRole}) {
            my $creds = VM::EC2::Security::CredentialCache->get();
            defined($creds) || die("Unable to retrieve IAM role credentials");
            $self->{AWSAccessKeyId} = $creds->accessKeyId;
            $self->{SecretKey} = $creds->secretAccessKey;
            $req->header('x-amz-security-token' => $creds->sessionToken);
        }

        $params->{AWSAccessKeyId} = $self->{AWSAccessKeyId};



( run in 0.265 second using v1.01-cache-2.11-cpan-4d50c553e7e )