Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self._repr_str = "Dataging in Commcell: {0}".format(
class_object.commserv_name)
elif not operation_type:
self._SCHEDULES = class_object._services['COMMCELL_SCHEDULES']
self._repr_str = "Schedules in Commcell: {0}".format(
class_object.commserv_name)
else:
raise SDKException('Schedules', '103')
elif isinstance(class_object, Client):
self._SCHEDULES = class_object._commcell_object._services['CLIENT_SCHEDULES'] % (
class_object.client_id)
self._repr_str = "Client: {0}".format(class_object.client_name)
self._commcell_object = class_object._commcell_object
elif isinstance(class_object, Agent):
self._SCHEDULES = class_object._commcell_object._services['AGENT_SCHEDULES'] % (
class_object._client_object.client_id, class_object.agent_id)
self._repr_str = "Agent: {0}".format(class_object.agent_name)
self._commcell_object = class_object._commcell_object
elif isinstance(class_object, Instance):
self._SCHEDULES = class_object._commcell_object._services['INSTANCE_SCHEDULES'] % (
class_object._agent_object._client_object.client_id,
class_object._agent_object.agent_id,
class_object.instance_id
)
self._repr_str = "Instance: {0}".format(
class_object.instance_name)
self._commcell_object = class_object._commcell_object
elif isinstance(class_object, Backupset):
object - instance of the Subclients class
Raises:
SDKException:
if class object is not an instance of Agent / Instance / Backupset
"""
from .agent import Agent
from .instance import Instance
from .backupset import Backupset
self._agent_object = None
self._instance_object = None
self._backupset_object = None
if isinstance(class_object, Agent):
self._agent_object = class_object
elif isinstance(class_object, Instance):
self._instance_object = class_object
self._agent_object = self._instance_object._agent_object
elif isinstance(class_object, Backupset):
self._backupset_object = class_object
self._instance_object = class_object._instance_object
self._agent_object = self._instance_object._agent_object
else:
raise SDKException('Subclient', '115')
self._client_object = self._agent_object._client_object
self._commcell_object = self._agent_object._commcell_object
Raises:
SDKException:
if type of the agent name argument is not string
if no agent exists with the given name
"""
if not isinstance(agent_name, basestring):
raise SDKException('Agent', '101')
else:
agent_name = agent_name.lower()
if self.has_agent(agent_name):
updated_agent_name = agent_name
if "file system" in agent_name:
updated_agent_name = "file system"
return self._agents_dict.get(agent_name, Agent)(
self._client_object, updated_agent_name, self._agents[agent_name]
)
raise SDKException('Agent', '102', 'No agent exists with name: {0}'.format(agent_name))
if sf_options is None:
sf_options = {}
# check if client name is correct
if destination_client is None:
destination_client = self._backupset_object._agent_object._client_object
if isinstance(destination_client, Client):
dest_client = destination_client
elif isinstance(destination_client, basestring):
dest_client = Client(self._commcell_object, destination_client)
else:
raise SDKException('Subclient', '105')
dest_agent = Agent(dest_client, 'Cloud Apps')
# check if instance name is correct
if destination_instance is None:
destination_instance = self._backupset_object._instance_object
if isinstance(destination_instance, Instance):
dest_instance = destination_instance
elif isinstance(destination_instance, basestring):
dest_instance = dest_agent.instances.get(destination_instance)
else:
raise SDKException('Subclient', '113')
# check if backupset name is correct
if destination_backupset is None:
destination_backupset = self._backupset_object
if sf_options is None:
sf_options = {}
# check if client name is correct
if destination_client is None:
destination_client = self._backupset_object._agent_object._client_object
if isinstance(destination_client, Client):
dest_client = destination_client
elif isinstance(destination_client, basestring):
dest_client = Client(self._commcell_object, destination_client)
else:
raise SDKException('Subclient', '105')
dest_agent = Agent(dest_client, 'Cloud Apps', '134')
# check if instance name is correct
if destination_instance is None:
destination_instance = self._backupset_object._instance_object
if isinstance(destination_instance, Instance):
dest_instance = destination_instance
elif isinstance(destination_instance, basestring):
dest_instance = dest_agent.instances.get(destination_instance)
else:
raise SDKException('Subclient', '113')
# check if backupset name is correct
if destination_backupset is None:
destination_backupset = self._backupset_object
self.generic_entity_obj = generic_entity_obj
# we will derive all the entity id's based on the input entity type
if isinstance(generic_entity_obj, Commcell):
self.entity_details["entity_level"] = "commserv"
elif isinstance(generic_entity_obj, ClientGroup):
self.clientgroup_id = generic_entity_obj.clientgroup_id
self.entity_type = "clientgroupId"
self.entity_id = self.clientgroup_id
self.entity_details["entity_level"] = self.entity_type[:-2]
elif isinstance(generic_entity_obj, Client):
self.client_id = generic_entity_obj.client_id
self.entity_type = "clientId"
self.entity_id = self.client_id
self.entity_details["entity_level"] = self.entity_type[:-2]
elif isinstance(generic_entity_obj, Agent):
self.client_id = generic_entity_obj._client_object.client_id
self.agent_id = generic_entity_obj.agent_id
self.entity_type = "applicationId"
self.entity_id = self.agent_id
self.entity_details["entity_level"] = "agent"
elif isinstance(generic_entity_obj, Instance):
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
class_object (object) -- instance of the Agent / Instance class
Returns:
object - instance of the Backupsets class
Raises:
SDKException:
if class object is not an instance of the Agent / Instance class
"""
from .agent import Agent
from .instance import Instance
self._instance_object = None
if isinstance(class_object, Agent):
self._agent_object = class_object
elif isinstance(class_object, Instance):
self._instance_object = class_object
self._agent_object = class_object._agent_object
else:
raise SDKException('Backupset', '103')
self._client_object = self._agent_object._client_object
self._commcell_object = self._agent_object._commcell_object
self._cvpysdk_object = self._commcell_object._cvpysdk_object
self._services = self._commcell_object._services
self._update_response_ = self._commcell_object._update_response_
self._BACKUPSETS = self._services['GET_ALL_BACKUPSETS'] % (self._client_object.client_id)
# check if client name is correct
if destination_client is None:
destination_client = self._agent_object._client_object.client_name
if isinstance(destination_client, Client):
destination_client = destination_client
elif isinstance(destination_client, str):
destination_client = Client(self._commcell_object, destination_client)
#print(destination_client)
else:
raise SDKException('Instance', '101')
dest_agent = Agent(destination_client, 'sap for oracle','61')
# check if instance name is correct
if destination_instance is None:
destination_instance = self.instance_name
if isinstance(destination_instance, Instance):
destination_instance = destination_instance
elif isinstance(destination_instance, str):
destination_instance = dest_agent.instances.get(destination_instance)
else:
raise SDKException('Instance', '101')
sap_options["destination_client"] = destination_client.client_name
sap_options["destination_instance"] = destination_instance.instance_name
#sap_options["copyPrecedence"] = sap_options.get("copyPrecedence", "0")
# prepare and execute
Attributes
----------
**subclients** -- returns the instance of the Subclients class, listing the subclients
associated to the Agent
"""
from __future__ import unicode_literals
from ..agent import Agent
from ..subclient import Subclients
class ExchangeDatabaseAgent(Agent):
"""Derived class from the Agent Base class,
to perform operations specific to an Exchange Database Agent."""
def __init__(self, client_object, agent_name, agent_id=None):
"""Initialize the instance of the Agent class.
Args:
client_object (object) -- instance of the Client class
agent_name (str) -- name of the agent
(File System, Virtual Server, etc.)
agent_id (str) -- id of the agent
default: None