Infoblox::Grid::ExtensibleAttributeDef - Extensible Attribute Definition object.
The Extensible Attribute Definition object is used to create or modify the definition of an extensible attribute. After the definition is created, the attribute can be defined on other Infoblox objects.
When searching for integer, string and date extensible attributes, the following constructs are supported, in addition to specifying the actual desired value.
The string search can be modified by specifying the string in the following format:
stringattr => { value => $wantedstring, ... options ... }
the following options are supported:
case_insensitive => "true" | "false" # Optional. If "true", the string search will be case insensitive. The default is "false".
Following is an example of a string search:
@result = $session->search(object => 'Infoblox::DNS::Record::A', extensible_attributes => { stringattr => { value => "some string", case_insensitive => "true"});
Integer searches support the following where X and Y are integers:
Following are examples of integer searches:
@result = $session->search(object => 'Infoblox::DNS::Record::A', extensible_attributes => { integerattr => '<= 5'});
@result = $session->search(object => 'Infoblox::DNS::Record::A', extensible_attributes => { integerattr => '!= 5'});
@result = $session->search(object => 'Infoblox::DNS::Record::A', extensible_attributes => { integerattr => '>=< 5,10'});
Valid values for dates when searching are:
Date searches support the following where X and Y are dates:
Following are examples of date searches:
@result = $session->search(object => 'Infoblox::DNS::Record::A', extensible_attributes => { dateattr => '<= yesterday'});
@result = $session->search(object => 'Infoblox::DNS::Record::A', extensible_attributes => { dateattr => 'this week'});
@result = $session->search(object => 'Infoblox::DNS::Record::A', extensible_attributes => { dateattr => '>=< 2010-10-20,2010-11-01'});
@result = $session->search(object => 'Infoblox::DNS::Record::A', extensible_attributes => { dateattr => '- 3'});
The valid value for an extensible attribute is a hash reference containing the names of extensible attributes and their associated values.
The names must be those of existing Infoblox::Grid::ExtensibleAttributeDef objects in the database.
For email, URL, and string types, the value is a string with a maximum of 256 characters.
For a list, the value is a string with a maximum of 64 characters.
For an integer, the value is an integer from -2147483648 through 2147483647.
For a date, the value is the number of seconds that have elapsed since January 1st, 1970 UTC or a string of the format YYYY-MM-DD. Any date entered will be converted to an epoch time corresponding to that day at 11:01am UTC.
The default value for the member is undefined.
my $ext_attr_def = Infoblox::Grid::ExtensibleAttributeDef->new( name => $string, #Required type => "string" | "integer" | "email" | "date" | "list" | "url", #Optional / Default is "string" comment => $string, #Optional / Default is undefined audit_log => "true" | "false", #Optional / Default is "false" inheritable => "true" | "false", #Optional / Default is "false" multiple => "true" | "false", #Optional / Default is "false" cloud_api => "true" | "false", #Optional / Default is "false" mgm_private => "true" | "false", #Optional / Default is "false" grid_master => "true" | "false", #Optional / Default is "false" default_value => $string | $num, #Optional / Default is undefined list_values => [$Value1, $Value2, ...], #Optional / Default is undefined (Mandatory if Extensible Attributes of type='list' is defined; optional otherwise) min => $num, #Optional / Default is undefined max => $num, #Optional / Default is undefined allowed_object_types=> [$string, $string, ...] #Optional / Default is undefined user_input => 'recommended' | 'required' | 'optional', #Optional / Default is 'optional' descendants_action => $descendants, #Optional / Default is undefined );
This section describes all the methods in the Infoblox::Session module that you can apply to an Extensible Attribute Definition object.
Use this method to add an object to the Infoblox appliance. See Infoblox::Session->add() for parameters and return values.
# Construct an Extensible Attribute Definition object my $ext_attr_def = Infoblox::Grid::ExtensibleAttributeDef->new( name => "test_ext_attr", comment => "test extensible attribute", type => "integer" ); # Submit for addition my $response = $session->add( $ext_attr_def );
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 Extensible Attribute Definition object:
name - Required. Extensible Attribute Definition name in string format. namespace - Optional. Extensible Attribute Definition namespace.
my @retrieved_objs = $session->get( object => "Infoblox::Grid::ExtensibleAttributeDef", name => "test_ext_attr" );
Use this method to modify an object in the Infoblox appliance. See Infoblox::Session->modify() for parameters and return values.
# Use this method to modify the comment. $ext_attr_def->comment("This is a modified comment"); # Submit modification my $response = $session->modify( $ext_attr_def );
Use this method to remove an object from the Infoblox appliance. See Infoblox::Session->remove() for parameters and return values.
To remove a specific object, use get()
or search()
to retrieve the specific object first, and then submit this object for removal.
# Get the Extensible Attribute Definition object matching the given name my @retrieved_objs = $session->get( object => "Infoblox::Grid::ExtensibleAttributeDef", name => "test_ext_attr" ); # Find the desired object from the retrieved list. my $ext_attr_def = $retrieved_objs[0]; # Submit for removal my $response = $session->remove( $ext_attr_def );
Use this method to search for Extensible Attribute Definition objects in the Infoblox appliance. See Infoblox::Session->search() for parameters and return values.
Apply the following attributes to search for a specific Extensible Attribute Definition object:
name - Optional. Extensible Attribute Definition name (regular expression). comment - Optional. Extensible Attribute Definition comment (regular expression). namespace - Optional. Extensible Attribute Definition namespace.
For more information about searching extensible attributes, see Infoblox::Grid::ExtensibleAttributeDef/Searching Extensible Attributes.
# search for all Extensible Attribute Definition objects starting with "test" my @retrieved_objs = $session->search( object => "Infoblox::Grid::ExtensibleAttributeDef", name => "test.*" );
This section describes all the methods that you can use to set and retrieve the attribute values of an Extensible Attribute Definition object.
Use this method to set or retrieve the object types on which the extensible attribute can be defined.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Parameter is an array reference that contains the list of object types on which the extensible attribute can be defined. The following object types are supported here:
Infoblox::Grid::Member Infoblox::Grid::Admin::User Infoblox::Grid::Admin::Role Infoblox::DHCP::FailOver Infoblox::DHCP::Filter::Fingerprint Infoblox::DHCP::Filter::MAC Infoblox::DHCP::Filter::NAC Infoblox::DHCP::Filter::Option Infoblox::DHCP::Filter::RelayAgent Infoblox::DHCP::Fingerprint Infoblox::DHCP::FixedAddr Infoblox::DHCP::FixedAddrTemplate Infoblox::DHCP::IPv6FixedAddr Infoblox::DHCP::IPv6FixedAddrTemplate Infoblox::DHCP::IPv6Network Infoblox::DHCP::IPv6Network Infoblox::DHCP::IPv6NetworkContainer Infoblox::DHCP::IPv6NetworkContainer Infoblox::DHCP::IPv6NetworkTemplate Infoblox::DHCP::IPv6Range Infoblox::DHCP::IPv6RangeTemplate Infoblox::DHCP::IPv6SharedNetwork Infoblox::DHCP::MAC Infoblox::DHCP::MSSuperscope Infoblox::DHCP::Network Infoblox::DHCP::NetworkContainer Infoblox::DHCP::NetworkTemplate Infoblox::DHCP::Range Infoblox::DHCP::RangeTemplate Infoblox::DHCP::RoamingHost Infoblox::DHCP::SharedNetwork Infoblox::DHCP::View Infoblox::DNS::BulkHost Infoblox::DNS::Host Infoblox::DNS::RPZRecord::A Infoblox::DNS::RPZRecord::AAAA Infoblox::DNS::RPZRecord::AAAAIpAddress Infoblox::DNS::RPZRecord::AIpAddress Infoblox::DNS::RPZRecord::CNAME Infoblox::DNS::RPZRecord::CNAME::ClientIpAddress Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN Infoblox::DNS::RPZRecord::CNAME::IpAddress Infoblox::DNS::RPZRecord::CNAME::IpAddressDN Infoblox::DNS::RPZRecord::MX Infoblox::DNS::RPZRecord::NAPTR Infoblox::DNS::RPZRecord::PTR Infoblox::DNS::RPZRecord::SRV Infoblox::DNS::RPZRecord::TXT Infoblox::DNS::Record::A Infoblox::DNS::Record::AAAA Infoblox::DNS::Record::Alias Infoblox::DNS::Record::CNAME Infoblox::DNS::Record::DNAME Infoblox::DNS::Record::MX Infoblox::DNS::Record::NS Infoblox::DNS::Record::PTR Infoblox::DNS::Record::SRV Infoblox::DNS::Record::TLSA Infoblox::DNS::Record::TXT Infoblox::DNS::SRG Infoblox::DNS::SharedRecord::A Infoblox::DNS::SharedRecord::AAAA Infoblox::DNS::SharedRecord::CNAME Infoblox::DNS::SharedRecord::MX Infoblox::DNS::SharedRecord::SRV Infoblox::DNS::SharedRecord::TXT Infoblox::DNS::View Infoblox::DNS::Zone Infoblox::DTC::LBDN Infoblox::DTC::Monitor::HTTP Infoblox::DTC::Monitor::ICMP Infoblox::DTC::Monitor::PDP Infoblox::DTC::Monitor::SIP Infoblox::DTC::Monitor::SNMP Infoblox::DTC::Monitor::TCP Infoblox::DTC::Pool Infoblox::DTC::Server Infoblox::DTC::Topology Infoblox::Grid::AllEndpoints Infoblox::Grid::DNS Infoblox::Grid::DNS::DNS64Group Infoblox::Grid::DNS::Nsgroup Infoblox::Grid::DNS::Nsgroup::DelegationMember Infoblox::Grid::DNS::Nsgroup::ForwardStubServer Infoblox::Grid::DNS::Nsgroup::ForwardingMember Infoblox::Grid::Discovery::Device Infoblox::Grid::Discovery::DeviceInterface Infoblox::Grid::MSServer Infoblox::Grid::Member::DNS Infoblox::Grid::NamedACL Infoblox::Grid::ParentalControl::SubscriberSite Infoblox::Grid::RIR::Organization Infoblox::Grid::SNMP::User Infoblox::Grid::ServiceRestart::Group
If the parameter is undefined, the extensible attribute can be defined on all object types. The default value is undefined.
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 allowed object types my $ref_allowed_object_types = $ext_attr_def->allowed_object_types(); # Modify allowed object types $ext_attr_def->allowed_object_types(['Infoblox::DHCP::Range', 'Infoblox::DHCP::RangeTemplate']);
Use this method to set or retrieve the "audit_log" flag.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the audit_log flag or "false" to deactivate/unset it. When the flag is set the extensible attribute name and value assigned to an object are logged in the audit log when a change occurs on the object. The default value for this field is "false".
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 audit_log flag my $audit_log = $ext_attr_def->audit_log(); # Modify audit_log flag $ext_attr_def->audit_log("true");
Use this method to set or retrieve the comment.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Comment in string format with a maximum of 256 characters. The default value is undefined.
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 = $ext_attr_def->comment(); #Modify comment $ext_attr_def->comment("This is the modified comment for extensible attribute definition");
Use this method to set or retrieve the value used to pre-populate the attribute value in the GUI.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Default value used to pre-populate the attribute value in the GUI. For email, URL, and string types, the value is a string with a maximum of 256 characters. For a list, the value is a string with a maximum of 64 characters. For an integer, the value is an integer from -2147483648 through 2147483647. For a date, the value is the number of seconds that have elapsed since January 1st, 1970 UTC. The default value is undefined.
Note that, for a date, the time value is automatically modified to 11:01:00 before insertion, so you may not get the same value that you've inserted upon retrieval. e.g. 1000000 (1970-01-12T13:46:40Z) will be returned as 990060 (1970-01-12T11:01:00Z).
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 default value of an extensible attribute of type string my $ext_attr_def = $ext_attr_def->default_value(); # Modify default value $ext_attr_def->default_value("Router");
Use this method to set the actions for extensible attributes that exist on descendants. This attribute is write-only and cannot be retrieved.
Valid value is an Infoblox::Grid::ExtensibleAttributeDef::Descendants object.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
#Modify attribute value $ext_attr_def->descendants_action($descendants);
Use this method to set or retrieve the "inheritable" flag.
Specify "true" to set the inheritable flag or "false" to deactivate/unset it. The default value is "false".
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 inheritable flag my $inheritable = $ext_attr_def->inheritable(); # Modify inheritable flag $ext_attr_def->inheritable("true");
Use this method to set or retrieve the list of values that can be defined for the list type.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Parameter is an array reference that contains Infoblox::Grid::ExtensibleAttributeDef::ListValue values associated with an extensible attribute object defined as the "list" type. This parameter is not used for other types. The default value for this field is undefined.
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 list of values my $ref_list_values = $ext_attr_def->list_values();
# Add a new value to the list my $ref_list_values = $ext_attr_def->list_values(); push @$ref_list_values, Infoblox::Grid::ExtensibleAttributeDef::ListValue->new(value => 'Santa Clara'); $ext_attr_def->list_values($ref_list_values);
# Rename a value in the list my $ref_list_values = $ext_attr_def->list_values(); foreach my $value (@$ref_list_values) { if ($value->value() eq 'San Francisco') { $value->value('Los Angeles'); } } $ext_attr_def->list_values($ref_list_values);
Use this method to set or retrieve the maximal length of string for string type or maximal value for integer type.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
For a string, the value is an integer from 1 through 256. For an integer, the value is an integer from -2147483648 through 2147483647. This parameter is not used for other types. Using the Infoblox::Session->modify() function you can only define a value greater than the current one. The default value is undefined.
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 max my $ext_attr_def = $ext_attr_def->max(); # Modify max $ext_attr_def->max(23);
Use this method to set or retrieve the minimal length of string for string type or minimal value for integer type.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
For a string, the value is an integer from 1 through 256. For an integer, the value is an integer from -2147483648 through 2147483647. This parameter is not used for other types. Using the Infoblox::Session->modify() function you can only define a value lesser than the current one. The default value is undefined.
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 min my $ext_attr_def = $ext_attr_def->min(); # Modify min $ext_attr_def->min(3);
Use this method to set or retrieve the "multiple" flag.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the multiple flag or "false" to deactivate/unset it. When the flag is set multiple values can be assigned to an extensible attribute. Using the Infoblox::Session->modify() function you can change this flag from "false" to "true". The reverse operation is not allowed. The default value for this field is "false".
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 multiple flag my $audit_log = $ext_attr_def->multiple(); # Modify multiple flag $ext_attr_def->multiple("true");
Use this method to set or retrieve the "cloud_api" flag.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the cloud_api flag or "false" to deactivate or unset it. The default value is "false".
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 cloud_api flag my $cloud_api = $ext_attr_def->cloud_api(); # Modify cloud_api flag $ext_attr_def->cloud_api("true");
Use this method to set or retrieve the "grid_master" flag.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the grid_master flag or "false" to deactivate or unset it. The default value is "false".
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 grid_master flag my $grid_master = $ext_attr_def->grid_master(); # Modify grid_master flag $ext_attr_def->grid_master("true");
Use this method to set or retrieve the "mgm_private" flag.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify "true" to set the mgm_private flag or "false" to deactivate or unset it. The default value is "false".
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 mgm_private flag my $mgm_private = $ext_attr_def->mgm_private(); # Modify mgm_private flag $ext_attr_def->mgm_private("true");
Use this method to set or retrieve the name of an extensible attribute definition.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Name of the extensible attribute with a maximum of 128 characters.
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 my $name = $ext_attr_def->name(); # Modify name $ext_attr_def->name("Class");
Use this method to retrieve the extensible attribute definition namespace. This is a read-only attribute.
Specific extensible attribute definitions with 'RIPE' namespace will be added only when support for RIR/SWIP is enabled at the Grid level for the first time. See Infoblox::Grid->enable_rir_swip() method.
None
The method returns the attribute value that can be 'default', 'MSADSITES', 'RIPE' or 'CLOUD'.
# Get namespace $namespace = $ext_attr_def->namespace();
Use this method to set or retrieve the type of an extensible attribute.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Parameter is a string. The default value for this field is "string". Currenty the supported object types are 'string', 'integer', 'email', 'date', 'list' and 'url'. Modification of the type using the Infoblox::Session->modify() function is not allowed.
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 type my $type = $ext_attr_def->type();
Use this method to set or retrieve the flag that indicates whether the extensible attribute value is required, recommended or optional.
Valid values are 'recommended', 'required' or 'optional'. The default value is 'optional'.
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 user_input my $user_input = $ext_attr_def->user_input(); #Modify user_input $ext_attr_def->user_input('required');
The following sample code demonstrates the different functions that can be applied to an object, such as add, get, modify, and remove. This sample also includes error handling for the operations.
#Preparation prior to an Extensible Attribute Definition 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", #appliance host ip username => "admin", #appliance user login password => "infoblox" #appliance password );
unless ($session) { die("Construct session failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Session created successfully\n";
#Create an Extensible Attribute Definition object
my $ext_attr_def = Infoblox::Grid::ExtensibleAttributeDef->new( name => "test_extensible_atttribute", comment => "test extensibleatttribute", type => "integer", min => -50, max => 50, );
unless ($ext_attr_def) { die("Construct extensible attribute definition object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Extensible Attribute Definition object created successfully\n";
#Add this object to the Infoblox appliance through a session $session->add($ext_attr_def) or die("Add Extensible Attribute Definition object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Extensible Attribute Definition object added to server successfully\n";
#Get and modify an Extensible Attribute Definition object
#Get the object from Infoblox appliance through a session my @retrieved_objs = $session->get( object => "Infoblox::Grid::ExtensibleAttributeDef", name => "test_extensible_atttribute" ); my $object = $retrieved_objs[0];
unless ($object) { die("Get Extensible Attribute Definition object failed: ", $session->status_code() . ":" . $session->status_detail()); } print "Get Extensible Attribute Definition object found at least 1 matching entry\n";
#Modify the object $object->comment("this is a new comment"); $object->min(-100); $object->max(100);
#Apply the changes. $session->modify($object) or die("Modify Extensible Attribute definition object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Extensible Attribute definition object modified successfully \n";
#Accessor methods print "name: " . $object->name() . "\n"; print "comment: " . $object->comment() . "\n"; print "min: " . $object->min() . "\n"; print "max: " . $object->max() . "\n";
#Remove an Extensible Attribute Definition object
#Get the object through the session my @retrieved_objs = $session->get( object => "Infoblox::Grid::ExtensibleAttributeDef", name => "test_extensible_atttribute" ); my $object = $retrieved_objs[0]; unless ($object) { die("Get Extensible Attribute Definition object failed: ", $session->status_code() . ":" . $session->status_detail()); } print "Get Extensible Attribute Definition object found at least 1 matching entry\n";
#Submit the object for removal $session->remove($object) or die("Remove Extensible Attribute Definition object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Extensible Attribute Definition object removed successfully \n";
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Session->add(), Infoblox::Session->get(), Infoblox::Session->modify(), Infoblox::Session->remove(), Infoblox::Session->search(),Infoblox::Session,Infoblox::Grid::ExtensibleAttributeDef::Descendants
Copyright (c) 2019 Infoblox Inc.