Infoblox::DNS::Sortlist - DNS Sortlist Object.
A sortlist sorts the order of addresses in responses made to DNS queries.
my $sort_list = Infoblox::DNS::Sortlist->new( source_ipv4addr => $ipv4addr | $ipv4_subnet/prefix #Either source_ipv4addr or source_ipv6addr is required source_ipv6addr => $ipv6addr | $ipv6_subnet/prefix #Either source_ipv4addr or source_ipv6addr is required match_list => [ $ipv4addr | $ipv4_subnet/prefix | $ipv6addr | $ipv6_subnet/prefix ...] | undef #Optional / Default is undefined comment => $string| undef, #Optional / Default is undefined );
The following functions are available to apply to an Sortlist object.
Use this function to specify a sortlist at the grid level on the Infoblox appliance. See Infoblox::Grid::DNS->sortlist() for parameters and return values.
# Construct the object my $sortlist = Infoblox::DNS::Sortlist->new( match_list => ["10.20.1.0/24", "10.20.2.0/24"], source_ipv4addr => "1.2.3.4" ); # Configure sortlist on the grid DNS object my $response = $Grid_DNS->sortlist([$sortlist]);
Use this function to specify a sortlist at the grid member level. See Infoblox::Grid::Member::DNS->sortlist() for parameters and return values.
# Construct the object my $sortlist = Infoblox::DNS::Sortlist->new( match_list => ["10.20.1.0/24", "10.20.2.0/24"], source_ipv4addr => "1.2.3.4" ); # Configure sortlist on a Grid Member DNS object my $response = $Grid_Member_DNS->sortlist([$sortlist]);
This section describes all the methods that you can use to configure and retrieve the attribute values of a sortlist object.
Use this method to set or retrieve the match list of a sortlist.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Array reference which contains IP addresses and/or networks.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get match list. my $ref_matchlist = $sort_list->match_list(); #Modify match list. $sort_list->match_list(["10.0.0.10", "20.0.0.0/24", "2001:db8:1234::/48", "2001:db8::1428:57ab"]);
Use this method to set or retrieve the source IPv4 address of a sortlist object.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Address or network of querier which will be preferred by the resolver as the result of a query. To specify "ANY" querier, please use "0.0.0.0/0".
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get ipv4addrs my $source_ipv4addr = $sort_list->source_ipv4addr(); #Modify ipv4addrs $sort_list->source_ipv4addr("10.20.1.0/24");
Use this method to set or retrieve the source IPv6 address of a sortlist object.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Address or network of querier which will be preferred by the resolver as the result of a query.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get ipv6addrs my $source_ipv6addr = $sort_list->source_ipv6addr(); #Modify ipv6addrs $sort_list->source_ipv6addr("2001:25d8:44:55::/64");
Use this method to set or retrieve a descriptive comment of a sortlist object.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Enter a descriptive comment for the sortlist in string format with a maximum of 256 bytes.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
# Get comment my $comment = $sort_list->comment(); # Modify comment $sort_list->comment("test comment");
The following sample code demonstrates the different functions that can be applied to an object, such as add, modify. This sample also includes error handling for the operations.
#Preparation prior to a DNS sortlist object insertion
#PROGRAM STARTS: Include all the modules that will be used use strict; use Infoblox;
#Create a session to the Infoblox appliance
my $session = Infoblox::Session->new( master => "192.168.1.2", username => "admin", password => "infoblox" );
unless ($session) { die("Construc session failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Session created successfully\n";
#Create a Sortlist object
my $sort1 = Infoblox::DNS::Sortlist->new( match_list => ["10.20.1.0/24", "10.20.2.0/24"], source_ipv4addr => "1.2.3.4" );
unless($sort1) { die("Construct sort list failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "First sort list object (IPv4) created successfully\n";
#Create another sortlist to demonstrate IPv6
my $sort2 = Infoblox::DNS::Sortlist->new( match_list => ["2001:db8:1234::/48", "2001:db8:345::/64", "192.168.1.1"], source_ipv6addr => "2001:db8::1428:57ab" );
unless($sort2) { die("Construct sort list failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Second sort list object (IPv6) created successfully\n";
#Get the Member DNS object to add sortlist object to it
my @result_array = $session->get( object => "Infoblox::Grid::Member::DNS", name => $host_name );
unless (scalar(@result_array) == 0) { my $memberdns = $result_array[0];
if ($memberdns) {
#Apply changes to the Member object. $memberdns->sortlist([$sort1, $sort2]) or die("modify member failed: ", $session->status_code() . ":" . $session->status_detail()); print "sort lists added to Member DNS object successfully\n";
#Update member DNS object through the Infoblox session. $session->modify($memberdns) or die("modify session failed: ", $session->status_code() . ":" . $session->status_detail()); print "Member DNS object with sortlists updated to Infoblox device successfully\n";
#Modify existing sortlist objects
#Modifying the value of the specified object. $sort1->source_ipv4addr("10.20.1.0/24"); print "Modify first sortlist value\n";
#Modifying the value of the specified object. $sort1->match_list(["10.0.0.10", "20.0.0.0/24", "30.0.0.30", "40.10.0.0/24"]);
#Modifying the value of the specified object. $sort2->source_ipv6addr("2001:db8::1428:0/112"); print "Modify second sortlist value\n";
#Apply changes to the member object. $memberdns->sortlist([$sort1, $sort2]) or die("modify member failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); print "sort list updated to Member DNS object successfully\n";
#Update member DNS object through the Infoblox session. $session->modify($memberdns) or die("modify session failed: ", $session->status_code() . ":" . $session->status_detail()); print "Member DNS object with sortlist updated to Infoblox device successfully\n"; } } else { print "No member found with the specified name."; }
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Session,Infoblox::Session->get(), Infoblox::Session->modify(),Infoblox::Grid::Member::DNS->sortlist(), Infoblox::Grid::DNS->sortlist()
Copyright (c) 2017 Infoblox Inc.