-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from mfleader/jira
Jira Service Connection
- Loading branch information
Showing
8 changed files
with
238 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from fastapi import APIRouter, Query | ||
from app.services.jira_svc import JiraService | ||
|
||
router = APIRouter() | ||
|
||
@router.get( | ||
'/api/v1/jira', | ||
summary="Query Jira Issues", | ||
) | ||
async def query( | ||
q: str = Query(None, description="Jira query language string") | ||
): | ||
jira = JiraService() | ||
return jira.jql(q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from atlassian import Jira | ||
|
||
from app import config | ||
|
||
|
||
class JiraService: | ||
|
||
def __init__(self, configpath="jira"): | ||
self.cfg = config.get_config() | ||
self.url = self.cfg.get(configpath+'.url') | ||
self.pat = self.cfg.get(configpath+'.personal_access_token') | ||
self.svc = Jira( | ||
url=self.url, | ||
token=self.pat | ||
) | ||
|
||
def jql(self, query: str, fields="*all", expand=None, validate_query=None): | ||
return self.svc.jql( | ||
jql=query, | ||
fields=fields, | ||
expand=expand, | ||
validate_query=validate_query | ||
) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/usr/bin/bash | ||
|
||
uvicorn --reload --host="0.0.0.0" --port=8000 --forwarded-allow-ips='*' --proxy-headers app.main:app app.main:app | ||
uvicorn --reload --host="0.0.0.0" --port=8000 --forwarded-allow-ips='*' --proxy-headers app.main:app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ password= | |
[ocp-server] | ||
port=8000 | ||
|
||
[jira] | ||
url= | ||
personal_access_token= |