Thank you Andrew. The unwrap() method works just fine. But I was wondering if JClouds has provision for something on the following guidelines:
The nodes/instances that we receive from the generic jclouds call populates the following fields private final Status status; private final String backendStatus; private final int loginPort; private final Set<String> publicAddresses; private final Set<String> privateAddresses; @Nullable private final LoginCredentials credentials; @Nullable private final String group; @Nullable private final String imageId; @Nullable private final Hardware hardware; @Nullable private final OperatingSystem os; @Nullable private final String hostname; Is there any provision in JClouds where the rest of the provider-specific attributes for a particular instance/node are stored in key value pair form? Going by the unwrap() way would require us to be provider-aware and hence losing out on having a generic code. On the other hand, having key-value pair would just require skimming through the map, irrespective of any provider. If only it exists :) On Wed, Aug 7, 2013 at 7:13 PM, Andrew Phillips <andr...@apache.org> wrote: > 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)<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<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<http://apache.markmail.org/thread/g24ahltkamzf6bpp> > -- Thanks and Regards, Shruti Mehra