Marco Fontani > Net-Amazon-Route53 > Net::Amazon::Route53

Download:
Net-Amazon-Route53-0.123250.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.123250   Source  

SYNOPSIS

    use strict;
    use warnings;
    use Net::Amazon::Route53;
    my $route53 = Net::Amazon::Route53->new( id => '...', key => '...' );
    my @zones = $route53->get_hosted_zones;
    for my $zone ( @zones ) {
        # use the Net::Amazon::Route53::HostedZone object
    }

ATTRIBUTES

id

The Amazon id, needed to contact Amazon's Route 53.

key

The Amazon key, needed to contact Amazon's Route 53.

ua

Internal user agent object used to perform requests to Amazon's Route 53

METHODS

request

    my $hr_xml_response = $self->request( $method, $url );

Requests something from Amazon Route 53, signing the request. Uses LWP::UserAgent internally, and returns the hashref obtained from the request. Dies on error, showing the request's error given by the API.

get_hosted_zones

    my $route53 = Net::Amazon::Route53->new( key => '...', id => '...' );
    my @zones = $route53->get_hosted_zones();
    my $zone = $route53->get_hosted_zones( 'example.com.' );

Gets one or more Net::Amazon::Route53::HostedZone objects, representing the zones associated with the account.

Takes an optional parameter indicating the name of the wanted hosted zone.

batch_create

    my $route53 = Net::Amazon::Route53->new( key => '...', id => '...' );
    my @records = record_generating_subroutine(); # returning an array of Net::Amazon::Route53::ResourceRecordSets
    my $change = $route53->batch_create(\@records); # Or ->batch_create(\@records,1) if you want to wait

Turns an arrayref of Net::Amazon::Route53::ResourceRecordSet objects into one big create request. All records must belong to the same hosted zone.

Takes an optional boolean parameter, wait, to indicate whether the request should return straightaway (default, or when wait is 0) or it should wait until the request is INSYNC according to the Change's status.

Returns a Net::Amazon::Route53::Change object representing the change requested.

atomic_update

    my $route53 = Net::Amazon::Route53->new( key => '...', id => '...' );
    my $hosted_zone = $route_53->get_hosted_zones("example.com.");
    my $old_records = $hosted_zone->resource_record_sets;
    my $new_records = record_generating_subroutine();
    my $change = $route53->atomic_update($old_records,$new_records);
    # Or ->atomic_update($ref1,$ref2,1) if you want to wait

Be warned: this method can be destructive. Give it the arrayref of records currently in your zone and an arrayref of records representing the desired state of your zone, and it will create, change, and delete the current records in the zone to match the set you submitted.

Don't send the Amazon Route53 NS or SOA record in the set of original records.

This method discovers which records needs to be deleted/created, e.g., changed, which ones need simply to be created for the first time, and deletes records not defined in the new set. It's an "all-in-one, all-at-once" update for all the records in your zone. This, and the fact that it is destructive, is why it is called atomic_update.

Takes an optional boolean parameter, wait, to indicate whether the request should return straightaway (default, or when wait is 0) or it should wait until the request is INSYNC according to the Change's status.

Returns a Net::Amazon::Route53::Change object representing the change requested.

batch_change

    my $route53 = Net::Amazon::Route53->new( key => '...', id => '...' );
    my $hosted_zone = $route_53->get_hosted_zones("example.com.");
    my $recordset_changes = recordset_changes_generating_subroutine();
    my $change = $route53->batch_change($recordset_changes);
    # Or ->batch_change($recordset_changes,1) if you want to wait

This method takes an arrayref of Net::Amazon::Route53::ResourceRecordSet::Change objects and the optional wait argument, and makes one big request to change all the records at once.

_get_create_xml

Private method for xml templating. Takes an Net::Amazon::Route53::ResourceRecordSet::Change object and returns the xml to create that single record.

_get_delete_xml

Private method for xml templating. Takes an Net::Amazon::Route53::ResourceRecordSet object and returns the xml to delete that single record.

_get_change_xml

Private method for xml templating. Takes an Net::Amazon::Route53::ResourceRecordSet::Change object and returns the xml to change, i.e., delete and create, that single record.

_batch_request_header

Private method for xml templating. Returns a header string.

_batch_request_footer

Private method for xml templating. Returns a footer string.

SEE ALSO ^

Net::Amazon::Route53::HostedZone http://docs.amazonwebservices.com/Route53/latest/APIReference/

AUTHOR ^

Marco FONTANI <mfontani@cpan.org>

CONTRIBUTORS ^

Daiji Hirata <hirata@uva.ne.jp> Amiri Barksdale <amiri@arisdottle.net>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2011 by Marco FONTANI.

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

syntax highlighting: