Infoblox::Grid::ScheduledTask - scheduled task object.


NAME

Infoblox::Grid::ScheduledTask - scheduled task object.


DESCRIPTION

A scheduled task object is used to retrieve information about scheduled tasks. Scheduled tasks are commands that are scheduled by the Infoblox::Session methods, Infoblox::Session->add(), Infoblox::Session->modify() and Infoblox::Session->remove(), and are called with the scheduled_at parameter.


CONSTRUCTOR

The Infoblox::Grid::ScheduledTask object is automatically generated after the Infoblox::Session methods, Infoblox::Session->add(), Infoblox::Session->modify() and Infoblox::Session->remove(), are called with the scheduled_at parameter. It does not require manual construction.


SESSION METHODS

This section describes all the methods in the Infoblox::Session module that you can apply to a scheduled task 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 scheduled task object:

member - The Grid member name.

scheduled_time - The time when the task is scheduled to occur.

submit_time - The time when the scheduled task was submitted.

submitter - The name of the user who submitted the task (regular expression).

task_id - The identifier of a scheduled task.

action - The type of action performed. When used, the search returns ScheduledTask objects that have ScheduledTask::ChangedObject objects in the changed_objects list with matching 'action' attributes. Possible values are:

                       Add
                       Modify
                       Delete
                       Network Discovery
                       Restart Services

object_name - The name of the changed object (regular expression). When used, the search returns ScheduledTask objects that have ScheduledTask::ChangedObject objects in the changed_objects list with matching 'object_name' attirbutes.

object_type - The type of the changed object (regular expression). When used, the search returns ScheduledTask objects that have ScheduledTask::ChangedObject objects in the changed_objects list with matching 'object_type' attributes. Possible values are:

                       A Record
                       AAAA Record
                       Authoritative Zone
                       Bulk Host
                       CNAME Record
                       Delegated Zone
                       DHCP Range
                       DNAME Record
                       DNS View
                       Fixed Address
                       Forward Zone
                       Host Record
                       IPv4 Network
                       IPv4 Network Container
                       IPv6 Network
                       IPv6 Network Container
                       MX Record
                       NS Record
                       PTR Record
                       Reservation
                       Roaming Host
                       Shared A Record
                       Shared AAAA Record
                       Shared MX Record
                       Shared Network
                       Shared Record Group
                       Shared SRV Record
                       Shared TXT Record
                       SRV Record
                       Stub Zone
                       TXT Record
Example
 my @retrieved_objs = $session->get(
     object     => "Infoblox::Grid::ScheduledTask",
     task_id    => "34" );

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 this method to modify the object.
 $task->scheduled_time( "2008-10-21T10:56:33Z" );
 # Submit modification
 my $response = $session->modify( $task );

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

Example
 # Get the ScheduledTask objects
 my @retrieved_objs = $session->get(
     object     => "Infoblox::Grid::ScheduledTask",
     submitter  => "admin" );
 # find the desired object from the retrieved list.
 my $task = $retrieved_objs[0];
 # Submit for removal
 my $response = $session->remove( $task );

Infoblox::Session->search( )

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

Key References

The search can be performed on any combination of the following attributes:

member - The Grid member name.

scheduled_time - The time when the task is scheduled to occur. This method supports searching with limit parameters (see below).

submit_time - The time when the scheduled task was submitted. This method supports searching with limit parameters (see below).

submitter - The name of the user who submitted the task (regular expression).

task_id - The identifier of a scheduled task.

action - The type of action performed. When used, the search returns ScheduledTask objects that have ScheduledTask::ChangedObject objects in the changed_objects list with matching 'action' attributes. Possible values are:

                       Add
                       Modify
                       Delete
                       Network Discovery
                       Restart Services

object_name - The name of the changed object (regular expression). When used, the search returns ScheduledTask objects that have ScheduledTask::ChangedObject objects in the changed_objects list with matching 'object_name' attirbutes.

object_type - The type of the changed object (regular expression). When used, the search returns ScheduledTask objects that have ScheduledTask::ChangedObject objects in the changed_objects list with matching 'object_type' attributes. Possible values are:

                       A Record
                       AAAA Record
                       Authoritative Zone
                       Bulk Host
                       CNAME Record
                       Delegated Zone
                       DHCP Range
                       DNAME Record
                       DNS View
                       Fixed Address
                       Forward Zone
                       Host Record
                       IPv4 Network
                       IPv4 Network Container
                       IPv6 Network
                       IPv6 Network Container
                       MX Record
                       NS Record
                       PTR Record
                       Reservation
                       Roaming Host
                       Shared A Record
                       Shared AAAA Record
                       Shared MX Record
                       Shared Network
                       Shared Record Group
                       Shared SRV Record
                       Shared TXT Record
                       SRV Record
                       Stub Zone
                       TXT Record

See Infoblox::Session/search with limit parameters for more information on this functionality.

Example
 # search for all ScheduledTask objects
 my @retrieved_objs = $session->search(
     object  => "Infoblox::Grid::ScheduledTask",
     scheduled_time => ">=< 2008-10-21T10:56:33Z,2008-11-21T10:56:33Z");


METHODS

This section describes all the methods that you can use to set and retrieve the attribute values of a ScheduledTask object.

approval_status( )

Use this method to set or retrieve the approval status if approvals are required for this task.

Parameter

Valid values are 'NONE', 'APPROVED', 'PENDING' and 'REJECTED'.

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 approval_status value
 my $approval_status = $task->approval_status();
 #Modify approval_status value
 $task->approval_status('APPROVED');

approver( )

Use this method to retrieve the username of the approver. This is a read-only attribute.

Parameter

none

Returns

The method returns the attribute value.

Example
 #Get approver value
 my $approver = $task->approver();

approver_comment( )

Use this method to set or retrieve the approver comment.

Parameter

The approver comment 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 approver_comment value
 my $approver_comment = $task->approver_comment();
 #Modify approver_comment value
 $task->approver_comment('ok');

changed_objects( )

Use this method to retrieve information about the objects that are scheduled to be changed.

Parameter

none

Returns

The method returns a reference to an array of Infoblox::Grid::ScheduledTask::ChangedObject objects.

Example
 #Get changed_objects
 my $changed_objects = $task->changed_objects();
 my $obj = $changed_objects->[0];

dependent_tasks( )

Use this method to retrieve an array of of tasks dependent on this one. This is a read-only attribute.

Parameter

None

Returns

The method returns a reference to an array of Infoblox::Grid::ScheduledTask objects.

Example
 #Get array of ScheduledTask objects
 my @dependent_tasks = $task->dependent_tasks();

execution_details( )

Use this method to retrieve the list of details generated by the execution. This is a read-only field.

Parameters

None

Returns

The method returns the array of strings that contains details generated by the execution.

Example
 #Get execution_details value
 my $details = $task->execution_details();

execution_details_type( )

Use this method to retrieve the type of details generated by the execution after the task has been completed. This is a read-only field.

Parameters

None

Returns

The method returns the attribute value that can be 'NONE' or 'WARNING'.

Example
 #Get execution_details_type value
 my $details = $task->execution_details_type();

execution_status( )

Use this method to retrieve the status of the task. This is a read-only attribute.

Parameter

none

Returns

The method returns the attribute value that can be 'COMPLETED', 'FAILED' or 'PENDING'.

Example
 #Get execution_status
 my $execution_status = $task->execution_status();

execution_time( )

Use this method to retrieve the execution time. This is a read-only attribute.

Parameter

none

Returns

The method returns the attribute value.

Example
 #Get execution_time
 my $execution_time = $task->execution_time();

member( )

Use this method to retrieve the Grid member that has created this task. This is a read-only attribute.

Parameter

None

Returns

The method returns the attribute value.

