AWS-Networks

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

      foreach my $cidr (@{ $nets->cidrs }){
        say $cidr
      }

DESCRIPTION
    This module parses the official public IP network information published
    by Amazon Web Services at https://ip-ranges.amazonaws.com/ip-ranges.json

    Please read and understand the information can be found at
    http://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html to make
    sense of the data retured by this module.

USAGE
    Instance an object, and use it to filter information of interest to you
    with the attributes and methods provided.

METHODS
  new([ url => 'http....' ])
    Standard Moose constructor. Can specify a custom URL to download a
    document that follows the same schema

  url
    Returns the URL from which the information was retrieved. Returns undef
    on filtered datasets

  sync_token
    Returns a DateTime object created from the current timestamp of the
    syncToken reported from the service

  networks
    Returns an ArrayRef with HashRefs following the following structure:

    { ip_prefix => '0.0.0.0/0', region => '...', service => '...' }

t/02_tests.t  view on Meta::CPAN

);

is_deeply(
  [ sort @{ $net->services } ],
  [ sort qw/AMAZON EC2 CLOUDFRONT ROUTE53 ROUTE53_HEALTHCHECKS/],
  'Services OK'
);

my $by_region = $net->by_region('GLOBAL');

cmp_ok($by_region->sync_token->iso8601, 'eq', '2014-11-20T22:47:08', 'Sync Token in filtered dataset');
ok(not(defined($by_region->url)), 'URL not defined in filtered dataset');

is_deeply(
  [ sort @{ $by_region->services } ],
  [ sort (
          'CLOUDFRONT',
          'ROUTE53',
          'AMAZON'
  ) ],
  'Global region services'
);

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.634 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )