Infoblox::Grid::ScheduledBackup - Scheduled Backup object.
The Scheduled Backup object is used to schedule system backups.
#Constructor for a ScheduledBackup object my $backup = Infoblox::Grid::ScheduledBackup->new ( backup_type => "LOCAL" | "TFTP" | "FTP" | "SCP", #Optional / Default is "LOCAL" keep_local_copy => "true" | "false", #Optional / Default is "false" backup_frequency => "Weekly" | "Daily" | "Hourly", #Optional / Default is "Daily" weekday => "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" #Optional / Default is "0" hour_of_day => $num, #Optional / Default is 3 minute_of_hour => $num, #Optional / Default is 0 user => $string, #Optional / Default is undefined password => $string, #Optional / Default is undefined backup_server => $string, #Optional / Default is undefined path => $string, #Optional / Default is undefined disabled => "true" | "false", #Optional / Default is "false"
source => "DB" | "REPORTING" #Optional / Default is "DB" status => "IDLE" | "TRIGGERED" | "IN_PROGRESS" | "FINISHED" | "FAILED", #Optional / Default is "IDLE" operation_state => 'TRIGGERED', #Optional / Default is undefined operation => "NONE" | "BACKUP" | "RESTORE", #Optional / Default is "NONE" restore_type => "FTP" | "SCP", #Optional / Default is "FTP" restore_host => $string, #Optional / Default is undefined restore_username => $string, #Optional / Default is undefined restore_password => $string, #Optional / Default is undefined restore_directory => $string, #Optional / Default is undefined nios_data => 'true' | 'false', #Optional / If any of nios_data and discovery_data is not #defined, nios_data is 'true'. discovery_data => 'true' | 'false', #Optional / If any of nios_data and discovery_data is not #defined, discovery_data is 'false'. splunk_app_data => 'true' | 'false', #Optional / Default is 'false' );
The following functions can be applied to a ScheduledBackup object.
Use this function to specify a ScheduledBackup object. See Infoblox::Grid->scheduled_backup() for parameters and return values.
# Retrieve the list of ScheduledBackup objects from the Grid object. my @retrieved_objs = $session->get( object => "Infoblox::Grid", name => "Infoblox" );
my $Grid_obj = $retrieved_objs[0];
# construct a ScheduledBackup object my $backup = Infoblox::Grid::ScheduledBackup->new ( backup_type => "LOCAL", backup_frequency => "Weekly", weekday => "0", # "0" is the same as "Sunday" hour_of_day => "4", minute_of_hour => "0", user => "username", password => "user-password", backup_server => "my-backup-server", path => "/tmp/infoblox/database.tar.gz", disabled => "false", );
# Modify the scheduled backup list $Grid_obj->scheduled_backup($backup);
This section describes all the methods that you can use to configure and retrieve the attribute values of a ScheduledBackup object.
Use this method to set or retrieve the destination of the backup files. You can back up system files to a local directory, a TFTP server, an FTP server, or an SSH server that supports SCP.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Valid values are "LOCAL", "TFTP", "FTP" or "SCP". The default value is "LOCAL".
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.
#Get backup_type my $backup_type = $backup->backup_type(); #Modify backup_type $backup->backup_type("FTP");
Use this method to control whether a local backup is created in addition to a remote one. This option works only if you also specify a remote backup type (TFTP, FTP, or SCP). You cannot enable this option using the "LOCAL" backup type.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Valid values are "true" and "false". The default value is "false".
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.
#Get keep_local_copy my $keep_local_copy = $backup->keep_local_copy(); #Modify keep_local_copy $backup->backup_type("true");
Use this method to set or retrieve the frequency of backups.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Valid values are "Weekly", "Daily" or "Hourly". The default value is "Daily".
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
#Get backup frequency my $backup_backup_frequency = $backup->backup_frequency(); #Modify backup frequency $backup->backup_frequency("Weekly");
Use this method to set or retrieve the day of the week when the backup is performed. This is required only when backup_frequency is set to "Weekly".
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Valid values are "0", "1", "2", "3", "4", "5", "6", "7", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" or "Saturday". "0" means "Sunday", "1" - "Monday". etc. The default value is "6" (Saturday).
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.
#Get weekday my $weekday = $backup->weekday(); #Modify weekday $backup->weekday("0");
Use this method to set the state for Reporting scheduled backup / restore operation. This is a write-only attribute.
The valid value is 'TRIGGER'. The default is undefined.
None
#Modify operation_state value $object->execute('TRIGGER');
Use this method to set or retrieve the hour when the backup is performed.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
A number from 0 through 23. The default value is 3 (3:00 A.M.).
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.
#Get hour_of_day my $hour_of_day = $backup->hour_of_day(); #Modify hour_of_day $backup->hour_of_day("4");
Use this method to set or retrieve the minute of the hour when the backup is performed.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
A number from 0 through 59. The default value is 0.
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.
#Get minute_of_hour my $minute_of_hour = $backup->minute_of_hour(); #Modify minute_of_hour $backup->minute_of_hour("5");
Use this method to enable or disable the backup and restore of NIOS data.
If any of nios_data and discovery_data is not defined, nios_data is 'true'.
Set the parameter to "true" to enable backup/restore of NIOS data. Set the parameter to "false" to disable the object. The default value of this parameter is "false".
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.
#Get nios_data my $nios_data = $backup->nios_data(); #Modify nios_data $backup->nios_data("true");
Use this method to enable or disable the backup and restore of Network Automation data.
If any of nios_data and discovery_data is not defined, discovery_data is 'false'.
Set the parameter to "true" to enable backup/restore of Network Automation data. Set the parameter to "false" to disable the object. The default value of this parameter is "false".
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.
#Get discovery_data my $nios_data = $backup->discovery_data(); #Modify discovery_data $backup->discovery_data("true");
Use this method to enable or disable the backup and restore of Splunk application data.
Set the parameter to "true" to enable backup/restore of Splunk application data. Set the parameter to "false" to disable the object. The default value of this parameter is "false".
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.
#Get splunk_app_data my $nios_data = $backup->splunk_app_data(); #Modify splunk_app_data $backup->splunk_app_data("true");
Use this method to set or retrieve the user name on the backup server. This is required only when backup_type is set to "FTP" or "SCP".
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The user name in string format with a maximum of 1024 bytes.
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.
#Get user my $user = $backup->user(); #Modify user $backup->user("admin1");
Use this method to set the user password on the backup server. This is required only when backup_type is set to "FTP" or "SCP". This is a write-only attribute.
The password in string format with a maximum of 64 bytes.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
#Modify password $backup->password("userpassword");
Use this method to set or retrieve the IP address of the backup server. This is required only when backup_type is set to "FTP", "TFTP" or "SCP".
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The IP address of the backup server.
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.
#Get backup_server my $backup_server = $backup->backup_server(); #Modify backup_server $backup->backup_server("my-backup-server");
Use this method to set or retrieve the directory path to the backup file stored on the server. This is required only when backup_type is set to "FTP" or "SCP".
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Desired path in string format with a maximum of 1024 bytes.
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.
#Get path my $path = $backup->path(); #Modify path $backup->path("/tmp/infoblox/database.tar.gz");
Use this method to disable the ScheduledBackup object.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Set the parameter to "true" to disable the ScheduledBackup object. Set the parameter to "false" to enable the object. The default value of this parameter is "false".
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.
#Get disabled my $disabled = $backup->disabled(); #Modify disabled $backup->disabled("true");
Use thi method to set or retrieve the source of ScheduledBackup object.
Can be set to "DB" to operate with Grid ScheduledBackup object or to "REPORTING" to operate with Reporting ScheduledBackup object.
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.
#Get source my $source = $backup->source(); #Modify source $backup->source("REPORTING");
Use this method to set or retrieve the status of the Reporting ScheduledBackup object.
Either "TRIGGERED" or "IN_PROGRESS" to identify that Reporting backup/restore is running. Status "FINISHED" means Reporting backup/restore succeeded. Status "FAILED" means Reporting backup/restore failed. The default value of this parameter is "IDLE".
Set status to "TRIGGERED" to run a Reporting manual backup. Use this for a Reporting manual backup only.
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.
#Get status my $status = $backup->status(); #Modify status $backup->status("TRIGGERED");
Use this method to set or retrieve the operation of the Reporting ScheduledBackup object.
Specify "BACKUP" to indicate that a Reporting backup must be performed, or specify "RESTORE" to indicate that a Reporting restore must be performed. The default value is "NONE".
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.
#Get operation my $operation = $backup->operation(); #Modify operation $backup->operation("RESTORE");
Use this method to set or retrieve the destination of the restore files when the operation is set to "RESTORE". You can back up system files to an FTP server, or an SSH server that supports SCP.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Valid values are "FTP" or "SCP". The default value is "FTP".
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.
#Get restore_type my $restore_type = $backup->restore_type(); #Modify restore_type $backup->restore_type("FTP");
Use this method to set or retrieve the IP address of the restore server when the operation is set to "RESTORE".
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The IP address of the restore server.
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.
#Get backup_server my $restore_host = $backup->restore_host(); #Modify restore_host $backup->restore_host("my-restore-server");
Use this method to set or retrieve the user name that is used to log in to the restore server. This is required only when "RESTORE" operation is performed.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
The user name in string format with a maximum of 1024 bytes.
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.
#Get user my $restore_username = $backup->restore_username(); #Modify user $backup->restore_username("admin1");
Use this method to set the user password that is used to log in to the restore server. This is required only when "RESTORE" operation is performed. This is a write-only attribute.
The restore_password in string format with a maximum of 64 bytes.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
#Modify restore_password $backup->restore_password("userpassword");
Use this method to set or retrieve the directory path to the restored file on the server. This is required only when "RESTORE" operation is performed.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Desired path in string format with a maximum of 1024 bytes.
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.
#Get restore_directory my $restore_directory = $backup->restore_directory(); #Modify restore_directory $backup->restore_directory("/tmp");
The following sample code demonstrates different operations that can be applied to an object such as create, modify, and remove an object. This sample code also includes error handling for the operations.
#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";
#Add a ScheduledBackup object
my @result_array = $session->get( "object" => "Infoblox::Grid", "name" => "Infoblox"); if( scalar( @result_array ) > 0 ) { my $Grid_obj = $result_array[0]; unless ($Grid_obj) { die("Get Grid object failed: ", $session->status_code() . ":" . $session->status_detail()); } # construct a ScheduledBackup object my $backup = Infoblox::Grid::ScheduledBackup->new ( backup_type => "LOCAL", backup_frequency => "Weekly", weekday => "0", # "0" is the same as "Sunday" hour_of_day => "4", minute_of_hour => "0", user => "username", password => "user-password", backup_server => "10.0.3.4", path => "/tmp/infoblox/database.tar.gz", disabled => "false", );
# Add ScheduledBackup to Grid object. $Grid_obj->scheduled_backup($backup);
$session->modify($Grid_obj) or die("Modify Grid failed: ",$session->status_code(). ":" .$session->status_detail()); print "ScheduledBackup added to Grid object sucessfully\n"; } else { print "No Grid object found."; }
#Modify an existing ScheduledBackup object
@result_array = $session->get( "object" => "Infoblox::Grid", "name" => "Infoblox"); if( scalar( @result_array ) > 0 ) { my $Grid_obj = $result_array[0]; unless ($Grid_obj) { die("Get Grid object failed: ", $session->status_code() . ":" . $session->status_detail()); }
# get ScheduledBackup from Grid object. my $backup= $Grid_obj->scheduled_backup();
#modify the backup frequency $backup->backup_frequency("Daily");
# Add ScheduledBackup to Grid object. $Grid_obj->scheduled_backup($backup);
$session->modify($Grid_obj) or die("Modify Grid failed: ",$session->status_code(). ":" .$session->status_detail()); print "ScheduledBackup modified on Grid object sucessfully\n"; } else { print "No Grid object found."; }
#Remove an existing ScheduledBackup object
@result_array = $session->get( "object" => "Infoblox::Grid", "name" => "Infoblox"); if( scalar( @result_array ) > 0 ) { my $Grid_obj = $result_array[0]; unless ($Grid_obj) { die("Get Grid object failed: ", $session->status_code() . ":" . $session->status_detail()); }
# empty ScheduledBackup list on Grid object. $Grid_obj->scheduled_backup([]);
$session->modify($Grid_obj) or die("Modify Grid failed: ",$session->status_code(). ":" .$session->status_detail()); print "ScheduledBackup removed on Grid object sucessfully\n"; } else { print "No Grid object found."; }
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Grid, Infoblox::Grid->scheduled_backup()
Copyright (c) 2017 Infoblox Inc.