Skip to content

Expose all resources on a service resource. - #60

Merged
danielgtaylor merged 5 commits into
developfrom
service-subresources
Feb 10, 2015
Merged

danielgtaylor merged 5 commits into
developfrom
service-subresources

Conversation

@danielgtaylor

Copy link
Copy Markdown
Contributor

This change brings back behavior that was removed in Boto 3 - 0.0.7
and allows things like the following to work again:

import boto3

s3 = boto3.resource('s3')
obj = s3.Object('bucket-name', 'key')

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 from sqs.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

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')
```
@danielgtaylor danielgtaylor added the bug This issue is a confirmed bug. label Feb 9, 2015
@danielgtaylor danielgtaylor self-assigned this Feb 9, 2015
Comment thread boto3/resources/model.py Outdated

Copy link
Copy Markdown
Contributor

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.
Comment thread boto3/resources/model.py Outdated

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

@kyleknap

kyleknap commented Feb 9, 2015

Copy link
Copy Markdown
Contributor

Looks good. 🚒 Thanks for fixing the comments I made earlier

@coveralls

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling e2d3706 on service-subresources into * on develop*.

@kyleknap

Copy link
Copy Markdown
Contributor

Thanks! 🚒

danielgtaylor added a commit that referenced this pull request Feb 10, 2015
Expose all resources on a service resource.
@danielgtaylor
danielgtaylor merged commit d4ce4f9 into develop Feb 10, 2015
@danielgtaylor
danielgtaylor deleted the service-subresources branch February 10, 2015 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This issue is a confirmed bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants