def create_notification_rule(self,
                                 body=None):
        """Does a POST request to /public/alertNotificationRules.

        Creates a new notification rule with provided delivery targets such as
        email
        addresses and external apis.

        Args:
            body (NotificationRule, optional): Create Notification Rule
                argument.

        Returns:
            NotificationRule: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('create_notification_rule called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for create_notification_rule.')
            _url_path = '/public/alertNotificationRules'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for create_notification_rule.')
            _headers = {
                'accept': 'application/json',
                'content-type': 'application/json; charset=utf-8'
            }

            # Prepare and execute request
            self.logger.info('Preparing and executing request for create_notification_rule.')
            _request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name = 'create_notification_rule')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for create_notification_rule.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body, NotificationRule.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info = True)
            raise
    def delete_users(self, body=None):
        """Does a DELETE request to /public/users.

        Only users from the same domain can be deleted by a single request.
        If the Cohesity user was created for an Active Directory user, the
        referenced
        principal user on the Active Directory domain is NOT deleted.
        Only the user on the Cohesity Cluster is deleted.
        Returns Success if the specified users are deleted.

        Args:
            body (UserDeleteParameters, optional): Request to delete one or
                more users on the Cohesity Cluster.

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('delete_users called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for delete_users.')
            _url_path = '/public/users'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for delete_users.')
            _headers = {'content-type': 'application/json; charset=utf-8'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for delete_users.')
            _request = self.http_client.delete(
                _query_url,
                headers=_headers,
                parameters=APIHelper.json_serialize(body))
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name='delete_users')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for delete_users.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def get_active_directory_domain_controllers(self):
        """Does a GET request to /public/activeDirectory/domainControllers.

        List the domain controllers for a domain.

        Returns:
            DomainControllers: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_active_directory_domain_controllers called.')

            # Prepare query URL
            self.logger.info(
                'Preparing query URL for get_active_directory_domain_controllers.'
            )
            _url_path = '/public/activeDirectory/domainControllers'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info(
                'Preparing headers for get_active_directory_domain_controllers.'
            )
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for get_active_directory_domain_controllers.'
            )
            _request = self.http_client.get(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(
                _request, name='get_active_directory_domain_controllers')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info(
                'Validating response for get_active_directory_domain_controllers.'
            )
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(
                _context.response.raw_body, DomainControllers.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
Esempio n. 4
0
    def delete_uninstall_app(self, app_uid, version):
        """Does a DELETE request to /public/apps/{appUid}/versions/{version}.

        App must already been installed for this api to work.

        Args:
            app_uid (long|int): Specifies the app Id.
            version (long|int): Specifies the app version.

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('delete_uninstall_app called.')

            # Validate required parameters
            self.logger.info(
                'Validating required parameters for delete_uninstall_app.')
            self.validate_parameters(app_uid=app_uid, version=version)

            # Prepare query URL
            self.logger.info('Preparing query URL for delete_uninstall_app.')
            _url_path = '/public/apps/{appUid}/versions/{version}'
            _url_path = APIHelper.append_url_with_template_parameters(
                _url_path, {
                    'appUid': app_uid,
                    'version': version
                })
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for delete_uninstall_app.')
            _request = self.http_client.delete(_query_url)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='delete_uninstall_app')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for delete_uninstall_app.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
