Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Attributes
----------
**content** -- returns the content of the Exchange Database subclient
"""
from __future__ import unicode_literals
from ...subclient import Subclient
from ...exception import SDKException
from ...job import Job
class ExchangeDatabaseSubclient(Subclient):
"""Derived class from the Subclient Base class,
to perform operations specific to an Exchange Database Subclient."""
def _get_subclient_properties(self):
"""Gets the subclient related properties of Exchange Database subclient.."""
super(ExchangeDatabaseSubclient, self)._get_subclient_properties()
self._content = self._subclient_properties.get('content', [])
self._exchange_db_subclient_prop = self._subclient_properties.get(
'exchangeDBSubClientProp', {}
)
def _get_subclient_properties_json(self):
"""Returns the JSON with the properties for the Subclient, that can be used for a POST
request to update the properties of the Subclient.
CaseMangerSubclient: Derived class from Subclient Base class, representing an Exchange Mailbox
Agent subclient, and to perform operations on that subclient.
CaseMangerSubclient:
__new__() -- Method to create object based on the backupset name
"""
from __future__ import unicode_literals
from cvpysdk.subclient import Subclient
from cvpysdk.exception import SDKException
class CaseSubclient(Subclient):
"""Derived class from Subclient Base class, representing an Case Manger subclient,
and to perform operations on that subclient.
"""
def _case_definition_request(self, defination_json):
"""Runs the case defination ass API to add definition for case
Args:
defination_json (dict) -- request json sent as payload
Returns:
(str, str):
str - error code received in the response
str - error message received
from enum import Enum
import copy
import xml.etree.ElementTree as ET
from importlib import import_module
from inspect import getmembers, isclass, isabstract
import xmltodict
from past.builtins import basestring
from cvpysdk.plan import Plans
from ..exception import SDKException
from ..subclient import Subclient
from ..constants import VSAObjects
class VirtualServerSubclient(Subclient):
"""Derived class from Subclient Base class, representing a virtual server subclient,
and to perform operations on that subclient."""
def __new__(cls, backupset_object, subclient_name, subclient_id=None):
"""Decides which instance object needs to be created"""
instance_name = backupset_object._instance_object.instance_name
instance_name = re.sub('[^A-Za-z0-9_]+', '', instance_name.replace(" ", "_"))
try:
subclient_module = import_module("cvpysdk.subclients.virtualserver.{}".format(instance_name))
except ImportError:
subclient_module = import_module("cvpysdk.subclients.virtualserver.null")
classes = getmembers(subclient_module, lambda m: isclass(m) and not isabstract(m))
for name, _class in classes:
Note: GoogleSubclient class is used for OneDrive subclient too.
CloudAppsSubclient:
__new__() -- Method to create object based on specific cloud apps instance type
"""
from __future__ import unicode_literals
from ..subclient import Subclient
from ..exception import SDKException
class CloudAppsSubclient(Subclient):
"""Class for representing a subclient of the Cloud Apps agent."""
def __new__(cls, backupset_object, subclient_name, subclient_id=None):
from .cloudapps.salesforce_subclient import SalesforceSubclient
from .cloudapps.google_subclient import GoogleSubclient
from .cloudapps.cloud_storage_subclient import CloudStorageSubclient
from .cloudapps.cloud_database_subclient import CloudDatabaseSubclient
instance_types = {
1: GoogleSubclient,
2: GoogleSubclient,
3: SalesforceSubclient,
4: CloudDatabaseSubclient, # Amazon RDS Subclient
5: CloudStorageSubclient, # AmazonS3 Subclient
6: CloudStorageSubclient, # AzureBlob Subclient
7: GoogleSubclient, # OneDrive Subclient. GoogleSuclient class is used for OneDrive too
associate_site_collections_and_webs()-- associates the specified site collections/webs
restore_in_place() -- runs a in-place restore job on the specified Sharepoint pseudo client
"""
from __future__ import unicode_literals
from base64 import b64encode
from ..subclient import Subclient
from ..exception import SDKException
from ..constants import SQLDefines
from ..constants import SharepointDefines
class SharepointSubclient(Subclient):
"""Derived class from Subclient Base class, representing a Sharepoint subclient,
and to perform operations on that subclient."""
def _get_subclient_properties(self):
"""Gets the subclient related properties of the Sharepoint subclient.
"""
super(SharepointSubclient, self)._get_subclient_properties()
self._sharepoint_subclient_prop = self._subclient_properties.get('sharepointsubclientprop', {})
self._content = self._subclient_properties.get('content', {})
def _get_subclient_properties_json(self):
"""get the all subclient related properties of this subclient.
Returns:
self.client_id = generic_entity_obj._agent_object._client_object.client_id
self.agent_id = generic_entity_obj._agent_object.agent_id
self.instance_id = generic_entity_obj.instance_id
self.entity_type = "instanceId"
self.entity_id = self.instance_id
self.entity_details["entity_level"] = self.entity_type[:-2]
elif isinstance(generic_entity_obj, Backupset):
self.client_id = generic_entity_obj._instance_object._agent_object. \
_client_object.client_id
self.agent_id = generic_entity_obj._instance_object._agent_object.agent_id
self.instance_id = generic_entity_obj._instance_object.instance_id
self.backupset_id = generic_entity_obj.backupset_id
self.entity_type = "backupsetId"
self.entity_id = self.backupset_id
self.entity_details["entity_level"] = self.entity_type[:-2]
elif isinstance(generic_entity_obj, Subclient):
self.client_id = generic_entity_obj._backupset_object._instance_object. \
_agent_object._client_object.client_id
self.agent_id = generic_entity_obj._backupset_object. \
_instance_object._agent_object.agent_id
self.instance_id = generic_entity_obj._backupset_object._instance_object.instance_id
self.backupset_id = generic_entity_obj._backupset_object.backupset_id
self.subclient_id = generic_entity_obj.subclient_id
self.entity_type = "subclientId"
self.entity_id = self.subclient_id
self.entity_details["entity_level"] = self.entity_type[:-2]
else:
raise SDKException('Response', '101', "Invalid instance passed")
self.entity_details.update({"clientGroupId": self.clientgroup_id,
"clientId": self.client_id,
"applicationId": self.agent_id,
VMInstanceSubclient: Derived class from Subclient Base
class,representing a VMInstance Subclien
VMInstanceSubclient:
__init__(
backupset_object,
subclient_name,
subclient_id) -- initialize object of vminstance subclient class,
associated with the VirtualServer subclient
"""
from ..subclient import Subclient
class VMInstanceSubclient(Subclient):
"""
Derived class from Subclient Base class.
This represents a VMInstance virtual server subclient
"""
def __init__(self, backupset_object, subclient_name, subclient_id=None):
"""
Initialize the Instance object for the given Virtual Server instance.
Args:
backupset_object (object) -- instance of the Backupset class
subclient_name (str) -- subclient name
subclient (int) -- subclient id
update_dict (dict) -- The changes which are need to make
Return:
dict -- modified source dictionary with updated values
"""
for key, value in update_dict.items():
if isinstance(value, dict) and value:
source[key] = _nested_dict(source.get(key, {}), value)
else:
source[key] = value
return source
class FileSystemSubclient(Subclient):
"""Derived class from Subclient Base class, representing a file system subclient,
and to perform operations on that subclient.
"""
def _get_subclient_properties(self):
"""Gets the subclient related properties of File System subclient.
"""
super(FileSystemSubclient, self)._get_subclient_properties()
if 'impersonateUser' in self._subclient_properties:
self._impersonateUser = self._subclient_properties['impersonateUser']
if 'fsSubClientProp' in self._subclient_properties:
self._fsSubClientProp = self._subclient_properties['fsSubClientProp']
def __getattr__(self, attribute):
"""Returns the persistent attributes"""
if attribute in self._restore_methods:
return getattr(self._backupset_object, attribute)
if attribute in self._restore_options_json:
return getattr(self._backupset_object, attribute)
return super(Subclient, self).__getattribute__(attribute)
**is_proxy_enabled** -- Returns True if proxy is enabled in the subclient
**is_failover_to_production** -- Returns the isFailOverToProduction flag of the subclient
**content** -- Returns the appropriate content from
the Subclient relevant to the user
"""
from __future__ import unicode_literals
from ..subclient import Subclient
from ..exception import SDKException
class MYSQLSubclient(Subclient):
"""Derived class from Subclient Base class, representing a MYSQL subclient,
and to perform operations on that subclient."""
def __init__(self, backupset_object, subclient_name, subclient_id=None):
"""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 MYSQLSubclient class