Infoblox::Grid::DNS::Nsgroup::ForwardingMember - A forwarding member group.
The forwarding member group provides forwarding servers configuration for forward zones.
my $object = Infoblox::Grid::DNS::Nsgroup::ForwardingMember->new( name => $string, #Required forwarding_servers => [$dnsmember1, $dnsmember2, ...], #Required comment => $string, #Optional / Default is undefined extattrs => { $string => $extattr, ... }, #Optional / Default is undefined extensible_attributes => {$string => $string | $num, $string => [ $string | $num, ... ], ... } #Optional / Default is undefined );
You cannot set both extattrs and extensible_attributes attributes at the same time.
This section describes all the methods in an Infoblox::Session module that you can apply to a forwarding members group object.
Use this method to add the object to the Infoblox appliance. See Infoblox::Session->add() for parameters and return values.
#Construct an object my $object = Infoblox::Grid::DNS::Nsgroup::ForwardingMember->new( name => 'fwdgroup', forwarding_servers => [$dnsmember1, $dnsmember2], );
#Submit for addition my $response = $session->add($object);
Use this method to retrieve all the matching objects from the Infoblox appliance. See Infoblox::Session->get() for parameters and return values.
Apply the following attributes to get a specific forwarding member group object:
comment - Optional. The forwarding member group comment in a string format. name - Optional. The forwarding member group name in a string format. extattrs - Optional. A hash reference containing extensible attributes. extensible_attributes - Optional. A hash reference containing extensible attributes.
For more information about searching extensible attributes, see Infoblox::Grid::ExtensibleAttributeDef/Searching Extensible Attributes.
my @retrieved_objs = $session->get( object => 'Infoblox::Grid::DNS::Nsgroup::ForwardingMember', name => 'fwdgroup', );
# search for objects defining 'Santa Clara' for 'Site' extensible attribute my @retrieved_objs = $session->search( object => 'Infoblox::Grid::DNS::Nsgroup::ForwardingMember', extensible_attributes => {'Site' => 'Santa Clara'}, );
Use this method to modify the object in the Infoblox appliance. See Infoblox::Session->modify() for parameters and return values.
#Modify comment value $object->comment('this is a modified comment');
#Submit modification my $response = $session->modify($object);
Use this method to remove the object from the Infoblox appliance. See Infoblox::Session->remove() for parameters and return values.
To remove a specific object, first use get()
or search()
to retrieve the specific DHCP range object, and then submit this object for removal.
#Get the objects my @retrieved_objs = $session->get( object => 'Infoblox::Grid::DNS::Nsgroup::ForwardingMember', name => 'fwdgroup', );
#Find the desired object from the retrieved list my $desired_object = $retrieved_objs[0];
#Submit for removal my $response = $session->remove($desired_object);
Use this method to search for objects in the Infoblox appliance. See Infoblox::Session->search() for parameters and return values.
Apply the following attributes to search for the forwarding member group object:
comment - Optional. The forwarding member group comment in a string format (regexp). name - Optional. The forwarding member group name in a string format (regexp). extattrs - Optional. A hash reference containing extensible attributes. extensible_attributes - Optional. A hash reference containing extensible attributes.
For more information about searching extensible attributes, see Infoblox::Grid::ExtensibleAttributeDef/Searching Extensible Attributes.
# search for objects my @retrieved_objs = $session->search( object => 'Infoblox::Grid::DNS::Nsgroup::ForwardingMember', name => '^fwd.*', comment => '.*comment', );
# search for objects defining 'Santa Clara' for 'Site' extensible attribute my @retrieved_objs = $session->search( object => 'Infoblox::Grid::DNS::Nsgroup::ForwardingMember', extensible_attributes => {'Site' => 'Santa Clara'}, );
This section describes all the methods that you can use to configure and retrieve the attribute values of a forwarding member group.
Use this method to set or retrieve the forwarding member group comment.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The valid value is a desired comment in a string format.
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 value my $comment = $object->comment();
#Modify comment value $object->comment('fwd comment');
Use this method to set or retrieve the extensible attributes associated with a forwarding member group object.
Valid value is a hash reference that contains the names of extensible attributes and their associated values (Infoblox::Grid::Extattr objects).
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 extattrs value my $extattrs = $object->extattrs();
#Modify extattrs value $object->extattrs({'Site' => $extattr1, 'Administrator' => $extattr2});
Use this method to set or retrieve the extensible attributes associated with a forwarding member group object.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
For valid values for extensible attributes, see Infoblox::Grid::ExtensibleAttributeDef/Extensible Attribute Values.
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 extensible attributes value my $extensible_attributes = $object->extensible_attributes(); #Modify extensible attributes $object->extensible_attributes({'Site' => 'Santa Clara', 'Administrator' => ['Peter', 'Tom']});
Use this method to set or retrieve the list of forwarding servers.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The valid value is an array of Infoblox::DNS::Member objects.
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 forwarding_servers value my $forwarding_servers = $object->forwarding_servers();
#Modify forwarding_servers value
#Create nameserver object my $nameserver = Infoblox::DNS::Nameserver->new( name => 'ns1.domain1.extra', ipv4addr => '5.5.5.5', );
#Create dns member object my $dnsmember = Infoblox::DNS::Member->new( ipv4addr => '1.1.1.1', forward_to => [$nameserver], );
#Set forwarding_servers value $object->forwarding_servers([$dnsmember]);
Use this method to set or retrieve the forwarding member group name.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The valid value is a desired name in a string format.
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 name value my $name = $object->name();
#Modify name value $object->name('fwdg1');
The following sample code demonstrates the different functions that can be applied to an object, such as modify and remove. This sample also includes error handling for the operations.
#Preparation prior to an Forwarding Member Nsgroup object insertion
#PROGRAM STARTS: Include all the modules that will be used use strict; use Infoblox;
my ($session, $result);
#Create a session to the Infoblox device $session = Infoblox::Session->new( master => "192.168.1.2", username => "admin", password => "infoblox" ); unless ($session) { die("Construct session failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Session created successfully\n";
#Create an Forwarding Member Nsgroup object
#Creating an external nameserver my $nameserver = Infoblox::DNS::Nameserver->new( name => "ns1.domain0.external", ipv4addr => "5.5.5.5", );
#Creating a forwarding member object. my $fwd_member = Infoblox::DNS::Member->new( name => "infoblox.localdomain", ipv4addr => "192.168.1.2", forward_to => [$nameserver], );
#Creating a forwarding nsgroup object. my $fwd_nsg1 = Infoblox::Grid::DNS::Nsgroup::ForwardingMember->new( name => "fwd_group_1", forwarding_servers => [$fwd_member], );
unless ($fwd_nsg1) { die("Construct Forwarding Member Nsgroup failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); }
print "Forwarding Member Nsgroup object constructed successfully\n";
#Add the Nsgroup object
$result = $session->add($fwd_nsg1); unless ($result) { die("Add Forwarding Member Nsgroup to session failed: ", $session->status_code() . ":" . $session->status_detail()); }
print "Forwarding Member Nsgroup object created successfully\n";
#Search and Modify the Nsgroup object
my @result_array = $session->search( object => "Infoblox::Grid::DNS::Nsgroup::ForwardingMember", name => "fwd_.*", );
my $object = $result_array[0];
unless ($object) { die("Search for Forwarding Member Nsgroup failed: ", $session->status_code() . ":" . $session->status_detail()); }
$result = $object->comment("forwarding member");
unless ($result) { die("Modify Forwarding Member Nsgroup failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); }
$result = $session->modify($object);
unless ($result) { die("Submit modification to the session failed: ", $session->status_code() . ":" . $session->status_detail()); }
print "Forwarding Member Nsgroup object modified successfully\n";
#Remove a Nsgroup object
my @result_array = $session->get( object => "Infoblox::Grid::DNS::Nsgroup::ForwardingMember", name => "fwd_group_1", );
my $object = $result_array[0];
unless ($object) { die("Get Forwarding Member Nsgroup failed: ", $session->status_code() . ":" . $session->status_detail()); }
$result = $session->remove($object);
unless ($result) { die("Remove Nsgroup failed: ", $session->status_code() . ":" . $session->status_detail()); }
print "Forwarding Member Nsgroup object removed successfully\n";
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Session, Infoblox::Session->add(), Infoblox::Session->get(), Infoblox::Session->modify(), Infoblox::Session->remove(), Infoblox::Session->search(), Infoblox::DNS::Member, Infoblox::Grid::ExtensibleAttributeDef/Extensible Attribute Values, Infoblox::Grid::Extattr
Copyright (c) 2017 Infoblox Inc.