-
Notifications
You must be signed in to change notification settings - Fork 253
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 resource URL handler #9047
Add resource URL handler #9047
Conversation
@@ -726,147 +738,210 @@ async def get_url_for_resource( | |||
region = await get_region_for_arn(arn) |
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.
Nice stuff!
I think we need to handle the situation where account_id
is None
here. This function was generally only used for known resources previously. But if we pass in an S3 bucket ARN for an unknown resource, I'd expect this to be None.
We should try to adhere to the relatively new WebResponse model (This is in consoleme.models) and return a 404 with a description. Weep may need to be updated to show the error form the backend
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.
Ah good call, updated the PR to reflect the changes!
return resource_name.split("/")[0] | ||
return "" | ||
|
||
|
||
async def get_url_for_resource( |
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.
It'd be cool to use this functionality within ConsoleMe as well! Future feature?
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.
Ooooh I like this idea a lot; that would be super cool!
@jaydhulia Can you please add this new endpoint to the Swagger spec? |
@patricksanders Added the endpoint to the Swagger spec! |
consoleme/handlers/v2/resources.py
Outdated
class GetResourceURLHandler(BaseMtlsHandler): | ||
"""consoleme CLI resource URL handler. Parameters accepted: arn.""" | ||
|
||
def check_xsrf_cookie(self): |
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.
I don't think we need check_xsrf_cookie here since we're not performing a PUT/POST.
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.
Oh cool, looks like I was able to push to this branch
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.
Yup, I checked the Allow edits and access to secrets by maintainers
box when making the PR 😄
Thanks for this feature Jay!! |
Add a handler that returns a ConsoleMe URL suffix, given an ARN. To be used by Weep for allowing users to open a resource page by providing an ARN. This is linked to PR Netflix/weep#61 for weep