-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Secrets #69
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
base: master
Are you sure you want to change the base?
feat: Secrets #69
Conversation
yuechao-qin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions/comments. Great work getting secrets working quickly!
| current_time = _get_current_time() | ||
| secret = session.get(bts.Secret, (user_id, secret_id)) | ||
| if secret: | ||
| if not raise_if_exists: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if not raise_if_exists: | |
| if raise_if_exists: |
I believe you don't want the not here?
| # This hash is not used, so we're using a dummy value here that makes it possible to identify the secret arguments in the following code. | ||
| hash=secret_hash, | ||
| ) | ||
| session.rollback() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why is there a rollback here? I didn't notice any session changes.
| secret_id=secret_id, | ||
| secret_value=secret_value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious is there any validation needed for secret id/value? For example, what if they were empty strings?
| session: orm.Session, | ||
| user_id: str, | ||
| secret_id: str, | ||
| ): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ): | |
| ) -> None: |
| secret_value: str, | ||
| raise_if_not_exists: bool = False, | ||
| raise_if_exists: bool = False, | ||
| ): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ): | |
| ) -> None: |
| ): | ||
| return self._set_secret_value( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ): | |
| return self._set_secret_value( | |
| ) -> None: | |
| self._set_secret_value( |
_set_secret_value doesn't return anything, so a return is not necessary here?
| ): | ||
| return self._set_secret_value( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ): | |
| return self._set_secret_value( | |
| ) -> None: | |
| self._set_secret_value( |
API changes
List secrets: GET
/api/secrets/.Create a secret: POST
/api/secrets/.Update a secret: PUT
/api/secrets/{secret_id}.Delete a secret: DELETE
/api/secrets/{secret_id}.DB changes
TaskSpec changes
Fixes: #51