Infoblox::Grid::NamedACL - Named ACL object.


NAME

Infoblox::Grid::NamedACL - Named ACL object.


DESCRIPTION

Named ACL object represents a named list of access control entries.


CONSTRUCTOR

 my $nacl = Infoblox::Grid::NamedACL->new(
    'name'                  => $string,                                                                      # Required
    'comment'               => $string,                                                                      # Optional
    'access_list'           => [ $ipv4addr | $ipv4_subnet/prefix | $ipv6addr |                               # Optional
                                 $ipv6_subnet/prefix | $TSIGKey | $NamedACL, ... ],
    'extattrs'              => { $string => $extattr, ... },                                                 # Optional / Default is undefined
    'extensible_attributes' => { $string => $string | $num, $string => [ $string | $num, ... ], ... },       # Optional
 );

You cannot set both extattrs and extensible_attributes attributes at the same time.


SESSION METHODS

This section describes all the methods in the Infoblox::Session module that you can apply to a Named ACL object.

Infoblox::Session->get( )

Use this method to retrieve all the matching objects from the Infoblox appliance. See Infoblox::Session->get() for parameters and return values.

Key References
 Apply the following attributes to get a specific Named ACL object:
  name    - Optional. The name of Named ACL object.
  comment - Optional. The comment in string format.
  extattrs- Optional. A hash reference containing extensible attributes.
Example
 my @retrieved_objs = $session->get(
    object => 'Infoblox::Grid::NamedACL',
    name   => 'nacl',
 );

Infoblox::Session->modify( )

Use this method to modify an object in the Infoblox appliance. See Infoblox::Session->modify() for parameters and return values.

If you have applied an access control list to an object, you must restart services after you update the access control list for the changes to take effect. See Infoblox::Session->restart() method.

Example
 # Use this method to modify comment of Named ACL object.
 $nacl->comment('new comment');
 # Submit modification
 my $response = $session->modify( $nacl );

Infoblox::Session->remove( )

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, first use get() or search() to retrieve the specific object, and then submit this object for removal.

Example
 # Get the objects with the same name
 my @retrieved_objs = $session->get(
     object => "Infoblox::Grid::NamedACL",
     name   => "nacl");
 # Find the desired object from the retrieved list.
 my $desired_nacl = $retrieved_objs[0];
 # Submit for removal
 my $response = $session->remove( $desired_nacl );

Infoblox::Session->search( )

Use this method to search for Named ACL objects in the Infoblox appliance. See Infoblox::Session->search() for parameters and return values.

Key References
 Apply the following attributes to search for Named ACL objects:
  name    - Optional. The name of Named ACL object (regular expression).
  comment - Optional. The comment in string format (regular expression).
  extattrs- Optional. A hash reference containing extensible attributes.
Example
 my @retrieved_objs = $session->search(
    object => 'Infoblox::Grid::NamedACL',
    name   => 'nacl',
 );


MODULE METHODS

Retrieved Named ACL objects in an access list are considered 'partial' objects. See Infoblox::Session->fill_partial_object() for more information on how it can be converted to a 'full' API object.


METHODS

This section describes all the methods that you can use to configure and retrieve the attribute values of Named ACL object.

access_list( )

Use this method to set or retrieve an access list of Named ACL object.

Parameter

The valid value is an array reference that contains IPv4/IPv6 addresses, networks, Infoblox::DNS::TSIGKey objects and/or Infoblox::Grid::NamedACL objects.

To deny queries from certain IP addresses and networks, add "!" as a prefix to the IP addresses and networks.

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
 # Get attribute value
 my $value = $nacl->access_list();
 # Modify attribute value
 $nacl->access_list(['10.0.0.1', $tsigkey, $nacl]);

comment( )

Use this method to set or retrieve a descriptive comment about Named ACL object.

Parameter

Desired comment in string format with a maximum of 256 bytes.

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
 # Get attribute value
 my $value = $nacl->comment();
 # Modify attribute value
 $nacl->comment('modified comment');

exploded_access_list( )

Use this method to retrieve the exploded access list of the Named ACL object. This is a read-only attribute.

Parameter

None.

Returns

The method returns the attribute value.

The valid value is an array reference that contains IPv4/IPv6 addresses, networks and/or Infoblox::DNS::TSIGKey objects.

