Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _one_touch_response_json(live_mount_options):
"""Sets the oneTouchResponse value for the live mount job json
Args:
live_mount_options (dict) -- live mount job options
Returns:
_one_touch_response (dict) -- dict containing the oneTouchResponse value
"""
_csinfo = LiveMountPolicy._csinfo_json(live_mount_options)
_hwconfig = LiveMountPolicy._hwconfig_json(live_mount_options)
_netconfig = LiveMountPolicy._netconfig_json()
_one_touch_response = {
'copyPrecedence': live_mount_options.get('copyPrecedence', 0),
'version': '',
'platform': 0,
'dateCreated': '',
'automationTest': False,
'autoReboot': True,
'csinfo': _csinfo,
'hwconfig': _hwconfig,
'netconfig': _netconfig,
'dataBrowseTime': live_mount_options.get('pointInTime', {}),
'maInfo': {
'clientName': ''
},
'datastoreList': {}
}
def _prepare_live_mount_json(self, live_mount_options):
"""Sets values for creating the add policy json
Args:
live_mount_options (dict) -- live mount job options provided by user
"""
self._set_mounted_vm_name(live_mount_options)
self._live_mounted_vm_name = live_mount_options['vmName']
_associations = LiveMountPolicy.__associations_json(live_mount_options)
_task = LiveMountPolicy._task_json()
_subtask = LiveMountPolicy._subtask_json()
_one_touch_response = LiveMountPolicy._one_touch_response_json(live_mount_options)
_vm_entity = LiveMountPolicy._vm_entity_json(live_mount_options)
_vm_info = LiveMountPolicy._vm_info_json(live_mount_options)
# TODO: only if live mount is scheduled (non default)
# TODO: _pattern = live_mount_json['taskInfo']['subTasks'][0]['pattern']
# TODO: backupOpts = live_mount_json['taskInfo']['subTasks'][0]['options']['backupOpts']
live_mount_json = {
'taskInfo': {
'associations': _associations,
'task': _task,
'subTasks': [
{
'subTaskOperation': 1,
'subTask': _subtask,
'options': {
'adminOpts': {
def _prepare_live_mount_json(self, live_mount_options):
"""Sets values for creating the add policy json
Args:
live_mount_options (dict) -- live mount job options provided by user
"""
self._set_mounted_vm_name(live_mount_options)
self._live_mounted_vm_name = live_mount_options['vmName']
_associations = LiveMountPolicy.__associations_json(live_mount_options)
_task = LiveMountPolicy._task_json()
_subtask = LiveMountPolicy._subtask_json()
_one_touch_response = LiveMountPolicy._one_touch_response_json(live_mount_options)
_vm_entity = LiveMountPolicy._vm_entity_json(live_mount_options)
_vm_info = LiveMountPolicy._vm_info_json(live_mount_options)
# TODO: only if live mount is scheduled (non default)
# TODO: _pattern = live_mount_json['taskInfo']['subTasks'][0]['pattern']
# TODO: backupOpts = live_mount_json['taskInfo']['subTasks'][0]['options']['backupOpts']
live_mount_json = {
'taskInfo': {
'associations': _associations,
'task': _task,
'subTasks': [
{
def _prepare_live_mount_json(self, live_mount_options):
"""Sets values for creating the add policy json
Args:
live_mount_options (dict) -- live mount job options provided by user
"""
self._set_mounted_vm_name(live_mount_options)
self._live_mounted_vm_name = live_mount_options['vmName']
_associations = LiveMountPolicy.__associations_json(live_mount_options)
_task = LiveMountPolicy._task_json()
_subtask = LiveMountPolicy._subtask_json()
_one_touch_response = LiveMountPolicy._one_touch_response_json(live_mount_options)
_vm_entity = LiveMountPolicy._vm_entity_json(live_mount_options)
_vm_info = LiveMountPolicy._vm_info_json(live_mount_options)
# TODO: only if live mount is scheduled (non default)
# TODO: _pattern = live_mount_json['taskInfo']['subTasks'][0]['pattern']
# TODO: backupOpts = live_mount_json['taskInfo']['subTasks'][0]['options']['backupOpts']
live_mount_json = {
'taskInfo': {
'associations': _associations,
'task': _task,
'subTasks': [
{
'subTaskOperation': 1,
'subTask': _subtask,
'options': {
def _prepare_live_mount_json(self, live_mount_options):
"""Sets values for creating the add policy json
Args:
live_mount_options (dict) -- live mount job options provided by user
"""
self._set_mounted_vm_name(live_mount_options)
self._live_mounted_vm_name = live_mount_options['vmName']
_associations = LiveMountPolicy.__associations_json(live_mount_options)
_task = LiveMountPolicy._task_json()
_subtask = LiveMountPolicy._subtask_json()
_one_touch_response = LiveMountPolicy._one_touch_response_json(live_mount_options)
_vm_entity = LiveMountPolicy._vm_entity_json(live_mount_options)
_vm_info = LiveMountPolicy._vm_info_json(live_mount_options)
# TODO: only if live mount is scheduled (non default)
# TODO: _pattern = live_mount_json['taskInfo']['subTasks'][0]['pattern']
# TODO: backupOpts = live_mount_json['taskInfo']['subTasks'][0]['options']['backupOpts']
live_mount_json = {
'taskInfo': {
'associations': _associations,
'task': _task,
'subTasks': [
{
'subTaskOperation': 1,
'subTask': _subtask,
def _one_touch_response_json(live_mount_options):
"""Sets the oneTouchResponse value for the live mount job json
Args:
live_mount_options (dict) -- live mount job options
Returns:
_one_touch_response (dict) -- dict containing the oneTouchResponse value
"""
_csinfo = LiveMountPolicy._csinfo_json(live_mount_options)
_hwconfig = LiveMountPolicy._hwconfig_json(live_mount_options)
_netconfig = LiveMountPolicy._netconfig_json()
_one_touch_response = {
'copyPrecedence': live_mount_options.get('copyPrecedence', 0),
'version': '',
'platform': 0,
'dateCreated': '',
'automationTest': False,
'autoReboot': True,
'csinfo': _csinfo,
'hwconfig': _hwconfig,
'netconfig': _netconfig,
'dataBrowseTime': live_mount_options.get('pointInTime', {}),
'maInfo': {
'clientName': ''
},
def _one_touch_response_json(live_mount_options):
"""Sets the oneTouchResponse value for the live mount job json
Args:
live_mount_options (dict) -- live mount job options
Returns:
_one_touch_response (dict) -- dict containing the oneTouchResponse value
"""
_csinfo = LiveMountPolicy._csinfo_json(live_mount_options)
_hwconfig = LiveMountPolicy._hwconfig_json(live_mount_options)
_netconfig = LiveMountPolicy._netconfig_json()
_one_touch_response = {
'copyPrecedence': live_mount_options.get('copyPrecedence', 0),
'version': '',
'platform': 0,
'dateCreated': '',
'automationTest': False,
'autoReboot': True,
'csinfo': _csinfo,
'hwconfig': _hwconfig,
'netconfig': _netconfig,
'dataBrowseTime': live_mount_options.get('pointInTime', {}),
'maInfo': {
'clientName': ''
},
'datastoreList': {}
def _prepare_live_mount_json(self, live_mount_options):
"""Sets values for creating the add policy json
Args:
live_mount_options (dict) -- live mount job options provided by user
"""
self._set_mounted_vm_name(live_mount_options)
self._live_mounted_vm_name = live_mount_options['vmName']
_associations = LiveMountPolicy.__associations_json(live_mount_options)
_task = LiveMountPolicy._task_json()
_subtask = LiveMountPolicy._subtask_json()
_one_touch_response = LiveMountPolicy._one_touch_response_json(live_mount_options)
_vm_entity = LiveMountPolicy._vm_entity_json(live_mount_options)
_vm_info = LiveMountPolicy._vm_info_json(live_mount_options)
# TODO: only if live mount is scheduled (non default)
# TODO: _pattern = live_mount_json['taskInfo']['subTasks'][0]['pattern']
# TODO: backupOpts = live_mount_json['taskInfo']['subTasks'][0]['options']['backupOpts']
live_mount_json = {
'taskInfo': {
'associations': _associations,
'task': _task,
'subTasks': [
def _prepare_live_mount_json(self, live_mount_options):
"""Sets values for creating the add policy json
Args:
live_mount_options (dict) -- live mount job options provided by user
"""
self._set_mounted_vm_name(live_mount_options)
self._live_mounted_vm_name = live_mount_options['vmName']
_associations = LiveMountPolicy.__associations_json(live_mount_options)
_task = LiveMountPolicy._task_json()
_subtask = LiveMountPolicy._subtask_json()
_one_touch_response = LiveMountPolicy._one_touch_response_json(live_mount_options)
_vm_entity = LiveMountPolicy._vm_entity_json(live_mount_options)
_vm_info = LiveMountPolicy._vm_info_json(live_mount_options)
# TODO: only if live mount is scheduled (non default)
# TODO: _pattern = live_mount_json['taskInfo']['subTasks'][0]['pattern']
# TODO: backupOpts = live_mount_json['taskInfo']['subTasks'][0]['options']['backupOpts']
live_mount_json = {
'taskInfo': {
'associations': _associations,
'task': _task,
'subTasks': [
{
'subTaskOperation': 1,
commcell_object,
vm_policy_name,
vm_policy_type_id,
vm_policy_id=None
):
"""Initialize object of the LiveMountPolicy class.
Args:
commcell_object (object) -- instance of the Commcell class
vm_policy_name (str) -- name of the Live Mount policy
vm_policy_type_id (int) -- policy type id
vm_policy_id (int) -- id of the Live Mount policy, if available
Returns:
object -- instance of the LiveMountPolicy class
"""
super(LiveMountPolicy, self).__init__(commcell_object,
vm_policy_name,
vm_policy_type_id,
vm_policy_id)
self._LIVE_MOUNT_JOB_URL = self._commcell_object._services['CREATE_TASK']
self._QOPERATION_URL = self._commcell_object._services['EXECUTE_QCOMMAND']
self._live_mounted_vm_name = None