Infoblox::DNS::Record::DNAME - DNAME record object.


NAME

Infoblox::DNS::Record::DNAME - DNAME record object.


DESCRIPTION

A DNAME record maps all the names in one domain to those in another domain, essentially substituting one domain name suffix with the other.

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


CONSTRUCTOR

 my $bind_dname = Infoblox::DNS::Record::DNAME->new (
     name                  => $fqdn,                                                             # Required
     target                => $fqdn,                                                             # Required
     comment               => $string,                                                           # Optional / Defauilt 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
     creator               => "DYNAMIC" | "STATIC",                                              # Optional / Default is "STATIC"
     ddns_protected        => "true" | "false",                                                  # Optional / Default is "false"
     ddns_principal        => $string,                                                           # Optional / Default is undefined
     forbid_reclamation    => "true" | "false",                                                  # Optional / Default is "false"
 );

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 DNAME object.

Infoblox::Session->add( )

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

Example
 #Construct object
 my $bind_dname = Infoblox::DNS::Record::DNAME->new (
     name    => "bind_dname.domain.com",
     comment => "add dname bind_dname.domain.com",
     target  => "target.org",
     disable => "true",
     ttl     => "33",
     views   => [$view1]
     );
 # Submit for addition
 my $response = $session->add( $bind_dname );

Infoblox::Session->get( )

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

Key Reference
 Apply the following attributes to get a specific DNS DNAME object:
  name                  - Optional. A domain name in string format (regular expression).
  view                  - Optional. The DNS view in which the DNAME record 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.
  creator               - Optional. Record creator.
  ddns_principal        - Optional. GSS-TSIG principal that owns the record.
  reclaimable           - Optional. The flag that indicates whether the record is reclaimable or not.
  extattrs              - Optional. A hash reference containing extensible attributes.
  extensible_attributes - Optional. A hash reference containing extensible attributes.
Example
 my @retrieved_objs = $session->get(
     object => "Infoblox::DNS::Record::DNAME",
     name   => "bind_dname.domain.com",
     view   => "default"
     );
 # get all DNS DNAME record in zone "domain.com" of default view
 my @retrieved_objs = $session->get(
     object => "Infoblox::DNS::Record::DNAME",
     name   => "domain.com",
     view   => "default"
     );
 # get all DNS DNAME record with a given extensible attribute
 my @retrieved_objs = $session->get(
     object => "Infoblox::DNS::Record::DNAME",
     extensible_attributes => { 'Site' => 'Santa Clara' });

Infoblox::Session->modify( )

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

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

Infoblox::Session->remove( )

Use this method to remove a DNAME record 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::Record::DNAME",
     name   => "bind_dname.domain.com",
     view   => "default" );
 # Find the desired object from the retrieved list.
 my $desired_dname = $retrieved_objs[0];
 # Submit for removal
 my $response = $session->remove( $desired_dname );

Infoblox::Session->search( )

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

