Beispiel #1
0
    def create_teams(self, container: str, url: str) -> models.Notification:
        """ Create a Teams notification integration """

        self.logger.debug("create teams notification integration: %s", container)

        config = models.NotificationConfig(config=models.TeamsTemplate(url=url))
        return self.create(container, config)
Beispiel #2
0
    def create_ado(
        self,
        container: str,
        project: str,
        base_url: str,
        auth_token: str,
        work_item_type: str,
        unique_fields: List[str],
        comment: Optional[str] = None,
        fields: Optional[Dict[str, str]] = None,
        on_dup_increment: Optional[List[str]] = None,
        on_dup_comment: Optional[str] = None,
        on_dup_set_state: Optional[Dict[str, str]] = None,
        on_dup_fields: Optional[Dict[str, str]] = None,
    ) -> models.Notification:
        """ Create an Azure DevOps notification integration """

        self.logger.debug("create ado notification integration: %s", container)

        entry = models.NotificationConfig(config=models.ADOTemplate(
            base_url=base_url,
            auth_token=auth_token,
            project=project,
            type=work_item_type,
            comment=comment,
            unique_fields=unique_fields,
            ado_fields=fields,
            on_duplicate=models.ADODuplicateTemplate(
                increment=on_dup_increment or [],
                comment=on_dup_comment,
                ado_fields=on_dup_fields or {},
                set_state=on_dup_set_state or {},
            ),
        ), )
        return self.create(container, entry)