Infoblox::Grid::SmartFolder::GroupBy - Smart Folder Group By object


NAME

Infoblox::Grid::SmartFolder::GroupBy - Smart Folder Group By object


DESCRIPTION

Defines grouping information in a global or personal smart folder.


CONSTRUCTOR

 my $group_by = Infoblox::Grid::SmartFolder::GroupBy->new(
     value                   => $string,            #Required
     enable_grouping         => "true" | "false",   #Required
     value_type              => "EXTATTR" | "NORMAL", #Optional / Default is "EXTATTR"
 );


MODULE METHODS

The following functions can be applied to a GroupBy object.

Infoblox::Grid::GlobalSmartFolder->group_bys( )

Use this function to specify a list of "group by" items to store in a global smart folder.

Example
 #Construct an object
 my $group_by_state = Infoblox::Grid::SmartFolder::GroupBy->new(
                                                                enable_grouping => 'true',
                                                                value => "State",
                                                                value_type => "EXTATTR",
                                                               );
 my $group_by_vcluster = Infoblox::Grid::SmartFolder::GroupBy->new(
                                                             enable_grouping => 'true',
                                                             value => "v_cluster",
                                                             value_type => "NORMAL",
                                                            );
 # Configure group_by items
 my $response = $GlobalSmartFolder->group_bys([$group_by_state,$group_by_vcluster]);

Infoblox::Grid::PersonalSmartFolder->group_bys( )

Use this function to specify a list of "group by" items to store in a personal smart folder.

Example
 #Construct an object
 my $group_by_state = Infoblox::Grid::SmartFolder::GroupBy->new(
                                                                enable_grouping => 'true',
                                                                value => "State",
                                                                value_type => "EXTATTR",
                                                               );
 my $group_by_vcluster = Infoblox::Grid::SmartFolder::GroupBy->new(
                                                             enable_grouping => 'true',
                                                             value => "v_cluster",
                                                             value_type => "NORMAL",
                                                            );
 # Configure group_by items
 my $response = $PersonalSmartFolder->group_bys([$group_by_state,$group_by_vcluster]);


METHODS

This section describes all the methods that you can use to configure and retrieve the attribute values of a SmartFolder::GroupBy object.

value( )

Use this method to specify the name of the attribute (when value_type is "EXTATTR" or "NORMAL"). The possible values for the value attribute are v_datacenter, v_cluster, v_host, v_entity_type, port_vlan_name, network_component_name, network_component_port_name, and any valid extensible attribute in the appliance.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

Valid values are strings corresponding to extensible attributes, object types, or object names.

Returns

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.

Example
 # Getting value
 my $value = $group_by->value();
 # Modifying value
 $group_by->value("Country");

value_type( )

Use this method to set or retrieve the value type.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

"EXTATTR" and "NORMAL" are supported.

Returns

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.

Example
 # Getting value_type
 my $value_type = $group_by->value_type();
 # Modifying value_type
 $group_by->value_type("EXTATTR");

enable_grouping( )

Use this method to set or retrieve the enable grouping attribute.

Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.

Parameter

Specify "true" to set the enable_grouping flag or "false" to deactivate/unset it. "group by" rules where enable_grouping is set to "false" will be ignored when retrieving the corresponding smart folder.

Returns

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.

Example
 # Getting enable_grouping
 my $enable_grouping = $group_by->enable_grouping();
 # Modifying enable_grouping
 $group_by->enable_grouping("true");


SAMPLE CODE

##Preparation prior to a smart folder group by 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("Construct session failed: ",
        Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "Session created successfully\n";

#Create a smart folder query item object

 my $group_by_state = Infoblox::Grid::SmartFolder::GroupBy->new(
                                                             enable_grouping => 'true',
                                                             value => "State",
                                                             value_type => "EXTATTR",
                                                            );
 unless ($group_by_state){
      die("Construct smart folder group_by item failed: ",
            Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "SmartFolder::GroupBy object created successfully\n";

#Create a personal smart folder and use $group_by

  #create a personal smart folder and use $query_item
  my $smart_folder = Infoblox::Grid::PersonalSmartFolder->new(
     name         => "my_personal_folder",
     group_bys    => [$group_by_state],
   );
 #put smart folder into session
 $session->add($smart_folder)
   or die("Smart folder creation failed: ",
            Infoblox::status_code() . ":" . Infoblox::status_detail());
 print "Smart folder creation successful\n";

#Clean up

 my @result = $session->get(
     object => "Infoblox::Grid::PersonalSmartFolder",
     name   => "my_personal_folder"
 );
 unless (scalar(@result) == 0) {
     $session->remove($result[0]);
 }
 ####PROGRAM ENDS####


AUTHOR

Infoblox Inc. http://www.infoblox.com/


SEE ALSO

Infoblox::Session, Infoblox::Session->add(), Infoblox::Session->get(), Infoblox::Session->modify(),Infoblox::Grid::GlobalSmartFolder,Infoblox::Grid::PersonalSmartFolder


COPYRIGHT

Copyright (c) 2017 Infoblox Inc.