How to use the cvpysdk.backupset.Backupset function in cvpysdk

To help you get started, we’ve selected a few cvpysdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CommvaultEngg / cvpysdk / cvpysdk / backupsets / vsbackupset.py View on Github external
def __new__(cls, instance_object, backupset_name, backupset_id=None):
        """Decides which instance object needs to be created"""
        instance_name = instance_object.instance_name
        instance_name = re.sub('[^A-Za-z0-9_]+', '', instance_name.replace(" ", "_"))

        try:
            backupset_module = import_module("cvpysdk.backupsets._virtual_server.{}".format(instance_name))
        except ImportError:
            return object.__new__(cls)

        classes = getmembers(backupset_module, lambda m: isclass(m) and not isabstract(m))

        for name, _class in classes:
            if issubclass(_class, Backupset) and _class.__module__.rsplit(".", 1)[-1] == instance_name:
                return object.__new__(_class)
github CommvaultEngg / cvpysdk / cvpysdk / backupsets / cabackupset.py View on Github external
#. Add the import statement inside the __new__ method.
        **NOTE:** If you add the import statement at the top,
        it'll cause cyclic import, and the call will fail

    #. After adding the import statement:
        - In the **instance_type** dict
            - Add the cloud apps instance type as the key, and the class as its value

"""

from __future__ import unicode_literals

from ..backupset import Backupset


class CloudAppsBackupset(Backupset):
    """Class for representing a Backupset of the Cloud Apps agent."""

    def __new__(cls, instance_object, backupset_name, backupset_id=None):

        from .cloudapps.salesforce_backupset import SalesforceBackupset

        instance_types = {
            3: SalesforceBackupset
        }

        cloud_apps_instance_type = instance_object._properties['cloudAppsInstance']['instanceType']

        if cloud_apps_instance_type in instance_types:
            instance_type = instance_types[cloud_apps_instance_type]
        else:
            instance_type = cls
github CommvaultEngg / cvpysdk / cvpysdk / backupset.py View on Github external
backupset_name = backupset_name.lower()

            if self.has_backupset(backupset_name):
                if self._instance_object is None:
                    self._instance_object = self._agent_object.instances.get(
                        self._backupsets[backupset_name]['instance']
                    )

                if self._agent_object.agent_name in self._backupsets_dict.keys():
                    return self._backupsets_dict[self._agent_object.agent_name](
                        self._instance_object,
                        backupset_name,
                        self._backupsets[backupset_name]["id"]
                    )
                else:
                    return Backupset(
                        self._instance_object,
                        backupset_name,
                        self._backupsets[backupset_name]["id"]
                    )

            raise SDKException(
                'Backupset', '102', 'No backupset exists with name: "{0}"'.format(backupset_name)
            )
github CommvaultEngg / cvpysdk / cvpysdk / backupsets / db2backupset.py View on Github external
restore_entire_database()       --      runs the restore job for specified backupset


DB2Backupset instance Attributes:
=================================

    **db2_db_status**       --      returns db2 database status

"""

from __future__ import unicode_literals

from ..backupset import Backupset


class DB2Backupset(Backupset):
    """Derived class from Backupset Base class, representing a db2 backupset,
        and to perform operations on that backupset."""

    @property
    def db2_db_status(self):
        """
        returns db2 database status

        Returns:
            (str) -- Status of db as connected or disconnected

        """
        return self._properties.get('db2BackupSet', {}).get('dB2DBStatus', "")

    def restore_entire_database(
            self,
github CommvaultEngg / cvpysdk / cvpysdk / backupsets / hanabackupset.py View on Github external
HANABackupset:

    restore()       --      runs the restore job for specified backupset

"""

from __future__ import absolute_import
from __future__ import unicode_literals

from past.builtins import basestring

from ..backupset import Backupset
from ..exception import SDKException


class HANABackupset(Backupset):
    """Derived class from Backupset Base class, representing a SAP HANA backupset,
        and to perform operations on that backupset.
    """

    def restore(
            self,
            pseudo_client,
            instance,
            backup_prefix=None,
            point_in_time=None,
            initialize_log_area=False,
            use_hardware_revert=False,
            clone_env=False,
            check_access=True,
            destination_instance_dir=None,
            ignore_delta_backups=True):
github CommvaultEngg / cvpysdk / cvpysdk / backupsets / adbackupset.py View on Github external
Usage
=====


Limitation:
 * current , update subclient content failed. this is limitation in sp12.will tyr in sp13

"""

from __future__ import unicode_literals

from ..backupset import Backupset
from ..exception import SDKException


class ADBackupset(Backupset):
    """ AD agent backupset class """

    def check_subclient(self,
                        backupset_ins,
                        subclientname,
                        storagepolicy=None,
                        subclientcontent=None,
                        deleteexist=False):
        """check if the subclient exsit, will create new one if not found

        Args:

            backupset_ins        (instance)       inherite backupset instance

            subclientname        (string)        subclient name
github CommvaultEngg / cvpysdk / cvpysdk / backupsets / vsbackupset.py View on Github external
The Virtual Server 'Hyper-V' is named as 'hyperv.py'
"""

from __future__ import unicode_literals

import re
import time
from importlib import import_module
from inspect import isabstract, isclass, getmembers

from ..backupset import Backupset
from ..exception import SDKException


class VSBackupset(Backupset):
    """Derived class from Backupset Base class, representing a vs backupset,
            and to perform operations on that backupset."""

    def __new__(cls, instance_object, backupset_name, backupset_id=None):
        """Decides which instance object needs to be created"""
        instance_name = instance_object.instance_name
        instance_name = re.sub('[^A-Za-z0-9_]+', '', instance_name.replace(" ", "_"))

        try:
            backupset_module = import_module("cvpysdk.backupsets._virtual_server.{}".format(instance_name))
        except ImportError:
            return object.__new__(cls)

        classes = getmembers(backupset_module, lambda m: isclass(m) and not isabstract(m))

        for name, _class in classes:
github CommvaultEngg / cvpysdk / cvpysdk / backupsets / fsbackupset.py View on Github external
create_granular_replica_copy()      --   Triggers  Granular replication permanent mount

"""

from __future__ import unicode_literals

from past.builtins import basestring

from ..backupset import Backupset
from ..client import Client
from ..exception import SDKException
from ..job import Job
from ..schedules import Schedules

class FSBackupset(Backupset):
    """Derived class from Backupset Base class, representing a fs backupset,
        and to perform operations on that backupset."""

    def restore_in_place(
            self,
            paths,
            overwrite=True,
            restore_data_and_acl=True,
            copy_precedence=None,
            from_time=None,
            to_time=None,
            fs_options=None,
            restore_jobs=None
    ):
        """Restores the files/folders specified in the input paths list to the same location.