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_readers
archiver_retention
archiver_retention_days
backup
backup_nodes
backup_only_archiving_candidate
backup_private_authorities
backup_queue_data
backup_retention
backup_retention_days
backup_savf_file_data
backup_spool_file_data
backup_using_multiple_drives
block_level_backup_option
browse
catalog_acl
content
create_file_level_index_option
data_readers
deduplication_options
description
disable_backup
disable_content_indexing
disable_intelli_snap
disk_cleanup
disk_cleanup_rules
display_name
enable_backup
enable_backup_at_time
enable_content_indexing
enable_dc_content_indexing
enable_intelli_snap
enable_synclib
enable_trueup
enable_trueup_days
encryption_flag
exception_content
exclude_from_sla
file_version
filter_content
find
find_all_versions
find_latest_job
generate_signature_on_ibmi
get_ma_associated_storagepolicy
global_filter_status
ibmi_compression
ibmi_dr_config
impersonate_user
index_pruning_cycles_retention
index_pruning_days_retention
index_pruning_type
index_server
is_backup_enabled
is_blocklevel_backup_enabled
is_default_subclient
is_intelli_snap_enabled
is_on_demand_subclient
is_trueup_enabled
last_backup_time
list_media
name
network_agent
network_share_auto_mount
next_backup_time
object_level_backup
onetouch_option
onetouch_server
onetouch_server_directory
other_pending_changes
pending_record_changes
plan
pre_post_commands
properties
read_buffer_size
refresh
restore_out_of_place
run_backup_copy
save_access_path
save_while_active_option
scan_type
set_backup_nodes
set_data_access_nodes
set_proxy_for_snap
snapshot_engine_name
software_compression
storage_ma
storage_ma_id
storage_policy
subclient_guid
subclient_id
subclient_name
system_state_option
target_release
trueup_days
trueup_option
unset_proxy_for_snap
update_history
update_properties
use_vss