Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an endpoint for creating pipeline tokens #61

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

kjsanger
Copy link
Member

Add a POST endpoint to be used with the admin token to create tokens for a pipeline. There is no limit on the number of tokens that can be created for a particular pipeline.

Add a POST endpoint to be used with the admin token to create tokens
for a pipeline. There is no limit on the number of tokens that can be
created for a particular pipeline.
@kjsanger kjsanger added the enhancement New feature or request label Jun 14, 2024
@kjsanger kjsanger requested a review from nerdstrike June 14, 2024 10:54
@mgcam
Copy link
Member

mgcam commented Jun 14, 2024

Looks good to me

except NoResultFound:
raise HTTPException(status_code=404,
detail=f"Pipeline '{pipeline_name}' not found")
return Response(status_code=status.HTTP_201_CREATED, content=token, media_type="text/plain")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't care that much, but it's a bit naughty to return different content-types depending on whether the request was executed correctly. Content negotiation would be ideal, but fastapi isn't very good at this side of API compliance.

@nerdstrike nerdstrike merged commit c377852 into wtsi-npg:devel Jun 17, 2024
1 check passed
@kjsanger
Copy link
Member Author

Err.. okay - I was working on a fix. I'll open a new PR to address it. Your comment also made me consider whether having JSON Content-Type for everything apart from one call was a good idea.

@nerdstrike
Copy link
Contributor

Oops. Sorry!

@kjsanger
Copy link
Member Author

Although now if I return Token I'm faced with leaking internal database keys (Token.token_id), so I'll see if I can avoid that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants