jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Phillips <andr...@apache.org>
Subject Re: Retrieving provider specific details using JClouds
Date Wed, 07 Aug 2013 13:43:56 GMT
> Here the nodes will be represented using NodeMetaData having standard
> attributes which hold true for all the cloud providers. What if I wish to
> access say aws-ec2 specific attributes without compromising on the generic
> code which hold true across vendors?

If you need to get access at AWS-specific APIs or classes, you can  
"unwrap" [1] the context to access the underlying API [2]:

AWSEC2Api awsApi = context.unwrapApi(AWSEC2Api.class);

If you only use the API in places where provider-specific logic is  
required, the remainder of the code should remain generic. See this  
recent thread [3] for an example of testing for a specific backing  
provider before unwrapping.

ap

[1]  
http://javadocs.jclouds.cloudbees.net/org/jclouds/View.html#unwrapApi(java.lang.Class)
[2]  
https://github.com/jclouds/jclouds/blob/master/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/AWSEC2Api.java
[3] http://apache.markmail.org/thread/g24ahltkamzf6bpp

Mime
View raw message