示例#1
0
    def download_trail_log(
        self,
        connection_id: str,
        channel_id: str,
        session_id: str,
        format_param: Optional[str] = None,
        filter_param: Optional[str] = None,
    ) -> PrivXStreamResponse:
        """
        Download trail log of audited connection channel.

        use object.iter_content() for consuming the chunked response

        Returns:
            StreamResponse
        """
        search_params = self._get_search_params(format=format_param,
                                                filter=filter_param)
        response_obj = self._http_stream(
            UrlEnum.CONNECTION_MANAGER.TRAIL_LOG_SESSION_ID,
            path_params={
                "connection_id": connection_id,
                "channel_id": channel_id,
                "session_id": session_id,
            },
            query_params=search_params,
        )
        return PrivXStreamResponse(response_obj, HTTPStatus.OK)
示例#2
0
    def download_trail(
        self,
        connection_id: str,
        channel_id: str,
        file_id: str,
        session_id: str,
    ) -> PrivXStreamResponse:
        """
        Download trail stored file transferred within audited connection channel.

        use object.iter_content() for consuming the chunked response

        Returns:
            StreamResponse
        """
        response_obj = self._http_stream(
            UrlEnum.CONNECTION_MANAGER.TRAIL,
            path_params={
                "connection_id": connection_id,
                "channel_id": channel_id,
                "file_id": file_id,
                "session_id": session_id,
            },
        )
        return PrivXStreamResponse(response_obj, HTTPStatus.OK)
示例#3
0
    def download_authorizer_cert(self, cert_id: str) -> PrivXStreamResponse:
        """
        Gets authorizer's root certificate.

        Returns:
            PrivXStreamResponse
        """
        response = self._http_stream(UrlEnum.AUTHORIZER.AUTHORIZER_CERT_ID,
                                     path_params={"id": cert_id})
        return PrivXStreamResponse(response, HTTPStatus.OK)
示例#4
0
    def download_principal_command_script(self) -> PrivXStreamResponse:
        """
        Gets the principals_command.sh script.

        Returns:
            PrivXStreamResponse
        """
        response = self._http_stream(
            UrlEnum.AUTHORIZER.DOWNLOAD_COMMAND_SCRIPT, )
        return PrivXStreamResponse(response, HTTPStatus.OK)
示例#5
0
    def download_cert_revocation_list(self,
                                      cert_id: str) -> PrivXStreamResponse:
        """
        Gets authorizer CA's certificate revocation list.

        Returns:
            PrivXStreamResponse
        """
        response = self._http_stream(UrlEnum.AUTHORIZER.CERT_REVOCATION_LIST,
                                     path_params={"id": cert_id})
        return PrivXStreamResponse(response, HTTPStatus.OK)
示例#6
0
    def download_component_cert(self, ca_type: str,
                                cert_id: str) -> PrivXStreamResponse:
        """
        Gets authorizer's CA certificate.
        ca_type should be `extender` or `icap`.

        Returns:
            PrivXStreamResponse
        """
        response = self._http_stream(
            UrlEnum.AUTHORIZER.COMPONENT_CERT,
            path_params={
                "id": cert_id,
                "ca_type": ca_type
            },
        )
        return PrivXStreamResponse(response, HTTPStatus.OK)
示例#7
0
    def download_web_proxy_config(
        self,
        trusted_client_id: str,
        session_id: str,
    ) -> PrivXStreamResponse:
        """
        Gets a web-proxy-config.toml pre-configured for this PrivX installation.

        Returns:
            PrivXStreamResponse
        """
        response = self._http_stream(
            UrlEnum.AUTHORIZER.DOWNLOAD_CARRIER_CONFIG,
            path_params={
                "trusted_client_id": trusted_client_id,
                "session_id": session_id,
            },
        )
        return PrivXStreamResponse(response, HTTPStatus.OK)
示例#8
0
    def download_deployment_script(
        self,
        trusted_client_id: str,
        session_id: str,
    ) -> PrivXStreamResponse:
        """
        Gets a deployment script pre-configured for this PrivX installation.

        Returns:
            PrivXStreamResponse
        """
        response = self._http_stream(
            UrlEnum.AUTHORIZER.DOWNLOAD_DEPLOYMENT_SCRIPT,
            path_params={
                "trusted_client_id": trusted_client_id,
                "session_id": session_id,
            },
        )
        return PrivXStreamResponse(response, HTTPStatus.OK)