jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Bayer <andrew.ba...@gmail.com>
Subject Re: Retrieving provider specific details using JClouds
Date Wed, 07 Aug 2013 18:32:12 GMT
Actually, in 1.6, don't you still need to go the CONTEXT_TOKEN route? i.e.,

EC2Client ec2Client =
computeServiceContext.unwrap(EC2ApiMetadata.CONTEXT_TOKEN).getApi()

I thought unwrapApi wasn't available on async-enabled services...

A.

On Wed, Aug 7, 2013 at 6:43 AM, Andrew Phillips <andrewp@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>
>

Mime
View raw message