Esempio n. 5
0
    def update_user_preferences(self,
                                body=None):
        """Does a PUT request to /public/sessionUser/preferences.

        Returns the updated user preferences.

        Args:
            body (list of UserPreferencesProtoUserPreferencesPreference,
                optional): Request to create or update User Preferences

        Returns:
            list of UserPreferencesProtoUserPreferencesPreference: Response
                from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('update_user_preferences called.')
    
            # Prepare query URL
            self.logger.info('Preparing query URL for update_user_preferences.')
            _url_path = '/public/sessionUser/preferences'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)
    
            # Prepare headers
            self.logger.info('Preparing headers for update_user_preferences.')
            _headers = {
                'accept': 'application/json',
                'content-type': 'application/json; charset=utf-8'
            }
    
            # Prepare and execute request
            self.logger.info('Preparing and executing request for update_user_preferences.')
            _request = self.http_client.put(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name = 'update_user_preferences')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for update_user_preferences.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)
    
            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body, UserPreferencesProtoUserPreferencesPreference.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info = True)
    def delete_protection_policy(self, id):
        """Does a DELETE request to /public/protectionPolicies/{id}.

        Returns Success if the Protection Policy is deleted.

        Args:
            id (string): Specifies a unique id of the Protection Policy to
                return.

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('delete_protection_policy called.')

            # Validate required parameters
            self.logger.info(
                'Validating required parameters for delete_protection_policy.')
            self.validate_parameters(id=id)

            # Prepare query URL
            self.logger.info(
                'Preparing query URL for delete_protection_policy.')
            _url_path = '/public/protectionPolicies/{id}'
            _url_path = APIHelper.append_url_with_template_parameters(
                _url_path, {'id': id})
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for delete_protection_policy.'
            )
            _request = self.http_client.delete(_query_url)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='delete_protection_policy')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info(
                'Validating response for delete_protection_policy.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
Esempio n. 7
0
    def get_basic_cluster_info(self):
        """Does a GET request to /public/basicClusterInfo.

        All Active Directory domains that are currently joined to the
        Cohesity
        Cluster are returned. In addition, the default LOCAL domain on the
        Cohesity Cluster is returned as the first element of the domains array
        in
        the response.

        Returns:
            BasicCohesityClusterInformation: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_basic_cluster_info called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for get_basic_cluster_info.')
            _url_path = '/public/basicClusterInfo'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for get_basic_cluster_info.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for get_basic_cluster_info.')
            _request = self.http_client.get(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='get_basic_cluster_info')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for get_basic_cluster_info.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(
                _context.response.raw_body,
                BasicCohesityClusterInformation.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def create_export_config(self,
                             body):
        """Does a POST request to /public/export/config.

        Export metadata into Json files

        Args:
            body (ExportParameters): Request to open an exported config file
                to prepare for importing.

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('create_export_config called.')

            # Validate required parameters
            self.logger.info('Validating required parameters for create_export_config.')
            self.validate_parameters(body=body)

            # Prepare query URL
            self.logger.info('Preparing query URL for create_export_config.')
            _url_path = '/public/export/config'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for create_export_config.')
            _headers = {
                'content-type': 'application/json; charset=utf-8'
            }

            # Prepare and execute request
            self.logger.info('Preparing and executing request for create_export_config.')
            _request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name = 'create_export_config')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for create_export_config.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info = True)
            raise