Example
 # Get attribute value
 my $value = $nacl->exploded_access_list();

extattrs( )

Use this method to set or retrieve the extensible attributes associated with a Named ACL object.

Parameter

Valid value is a hash reference containing the names of extensible attributes and their associated values ( Infoblox::Grid::Extattr objects ).

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
 #Get extattrs
 my $ref_extattrs = $nacl->extattrs();
 #Modify extattrs
 $nacl->extattrs({ 'Site' => $extattr1, 'Administrator' => $extattr2 });

extensible_attributes( )

Use this method to set or retrieve the extensible attributes associated with Named ACL object.

Parameter

For valid values for extensible attributes, see Infoblox::Grid::ExtensibleAttributeDef/Extensible Attribute Values.

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
 # Get attribute value
 my $value = $nacl->extensible_attributes();
 # Modify attribute value
 $nacl->extensible_attributes({ 'Site' => 'Santa Clara', 'Administrator' => [ 'Peter', 'Tom' ] });

name( )

Use this method to set or retrieve the name of the Named ACL object.

Parameter

The name of the Named ACL object in string format.

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
 # Get attribute value
 my $value = $nacl->name();
 # Modify attribute value
 $nacl->name('new_nacl');


SAMPLE CODE

The following sample code demonstrates the different functions that can be applied to an object such as add, get, modify, search and remove. This sample also includes error handling for the operations.

#Preparation prior to getting and modifying an object

 use strict;
 use Infoblox;
 #refers to Infoblox Appliance IP address
 my $host_ip = "192.168.1.2";
 #Create a session to the Infoblox appliance
 my $session = Infoblox::Session->new(
     master   => $host_ip,
     username => "admin",
     password => "infoblox"
 );
 unless ($session) {
        die("Construct session failed: ",
                Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "Session created successfully\n";

#Create an object

 my $nacl = Infoblox::Grid::NamedACL->new(
     name          => "NACL",
     access_list   => ['10.0.0.1', '20.0.0.0/24'],
     comment       => "Script Generated",
     );
 unless ($nacl) {
        die("Construct object failed: ",
                Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "The object created successfully\n";
 #Adding the object to appliance through session
 my $response = $session->add( $nacl );
 unless ($response) {
     die("Add object failed: ",
            $session->status_code() . ":" . $session->status_detail());
 }
 print"The object was added successfully \n";

#Search for the object

  my @retrieved_objs = $session->search(
      object => "Infoblox::Grid::NamedACL",
      name   => ".*");
  my $object = $retrieved_objs[0];
  unless ($object) {
         die("Search the object failed: ",
                 $session->status_code() . ":" . $session->status_detail());
  }
  print "Search the object found at least 1 matching entry\n";

#Get and modify the object

 #Get the object through session
 my @retrieved_objs = $session->get(
     object => "Infoblox::Grid::NamedACL",
     name   => "NACL"
     );
 my $nacl = $retrieved_objs[0];
 unless ($nacl) {
     die("Get the object failed: ",
            $session->status_code() . ":" . $session->status_detail());
 }
 print"Retrieved the object successfully \n";
 # Modify one of the attributes of selected object.
 $nacl->comment("Modified object");
 #Applying the changes
 $session->modify($nacl)
    or die("Modify the object failed",
             $session->status_code() . ":" . $session->status_detail());
 print"The object was modified successfully \n";

#Remove the object

 #Get the object through session
 my @retrieved_objs = $session->get(
     object => "Infoblox::Grid::NamedACL",
     name   => "NACL"
     );
 my $desired_nacl = $retrieved_objs[0];
 unless ($desired_nacl) {
     die("Get the object failed: ",
            $session->status_code() . ":" . $session->status_detail());
 }
 print"Retrieved the object successfully \n";
 #Submit the object for removal
 $session->remove( $desired_nacl )
     or die("Remove the object failed",
            $session->status_code() . ":" . $session->status_detail());
 print"The object was removed successfully \n";
 ####PROGRAM ENDS####


AUTHOR

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


SEE ALSO

Infoblox::Session, Infoblox::DNS::TSIGKey, Infoblox::Grid::ExtensibleAttributeDef


COPYRIGHT

Copyright (c) 2017 Infoblox Inc.