-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Expose all resources on a service resource. #60
Conversation
This change brings back behavior that was removed in Boto 3 - 0.0.7 and allows things like the following to work again: ```python import boto3 s3 = boto3.resource('s3') obj = s3.Object('bucket-name', 'key') ```
allows things like ``s3.Object('bucket-name', 'key')`` to | ||
work even though the JSON doesn't define it explicitly. | ||
|
||
@rtype: dict |
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.
What's with the @rtype: notation?
It is possible to define many subresources on a service that have the same resource type, e.g. `Queue`, `PriorityQueue`, and `Stack` might all be implemented as a single resource type with different default values. We need to make sure all of these are exposed on the service resource.
if has_def.get('resource', {}).get('type') == name: | ||
definition[has_name] = has_def | ||
break | ||
else: |
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.
Where is this else coming from? It does not look in line with any if statement.
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's from the for
loop. If it never breaks, then the else
is executed. I've since removed it to simplify the code and fix a potential case I hadn't considered so it should now be easier to understand.
Looks good. 🚢 Thanks for fixing the comments I made earlier |
Changes Unknown when pulling e2d3706 on service-subresources into * on develop*. |
Thanks! 🚢 |
Expose all resources on a service resource.
This change brings back behavior that was removed in Boto 3 - 0.0.7
and allows things like the following to work again:
This is required to gain direct access to some resources that are not exposed as subresources nor references (think something like
sqs.Message
, which you can now only get fromsqs.Queue('url').receive_messages() => [Message(...)]
Without the change in this pull request there is no way to instantiate a message instance yourself).cc @jamesls @kyleknap