Where can I find an implementation of "AWSEC2Client"

54 views
Skip to first unread message

Nirmal Fernando

unread,
Nov 2, 2012, 7:12:28 AM11/2/12
to jcl...@googlegroups.com
Hi,

$Subject please? Which is needed when you create a new instance of 'ImportOrReturnExistingKeypair'.

Am I missing something?

--

Thanks & regards,
Nirmal

Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/

Richard Downer

unread,
Nov 2, 2012, 7:40:06 AM11/2/12
to jcl...@googlegroups.com
Nirmal,

Here's my EC2 cheat sheet:

        ContextBuilder builder = ContextBuilder.newBuilder("aws-ec2")
                .credentials(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
                .modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()))
                .overrides(overrides);

        ComputeService computeService = builder.buildView(ComputeServiceContext.class).getComputeService();
        ComputeServiceContext context = computeService.getContext();
        Logger logger = context.getUtils().getLoggerFactory().getLogger(MyClass.class.getName());
        RestContext<AWSEC2Client, AWSEC2AsyncClient> restContext = context.unwrap(RestContext.class);
        AWSEC2Client syncApi = restContext.getApi();
        AWSEC2AsyncClient asyncApi = restContext.getAsyncApi();

Possibly it's not the ideal version - the furtling with ComputeService and ComputeServiceContext could probably be done in fewer keystrokes! - but in the last couple of lines you can see where an AWSEC2Client reference can be obtained.

Richard.


--
You received this message because you are subscribed to the Google Groups "jclouds" group.
To post to this group, send email to jcl...@googlegroups.com.
To unsubscribe from this group, send email to jclouds+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jclouds?hl=en.



--
Richard Downer • Lead Engineer • Cloudsoft Corporation • http://www.cloudsoftcorp.com
Skype richardcloudsoft • Twitter @FrontierTown

Nirmal Fernando

unread,
Nov 2, 2012, 7:47:36 AM11/2/12
to jcl...@googlegroups.com
On Fri, Nov 2, 2012 at 5:10 PM, Richard Downer <richard...@cloudsoftcorp.com> wrote:
Nirmal,

Here's my EC2 cheat sheet:

        ContextBuilder builder = ContextBuilder.newBuilder("aws-ec2")
                .credentials(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
                .modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()))
                .overrides(overrides);

        ComputeService computeService = builder.buildView(ComputeServiceContext.class).getComputeService();
        ComputeServiceContext context = computeService.getContext();
        Logger logger = context.getUtils().getLoggerFactory().getLogger(MyClass.class.getName());
        RestContext<AWSEC2Client, AWSEC2AsyncClient> restContext = context.unwrap(RestContext.class);
        AWSEC2Client syncApi = restContext.getApi();
        AWSEC2AsyncClient asyncApi = restContext.getAsyncApi();

Possibly it's not the ideal version - the furtling with ComputeService and ComputeServiceContext could probably be done in fewer keystrokes! - but in the last couple of lines you can see where an AWSEC2Client reference can be obtained.

Thanks Richard! This will be really useful.

 

Adrian Cole

unread,
Nov 2, 2012, 1:16:09 PM11/2/12
to jcl...@googlegroups.com, jclou...@googlegroups.com

Hi, Nirmal.

I can't seem to find the doc we have on this, but here's the quick answer.  This is a synchronous proxy to AWSEC2AsyncClient which is implemented by reading jaxrs and other annotations.

HTH

--
Reply all
Reply to author
Forward
0 new messages