Reply

How to set zone objects with extensible attribute of type list using API

Member
Posts: 2
1884     0

Hi All, 


I was wondering if anyone here has used the API to set an object's extensible attribute with a type List? 

The list that I have has multiple entries and i wanted to use the API to select one or multiple entries on the list. 

I am using infoblox 6.8.

Regards, 

Mark

setting attributes via Perl API

Authority
Posts: 39
1884     0

Hi,

I use the Perl API to create Host entries that have extensible attributes with a List type. This will be the same for Zone objects.

I just set them manually in the script :

my $host = Infoblox:Smiley Very HappyNS::Host->new(
    ipvaddrs => "10.10.10.10",
    name   => "example"
    extensible_attributes => { attr_w_list => "listitem4" },
);
my $response = $session->add($host);
print $session->status_detail();

When the object is created it will print "Operation succeeded" if "listitem4" is indeed in the list of attr_w_list. If "listitem4" is not in the list it will print "Enum Value Invalid: name: attr_w_list, value listitem4."

If you prefer not to have Infoblox throw an error when a value doesn't exist you could get the values in the list by using the list_values function on the Infoblox::Grid::ExtensibleAttributeDef object  :

my @retrieved_objs = $session->get(
     object     => "Infoblox::Grid::ExtensibleAttributeDef",
     name       => "attr_w_list" );
my $ext_attr_def = $retrieved_objs[0];
my $ref_list_values = $ext_attr_def->list_values();
foreach my $value (@$ref_list_values)
{
    print "$value\n";
}

Kind regards,

Stefaan Van den Branden

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You