Key Reference
 Apply the following attributes to search for a DNS DNAME record object:
  name                  - Optional. A domain name in string format (regular expression).
  view                  - Optional. The DNS view in which the DNAME record 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.
  comment               - Optional. A comment in string format (regular expression).
  creator               - Optional. Record creator.
  ddns_principal        - Optional. GSS-TSIG principal that owns the record.
  reclaimable           - Optional. The flag that indicates whether the record is reclaimable or not.
  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 DNAME objects that match "domain.com" in the default DNS view
 my @retrieved_objs = $session->search(
     object => "Infoblox::DNS::Record::DNAME",
     name   => '.*\.domain\.com',
     view   => "default"
     );
 # search for all DNS DNAME records in the "domain.com" zone of the default view
 my @retrieved_objs = $session->search(
     object => "Infoblox::DNS::Record::DNAME",
     zone   => "domain.com",
     view   => "default"
     );
 # search all DNS DNAME recods with the extensible attribute 'Site'
 my @retrieved_objs = $session->search(
    object => "Infoblox::DNS::Record::DNAME",
    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 DNAME record.

comment( )

Use this method to set or retrieve the comment value.

Enter identifying text for this record, such as a meaningful note or reminder.

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 = $binddname->comment();
 #Modify comment
 $binddname->comment("Modifying the DNAME comment");

cloud_info( )

Use this method to retrieve cloud API related information for the Infoblox::DNS::Record::DNAME object.

Parameter

None

Returns

The method returns the attribute value.

Example
 # Get cloud_info
 my $cloud_info = $object->cloud_info();

creator( )

Use this method to set or retrieve the record creator.

Note that changing creator from or to 'SYSTEM' value is not allowed.

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

Paramter

The valid values are 'STATIC' and 'DYNAMIC'. The default value is 'STATIC'.

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 creator value
 my $creator = $object->creator();
 #Modify creator value
 $object->creator("DYNAMIC");

creation_time( )

Use this method to retrieve the creation time for the record. This is a read-only attribute.

Parameter

None

Returns

The valid return value is a number of seconds that have elapsed since January 1st, 1970 UTC.

Example
 #Get creation_time value
 my $creation_time = $object->creation_time();

ddns_principal( )

Use this method to set or retrive the GSS-TSIG principal that owns this record.

Note that you cannot set ddns_principal for 'STATIC' and 'SYSTEM' records.

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

Paramter

The GSS-TSIG principal FQDN (Fully Qualified Domain Name) format. The FQDN consists of the hostname followed by the domain name (example: abc.com). A hostname can have a maximum of 256 characters.

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 ddns_principal value
 my $ddns_principal = $object->ddns_principal();
 #Modify ddns_principal value
 $object->ddns_principal('foo.com');

ddns_protected( )

Use this method to set or retrieve the flag that indicates whether DDNS updates for this record are allowed or not.

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

Parameter

Specify 'true' to protect record from DDNS updates and 'false' to allow DDNS updates for the specified record.

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 ddns_protected value
 my $ddns_protected = $object->ddns_protected();
 #Modify ddns_protected value
 $object->ddns_protected('true');

disable( )

Use this method to set or retrieve the disable value.

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", therefore the DNS record 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 = $binddname->disable();
 #Modify disable
 $binddname->disable("true");

dns_name( )

Use this method to retrieve the host name in punycode format. This is a read-only attribute.

Parameter

None

Returns

The method returns the attribute value.

Example
 # Get attribute value
 my $value = $binddname->dns_name();

dns_target( )

Use this method to retrieve the target in punycode format. This is a read-only attribute.

Parameter

None

Returns

The method returns the attribute value.

Example
 # Get attribute value
 my $value = $binddname->dns_target();

extattrs( )

Use this method to set or retrieve the extensible attributes associated with a DNS DNAME record 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 = $binddname->extattrs();
 #Modify extattrs
 $binddname->extattrs({ 'Site' => $extattr1, 'Administrator' => $extattr2 });

extensible_attributes( )

Use this method to set or retrieve the extensible attributes associated with a DNS DNAME record.

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

forbid_reclamation( )

Use this method to set or retrieve the flag that indicates whether the reclamation is allowed for the record or not.

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

Parameter

Specify 'true' to forbid reclamation for the record and 'false' to allow it. The default value is 'false'.

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 forbid_reclamation
 my $forbid_reclamation = $object->forbid_reclamation();
 #Modify forbid_reclamation
 $object->forbid_reclamation('true');

last_queried( )

Use this method to retrieve the time when the associated record was last queried. This is a read-only attribute.

Parameter

None

Returns

The method returns the attribute value. The number of seconds that have elapsed since January 1st, 1970 UTC.

Example
 #Get last_queried
 my $last_queried = $binddname->last_queried();

name( )

Use this method to set or retrieve the name value.

Enter the name of a sub domain. If you are adding a DNAME record for the entire zone, leave this field empty. This field is for adding a DNAME record for a sub domain within the selected zone.

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

The attribute value can be in unicode format.

Parameter

Hostname in FQDN (Fully Qualified Domain Name) format. The FQDN consists of the hostname followed by the domain name (example: abc.com). A hostname can have 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 name
 my $name = $binddname->name();
 #Modify name
 $binddname->name("bind_dname1.domain.com");

reclaimable( )

Use this method to retrieve the flag that indicates whether the record is reclaimable or not.

Parameter

None

Returns

The method returns the attribute value.

Example
 #Get reclaimable
 my $reclaimable = $object->reclaimable();

target( )

Use this method to set or retrieve the target value.

Enter the domain name to which you want to map all the domain names specified in the Domain Name field.

Include the specified parameter to set the attribute value. Must use some parameter to add a DNAME record.

The attribute value can be in unicode format.

Parameter

Text with the target (domain-name) for the DNS DNAME record.

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 $target = $binddname->target();
 #Modify name
 $binddname->target("modified_target.org");

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; therefore the record inherits the TTL value from the zone level.

With a specified TTL value, the method overrides the zone values with the specified TTL value.

Parameter

A 32-bit integer (range from 0 to 4294967295) that represents the duration in seconds that the record is cached. Zero indicates that the record 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 = $binddname->ttl();
 #Modify ttl
 $binddname->ttl(1800);
 #Un-override ttl
 $binddname->ttl(undef);

views( )

Use this method to set or retrieve the views value.

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

The default value is the default view, therefore the DNAME record is referenced under the default view.

Parameter

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 = $binddname->views();
 #Modify views, list of Infoblox::DNS::View objects
 $binddname->views([$view1]);

zone( )

Use this method to retrieve the zone name of a DNS DNAME record. This method is read-only and cannot be set.

Parameter

None

Returns

Returns the attribute value.

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


SAMPLE CODE

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

#Preparation prior to a DNAME record 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 DNAME record insertion
 my $zone = Infoblox::DNS::Zone->new(name => "domain.com");
 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 => "domain.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 DNAME record

 #Construct a DNAME object
 my $bind_dname = Infoblox::DNS::Record::DNAME->new(
     name     => "bind_dname.domain.com",
     target   => "target.org",
     comment  => "this is a demo bind_dname record",
 );
 unless ($bind_dname) {
    die("Construct DNS record DNAME failed: ",
        Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "DNS DNAME object created successfully\n";
 #Add the DNS DNAME record object to Infoblox appliance through a session
 $session->add($bind_dname)
     or die("Add record DNAME failed: ",
            $session->status_code() . ":" . $session->status_detail());
 print "DNS DNAME object added to server successfully\n";

#Search for a specific DNS DNAME record

 #Search all DNAME records in the zone
 my @retrieved_objs = $session->search(
     object => "Infoblox::DNS::Record::DNAME",
     name   => 'domain\.com'
 );
 my $object = $retrieved_objs[0];
 unless ($object) {
     die("Search record DNAME failed: ",
         $session->status_code() . ":" . $session->status_detail());
 }
 print "Search DNS DNAME object found at least 1 matching entry\n";
 #Search all DNAME records that start with "bind" and end with "domain.com"
 my @retrieved_objs = $session->search(
     object => "Infoblox::DNS::Record::DNAME",
     name   => '^bind.*\.domain.com\$'
 );
 my $object = $retrieved_objs[0];
 unless ($object) {
     die("Search record DNAME failed: ",
         $session->status_code() . ":" . $session->status_detail());
 }
 print "Search DNS DNAME object using regexp found at least 1 matching entry\n";

#Get and modify a DNS DNAME record

 #Get DNAME record through the session
 my @retrieved_objs = $session->get(
     object => "Infoblox::DNS::Record::DNAME",
     name   => "bind_dname.domain.com",
     target => "target.org"
 );
 my $object = $retrieved_objs[0];
 unless ($object) {
     die("Get record DNAME failed: ",
         $session->status_code() . ":" . $session->status_detail());
 }
 print "Get DNS DNAME object found at least 1 matching entry\n";
 #Modify one of the attributes of the specified DNAME record
 $object->comment("This is a modified comment.");
 #Apply the changes
 $session->modify($object)
     or die("Modify record DNAME failed: ",
            $session->status_code() . ":" . $session->status_detail());
 print "DNS DNAME object modified successfully \n";

#Remove a DNS DNAME record

 #Get DNAME record through the session
 my @retrieved_objs = $session->get(
     object => "Infoblox::DNS::Record::DNAME",
     name   => "bind_dname.domain.com"
 );
 my $object = $retrieved_objs[0];
 unless ($object) {
     die("Get record DNAME failed: ",
         $session->status_code() . ":" . $session->status_detail());
 }
 print "Get DNS DNAME object found at least 1 matching entry\n";
 #Submit the object for removal
 $session->remove($object)
     or die("Remove record DNAME failed: ",
         $session->status_code() . ":" . $session->status_detail());
 print "DNS DNAME 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.