How to use the cvpysdk.instance.Instance 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 / instances / hanainstance.py View on Github external
restore or not
                    default: True

            Returns:
                object  -   instance of the Job class for this restore job

            Raises:
                SDKException:
                    if instance is not a string or object

                    if response is empty

                    if response is not success

        """
        if not isinstance(instance, (basestring, Instance)):
            raise SDKException('Instance', '101')

        request_json = self._restore_request_json(
            pseudo_client,
            instance,
            backupset_name,
            backup_prefix,
            point_in_time,
            initialize_log_area,
            use_hardware_revert,
            clone_env,
            check_access,
            destination_instance_dir,
            ignore_delta_backups
        )
github CommvaultEngg / cvpysdk / cvpysdk / instance.py View on Github external
agent_name = self._agent_object.agent_name

            if self.has_instance(instance_name):
                if agent_name in self._instances_dict:
                    if isinstance(self._instances_dict[agent_name], list):
                        if instance_name == "vminstance":
                            instance = self._instances_dict[agent_name][-1]
                        else:
                            instance = self._instances_dict[agent_name][0]
                    else:
                        instance = self._instances_dict[agent_name]
                    return instance(
                        self._agent_object, instance_name, self._instances[instance_name]
                    )
                else:
                    return Instance(
                        self._agent_object, instance_name, self._instances[instance_name]
                    )

            raise SDKException(
                'Instance', '102', 'No instance exists with name: "{0}"'.format(instance_name)
            )
        elif isinstance(instance_name, int):
            instance_name = str(instance_name)
            instance_name = [name for name, instance_id in self.all_instances.items() if instance_name == instance_id]

            if instance_name:
                return self.get(instance_name[0])
            raise SDKException('Instance', '102', 'No Instance exists with the given ID: {0}'.format(instance_name))

        raise SDKException('Instance', '101')
github CommvaultEngg / cvpysdk / cvpysdk / instances / postgresinstance.py View on Github external
**maintenance_database**             --  returns the maintenance database associated
    with postgres server

    **postgres_version**                 --  returns the postgres server version

"""

from __future__ import absolute_import
from __future__ import unicode_literals

from ..instance import Instance
from ..exception import SDKException


class PostgreSQLInstance(Instance):
    """Derived class from Instance Base class, representing a POSTGRESQL instance,
        and to perform operations on that Instance."""

    def __init__(self, agent_object, instance_name, instance_id):
        """Initialize object of the Instances class.

            Args:
                agent_object (object)  --  instance of the Agent class

            Returns:
                object - instance of the Instances class

        """
        super(
            PostgreSQLInstance,
            self).__init__(
github CommvaultEngg / cvpysdk / cvpysdk / instances / mysqlinstance.py View on Github external
**xtrabackup_bin_path**             -- Returns the MySQL Server xtrabackup bin path

    **is_xtrabackup_enabled**           -- Returns the MySQL Server xtrabackup enabled flag

    **proxy_options**                   -- Returns the MySQL Server proxy options


"""

from __future__ import unicode_literals
from ..instance import Instance
from ..exception import SDKException


class MYSQLInstance(Instance):
    """
    Class to represent a standalone MYSQL Instance
    """

    def __init__(self, agent_object, instance_name, instance_id=None):
        """Initialise the Subclient object.

            Args:
                agent_object    (object)  --  instance of the Agent class

                instance_name   (str)     --  name of the instance

                instance_id     (str)     --  id of the instance

                    default: None
github CommvaultEngg / cvpysdk / cvpysdk / instances / informixinstance.py View on Github external
**log_storage_policy_name**     --  returns the log backup storage policy name

    **log_storage_policy_id**       --  returns the log backup storage policy id

    **command_line_sp_name**        --  returns command line storage policy name

    **command_line_sp_id**          --  returns command line storage policy id

"""

from __future__ import unicode_literals
from ..instance import Instance
from ..exception import SDKException


class InformixInstance(Instance):
    """
    Class to represent a standalone Informix Instance
    """

    def __init__(self, agent_object, instance_name, instance_id):
        """Initialize object of the Instances class.

            Args:
                agent_object (object)  --  instance of the Agent class

                instance_name          --   Name of the instance

                instance_id            --   ID of the instance

            Returns:
                object - instance of the Instances class
github CommvaultEngg / cvpysdk / cvpysdk / instances / cainstance.py View on Github external
**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 ..instance import Instance
from ..exception import SDKException


class CloudAppsInstance(Instance):
    """Class for representing an Instance of the Cloud Apps agent."""

    def __new__(cls, agent_object, instance_name, instance_id):
        from .cloudapps.google_instance import GoogleInstance
        from .cloudapps.salesforce_instance import SalesforceInstance
        from .cloudapps.cloud_storage_instance import CloudStorageInstance
        from .cloudapps.amazon_instance import AmazonRedshiftInstance
        from .cloudapps.amazon_instance import AmazonDocumentDBInstance
        from .cloudapps.amazon_instance import AmazonRDSInstance
        from .cloudapps.amazon_instance import AmazonDynamoDBInstance
        instance_type = {
            1: GoogleInstance,
            2: GoogleInstance,
            3: SalesforceInstance,
            4: AmazonRDSInstance,     # Amazon RDS Instance
            5: CloudStorageInstance,  # AmazonS3 Instance
github CommvaultEngg / cvpysdk / cvpysdk / operation_window.py View on Github external
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
            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):
github CommvaultEngg / cvpysdk / cvpysdk / instances / sqlinstance.py View on Github external
from __future__ import unicode_literals

import re
import time
import datetime
import threading
from base64 import b64encode

from ..instance import Instance
from ..exception import SDKException
from ..job import Job
from ..constants import SQLDefines


class SQLServerInstance(Instance):
    """Derived class from Instance Base class, representing a SQL Server instance,
        and to perform operations on that Instance."""

    def _get_instance_properties(self):
        """Gets the properties of this instance.

            Raises:
                SDKException:
                    if response is empty

                    if response is not success
        """

        super(SQLServerInstance, self)._get_instance_properties()

        self._mssql_instance_prop = self._properties.get('mssqlInstance', {})
github CommvaultEngg / cvpysdk / cvpysdk / instances / bigdataappsinstance.py View on Github external
BigDataAppsInstance is the only class defined in this file.

BigDataAppsInstance:    Derived class from Instance Base class, representing a
bigdata apps instance, and to perform operations on that instance

BigDataAppsInstance
===================

    __new__()   --  Method to create object based on specific bigdatapps instance type

"""
from ..instance import Instance
from ..exception import SDKException

class BigDataAppsInstance(Instance):
    """
    Class for representing an Instance of the BigDataApps agent
    """
    def __new__(cls, agent_object, instance_name, instance_id):
        """
        Method for object creation based on cluster type of BigdataApps

        Args:
            agent_object    (object)    -- Object associated with the agent

            instance_name   (str)       --  Name associated with the instance object

            instance_id     (int)       --  Id associated with the instance object

        Returns:
            object          (obj)       --  Object associated with the BigDataApps instance