Example
 #Get member
 my $member = $task->member();

is_network_insight_task( )

Use this method to retrieve the flag that indicates if this task is related to network insight. This is a read-only attribute.

Parameter

none

Returns

This method returns the attribute value.

Example
 #Get value
 $value = $task->is_network_insight_task();

re_execute_task( )

Use this method to set failed discovery task to be re-executed.

If this flag is set to 'true' a failed Network Insight discovery task will be re-executed, a new task will be created cloned from this one and restarted.

Parameter

Boolean to set failed netmri task to be re-executed. Only "true" value makes sense.

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 value
 $value = $task->re_execute_task();
 # Set value
 $task->re_execute_task('true');

scheduled_time( )

Use this method to set or retrieve the date and time the task is scheduled to occur.

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

Parameter

Scheduled date and time in ISO 8601 extended format (e.g., 2008-10-21T10:56:33Z or 2008-10-21T10:56:33.001Z).

Use case insensitive value "now" to execute a scheduled task immediately.

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 scheduled_time value
 my $scheduled_time = $task->scheduled_time();
 #Modify scheduled_time value
 $task->scheduled_time("2008-10-21T10:56:33Z");
 # Submit modification
 $session->modify($task);
 # Do it now
 $task->scheduled_time("Now");
 # Submit modification
 $session->modify($task);

submit_time( )

Use this method to retrieve the time the scheduled task was submitted (when appropriate Session method was called with parameter scheduled_time).

Parameter

none

Returns

The method returns the submitted date and time in ISO 8601 extended format (e.g., 2008-10-21T10:56:00Z or 2008-10-21T10:56:00.001Z).

Example
 #Get submit_time
 my $submit_time = $task->submit_time();

submitter_comment( )

Use this method to set or retrieve the submitter comment.

Parameter

The submitter comment 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 submitter_comment value
 my $submitter_comment = $task->submitter_comment();
 #Modify submitter_comment value
 $task->submitter_comment('ok');

submitter( )

Use this method to retrieve the name of the user who submitted the task.

Parameter

none

Returns

The method returns the user name in string format.

Example
 #Get submitter
 my $submitter = $task->submitter();

task_id( )

Use this method to retrieve the identifier of a scheduled task.

Parameter

none

Returns

The method returns the identifier in numeric format.

Example
 #Get task_id
 my $task_id = $task->task_id();

ticket_number( )

Use this method to set or retrieve the ticket number.

Parameter

The ticket number 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 ticket_number value
 my $ticket_number = $task->ticket_number();
 #Modify ticket_number value
 $task->ticket_number('ok');

task_type( )

Use this method to retrieve the scheduled task type. This is a read-only attribute.

Parameter

none

Returns

The method returns the attribute value. Valid return value is "OBJECT_CHANGE" and "PORT_CONTROL".

Example
 #Get task_type value
 my $task_type = $task->task_type();

time_zone( )

Use this method to set or retrieve the time zone.

Parameter

The UTC string that represents the time zone. For example "(UTC - 6:00) Central Time (US and Canada)". The default value is "(UTC) Coordinated Universal Time".

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 = $schedule_setting->time_zone();
 #Modify attribute value
 $schedule_setting->time_zone("(UTC - 6:00) Central Time (US and Canada)");

predecessor_task( )

Use this method to retrieve the predecessor task. This is a read-only attribute.

Parameter

none

Returns

The method returns an Infoblox::Grid::ScheduledTask object.

Example
 #Get predecessor_task value
 my $predecessor_task = $task->predecessor_task();


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 also includes error handling for the operations.

