Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN - DNS Substitute Domain Name rule object.


NAME

Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN - DNS Substitute Domain Name (Based on Client IP Address) rule object.


DESCRIPTION

A DNS Substitute Domain Name (Based on Client IP Address) rule represents different Response Policy Zone (RPZ) rules, depending on the value of the canonical name.

This rule represents Substitute (Domain Name) Rule.

Note that you must specify only one view for the attribute "views".


CONSTRUCTOR

  my $bind_cname_dn =  Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN->new (
      canonical => $fqdn,                 #Required
      name      => $fqdn,                 #Required
      rp_zone   => $rp_zone,              #Required
      comment   => $string,               #Optional / Default is empty
      disable   => "true"|"false"         #Optional / Default "false"
      extattrs              => { $string => $extattr, ... },      #Optional / Default is undefined
      extensible_attributes => { $string => $string|$num, $string => [ $string|$num, ...], ... }, #Optional / Default is undefined
      ttl       => $num|undef,            #Optional / Default is undefined
      views     => [$View1],              #Optional / Default is "default" view
   );

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


SESSION METHODS

This section describes all the methods in Infoblox::Session module that you can apply to a DNS Substitute Domain Name (Based on Client IP Address) rule object.

Infoblox::Session->add( )

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

Example
 #Construct a DNS Substitute Domain Name (Based on Client IP Address) rule object
 my $bind_cname_dn = Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN->new (
     name      => "10.6.0.0/16.rpz.com",
     canonical => "domain.com",
     rp_zone   => response_policy_zone1,
     comment   => "this is a demo rule",
     disable   => "true",
     ttl       => "33",
     views     => [$view1]  );
 # Submit for addition
 my $response = $session->add( $bind_cname_dn );

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 DNS Substitute Domain Name (Based on Client IP Address) rule object:
  name - Optional. A host name in string format.
  view - Optional. The DNS view in which the Substitute Domain Name (Based on Client IP Address) rule is located. By default, all DNS views are searched. But if you omit this attribute and specify a zone, the appliance searches the 'default' view only.
  zone - Optional. A zone name in FQDN format.
  canonical - Optional. A canonical name.
  extattrs     - Optional. A hash reference containing extensible attributes.
  extensible_attributes - Optional. A hash reference containing extensible attributes.
Example
 # get DNS Substitute Domain Name (Based on Client IP Address) rule with name "1.2.3.4.rpz.com" of default view
 my @retrieved_objs = $session->get(
     object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
     name   => "1.2.3.4.rpz.com",
     view   => "default" );
 # get all DNS Substitute Domain Name (Based on Client IP Address) rules in zone "rpz.com" of default view
 my @retrieved_objs = $session->get(
     object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
     zone   => "rpz.com",
     view   => "default" );
 # get DNS Substitute Domain Name (Based on Client IP Address) rule with canonical name "domain.com" of default view
 my @retrieved_objs = $session->get(
     object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
     canonical => "domain\.com",
     view   => "default" );
 # get all DNS Substitute Domain Name (Based on Client IP Address) rules with a given extensible attribute
 my @retrieved_objs = $session->get(
     object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
     extensible_attributes => { 'Site' => 'Santa Clara' });

Infoblox::Session->modify( )

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

Example
 # Use method to modify the comment.
 $bind_cname_dn->comment("this is a modified comment");
 # Submit modification
 my $response = $session->modify( $bind_cname_dn );

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::DNS::RPZRecord::CNAME::ClientIpAddressDN",
   name   => "1.2.3.4.rpz.com",
   view   => "default");
 #Find the desired object from the retrieved list.
 my $desired_cname = $retrieved_objs[0];
 # Submit for removal
 my $response = $session->remove( $desired_cname );

Infoblox::Session->search( )

Use this method to search for DNS Substitute Domain Name (Based on Client IP Address) rule objects in the Infoblox appliance. See Infoblox::Session->search() for parameters and return values.

