h_e' d dl Z d dlmZ d dlmZmZ d dlmZ d dlmZm Z d dl mc mc m Z d dlmZ d dlmZmZmZ d dlmZ d d lmZ ee Zd ZdZ G d d e ZdS ) N) getLogger)datetime timedelta)ValidationError) RootEndpointsbind)send_request)get_ssh_portcheck_ssh_connectioninstall_pub_key)AnalystCleanupRequest)AnalystCleanupAPIzhttps://cloudlinux.zendesk.com/hc/en-us/articles/6245743410460-How-to-authenticate-your-server-for-Support-Team-and-use-the-SSH-access-formz9https://cloudlinux.zendesk.com/auth/v2/login/registrationc e Zd ZdeeffdZ edd d Z edd d d Z edd d ZdS )AnalystCleanupEndpointsreturnc h K t ||| d{V }t d| |r|| d d fS t d # t $ rA}t d| t dt | d}~ww xY w)z Creates a Zendesk ticket and return link and id of the ticket On any error raises ValidationError, which would be added to RPC answer NzCreated ticket on url /zFailed to create support ticketz#Failed to process cleanup request: )r loggerinfosplitr Exceptionerrorstr)selfemailsubjectfull_description ticket_urles _/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/simple_rpc/analyst_cleanup.py_create_zendesk_ticketz.AnalystCleanupEndpoints._create_zendesk_ticket s + J KK===>>> I!:#3#3C#8#8#<<<%&GHHH LLBqBBCCC!>c!ff>> s AA&