#Preparation prior to a ScheduledTask 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", #appliance host ip
                username => "admin",       #appliance user login
                password => "infoblox"     #appliance password
                );
 unless ($session) {
        die("Construct session failed: ",
                Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "Session created successfully\n";
 # Add a network
 my $network = Infoblox::DHCP::Network->new(
     network => "10.0.0.0/24",
 );
 unless ($network) {
     die("Construct Network failed: ",
         Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "Network created successfully\n";
 $session->add($network)
     or die("Add Network object failed: ",
     $session->status_code() . ":" . $session->status_detail());
 print "Network object added to server successfully\n";

#Create a ScheduledTask object

 # Create a fixed address
 my $fixed_addr = Infoblox::DHCP::FixedAddr->new(
     ipv4addr    => '10.0.0.3',
     mac         => '11:22:33:44:55:66'
 );
 unless ($fixed_addr) {
     die("Construct FixedAddr failed: ",
         Infoblox::status_code() . ":" . Infoblox::status_detail());
 }
 print "FixedAddr created successfully\n";
 # Schedule the addition of a fixed address
 $session->add($fixed_addr, scheduled_at => "2020-01-01T14:52:00Z")
     or die("Schedule fixed address add failed: ",
     $session->status_code() . ":" . $session->status_detail());
 print "Fixed address add scheduled successfully\n";

#Search for a ScheduledTask object

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

#Get and modify a ScheduledTask object

 #Get the ScheduledTask object from Infoblox appliance through a session
 my @retrieved_objs = $session->get(
     object         => "Infoblox::Grid::ScheduledTask",
     scheduled_time => "2020-01-01T14:52:33Z"
 );
 my $object = $retrieved_objs[0];
 unless ($object) {
     die("Get ScheduledTask object failed: ",
         $session->status_code() . ":" . $session->status_detail());
 }
 print "Get ScheduledTask object found at least 1 matching entry\n";
 #Modify the ScheduledTask object
 $object->scheduled_time("2020-02-01T14:52:33Z");
 #Apply the changes.
 $session->modify($object)
     or die("Modify ScheduledTask object failed: ",
     $session->status_code() . ":" . $session->status_detail());
 print "ScheduledTask object modified successfully \n";

#Remove a ScheduledTask object

 #Get the ScheduledTask object through the session
 my @retrieved_objs = $session->get(
     object => "Infoblox::Grid::ScheduledTask",
     action => "Add"
 );
 my $object = $retrieved_objs[0];
 unless ($object) {
     die("Get ScheduledTask object failed: ",
         $session->status_code() . ":" . $session->status_detail());
 }
 print "Get ScheduledTask object found at least 1 matching entry\n";
 #Submit the object for removal
 $session->remove($object)
     or die("Remove ScheduledTask object failed: ",
     $session->status_code() . ":" . $session->status_detail());
 print "ScheduledTask object removed successfully \n";

#Cleanup

 #Get the Network object through the session
 my @retrieved_objs = $session->get(
     object  => "Infoblox::DHCP::Network",
     network => "10.0.0.0/24"
 );
 my $object = $retrieved_objs[0];
 unless ($object) {
     die("Get Network object failed: ",
         $session->status_code() . ":" . $session->status_detail());
 }
 print "Get Network object found at least 1 matching entry\n";
 #Submit the object for removal
 $session->remove($object)
     or die("Remove Network object failed: ",
     $session->status_code() . ":" . $session->status_detail());
 print "Network object removed successfully \n";
 ####PROGRAM ENDS####


SCHEDULED DATE AND TIME FORMAT

Scheduled date and time are represented in ISO 8601 extended format (e.g., 2008-10-21T10:56:00Z or 2008-10-21T10:56:00.001Z) with some restrictions:

When the scheduling parameter is used, changes to objects do not occur immediately. Instead, the Infoblox::Grid::ScheduledTask object is created, and then executed at the time specified in this parameter.


AUTHOR

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


SEE ALSO

Infoblox::Grid::ScheduledTask, Infoblox::Grid::ScheduledTask::ChangedObject, Infoblox::Session->add(), Infoblox::Session->get(), Infoblox::Session->modify(), Infoblox::Session->remove(), Infoblox::Session->search(),Infoblox::Session


COPYRIGHT

Copyright (c) 2017 Infoblox Inc.