Key References
 Apply the following attributes to search for a specific DNS Substitute Domain Name (Based on Client IP Address) rule object.
  name    - Optional. A host name in string format (regular expression).
  view    - Optional. The DNS view in which the Substitute Domain Name (Based on Client IP Address) rule is located. By default, all DNS views are searched. But if you omit this attribute and specify a zone, the appliance searches the 'default' view only.
  zone    - Optional. A zone name in FQDN format.
  canonical - Optional. A canonical name (regular expression).
  comment - Optional. A comment in string format (regular expression).
  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.

Example
 # search for all DNS Substitute Domain Name (Based on Client IP Address) rules that match "rpz.com" in the default DNS view
 my @retrieved_objs = $session->search(
     object  => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
     name    => 'rpz\.com',
     view    => "default" );
 # search for all DNS Substitute Domain Name (Based on Client IP Address) rules in zone "rpz.com" of default view
 my @retrieved_objs = $session->search(
     object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
     zone   => "rpz\.com",
     view   => "default" );
 # search for all DNS Substitute Domain Name (Based on Client IP Address) rules with canonical name that match "domain.com" of default view
 my @retrieved_objs = $session->search(
     object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
     canonical => "domain\.com",
     view   => "default" );
 # search all DNS Substitute Domain Name (Based on Client IP Address) rules with the extensible attribute 'Site'
 my @retrieved_objs = $session->search(
    object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
    extensible_attributes => { 'Site' => 'Santa Clara' });


METHODS

This section describes all the methods that you can use to configure and retrieve the attribute values of a DNS Substitute Domain Name (Based on Client IP Address) rule.

canonical( )

Use this method to set or retrieve the canonical name.

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

Parameter

Canonical name in FQDN (Fully Qualified Domain Name) format. The FQDN consists of the hostname followed by the domain name (example: abc.com)

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 canonical
 my $canonical = $bind_cname_dn->canonical();
 #Modify canonical name
 $bind_cname_dn->canonical("domain.name");

comment( )

Use this method to set or retrieve the descriptive comment.

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

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 comment
 my $comment = $bind_cname_dn->comment();
 #Modify comment
 $bind_cname_dn->comment("Modifying the DNS Substitute Domain Name (Based on Client IP Address) rule comment");

disable( )

Use this method to set or retrieve the disable flag of a DNS Substitute Domain Name (Based on Client IP Address) rule.

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

The default value for this field is false. The DNS Substitute Domain Name (Based on Client IP Address) rule is enabled.

Parameter

Specify "true" to set the disable flag or "false" to deactivate/unset it.

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 disable
 my $disable = $bind_cname_dn->disable();
 #Modify disable
 $bind_cname_dn->disable("true");

extattrs( )

Use this method to set or retrieve the extensible attributes associated with a DNS Substitute Domain Name (Based on Client IP Address) rule 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 = $bind_cname_dn->extattrs();
 #Modify extattrs
 $bind_cname_dn->extattrs({ 'Site' => $extattr1, 'Administrator' => $extattr2 });

extensible_attributes( )

Use this method to set or retrieve the extensible attributes associated with a DNS Substitute Domain Name (Based on Client IP Address) rule.

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

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 extensible attributes
 my $ref_extensible_attributes = $bind_cname_dn->extensible_attributes();
 #Modify extensible attributes
 $bind_cname_dn->extensible_attributes({ 'Site' => 'Santa Clara', 'Administrator' => [ 'Peter', 'Tom' ] });

name( )

Use this method to set or retrieve the host name.

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

Parameter

A name in FQDN (Fully Qualified Domain Name) format. The FQDN consists of the network address in CIDR notation or host IP address followed by the domain name (example: 10.0.0.0/8.rpz.com, 1.2.3.4.rpz.com).

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 name
 my $name = $bind_cname_dn->name();
 #Modify name
 $bind_cname_dn->name("4.3.2.1.rpz.com");

ttl( )

Use this method to set or retrieve the Time to Live (TTL) value.

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

