Module cvpysdk.subclients.splunksubclient
Module for operating with splunk subclient
SplunkSubClient is the only class defined in this file
SplunkSubClient: Derived class from BigDataAppsSubclient Base class, representing splunk subclient, and to perform operations on that subclient
SplunkSubclient:
splunk_restore() – performs a restore job by taking index name as the argument
subclient_content() – sets backup content at subclient level
Expand source code Browse git
# -*- coding: utf-8 -*-
# pylint: disable=R1705, R0205
# --------------------------------------------------------------------------
# Copyright Commvault Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# --------------------------------------------------------------------------
"""
Module for operating with splunk subclient
SplunkSubClient is the only class defined in this file
SplunkSubClient: Derived class from BigDataAppsSubclient Base class, representing
splunk subclient, and to perform operations on that subclient
SplunkSubclient:
===============
splunk_restore() -- performs a restore job by taking index name as
the argument
subclient_content() -- sets backup content at subclient level
"""
from cvpysdk.subclients.bigdataappssubclient import BigDataAppsSubclient
class SplunkSubclient(BigDataAppsSubclient):
"""
Derived class from BigDataAppsSubclient, representing splunk subclient,
and to perform operations on that subclient
"""
def restore_in_place(self, index_list, copy_precedence=None):
"""
Performs a restore job on the splunk subclient
Args:
index_list (list) -- list containing the indexes to be restored
Example: ["index1",index2"]
copy_precedence (int) -- the copy precedence value
Returns:
job_obj (obj) -- job object associated with the restore job
"""
subclient_properties = self.properties["subClientEntity"]
subclient_id = int(self.subclient_id)
backupset_id = int(subclient_properties["backupsetId"])
for count, ele in enumerate(index_list):
index_list[count] = "/Indexes/" + ele
instance_obj = self._instance_object
instance_obj._restore_association = self._subClientEntity
parameter_dict = self._restore_json(paths=index_list, copy_precedence = copy_precedence)
parameter_dict["taskInfo"]["associations"] \
[0]["subclientId"] = subclient_id
parameter_dict["taskInfo"]["associations"] \
[0]["backupsetId"] = backupset_id
parameter_dict["taskInfo"]["subTasks"][0]["options"] \
["restoreOptions"]["browseOption"]["backupset"]["backupsetId"] = backupset_id
return self._process_restore_response(parameter_dict)
@property
def subclient_content(self):
"""
Returns the appropriate content associated with the subclient
Returns:
index_list (list) -- list of subclient content
"""
subclient_prop = self.properties
index_list = []
content_list = subclient_prop["splunkProps"]["contentList"]
for content in content_list:
index_list.append(content["title"])
return index_list
@subclient_content.setter
def subclient_content(self, index_list):
"""
Sets content of subclient entity
Args:
index_list (list) -- list of the indexes to be backed up
Example:["index1","index2"]
Returns:
Nothing
"""
subclient_prop = self.properties
index_list_copy = list(index_list)
content_prop_dict = {
"path": "indexes/" + index_list_copy[0],
"level": 1,
"type": 1,
"title": index_list_copy[0]
}
subclient_prop["splunkProps"]["contentList"][0] = content_prop_dict
del index_list_copy[0]
for index in index_list_copy:
content_prop_dict = {
"path": "indexes/" + index,
"level": 1,
"type": 1,
"title": index
}
subclient_prop["splunkProps"]["contentList"].append(content_prop_dict)
self.update_properties(subclient_prop)
Classes
class SplunkSubclient (backupset_object, subclient_name, subclient_id=None)-
Derived class from BigDataAppsSubclient, representing splunk subclient, and to perform operations on that subclient
Initialise the Subclient object.
Args
backupset_object (object) – instance of the Backupset class
subclient_name (str) – name of the subclient
subclient_id (str) – id of the subclient default: None
Returns
object - instance of the Subclient class
Expand source code Browse git
class SplunkSubclient(BigDataAppsSubclient): """ Derived class from BigDataAppsSubclient, representing splunk subclient, and to perform operations on that subclient """ def restore_in_place(self, index_list, copy_precedence=None): """ Performs a restore job on the splunk subclient Args: index_list (list) -- list containing the indexes to be restored Example: ["index1",index2"] copy_precedence (int) -- the copy precedence value Returns: job_obj (obj) -- job object associated with the restore job """ subclient_properties = self.properties["subClientEntity"] subclient_id = int(self.subclient_id) backupset_id = int(subclient_properties["backupsetId"]) for count, ele in enumerate(index_list): index_list[count] = "/Indexes/" + ele instance_obj = self._instance_object instance_obj._restore_association = self._subClientEntity parameter_dict = self._restore_json(paths=index_list, copy_precedence = copy_precedence) parameter_dict["taskInfo"]["associations"] \ [0]["subclientId"] = subclient_id parameter_dict["taskInfo"]["associations"] \ [0]["backupsetId"] = backupset_id parameter_dict["taskInfo"]["subTasks"][0]["options"] \ ["restoreOptions"]["browseOption"]["backupset"]["backupsetId"] = backupset_id return self._process_restore_response(parameter_dict) @property def subclient_content(self): """ Returns the appropriate content associated with the subclient Returns: index_list (list) -- list of subclient content """ subclient_prop = self.properties index_list = [] content_list = subclient_prop["splunkProps"]["contentList"] for content in content_list: index_list.append(content["title"]) return index_list @subclient_content.setter def subclient_content(self, index_list): """ Sets content of subclient entity Args: index_list (list) -- list of the indexes to be backed up Example:["index1","index2"] Returns: Nothing """ subclient_prop = self.properties index_list_copy = list(index_list) content_prop_dict = { "path": "indexes/" + index_list_copy[0], "level": 1, "type": 1, "title": index_list_copy[0] } subclient_prop["splunkProps"]["contentList"][0] = content_prop_dict del index_list_copy[0] for index in index_list_copy: content_prop_dict = { "path": "indexes/" + index, "level": 1, "type": 1, "title": index } subclient_prop["splunkProps"]["contentList"].append(content_prop_dict) self.update_properties(subclient_prop)Ancestors
Instance variables
var subclient_content-
Returns the appropriate content associated with the subclient
Returns
index_list (list) – list of subclient content
Expand source code Browse git
@property def subclient_content(self): """ Returns the appropriate content associated with the subclient Returns: index_list (list) -- list of subclient content """ subclient_prop = self.properties index_list = [] content_list = subclient_prop["splunkProps"]["contentList"] for content in content_list: index_list.append(content["title"]) return index_list
Methods
def restore_in_place(self, index_list, copy_precedence=None)-
Performs a restore job on the splunk subclient
Args
- index_list (list) – list containing the indexes to be restored
Example- ["index1",index2"]
copy_precedence (int) – the copy precedence value
Returns
job_obj (obj) – job object associated with the restore job
Expand source code Browse git
def restore_in_place(self, index_list, copy_precedence=None): """ Performs a restore job on the splunk subclient Args: index_list (list) -- list containing the indexes to be restored Example: ["index1",index2"] copy_precedence (int) -- the copy precedence value Returns: job_obj (obj) -- job object associated with the restore job """ subclient_properties = self.properties["subClientEntity"] subclient_id = int(self.subclient_id) backupset_id = int(subclient_properties["backupsetId"]) for count, ele in enumerate(index_list): index_list[count] = "/Indexes/" + ele instance_obj = self._instance_object instance_obj._restore_association = self._subClientEntity parameter_dict = self._restore_json(paths=index_list, copy_precedence = copy_precedence) parameter_dict["taskInfo"]["associations"] \ [0]["subclientId"] = subclient_id parameter_dict["taskInfo"]["associations"] \ [0]["backupsetId"] = backupset_id parameter_dict["taskInfo"]["subTasks"][0]["options"] \ ["restoreOptions"]["browseOption"]["backupset"]["backupsetId"] = backupset_id return self._process_restore_response(parameter_dict)
Inherited members
BigDataAppsSubclient:allow_multiple_readersarchiver_retentionarchiver_retention_daysbackupbackup_nodesbackup_only_archiving_candidatebackup_private_authoritiesbackup_queue_databackup_retentionbackup_retention_daysbackup_savf_file_databackup_spool_file_databackup_using_multiple_drivesblock_level_backup_optionbrowsecatalog_aclcontentcreate_file_level_index_optiondata_readersdeduplication_optionsdescriptiondisable_backupdisable_content_indexingdisable_intelli_snapdisk_cleanupdisk_cleanup_rulesdisplay_nameenable_backupenable_backup_at_timeenable_content_indexingenable_dc_content_indexingenable_intelli_snapenable_synclibenable_trueupenable_trueup_daysencryption_flagexception_contentexclude_from_slafile_versionfilter_contentfindfind_all_versionsfind_latest_jobgenerate_signature_on_ibmiget_ma_associated_storagepolicyglobal_filter_statusibmi_compressionibmi_dr_configimpersonate_userindex_pruning_cycles_retentionindex_pruning_days_retentionindex_pruning_typeindex_serveris_backup_enabledis_blocklevel_backup_enabledis_default_subclientis_intelli_snap_enabledis_on_demand_subclientis_trueup_enabledlast_backup_timelist_medianamenetwork_agentnetwork_share_auto_mountnext_backup_timeobject_level_backuponetouch_optiononetouch_serveronetouch_server_directoryother_pending_changespending_record_changesplanpre_post_commandspropertiesread_buffer_sizerefreshrestore_out_of_placerun_backup_copysave_access_pathsave_while_active_optionscan_typeset_backup_nodesset_data_access_nodesset_proxy_for_snapsnapshot_engine_namesoftware_compressionstorage_mastorage_ma_idstorage_policysubclient_guidsubclient_idsubclient_namesystem_state_optiontarget_releasetrueup_daystrueup_optionunset_proxy_for_snapupdate_historyupdate_propertiesuse_vss