def get_call(self, incident_id) -> str: """Returns the call link for the given incident""" incident: Incident = DynamoUtils.get_incident(self.team_id, incident_id) if incident is not None and incident.has_call(): return incident.call.get_link() return ""
def log_comment(self, incident_id: str, text: str) -> dict: """ Adds a comment to the ticket associated to the incident_id received in the arguments """ try: incident: Incident = DynamoUtils.get_incident( self.team_id, incident_id) if incident is None: return { "status": "failure", "failure_description": "Not ongoing incident in this channel, " "please run this command in an incident channel", } if incident.has_ticket(): issue_id = incident.ticket.get_link().split("browse/")[1] response = self.ticket_service.add_comment(issue_id, text) if (response.get("success") is not None and response.get("success") is True): return {"status": "ok"} else: return { "status": "failure", "failure_description": response.get("descriptive_error"), } else: return { "status": "failure", "failure_description": "No ticket associated to this incident", } except Exception as e: logger.error( f"could not log comment for team {self.team_id} - {e}") return { "status": "failure", "failure_description": "Could not log comment" }