The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Akamai::Open::DiagnosticTools - The Akamai Open DiagnosticTools API Perl client

VERSION

version 0.02

SYNOPSIS

 use Akamai::Open::Client;
 use Akamai::Open::DiagnosticTools;

 my $client = Akamai::Open::Client->new();
 $client->access_token('foobar');
 $client->client_token('barfoo');
 $client->client_secret('Zm9vYmFyYmFyZm9v');

 my $diag = Akamai::Open::DiagnosticTools->new(client => $client);
 $diag->baseurl('http://mybaseurl.luna.akamaiapis.net');
 my $loc  = $diag->locations();
 my $dig  = $diag->dig({hostname => 'cpan.org', queryType => 'A', location => 'Frankfurt, Germany'});
 my $mtr  = $diag->mtr({destinationDomain => 'cpan.org', sourceIp => '23.62.61.24'});

ABOUT

Akamai::Open::DiagnosticTools provides an API client for the Akamai Open DiagnosticTools API which is described here.

USAGE

All API calls for the DiagnosticTools API are described and explained at the Akamai Open DiagnosticTools API Portal.

Akamai::Open::DiagnosticTools->new(client => $client)

For every Akamai::Open API call you'll need some client credentials. These are provided by the Akamai::Open:Client module and can reviewed at the LUNA control center.

A succesfull call to new() will return a Moose powered Akamai::Open::DiagnosticTools object.

$diag->baseurl($baseurl)

To successfully access an Akamai Open API you'll need a baseurl, which is provided by the LUNA control center Manage API Portal and is uniq to every configured API user and API itself.

baseurl() is a Moose powered getter/setter method, to set and receive the object's assigned baseurl.

$diag->locations()

To initiate diagnostinc actions inside the Akamai network, you'll need the information about the locations from which diagnostic actions are available.

locations() provides the informations. On success it returns a Perl-style array reference. On error it returns undef and sets the last_error() appropriate.

$diag->mtr($hash_ref)

mtr() returns a network trace like the well know mtr Unix command.

mtr() accepts the following parameters in $hash_ref as a Perl-style hash reference:

  • destinationDomain

    The domain name you want to get information about. Example: cpan.org. This parameter is mandatory.

  • location

    Location of a Akamai Server you want to run mtr from. You can find servers using the locations() call. This paramter is optional. Either location or sourceIp has to be passed to mtr()

  • sourceIp

    A Akamai Server IP you want to run mtr from. This paramter is optional. Either location or sourceIp has to be passed to mtr()

On success it returns a Perl-style hash reference. On error it returns undef and sets the last_error() appropriate.

The hash reference has the following format:

  {
     'source' => ...,
     'packetLoss' => '...',
     'destination' => '...',
     'errorString' => ...,
     'analysis' => '...',
     'host' => '...',
     'avgLatency' => '...',
     'hops' => [
                 {
                   'num' => '...',
                   'avg' => '...',
                   'last' => '...',
                   'stDev' => '...',
                   'host' => '...',
                   'worst' => '...',
                   'loss' => '...',
                   'sent' => '...',
                   'best' => '...'
                 }
               ]
  }

$diag->dig($hash_ref)

dig() returns dns information like the well know dig Unix command.

dig() accepts the following parameters in $hash_ref as a Perl-style hash reference:

  • hostname

    The hostname you want to get information about. Example: cpan.org. This parameter is mandatory.

  • queryType

    The query type for the dig command call, valid types are A, AAAA, PTR, SOA, MX and CNAME. This parameter is mandatory.

  • location

    Location of Akamai Server you want to run dig from. You can find servers using the locations() call. This paramter is optional. Either location or sourceIp has to be passed to dig()

  • sourceIp

    A Akamai Server IP you want to run dig from. This paramter is optional. Either location or sourceIp has to be passed to dig()

On success it returns a Perl-style hash reference. On error it returns undef and sets the last_error() appropriate.

The hash reference has the following format:

  {
      'authoritySection' => [
                             {
                                'recordType' => '...',
                                'domain' => '...',
                                'value' => '...',
                                'ttl' => '...',
                                'preferenceValues' => ...,
                                'recordClass' => '...'
                              }
                            ],
      'answerSection' => [
                          {
                             'recordType' => '...',
                             'domain' => '...',
                             'value' => '...',
                             'ttl' => '...',
                             'preferenceValues' => ...,
                             'recordClass' => '...'
                           }
                         ],
      'errorString' => ...,
      'queryType' => '...',
      'hostname' => '...',
      'result' => '...'
  }

$diag->last_error()

Just returns the last occured error.

AUTHOR

Martin Probst <internet+cpan@megamaddin.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Martin Probst.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.