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

Question about introspection #113

Closed
garnaat opened this issue May 19, 2015 · 2 comments
Closed

Question about introspection #113

garnaat opened this issue May 19, 2015 · 2 comments
Labels
feature-request This issue requests a feature.

Comments

@garnaat
Copy link
Member

garnaat commented May 19, 2015

I can easily find the available service resources give a session:

>>> import boto3.session
>>> session = boto3.session.Session(profile_name='prod')
>>> session.available_resources
['cloudformation',
 'dynamodb',
 'ec2',
 'glacier',
 'iam',
 'opsworks',
 's3',
 'sns',
 'sqs']

But is there a way to find the available resources for a given service resource? I.E. is there some way to get the equivalent of:

>>> ec2 = session.resource('ec2')
>>> ec2.available_resources

I've been going through the code for a while and can't really figure out an easy way to do this.

@kyleknap
Copy link
Member

Unfortunately, there is nothing equivalent to resource.available_resources. I think that this would be helpful. Marking as feature request.

One way you could go about figuring the available resources for now is using the inspect module to figure out the resources members and then look for any member that begins with a capitol letter. Those are usually the resources.

@kyleknap kyleknap added the feature-request This issue requests a feature. label May 19, 2015
@garnaat
Copy link
Member Author

garnaat commented May 19, 2015

Thanks. I can also find what I'm looking for by accessing the _loader private attribute of the client and then loading the service model but, of course, I shouldn't be mucking around with those private attributes.

JordonPhillips added a commit to JordonPhillips/boto3 that referenced this issue Mar 18, 2016
We currently have the ability to inspect what resources are available to
a session, but not what subresources are available to a resource. This
adds a method to do that on each resource class.

Resolves boto#113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue requests a feature.
Projects
None yet
Development

No branches or pull requests

2 participants