The default value is undefined which indicates that the rule inherits the TTL value of the zone.

Specify a TTL value to override the TTL value at the zone level.

Parameter

A 32-bit integer (range from 0 to 4294967295) that represents the duration, in seconds, that the rule is cached. Zero indicates that the rule should not be cached.

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 ttl
 my $ttl = $bind_cname_dn->ttl();
 #Modify ttl
 $bind_cname_dn->ttl(1800);
 #Un-override ttl
 $bind_cname_dn->ttl(undef);

views( )

Use this method to set or retrieve the view of the DNS Substitute Domain Name (Based on Client IP Address) rule.

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

The default value is the "default" view, which means the DNS Substitute Domain Name (Based on Client IP Address) rule is located in the default view.

Parameter

An array reference of defined Infoblox::DNS::View objects.

Note that the array size must be 1.

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 views
 my $ref_views = $bind_cname_dn->views();
 #Modify views, an array of Infoblox::DNS::View objects
 $bind_cname_dn->views([$view1]);

zone( )

Use this method to retrieve the zone name of a DNS Substitute Domain Name (Based on Client IP Address) rule. This method is read-only and cannot be set.

Parameter

None

Returns

Returns the attribute value.

Example
 # Get zone
 my $zone = $bind_cname_dn->zone();

rp_zone( )

Use this method to set or retrieve the zone object of a DNS Substitute Domain Name (Based on Client IP Address) rule.

Parameter

An Infoblox::DNS::Zone object.

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 rp_zone
 my $rp_zone = $bind_cname_dn->rp_zone();
 #Modify rp_zone, reference of Infoblox::DNS::Zone object
 $bind_cname_dn->rp_zone($response_policy_zone);

is_ipv4( )

Use this method to set or retrieve whether the DNS Substitute Domain Name (Based on Client IP Address) rule is an IPv4 rule. This method is read-only and cannot be set.

Parameter

None

Returns

Use this method to retrieve whether the DNS Substitute Domain Name (Based on Client IP Address) rule is an IPv4 rule. If the return value is "true", it is an IPv4 rule. Ohterwise, it is an IPv6 rule.

Example
 #Get is_ipv4
 my $ip_ipv4 = $bind_cname_dn->is_ipv4();


SAMPLE CODE

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

#Preparation prior to a DNS Substitute Domain Name (Based on Client IP Address) rule 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 the zone prior to a DNS Substitute Domain Name (Based on Client IP Address) rule insertion
 my $zone = Infoblox::DNS::Zone->new(name => "rpz.com",
                                     rpz_policy => "GIVEN");
 unless ($zone) {
 die("Construct zone failed: ",
     Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "Zone object created successfully\n";
 #Verify if the zone exists
 my $object = $session->get(object => "Infoblox::DNS::Zone", name => "rpz.com");
 unless ($object) {
 print "Zone does not exist on server, safe to add the zone\n";
 $session->add($zone)
    or die("Add zone failed: ",
           $session->status_code() . ":" . $session->status_detail());
 }
 print "Zone added successfully\n";

#Create a DNS Substitute Domain Name (Based on Client IP Address) rule

 my $view1 = Infoblox::DNS::View->new(
  name      => "default" );
 #Construct a DNS Substitute Domain Name (Based on Client IP Address) rule object
 my $domain_name = Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN->new(
  name      => "10.6.0.0/16.rpz.com",
  canonical => "test.com",
  comment   => "this is a demo DNS Substitute Domain Name (Based on Client IP Address) rule",
  ttl       => "33",
  views     => [$view1],
  rp_zone   => $zone);
 unless ($domain_name) {
 die("Construct DNS Substitute Domain Name (Based on Client IP Address) rule failed: ",
     Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "DNS Substitute Domain Name (Based on Client IP Address) rule object created successfully\n";
 #Add the DNS Substitute Domain Name (Based on Client IP Address) rule object to the Infoblox appliance through a session
 $session->add($domain_name)
  or die("Add DNS Substitute Domain Name (Based on Client IP Address) rule failed: ",
         $session->status_code() . ":" . $session->status_detail());
 print "DNS Substitute Domain Name (Based on Client IP Address) rule object added to server successfully\n";

#Search for a specific DNS Substitute Domain Name (Based on Client IP Address) rule

 #Search all DNS Substitute Domain Name (Based on Client IP Address) rules that match "rpz.com"
 my @retrieved_objs = $session->search(
  object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
  name   => 'rpz\.com'
 );
 my $object = $retrieved_objs[0];
 unless ($object) {
  die("Search DNS Substitute Domain Name (Based on Client IP Address) rule failed: ",
      $session->status_code() . ":" . $session->status_detail());
 }
 print "Search DNS Substitute Domain Name (Based on Client IP Address) rule object found at least 1 matching entry\n";
 #Search all DNS Substitute Domain Name (Based on Client IP Address) rules that start with "bind" and end with ".rpz.com"
 my @retrieved_objs = $session->search(
  object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
  name   => '^10\.6.*\.rpz\.com'
 );
 my $object = $retrieved_objs[0];
 unless ($object) {
  die("Search DNS Substitute Domain Name (Based on Client IP Address) rule failed: ",
      $session->status_code() . ":" . $session->status_detail());
 }
 print "Search DNS Substitute Domain Name (Based on Client IP Address) rule object using regexp found at least 1 matching entry\n";

#Get and modify a DNS Substitute Domain Name (Based on Client IP Address) rule

 #Get DNS Substitute Domain Name (Based on Client IP Address) rule through the session
 my @retrieved_objs = $session->get(
  object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
  name   => "10.6.0.0/16.rpz.com",
  view   => "default"
 );
 my $object = $retrieved_objs[0];
 unless ($object) {
  die("Get DNS Substitute Domain Name (Based on Client IP Address) rule failed: ",
      $session->status_code() . ":" . $session->status_detail());
 }
 print "Get DNS Substitute Domain Name (Based on Client IP Address) rule object found at least 1 matching entry\n";
 #Modify one of the attributes of the specified DNS Substitute Domain Name (Based on Client IP Address) rule
 $object->disable("true");
 #Apply the changes
 $session->modify($object)
  or die("Modify DNS Substitute Domain Name (Based on Client IP Address) rule failed: ",
         $session->status_code() . ":" . $session->status_detail());
 print "DNS Substitute Domain Name (Based on Client IP Address) rule object modified successfully \n";

#Remove a DNS Substitute Domain Name (Based on Client IP Address) rule

 #Get DNS Substitute Domain Name (Based on Client IP Address) rule through the session
 my @retrieved_objs = $session->get(
  object => "Infoblox::DNS::RPZRecord::CNAME::ClientIpAddressDN",
  name   => "10.6.0.0/16.rpz.com",
  view   => "default"
 );
 $object = $retrieved_objs[0];
 unless ($object) {
  die("Get DNS Substitute Domain Name (Based on Client IP Address) rule failed: ",
      $session->status_code() . ":" . $session->status_detail());
 }
 print "Get DNS Substitute Domain Name (Based on Client IP Address) rule object found at least 1 matching entry\n";
 #Submit the object for removal
 $session->remove( $object )
 or die("Remove DNS Substitute Domain Name (Based on Client IP Address) rule failed: ",
      $session->status_code() . ":" . $session->status_detail());
 print "DNS Substitute Domain Name (Based on Client IP Address) rule object removed successfully \n";
 ####PROGRAM ENDS####


AUTHOR

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


SEE ALSO

Infoblox::DNS::View, Infoblox::DNS::Zone, Infoblox::Session, Infoblox::Session->get(), Infoblox::Session->search(), Infoblox::Session->add(), Infoblox::Session->remove(), Infoblox::Session->modify()


COPYRIGHT

Copyright (c) 2017 Infoblox Inc.