### Install Software with Windows Features Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Example of installing software on Windows machines with specified features. Requires importing WindowsDownloadFeatures. ```python from cvpysdk.deployment.deploymentconstants import WindowsDownloadFeatures commcell_obj.install_software( client_computers=[win_machine1, win_machine2], windows_features=[WindowsDownloadFeatures.FILE_SYSTEM.value], unix_features=None, ) ``` -------------------------------- ### Installing Software on Windows Clients Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/commcell.html Example of calling the install_software method to install Windows file system features on specified client machines. Ensure to provide valid machine objects and credentials. ```python commcell_obj.install_software( client_computers=[win_machine1, win_machine2], windows_features=[WindowsDownloadFeatures.FILE_SYSTEM.value], unix_features=None, username='username', password='password', install_path='/opt/commvault', log_file_loc='/var/log', client_group_name=[My_Servers], storage_policy_name='My_Storage_Policy', sw_cache_client="remote_cache_client_name" install_flags={"preferredIPFamily":2} ) ``` -------------------------------- ### Get Browse Volume GUIDs for Client Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/backupsets/fsbackupset.html Retrieves the browse volume GUIDs and their properties for a given client. It makes a GET request to the BROWSE_MOUNT_POINTS service. ```Python def get_browse_volume_guid(self): """to get browse volume guids for client Returns: vguids (json) : Returns volume guids and properties """ client_id= self._client_object.client_id flag, response = self._cvpysdk_object.make_request('GET', self._services['BROWSE_MOUNT_POINTS'] %(client_id)) if flag: if response and response.json(): vguids = response.json() if response.json().get('errorCode', 0) != 0: raise SDKException('Response', '101', self._update_response_(response.text)) else: raise SDKException('Response', '102') else: raise SDKException('Response', '101') return vguids ``` -------------------------------- ### Install Software with Web Console Inputs Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Demonstrates configuring web console settings during software installation by providing the web server client ID. ```python webconsole_inputs = { "webServerClientId": "webservername" } commcell_obj.install_software(webconsole_inputs=webconsole_inputs) ``` -------------------------------- ### Prepare Client Details for Installation Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Prepares a list of client details, including client name and CommCell name, for the installation task. Ensures that client computers are provided. ```python client_details = [] for client_name in client_computers: client_details.append( { "clientEntity": { "clientId": 0, "clientName": client_name, "commCellName": commcell_name } }) ``` -------------------------------- ### Get User GUIDs Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/subclients/cloudapps/google_subclient.html Retrieves GUIDs for specified users. ```APIDOC ## _get_user_guids() ### Description Retrieve GUIDs for users specified. ### Method Not specified (assumed to be an internal SDK method). ### Endpoint Not applicable (SDK method). ### Parameters None explicitly documented. ### Response - A mapping of user identifiers to their GUIDs. ``` -------------------------------- ### Get VM GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/subclients/vminstancesubclient.html Retrieves the VM GUID for the client. The GUID is fetched and cached on the first call. ```python @property def vm_guid(self): """Returns vm guid Returns: str - vm guid of the client""" if not self._vm_guid: self._vm_guid = self._client_vm_status.get('strGUID') return self._vm_guid ``` -------------------------------- ### Configure Client Installation Options Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html This snippet shows how to configure specific installation options for clients, such as setting DB2 log paths, index cache locations for Media Agents, and firewall installation flags within the request JSON. ```python request_json["taskInfo"]["subTasks"][0]["options"]["adminOpts"]["clientInstallOption"]["installerOption"]["clientComposition"][0]["components"]["db2"] = db2_logs if ma_install and index_cache_location: index_cache_dict = { "indexCacheDirectory": { "path": index_cache_location } } request_json["taskInfo"]["subTasks"][0]["options"]["adminOpts"]["clientInstallOption"]["installerOption"]["clientComposition"][0]["components"]["mediaAgent"] = index_cache_dict if firewall_inputs: request_json["taskInfo"]["subTasks"][0]["options"]["adminOpts"]["clientInstallOption"]["installerOption"]["installFlags"]["firewallInstall"] = firewall_inputs ``` -------------------------------- ### Get CommCell GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/commcell.html Retrieves the GUID of the CommServ. It ensures CommServ details are loaded before returning the GUID. ```python if not self._commserv_details_loaded: self._get_commserv_details() return self._commserv_guid ``` -------------------------------- ### Get Provider GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/organization.html Retrieves the provider GUID associated with the organization. ```APIDOC ## Get Provider GUID ### Description Retrieves the provider GUID for this organization. ### Method ```python provider_guid(self) -> str ``` ### Returns - **str**: The provider GUID of the organization. ``` -------------------------------- ### Create and Configure a New Plan Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/plan.html This snippet demonstrates the logic for creating a new plan, including setting its name, description, parent plan, storage pool, and SLA. It handles different scenarios for storage and SLA overrides based on enforced or private entities. ```python if not isinstance(plan_name, str): raise SDKException('Plan', '101', 'Plan name must be string value') else: if self._commcell_object.plans.has_plan(plan_name): raise SDKException( 'Plan', '102', 'Plan "{0}" already exists'.format( plan_name) ) if self._override_entities is not None: request_json = self._commcell_object.plans._get_plan_template( str(self._subtype), "MSP") request_json['plan']['summary']['description'] = "Created from CvPySDK." request_json['plan']['summary']['plan']['planName'] = plan_name request_json['plan']['summary']['parent'] = { 'planId': int(self._plan_id) } is_dedupe = True if storage_pool_name is not None: storage_pool_obj = self._commcell_object.storage_pools.get( storage_pool_name ) if 'dedupDBDetailsList' not in storage_pool_obj._storage_pool_properties['storagePoolDetails']: is_dedupe = False storage_pool_id = int(storage_pool_obj.storage_pool_id) if is_dedupe: request_json['plan']['storage']['copy'][0]['dedupeFlags'][ 'useGlobalDedupStore'] = 1 else: del request_json['plan']['storage']['copy'][0]['storagePolicyFlags'] del request_json['plan']['storage']['copy'][0]['dedupeFlags'][ 'enableDeduplication'] del request_json['plan']['storage']['copy'][0]['dedupeFlags'][ 'enableClientSideDedup'] del request_json['plan']['storage']['copy'][0]['DDBPartitionInfo'] request_json['plan']['storage']['copy'][0]['extendedFlags'] = { 'useGlobalStoragePolicy': 1 } else: storage_pool_id = None if 1 in self._override_entities['enforcedEntities']: if storage_pool_id is None: request_json['plan']['storage'] = { "storagePolicyId": self.storage_policy.storage_policy_id } snap_copy_id = self.storage_policy.storage_policy_id else: raise SDKException( 'Plan', '102', 'Storage is enforced by base plan, cannot be overridden') elif 1 in self._override_entities['privateEntities']: if storage_pool_id is not None: request_json['plan']['storage']['copy'][0]['useGlobalPolicy'] = { "storagePolicyId": storage_pool_id } snap_copy_id = storage_pool_id else: raise SDKException('Plan', '102', 'Storage must be input') else: if storage_pool_id is not None: request_json['plan']['storage']['copy'][0]['useGlobalPolicy'] = { "storagePolicyId": storage_pool_id } snap_copy_id = storage_pool_id else: request_json['plan']['storage'] = { "storagePolicyId": self.storage_policy.storage_policy_id } snap_copy_id = self.storage_policy.storage_policy_id if 4 in self._override_entities['enforcedEntities']: if sla_in_minutes is None: request_json['plan']['summary']['slaInMinutes'] = self._sla_in_minutes else: raise SDKException( 'Plan', '102', 'SLA is enforced by base plan, cannot be overridden') elif 4 in self._override_entities['privateEntities']: if sla_in_minutes is not None: request_json['plan']['summary']['slaInMinutes'] = sla_in_minutes else: raise SDKException('Plan', '102', 'SLA must be input') else: if sla_in_minutes is not None: request_json['plan']['summary']['slaInMinutes'] = sla_in_minutes else: request_json['plan']['summary']['slaInMinutes'] = self._sla_in_minutes if isinstance(override_entities, dict): request_json['plan']['summary']['restrictions'] = 0 ``` -------------------------------- ### Get User GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/security/user.html Retrieves the globally unique identifier (GUID) for the user. ```python @property def user_guid(self): """ returns user guid """ return self._properties.get('userEntity', {}).get('userGUID') ``` -------------------------------- ### Configure Client Installation Options Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html This code configures various client installation options, including DB2 log paths, media agent index cache locations, and firewall settings. It prepares the request JSON for task creation. ```python request_json["taskInfo"]["subTasks"][0]["options"]["adminOpts"]["clientInstallOption"]["installerOption"]["clientComposition"][0]["components"]["db2"] = db2_logs if ma_install and index_cache_location: index_cache_dict = { "indexCacheDirectory": { "path": index_cache_location } } request_json["taskInfo"]["subTasks"][0]["options"]["adminOpts"]["clientInstallOption"]["installerOption"]["clientComposition"][0]["components"]["mediaAgent"] = index_cache_dict if firewall_inputs: request_json["taskInfo"]["subTasks"][0]["options"]["adminOpts"]["clientInstallOption"]["installerOption"]["installFlags"]["firewallInstall"] = firewall_inputs ``` -------------------------------- ### Get GUID for Tagset Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/activateapps/entity_manager.html Retrieves the container GUID for a Tagset. This property is read-only. ```python @property def guid(self): """Returns the container guid of this Tagset""" return self._container_guid ``` -------------------------------- ### Install Software with Install Flags Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Shows how to pass specific installation flags, such as preferred IP family and 32-bit base installation, during software deployment. ```python install_flags = {"preferredIPFamily":2, "install32Base":True} commcell_obj.install_software(install_flags=install_flags) ``` -------------------------------- ### Get Tag GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/activateapps/entity_manager.html Retrieves the globally unique identifier (GUID) of a tag. ```python @property def guid(self): """Returns the tag guid value""" return self._tag_props['id'] ``` -------------------------------- ### Get Backupset GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/backupset.html Retrieves the backupset GUID. It checks for the existence of the backupset entity and GUID within the properties. Raises an SDKException if the GUID or entity is not found. ```python @property def guid(self): """Treats the backupset GUID as a property of the Backupset class.""" if self._properties.get('backupSetEntity'): if self._properties['backupSetEntity'].get('backupsetGUID'): return self._properties['backupSetEntity']['backupsetGUID'] raise SDKException('Backupset', '102', 'Backupset GUID not found') raise SDKException('Backupset', '102', 'Backupset entity not found') ``` -------------------------------- ### Operation Window Time Configuration Examples Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/operation_window.html Illustrates how to specify start and end times for operation windows, either uniformly across selected days or with distinct times for each day. ```python day_of_week : ["sunday", "thursday", "saturday"] start_time : 28800 end_time : 86400 # The above inputs specify that for all the three days mentioned, start_time and end_time of # operation window would be same ``` ```python day_of_week : ["monday","friday"] start_time : [3600, 28800] end_time : [18000, 86400] # The above input specify that on monday operation window starts at 3600 and ends at 18000 whereas # on friday, the operation window starts at 28800 and ends at 86400 ``` -------------------------------- ### Install Class Initialization Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Initializes the Install class with a CommCell object. ```APIDOC ## __init__ ### Description Initializes the Install class, associating it with a CommCell object. ### Method __init__ ### Parameters - **commcell_object** (object) - Required - The CommCell object to associate with the Install class. ``` -------------------------------- ### Get Backupset GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/backupset.html Retrieves the globally unique identifier (GUID) for the backupset. Raises an SDKException if the GUID or backupset entity is not found. ```python def guid(self): """Treats the backupset GUID as a property of the Backupset class.""" if self._properties.get('backupSetEntity'): if self._properties['backupSetEntity'].get('backupsetGUID'): return self._properties['backupSetEntity']['backupsetGUID'] raise SDKException('Backupset', '102', 'Backupset GUID not found') raise SDKException('Backupset', '102', 'Backupset entity not found') ``` -------------------------------- ### Get Backupset GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/backupset.html Retrieves the globally unique identifier (GUID) of the backupset. Raises an SDKException if the GUID or backupset entity is not found. ```APIDOC ## guid ### Description Treats the backupset GUID as a property of the Backupset class. ### Method Signature `guid(self)` ### Returns * str: The backupset GUID. ### Raises * `SDKException`: If the backupset entity or GUID is not found. ``` -------------------------------- ### Example Priority Settings Output (App Type) Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/job.html Shows the expected dictionary format for priority settings when querying by application type, such as 'Windows File System'. ```python { "appTypeName": "Windows File System" } ``` -------------------------------- ### Get Backupset GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/backupset.html Retrieves the globally unique identifier (GUID) for the backupset. It attempts to access the GUID from the backupSetEntity properties. Raises an SDKException if the GUID or entity is not found. ```python @property def guid(self): """Treats the backupset GUID as a property of the Backupset class.""" if self._properties.get('backupSetEntity'): if self._properties['backupSetEntity'].get('backupsetGUID'): return self._properties['backupSetEntity']['backupsetGUID'] raise SDKException('Backupset', '102', 'Backupset GUID not found') raise SDKException('Backupset', '102', 'Backupset entity not found') ``` -------------------------------- ### Google Cloud Storage Instance Options Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/instance.html Provides the dictionary format for setting up a Google Cloud storage instance. Requires 'instance_name', 'storage_plan', and 'cloudapps_type'. ```python cloud_options = { 'instance_name': 'google_test', 'description': 'instance for google', 'storage_plan':'cs_sp', 'number_of_streams': 2, 'access_node': 'CS', 'cloudapps_type': 'google_cloud' 'host_url':'storage.googleapis.com', 'access_key':'xxxxxx', 'secret_key':'yyyyyy' } ``` -------------------------------- ### Install Software with Firewall Inputs (Client via Proxy) Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Configures firewall settings for client-to-CommServe communication through a proxy. Requires enabling firewall configuration, setting connection type to 2, and providing proxy details. ```python firewall_inputs = { "enableFirewallConfig": True, "firewallConnectionType": 2, "httpProxyConfigurationType": 0, "proxyClientName": "Proxy_client_name", "proxyHostName": "Proxy_host_name", "portNumber": "port_number", "encryptedTunnel": True } commcell_obj.install_software(firewall_inputs=firewall_inputs) ``` -------------------------------- ### Get GUID for Browse Path Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/subclients/cloudapps/dynamics365_subclient.html Retrieves the browse GUID for a given path from the browse response. This GUID is used in subsequent browse requests. ```python def _get_guid_for_path(self, browse_response: dict, path: str) -> str: """ Method to get the browse GUID corresponding to the path Arguments: browse_reponse (dict)-- Response from the browse query path (str)-- Path for which GUID is to be fetched Example: from the browse for "d365-env", find the GUID for the "Accounts" table The GUID would be used im the subsequent browse requests """ guid: str = str() ``` -------------------------------- ### Get Subclient GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/subclient.html Returns the globally unique identifier (GUID) for the subclient. This is a read-only property. ```python @property def subclient_guid(self): """Returns the SubclientGUID""" return self._subclient_properties.get('subClientEntity', {}).get('subclientGUID') ``` -------------------------------- ### Install Class Initialization Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Initializes the Install class with a Commcell object. This is the entry point for all installation-related operations. ```python class Install(object): """class for installing software packages""" def __init__(self, commcell_object): """Initialize object of the Install class. Args: commcell_object (object) -- instance of the Commcell class Returns: object - instance of the Install class """ self.commcell_object = commcell_object self._services = commcell_object._services self._cvpysdk_object = commcell_object._cvpysdk_object ``` -------------------------------- ### Get Replication GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/subclients/virtualserver/livesync/vsa_live_sync.html Accesses the replication GUID for the VM pair. This is treated as a read-only attribute. ```python @property def replication_guid(self): """Treats the replication guid as a read-only attribute.""" return self._replication_guid ``` -------------------------------- ### Configure Client Installation Parameters Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html This snippet defines the configuration for installing Commvault software on a client. It includes options for OS firewall, software cache, client groups, and installation paths. ```python { "disableOSFirewall": False, "stopOracleServices": False, "skipClientsOfCS": False, "addToFirewallExclusion": True, "ignoreJobsRunning": False, "forceReboot": False, "overrideClientInfo": True, "preferredIPFamily": install_flags.get('preferredIPFamily', 1) if install_flags else 1, "firewallInstall": { "enableFirewallConfig": False, "firewallConnectionType": 0, "portNumber": 0 } }, "User": { "userName": "admin", "userId": 1 }, "clientComposition": [ { "activateClient": True, "overrideSoftwareCache": True if sw_cache_client else False, "softwareCacheOrSrmProxyClient": { "clientName": sw_cache_client if sw_cache_client else "" }, "packageDeliveryOption": 0, "components": { "commonInfo": { "globalFilters": 2, "storagePolicyToUse": { "storagePolicyName": storage_policy_name if storage_policy_name else "" } }, "fileSystem": { "configureForLaptopBackups": False }, "componentInfo": install_options, "webConsole": web_console_input }, "clientInfo": { "clientGroups": selected_client_groups if client_group_name else [], "client": { "evmgrcPort": 0, "cvdPort": 0, "installDirectory": install_path if install_path else "" }, "clientProps": { "logFilesLocation": log_file_loc if log_file_loc else "" } } } ] }, "clientDetails": client_details, "clientAuthForJob": { "password": password, "userName": username } }, "updateOption": { "rebootClient": True } } } } ] } } if db2_install and db2_logs: ``` -------------------------------- ### Get Job Start Time Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/job.html Returns the recorded start time of the job. This is a read-only attribute. ```python @property def start_time(self): """Treats the start time as a read-only attribute.""" return self._start_time ``` -------------------------------- ### Operation Window Example with Client Entity Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/operation_window.html Demonstrates creating, listing, deleting, and modifying an operation window for a client entity. Requires Commcell initialization and client retrieval. ```python from cvpysdk.commcell import Commcell commcell = Commcell(, username, password) client = commcell.clients.get() from cvpysdk.operation_window import OperationWindow client_operation_window = OperationWindow(client) client_operation_window.list_operation_window() client_operation_window_details = client_operation_window.create_operation_window(name="operation window example on clientLevel") client_operation_window.delete_operation_window(rule_id=client_operation_window_details.rule_id) client_operation_window_details = client_operation_window.get(rule_id=client_operation_window_details.rule_id) client_operation_window_details.modify_operation_window(name="Modified operation window example on clientLevel") ``` -------------------------------- ### Get Installed Roles Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/index_server.html Retrieves the array of roles installed with the index server within the Commcell. ```python @property def roles(self): """Returns the array of roles installed with the index server within the commcell""" return self.index_server.role_display_name ``` -------------------------------- ### Install Software with Firewall Inputs (Client to CS) Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Configures firewall settings for when the client can open a connection to the CommServe. Requires enabling firewall configuration and setting connection type to 0. ```python firewall_inputs = { "enableFirewallConfig": True, "firewallConnectionType": 0, "proxyClientName": "", "proxyHostName": "", "portNumber": "port_number", "httpProxyConfigurationType": 0, "encryptedTunnel": True } commcell_obj.install_software(firewall_inputs=firewall_inputs) ``` -------------------------------- ### Client Installation Configuration Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html This snippet defines the configuration dictionary for installing Commvault software on a client. It includes parameters for OS firewall, software cache, client groups, and installation paths. ```python { "installFlags": install_flags, "disableOSFirewall": False, "stopOracleServices": False, "skipClientsOfCS": False, "addToFirewallExclusion": True, "ignoreJobsRunning": False, "forceReboot": False, "overrideClientInfo": True, "preferredIPFamily": install_flags.get('preferredIPFamily', 1) if install_flags else 1, "firewallInstall": { "enableFirewallConfig": False, "firewallConnectionType": 0, "portNumber": 0 } }, "User": { "userName": "admin", "userId": 1 }, "clientComposition": [ { "activateClient": True, "overrideSoftwareCache": True if sw_cache_client else False, "softwareCacheOrSrmProxyClient": { "clientName": sw_cache_client if sw_cache_client else "" }, "packageDeliveryOption": 0, "components": { "commonInfo": { "globalFilters": 2, "storagePolicyToUse": { "storagePolicyName": storage_policy_name if storage_policy_name else "" } }, "fileSystem": { "configureForLaptopBackups": False }, "componentInfo": install_options, "webConsole": web_console_input }, "clientInfo": { "clientGroups": selected_client_groups if client_group_name else [], "client": { "evmgrcPort": 0, "cvdPort": 0, "installDirectory": install_path if install_path else "" }, "clientProps": { "logFilesLocation": log_file_loc if log_file_loc else "" } } } ] }, "clientDetails": client_details, "clientAuthForJob": { "password": password, "userName": username } }, "updateOption": { "rebootClient": True } } } ] } } if db2_install and db2_logs: ``` -------------------------------- ### Get Start Timestamp Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/job.html Retrieves the Unix timestamp for the job's start time. This is a read-only attribute. ```python @property def start_timestamp(self): """Treats the unix start time as a read-only attribute.""" return self._summary['jobStartTime'] ``` -------------------------------- ### Get Commvault Job Start Time Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/job.html Retrieves the formatted start time of the job. This is a read-only attribute. ```python return self._start_time ``` -------------------------------- ### install_software() Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/commcell.html Triggers the install Software job with the given options. ```APIDOC ## install_software() ### Description Triggers the install Software job with the given options. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters - **options** (object) - Required - The options for the software installation job. ### Response None explicitly documented. ``` -------------------------------- ### Install Software with Firewall Configuration (Client to CS) Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Configures firewall settings to allow the client to initiate connections to the CommServe. This is suitable when clients have direct access to the CommServe. ```python firewall_inputs = { "enableFirewallConfig": True, "firewallConnectionType": 0, "proxyClientName": "", "proxyHostName": "", "portNumber": "port_number", "httpProxyConfigurationType": 0, "encryptedTunnel": True } commcell_obj.install_software( client_computers=[client1], firewall_inputs=firewall_inputs ) ``` -------------------------------- ### Get Start Phase Retry Interval Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/job.html Retrieves the retry interval in minutes for the start phase of jobs. ```Python @property def start_phase_retry_interval(self): """ gets the start phase retry interval in (minutes) Returns: (int) -- interval in minutes. """ return self._restart_settings["jobRestartSettings"]["startPhaseRetryIntervalInMinutes"] ``` -------------------------------- ### Get Mount Path GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/backupsets/fsbackupset.html Retrieves the GUID for a given mount path (volume). It iterates through the available mount paths and returns the GUID if a match is found. ```python def get_mount_path_guid(self, volume): """ Gets the mount points for the BLR pairs Args: volume (str): volume name eg: "E:" """ volume_list = self.get_browse_volume_guid() for mount_path in volume_list['mountPathInfo']: if mount_path['accessPathList'][0] == volume: return mount_path['guid'] return '' ``` -------------------------------- ### Install Software on Clients Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html This snippet demonstrates how to construct the request JSON for installing software packages on specified clients and client groups. It includes options for rebooting clients and running database maintenance. ```python request_json = { "taskInfo": { "task": { "taskType": 1, "initiatedFrom": 2, "policyType": 0, "taskFlags": { "disabled": False } }, "subTasks": [ { "subTaskOperation": 1, "subTask": { "subTaskType": 1, "operationType": 4020 }, "options": { "adminOpts": { "clientInstallOption": { "clientAuthForJob": { "userName": username, "password": password }, "installerOption": { "clientComposition": [ { "packageDeliveryOption": 0 } ] } }, "updateOption": { "installUpdateOptions": 0, "restartExplorerPlugin": True, "rebootClient": reboot_client, "clientAndClientGroups": [ { "clientGroupName": client_group, "clientName": client } ], "installUpdatesJobType": { "installType": 4, "upgradeClients": False, "undoUpdates": False, "installUpdates": False } } } } } ] } } flag, response = self._cvpyssdk_object.make_request( 'POST', self._services['CREATE_TASK'], request_json ) if flag: if response.json(): if "jobIds" in response.json(): return Job(self.commcell_object, response.json()['jobIds'][0]) else: raise SDKException('Install', '107') else: raise SDKException('Response', '102') else: raise SDKException('Response', '101') ``` -------------------------------- ### Install Software Configuration Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html This snippet shows the internal configuration for software installation, including OS type, component IDs, and client details. It's part of the install_software method's internal logic. ```python db2_install = False ma_install = False if windows_features: os_type = 0 if WindowsDownloadFeatures.DB2_AGENT.value in windows_features: db2_install = True if WindowsDownloadFeatures.MEDIA_AGENT.value in windows_features: ma_install = True install_options = [{'osType': 'Windows', 'ComponentId': feature_id} for feature_id in windows_features] elif unix_features: os_type = 1 if UnixDownloadFeatures.DB2_AGENT.value in unix_features: db2_install = True if UnixDownloadFeatures.MEDIA_AGENT.value in unix_features: ma_install = True install_options = [{'osType': 'Unix', 'ComponentId': feature_id} for feature_id in unix_features] else: raise SDKException('Install', '105') if client_computers: commcell_name = self.commcell_object.commserv_name client_details = [] for client_name in client_computers: client_details.append( { "clientEntity": { "clientId": 0, "clientName": client_name, "commCellName": commcell_name } }) else: raise SDKException('Install', '106') if client_group_name: client_group_name = [x.lower() for x in client_group_name] if not set(client_group_name).issubset(self.commcell_object.client_groups.all_clientgroups): raise SDKException('Install', '103') selected_client_groups = [{'clientGroupName': client_group} for client_group in client_group_name] install_flags = kwargs.get('install_flags') db2_logs = kwargs.get('db2_logs_location', {}) index_cache_location = kwargs.get('index_cache_location', None) firewall_inputs = kwargs.get('firewall_inputs', {}) web_console_input = kwargs.get('webconsole_inputs', {}) request_json = { "taskInfo": { "associations": [ { "commCellId": 2 } ], "task": { "taskType": 1, "initiatedFrom": 1, "taskFlags": { "disabled": False } }, "subTasks": [ { "subTask": { "subTaskType": 1, "operationType": 4026 }, "options": { "adminOpts": { "clientInstallOption": { "reuseADCredentials": False, "installOSType": os_type, "discoveryType": 0, "installerOption": { "requestType": 0, "Operationtype": 0, "CommServeHostName": self.commcell_object.commserv_name, "RemoteClient": False, "installFlags": { ``` -------------------------------- ### Get Job Start Time Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/organization.html Returns the job start time for a company. Returns 'System default' if not set. ```python @property def job_start_time(self): """ Returns the job start time for a company or 'System default' if not set """ return self._job_start_time ``` -------------------------------- ### List Media with Options Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/backupset.html Lists media for a backupset using various options. Pass options as a dictionary or keyword arguments. Refer to `_default_browse_options` for supported options. ```python list_media({ 'path': 'c:\\hello', 'show_deleted': True, 'from_time': '2020-04-20 12:00:00', 'to_time': '2021-04-19 12:00:00' }) ``` ```python list_media( path='c:\\hello', show_deleted=True, from_time='2020-04-20 12:00:00', to_time='2021-04-19 12:00:00' ) ``` -------------------------------- ### Get Subclient GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/subclient.html Retrieves the globally unique identifier (GUID) for the subclient. Returns an empty string if not found. ```python return self._subclient_properties.get('subClientEntity', {}).get('subclientGUID') ``` -------------------------------- ### Constructing Install Task Request JSON Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html This snippet shows how to build the JSON payload for initiating a client software installation task. It includes options for client installation, update settings, and client/group targeting. Authentication details can be conditionally added. ```python request_json = { "taskInfo": { "task": { "taskType": 1, "initiatedFrom": 2, "policyType": 0, "taskFlags": { "disabled": False } }, "subTasks": [ { "subTaskOperation": 1, "subTask": { "subTaskType": 1, "operationType": 4020 }, "options": { "adminOpts": { "clientInstallOption": { "installerOption": { "clientComposition": [ { "packageDeliveryOption": 0 } ] } }, "updateOption": { "installUpdateOptions": 0, "restartExplorerPlugin": True, "rebootClient": reboot_client, "clientAndClientGroups": [ { "clientGroupName": client_group, "clientName": client } ], "installUpdatesJobType": { "installType": 4, "upgradeClients": False, "undoUpdates": False, "installUpdates": False } } } } } ] } } if username: request_json["taskInfo"]["subTasks"][0]["options"]["adminOpts"]["clientInstallOption"]["clientAuthForJob"] \ = { "password": password, "userName": username } ``` -------------------------------- ### Get Export Set GUID - CVPySDK Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/activateapps/compliance_utils.html Retrieves the GUID of the export set. This is a property accessor for the 'containerGuid' field. ```python @property def export_set_guid(self): """Method to return the export set Guid Returns: (str) export set Guid """ return self._export_set_properties['containerGuid'] ``` -------------------------------- ### Get Subclient GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/subclient.html Retrieves the SubclientGUID. ```APIDOC ## GET /Subclient/SubclientGUID ### Description Returns the SubclientGUID. ### Method GET ### Endpoint /Subclient/SubclientGUID ### Response #### Success Response (200) - **string** - The SubclientGUID. ``` -------------------------------- ### Browse Instance Content (Keyword Args) Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/instance.html Use this method to browse the content of an instance by passing browse options as keyword arguments. Ensure the instance has only one backupset. ```python browse( path='c:\\hello', show_deleted=True, from_time='2014-04-20 12:00:00', to_time='2016-04-21 12:00:00' ) ``` -------------------------------- ### Get Organization Provider GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/organization.html Retrieves the unique provider GUID for the organization. This identifier is crucial for external system integrations. ```python return self._organization_info.get('organization', {}).get('providerGUID') ``` -------------------------------- ### Create Cloud Instance Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/instance.html This snippet demonstrates how to create a new cloud instance. It includes checks for existing instances and valid storage policies (plans). ```python def add_instance(self, instance_name, instance_options): """Add a new instance to the Commcell. Args: instance_name (str): Name of the instance to be created. instance_options (dict): Dictionary with options for the instance. Example: { "plan_name": "", "cloudinstancetype": "", "cloudaccount_name": "" } Returns: object - instance of the Instance class Raises: SDKException: if instance with same name already exists if given plan name does not exists in commcell """ if self.has_instance(instance_name): raise SDKException( 'Instance', '102', 'Instance "{0}" already exists.'.format( instance_name) ) if not self._commcell_object.plans.has_plan( instance_options.get("plan_name")): raise SDKException( 'Instance', '102', 'Storage Policy: "{0}" does not exist in the Commcell'.format( instance_options.get("plan_name")) ) request_json = { "instanceProperties": { "cloudAppsInstance": { "instanceType": instance_options.get("cloudinstancetype", ""), "rdsInstance": { } }, "instance": { "applicationId": 134, "clientId": int(self._client_object.client_id), "clientName": instance_options.get("cloudaccount_name", ""), "instanceName": instance_name }, "planEntity": { "planName": instance_options.get("plan_name") } } } self._process_add_response(request_json) ``` -------------------------------- ### Client Installation Configuration Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Defines various flags and settings for client installation, including firewall rules, user credentials, and component configurations. This is used when setting up new clients or modifying existing ones. ```python { "allowMultipleInstances": kwargs.get('allowMultipleInstances', False), "restoreOnlyAgents": False, "killBrowserProcesses": True, "install32Base": install_flags.get('install32Base', False) if install_flags else False, "disableOSFirewall": False, "stopOracleServices": False, "skipClientsOfCS": False, "addToFirewallExclusion": True, "ignoreJobsRunning": False, "forceReboot": False, "overrideClientInfo": True, "preferredIPFamily": install_flags.get('preferredIPFamily', 1) if install_flags else 1, "firewallInstall": { "enableFirewallConfig": False, "firewallConnectionType": 0, "portNumber": 0 } }, "User": { "userName": "admin", "userId": 1 }, "clientComposition": [ { "activateClient": True, "overrideSoftwareCache": True if sw_cache_client else False, "softwareCacheOrSrmProxyClient": { "clientName": sw_cache_client if sw_cache_client else "" }, "packageDeliveryOption": 0, "components": { "commonInfo": { "globalFilters": 2, "storagePolicyToUse": { "storagePolicyName": storage_policy_name if storage_policy_name else "" } }, "fileSystem": { "configureForLaptopBackups": False }, "componentInfo": install_options, "webConsole": web_console_input }, "clientInfo": { "clientGroups": selected_client_groups if client_group_name else [], "client": { "evmgrcPort": 0, "cvdPort": 0, "installDirectory": install_path if install_path else "" }, "clientProps": { "logFilesLocation": log_file_loc if log_file_loc else "" } } } ] }, "clientDetails": client_details, "clientAuthForJob": { "password": password, "userName": username } }, "updateOption": { "rebootClient": True } } } } ] } } if db2_install and db2_logs: ``` -------------------------------- ### Get CommServ GUID Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/commcell.html Returns the globally unique identifier (GUID) of the CommServ. Loads CommServ details if not already loaded. ```python @property def commserv_guid(self): """Returns the GUID of the CommServ.""" if not self._commserv_details_loaded: self._get_commserv_details() return self._commserv_guid ``` -------------------------------- ### Get Active Start Time of Schedule Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/schedules.html Retrieves the start time of a schedule. Returns the time in HH:MM format. ```python @property def active_start_time(self): """ gets the start time of the schedule Returns: (str) -- time in %H/%S """ return SchedulePattern._time_converter( self._pattern['active_start_time'], '%H:%M', False) ``` -------------------------------- ### Browse Backupset Content Example Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/backupsets/vsbackupset.html This snippet demonstrates how to initiate a browse operation on a backupset to view its content. Ensure the 'path' parameter is correctly specified. ```python backupset_object.browse({ 'path': 'c:\\hello' }) ``` -------------------------------- ### Get Schedule Active Start Date Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/schedules.html Retrieves the active start date of a schedule. The date is returned in MM/DD/YYYY format. ```python @property def active_start_date(self): """ gets the start date of the schedule Returns: (str) -- date in %m/%d/%Y """ return SchedulePattern._time_converter( self._pattern['active_start_date'], '%m/%d/%Y', False) ``` -------------------------------- ### Example Priority Settings Output (Job Type) Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/job.html Illustrates the expected dictionary format for priority settings when querying by job type, such as 'Information Management'. ```python { "jobTypeName": "Information Management", "combinedPriority": 0, "type_of_operation": 1 } ``` -------------------------------- ### Install Software with Firewall Inputs (CS to Client) Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/deployment/install.html Configures firewall settings for when the CommServe can open a connection to the client. Requires enabling firewall configuration and setting connection type to 1. ```python firewall_inputs = { "enableFirewallConfig": True, "firewallConnectionType": 1, "proxyClientName": "", "proxyHostName": "", "portNumber": "port_number", "httpProxyConfigurationType": 0, "encryptedTunnel": False } commcell_obj.install_software(firewall_inputs=firewall_inputs) ``` -------------------------------- ### Get Schedule Active Start Time Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/schedules.html Retrieves the active start time of the schedule pattern. This method does not require any arguments. ```python schedule_obj.active_start_time ``` -------------------------------- ### Add Google Cloud Storage Instance Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/instance.html Example configuration for adding a Google Cloud storage instance. Requires instance name, storage plan, access node, and Google Cloud credentials. ```python cloud_options = { 'instance_name': 'google_test', 'description': 'instance for google', 'storage_plan':'cs_sp', 'number_of_streams': 2, 'access_node': 'CS', 'cloudapps_type': 'google_cloud' 'host_url':'storage.googleapis.com', 'access_key':'xxxxxx', 'secret_key':'yyyyyy' } ``` -------------------------------- ### Get Schedule Active Start Date Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/schedules.html Retrieves the active start date of the schedule pattern. This method does not require any arguments. ```python schedule_obj.active_start_date ``` -------------------------------- ### Project.__init__ Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/activateapps/sensitive_data_governance.html Initializes an instance of the Project class. ```APIDOC ## __init__ ### Description Initializes an instance of the Project class. ### Method ```python def __init__(self, commcell_object: object, project_name: str, project_id: int = None) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **commcell_object** (object) - Required - instance of the commcell class * **project_name** (str) - Required - name of the project * **project_id** (int) - Optional - project's pseudoclient id ### Response #### Success Response * **object** - instance of the Project class ``` -------------------------------- ### Get Commvault Job Start Timestamp Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/job.html Retrieves the job's start time as a Unix timestamp. This is a read-only attribute. ```python return self._summary['jobStartTime'] ``` -------------------------------- ### Get GUID of Tag Source: https://github.com/commvault/cvpysdk/blob/master/docs/cvpysdk/activateapps/entity_manager.html Retrieves the globally unique identifier (GUID) for a tag. This property returns the tag's ID. ```python @property def guid(self): """Returns the tag guid value""" return self._tag_props['id'] ```