Infoblox::Grid::DNS::Nsgroup::StubMember - A stub member group.
The stub member group provides stub servers configuration for stub zones.
my $object = Infoblox::Grid::DNS::Nsgroup::StubMember->new( name => $string, #Required stub_members => [$grid_member1, $grid_member2, ...], #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 stub 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::StubMember->new( name => 'stubgroup', stub_members => ['member1.com', 'member2.com'], );
#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 stub member group object:
comment - Optional. The stub member group comment in a string format. name - Optional. The stub 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::StubMember', name => 'stubgroup', );
my @retrieved_objs = $session->get( object => 'Infoblox::Grid::DNS::Nsgroup::StubMember', 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::StubMember', name => 'stubgroup', );
#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 stub member group object:
comment - Optional. The stub member group comment in a string format (regexp). name - Optional. The stub 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::StubMember', name => '^stub.*', comment => '.*comment', );
# search for objects defining 'Santa Clara' for 'Site' extensible attribute my @retrieved_objs = $session->search( object => 'Infoblox::Grid::DNS::Nsgroup::StubMember', extensible_attributes => {'Site' => 'Santa Clara'}, );
This section describes all the methods that you can use to configure and retrieve the attribute values of a stub member group.
Use this method to set or retrieve the stub 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('stub comment');
Use this method to set or retrieve the extensible attributes associated with a stub 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 stub 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 stub members.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The valid value is an array of Grid Member host names 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 stub_members value my $stub_members = $object->stub_members();
#Modify stub_members value
#Set stub_members value $object->stub_members(['member1.com', 'member2.com']);
Use this method to set or retrieve the stub 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('stubg1');
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 Stub 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 Stub Member Nsgroup object
#Creating a forwarding nsgroup object. my $stub_nsg1 = Infoblox::Grid::DNS::Nsgroup::StubMember->new( name => "stub_group_1", stub_members => ["infoblox.localdomain"], );
unless ($stub_nsg1) { die("Construct Stub Member Nsgroup failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); }
print "Stub Member Nsgroup object constructed successfully\n";
#Add the Nsgroup object
$result = $session->add($stub_nsg1); unless ($result) { die("Add Stub Member Nsgroup to session failed: ", $session->status_code() . ":" . $session->status_detail()); }
print "Stub Member Nsgroup object created successfully\n";
#Search and Modify the Nsgroup object
my @result_array = $session->search( object => "Infoblox::Grid::DNS::Nsgroup::StubMember", name => "stub_.*", );
my $object = $result_array[0];
unless ($object) { die("Search for Stub Member Nsgroup failed: ", $session->status_code() . ":" . $session->status_detail()); }
$result = $object->comment("stub member");
unless ($result) { die("Modify Stub 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 "Stub Member Nsgroup object modified successfully\n";
#Remove a Nsgroup object
my @result_array = $session->get( object => "Infoblox::Grid::DNS::Nsgroup::StubMember", name => "stub_group_1", );
my $object = $result_array[0];
unless ($object) { die("Get Stub 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 "Stub 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::Grid::ExtensibleAttributeDef/Extensible Attribute Values, Infoblox::Grid::Extattr
Copyright (c) 2017 Infoblox Inc.