Esempio n. 9
0
    def list_remote_vault_restore_tasks(self):
        """Does a GET request to /public/remoteVaults/restoreTasks.

        A remote Vault restore task can restore archived data from a Vault
        (External Target) to this local Cluster.
        This is part of the CloudRetrieve functionality for finding and
        restoring
        archived data from remote Vaults to an alternative (non-original)
        Cluster.

        Returns:
            list of RemoteVaultRestoreTaskStatus: Response from the API.
                Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('list_remote_vault_restore_tasks called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for list_remote_vault_restore_tasks.')
            _url_path = '/public/remoteVaults/restoreTasks'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for list_remote_vault_restore_tasks.')
            _headers = {
                'accept': 'application/json'
            }

            # Prepare and execute request
            self.logger.info('Preparing and executing request for list_remote_vault_restore_tasks.')
            _request = self.http_client.get(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name = 'list_remote_vault_restore_tasks')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for list_remote_vault_restore_tasks.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body, RemoteVaultRestoreTaskStatus.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info = True)
            raise
Esempio n. 10
0
    def create_interface_group(self,
                               body=None):
        """Does a POST request to /public/interfaceGroups.

        Returns the create status upon completion.

        Args:
            body (InterfaceGroup, optional): TODO: type description here.
                Example:

        Returns:
            InterfaceGroup: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('create_interface_group called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for create_interface_group.')
            _url_path = '/public/interfaceGroups'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for create_interface_group.')
            _headers = {
                'accept': 'application/json',
                'content-type': 'application/json; charset=utf-8'
            }

            # Prepare and execute request
            self.logger.info('Preparing and executing request for create_interface_group.')
            _request = self.http_client.post(_query_url, headers=_headers, parameters=APIHelper.json_serialize(body))
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name = 'create_interface_group')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for create_interface_group.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body, InterfaceGroup.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info = True)
            raise
    def delete_tenant(self,
                      tenant_id=None):
        """Does a DELETE request to /public/tenants.

        Returns success if the specified tenant is deleted.

        Args:
            tenant_id (string, optional): TODO: type description here.
                Example:

        Returns:
            list of Tenant: Response from the API. Get Tenants Response.

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('delete_tenant called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for delete_tenant.')
            _url_path = '/public/tenants'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for delete_tenant.')
            _headers = {
                'accept': 'application/json',
                'content-type': 'text/plain; charset=utf-8'
            }

            # Prepare and execute request
            self.logger.info('Preparing and executing request for delete_tenant.')
            _request = self.http_client.delete(_query_url, headers=_headers, parameters=tenant_id)
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name = 'delete_tenant')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for delete_tenant.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body, Tenant.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info = True)
            raise
    def delete_unprotect_object(self, body=None):
        """Does a DELETE request to /public/protectionObjects.

        Unprotect a Protected Object.

        Args:
            body (UnprotectObjectParams, optional): TODO: type description
                here. Example:

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('delete_unprotect_object called.')

            # Prepare query URL
            self.logger.info(
                'Preparing query URL for delete_unprotect_object.')
            _url_path = '/public/protectionObjects'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for delete_unprotect_object.')
            _headers = {'content-type': 'application/json; charset=utf-8'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for delete_unprotect_object.')
            _request = self.http_client.delete(
                _query_url,
                headers=_headers,
                parameters=APIHelper.json_serialize(body))
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='delete_unprotect_object')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info(
                'Validating response for delete_unprotect_object.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def delete_notification_rule(self, rule_id):
        """Does a DELETE request to /public/alertNotificationRules/{ruleId}.

        Deletes an existing alert notification rule matching the rule id.

        Args:
            rule_id (long|int): Specifies the rule id.

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('delete_notification_rule called.')

            # Validate required parameters
            self.logger.info(
                'Validating required parameters for delete_notification_rule.')
            self.validate_parameters(rule_id=rule_id)

            # Prepare query URL
            self.logger.info(
                'Preparing query URL for delete_notification_rule.')
            _url_path = '/public/alertNotificationRules/{ruleId}'
            _url_path = APIHelper.append_url_with_template_parameters(
                _url_path, {'ruleId': rule_id})
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for delete_notification_rule.'
            )
            _request = self.http_client.delete(_query_url)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='delete_notification_rule')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info(
                'Validating response for delete_notification_rule.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def get_ldap_provider_status(self, id):
        """Does a GET request to /public/ldapProvider/{id}/status.

        Get the connection status of an LDAP provider.

        Args:
            id (long|int): Specifies the LDAP Id.

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_ldap_provider_status called.')

            # Validate required parameters
            self.logger.info(
                'Validating required parameters for get_ldap_provider_status.')
            self.validate_parameters(id=id)

            # Prepare query URL
            self.logger.info(
                'Preparing query URL for get_ldap_provider_status.')
            _url_path = '/public/ldapProvider/{id}/status'
            _url_path = APIHelper.append_url_with_template_parameters(
                _url_path, {'id': id})
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for get_ldap_provider_status.'
            )
            _request = self.http_client.get(_query_url)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='get_ldap_provider_status')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info(
                'Validating response for get_ldap_provider_status.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
Esempio n. 15
0
    def upload_package(self):
        """Does a POST request to /public/packages/file.

        Sends a request to upload a package to a Cluster. This can be used to
        upload
        a package which is on your local machine. The user must send the
        package as
        a multipart request.

        Returns:
            UploadPackageResult: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('upload_package called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for upload_package.')
            _url_path = '/public/packages/file'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for upload_package.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for upload_package.')
            _request = self.http_client.post(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name='upload_package')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for upload_package.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(
                _context.response.raw_body,
                UploadPackageResult.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def get_tenants_proxy_config_request(self):
        """Does a GET request to /public/tenants/proxy/config.

        Returns the config for tenants proxy.

        Returns:
            list of int: Response from the API. Get Tenants Proxy Config
                Response.

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_tenants_proxy_config_request called.')

            # Prepare query URL
            self.logger.info(
                'Preparing query URL for get_tenants_proxy_config_request.')
            _url_path = '/public/tenants/proxy/config'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info(
                'Preparing headers for get_tenants_proxy_config_request.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for get_tenants_proxy_config_request.'
            )
            _request = self.http_client.get(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(
                _request, name='get_tenants_proxy_config_request')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info(
                'Validating response for get_tenants_proxy_config_request.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
Esempio n. 17
0
    def get_notification_rules(self):
        """Does a GET request to /public/alertNotificationRules.

        Gets all alert notification rules containing criteria to deliver
        notification
        to delivery targets such as email addresses, invoking external apis
        etc.

        Returns:
            list of NotificationRule: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_notification_rules called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for get_notification_rules.')
            _url_path = '/public/alertNotificationRules'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for get_notification_rules.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for get_notification_rules.')
            _request = self.http_client.get(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='get_notification_rules')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for get_notification_rules.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body,
                                              NotificationRule.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def get_alert_types(self):
        """Does a GET request to /public/alertTypes.

        Returns registered alerts in the Cohesity cluster that match the
        filter
        criteria specified using parameters. If no filter parameters are
        specified,
        all registered alerts in the Cohesity cluster are returned.

        Returns:
            list of AlertMetadata: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_alert_types called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for get_alert_types.')
            _url_path = '/public/alertTypes'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for get_alert_types.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for get_alert_types.')
            _request = self.http_client.get(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name='get_alert_types')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for get_alert_types.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body,
                                              AlertMetadata.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
Esempio n. 19
0
    def get_apps(self):
        """Does a GET request to /public/apps.

        Api provides the list of the apps which are available for the user to
        install
        or are already installed. App object provides basic app information
        along with
        app metadata.

        Returns:
            list of AppInformation: Response from the API. GetAppsResponse
                specifies response for getting apps

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_apps called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for get_apps.')
            _url_path = '/public/apps'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for get_apps.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info('Preparing and executing request for get_apps.')
            _request = self.http_client.get(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name='get_apps')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for get_apps.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body,
                                              AppInformation.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def remove_static_route(self, ip):
        """Does a DELETE request to /public/staticRoutes/{ip}.

        Returns the delete status upon completion.

        Args:
            ip (string): Specifies the subnet IP of the route destination
                network.

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('remove_static_route called.')

            # Validate required parameters
            self.logger.info(
                'Validating required parameters for remove_static_route.')
            self.validate_parameters(ip=ip)

            # Prepare query URL
            self.logger.info('Preparing query URL for remove_static_route.')
            _url_path = '/public/staticRoutes/{ip}'
            _url_path = APIHelper.append_url_with_template_parameters(
                _url_path, {'ip': ip})
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for remove_static_route.')
            _request = self.http_client.delete(_query_url)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='remove_static_route')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for remove_static_route.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def update_tenant_groups(self):
        """Does a PUT request to /public/tenants/groups.

        Returns success if the update for groups is successful for specified
        tenant.

        Returns:
            list of GroupDetails: Response from the API. Tenant Group Mapping
                Response.

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('update_tenant_groups called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for update_tenant_groups.')
            _url_path = '/public/tenants/groups'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for update_tenant_groups.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for update_tenant_groups.')
            _request = self.http_client.put(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='update_tenant_groups')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for update_tenant_groups.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body,
                                              GroupDetails.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def delete_interface_group(self, name):
        """Does a DELETE request to /public/interfaceGroups/{name}.

        Returns the delete status upon completion.

        Args:
            name (string): Request to delete one interface group.

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('delete_interface_group called.')

            # Validate required parameters
            self.logger.info(
                'Validating required parameters for delete_interface_group.')
            self.validate_parameters(name=name)

            # Prepare query URL
            self.logger.info('Preparing query URL for delete_interface_group.')
            _url_path = '/public/interfaceGroups/{name}'
            _url_path = APIHelper.append_url_with_template_parameters(
                _url_path, {'name': name})
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for delete_interface_group.')
            _request = self.http_client.delete(_query_url)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='delete_interface_group')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for delete_interface_group.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
Esempio n. 23
0
    def get_idp_login(self,
                      tenant_id=None):
        """Does a GET request to /public/idps/login.

        Redirects the client to the IdP site with the URI to login.

        Args:
            tenant_id (string, optional): Specifies an optional tenantId for
                which the SSO login should be done. If this is not specified,
                Cluster SSO login is done.

        Returns:
            void: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_idp_login called.')
    
            # Prepare query URL
            self.logger.info('Preparing query URL for get_idp_login.')
            _url_path = '/public/idps/login'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_parameters = {
                'tenantId': tenant_id
            }
            _query_builder = APIHelper.append_url_with_query_parameters(_query_builder,
                _query_parameters, Configuration.array_serialization)
            _query_url = APIHelper.clean_url(_query_builder)
    
            # Prepare and execute request
            self.logger.info('Preparing and executing request for get_idp_login.')
            _request = self.http_client.get(_query_url)
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name = 'get_idp_login')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for get_idp_login.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info = True)
Esempio n. 24
0
    def create_vlan(self):
        """Does a POST request to /public/vlans.

        Returns the created VLAN on the Cohesity Cluster.

        Returns:
            VLAN: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('create_vlan called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for create_vlan.')
            _url_path = '/public/vlans'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for create_vlan.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for create_vlan.')
            _request = self.http_client.post(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(_request, name='create_vlan')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for create_vlan.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body,
                                              VLAN.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def get_user_preferences(self):
        """Does a GET request to /public/sessionUser/preferences.

        List the preferences of the session user.

        Returns:
            dict<object, string>: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_user_preferences called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for get_user_preferences.')
            _url_path = '/public/sessionUser/preferences'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for get_user_preferences.')
            _request = self.http_client.get(_query_url)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='get_user_preferences')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for get_user_preferences.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return _context.response.raw_body

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
Esempio n. 26
0
    def delete_web_server_certificate(self):
        """Does a DELETE request to /public/certificates/webServer.

        Returns delete status upon completion.

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('delete_web_server_certificate called.')

            # Prepare query URL
            self.logger.info(
                'Preparing query URL for delete_web_server_certificate.')
            _url_path = '/public/certificates/webServer'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for delete_web_server_certificate.'
            )
            _request = self.http_client.delete(_query_url)
            AuthManager.apply(_request)
            _context = self.execute_request(
                _request, name='delete_web_server_certificate')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info(
                'Validating response for delete_web_server_certificate.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def update_notifications(self):
        """Does a PATCH request to /public/sessionUser/notifications.

        Returns success or failure.

        Returns:
            void: Response from the API. No Content

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('update_notifications called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for update_notifications.')
            _url_path = '/public/sessionUser/notifications'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for update_notifications.')
            _request = self.http_client.patch(_query_url)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='update_notifications')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for update_notifications.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def get_cluster_partition_by_id(self, id):
        """Does a GET request to /public/clusterPartitions/{id}.

        Returns the Cluster Partition corresponding to the specified Cluster
        Partition Id.

        Args:
            id (long|int): Specifies a unique id of the Cluster Partition to
                return.

        Returns:
            ClusterPartition: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_cluster_partition_by_id called.')

            # Validate required parameters
            self.logger.info(
                'Validating required parameters for get_cluster_partition_by_id.'
            )
            self.validate_parameters(id=id)

            # Prepare query URL
            self.logger.info(
                'Preparing query URL for get_cluster_partition_by_id.')
            _url_path = '/public/clusterPartitions/{id}'
            _url_path = APIHelper.append_url_with_template_parameters(
                _url_path, {'id': id})
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info(
                'Preparing headers for get_cluster_partition_by_id.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for get_cluster_partition_by_id.'
            )
            _request = self.http_client.get(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='get_cluster_partition_by_id')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info(
                'Validating response for get_cluster_partition_by_id.')
            if _context.response.status_code == 404:
                raise APIException('Not Found', _context)
            elif (_context.response.status_code <
                  200) or (_context.response.status_code > 208):
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body,
                                              ClusterPartition.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def get_cluster_partitions(self, ids=None, names=None):
        """Does a GET request to /public/clusterPartitions.

        If no parameters are specified, all Cluster Partitions currently on
        the Cohesity Cluster are returned.
        Specifying parameters filters the results that are returned.

        Args:
            ids (list of long|int, optional): Array of Cluster Partition Ids.
                Filter by a list of Cluster Partition ids. If empty, the
                Cluster Partitions are not filtered by id.
            names (list of string, optional): Array of Cluster Partition
                Names.  Filter by a list of Cluster Partition Names. If empty,
                the Cluster Partitions are not filtered by names.

        Returns:
            list of ClusterPartition: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_cluster_partitions called.')

            # Prepare query URL
            self.logger.info('Preparing query URL for get_cluster_partitions.')
            _url_path = '/public/clusterPartitions'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_parameters = {'ids': ids, 'names': names}
            _query_builder = APIHelper.append_url_with_query_parameters(
                _query_builder, _query_parameters,
                Configuration.array_serialization)
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info('Preparing headers for get_cluster_partitions.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for get_cluster_partitions.')
            _request = self.http_client.get(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(_request,
                                            name='get_cluster_partitions')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info('Validating response for get_cluster_partitions.')
            if _context.response.status_code == 0:
                raise ErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(_context.response.raw_body,
                                              ClusterPartition.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise
    def get_protection_policy_summary(self,
                                      id,
                                      include_aggregated_last_run_summary=None,
                                      include_aggregated_runs_summary=None,
                                      start_time_usecs=None,
                                      end_time_usecs=None,
                                      page_count=None,
                                      pagination_cookie=None):
        """Does a GET request to /public/protectionPolicySummary.

        List Protection Policy Summary.

        Args:
            id (string): Specifies the id of the policy whose summary should
                be retrieved. If this is not set, the API will return error.
            include_aggregated_last_run_summary (bool, optional): Specifies
                whether to include summary of the last Protection Run of each
                Protection Source.
            include_aggregated_runs_summary (bool, optional): Specifies
                whether to include summary of all Protection Runs of the
                Protection Source or Protection Jobs. If this is set to true,
                then only the Protection Runs from the provided
                'startTimeUsecs' and 'endTimeUsecs' are processed.
            start_time_usecs (long|int, optional): Filter by a start time
                specified as a Unix epoch Timestamp (in microseconds). Only
                Job Runs that started after the specified time are included in
                the aggregated runs summary result.
            end_time_usecs (long|int, optional): Filter by a end time
                specified as a Unix epoch Timestamp (in microseconds). Only
                Job Runs that completed before the specified end time are
                included int he aggregated runs summary result.
            page_count (long|int, optional): Specifies the limit of the number
                of Protection Sources or Protection Jobs to be returned as a
                part of the Protection Policy Summary.
            pagination_cookie (string, optional): If set, i.e. there are more
                results to display, use this value to get the next set of
                results, by using this value in paginationCookie param for the
                next request to GetProtectionPolicySummary.

        Returns:
            ProtectionPolicySummary: Response from the API. Success

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        try:
            self.logger.info('get_protection_policy_summary called.')

            # Validate required parameters
            self.logger.info(
                'Validating required parameters for get_protection_policy_summary.'
            )
            self.validate_parameters(id=id)

            # Prepare query URL
            self.logger.info(
                'Preparing query URL for get_protection_policy_summary.')
            _url_path = '/public/protectionPolicySummary'
            _query_builder = Configuration.get_base_uri()
            _query_builder += _url_path
            _query_parameters = {
                'id': id,
                'includeAggregatedLastRunSummary':
                include_aggregated_last_run_summary,
                'includeAggregatedRunsSummary':
                include_aggregated_runs_summary,
                'startTimeUsecs': start_time_usecs,
                'endTimeUsecs': end_time_usecs,
                'pageCount': page_count,
                'paginationCookie': pagination_cookie
            }
            _query_builder = APIHelper.append_url_with_query_parameters(
                _query_builder, _query_parameters,
                Configuration.array_serialization)
            _query_url = APIHelper.clean_url(_query_builder)

            # Prepare headers
            self.logger.info(
                'Preparing headers for get_protection_policy_summary.')
            _headers = {'accept': 'application/json'}

            # Prepare and execute request
            self.logger.info(
                'Preparing and executing request for get_protection_policy_summary.'
            )
            _request = self.http_client.get(_query_url, headers=_headers)
            AuthManager.apply(_request)
            _context = self.execute_request(
                _request, name='get_protection_policy_summary')

            # Endpoint and global error handling using HTTP status codes.
            self.logger.info(
                'Validating response for get_protection_policy_summary.')
            if _context.response.status_code == 0:
                raise RequestErrorErrorException('Error', _context)
            self.validate_response(_context)

            # Return appropriate type
            return APIHelper.json_deserialize(
                _context.response.raw_body,
                ProtectionPolicySummary.from_dictionary)

        except Exception as e:
            self.logger.error(e, exc_info=True)
            raise