简体   繁体   English

如何使用Jclouds 1.7访问本机提供程序API

[英]How access native provider API with Jclouds 1.7

Using JClouds, up to version 1.6.x it was possible to access to the native EC2 provider API by using the following idiom: 使用JClouds(最高版本1.6.x),可以使用以下惯用法访问本机EC2提供程序API:

AWSEC2Client ec2Client = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi());

Actually, I copied from the documentation page: http://jclouds.apache.org/guides/aws/ 实际上,我是从文档页面复制的: http : //jclouds.apache.org/guides/aws/

It turns out that in the latest release this method has been removed. 事实证明,在最新版本中,此方法已被删除。 Is there an alternative method/way to access to the provider specific features (security groups, key-pairs, etc)? 是否存在访问提供商特定功能(安全组,密钥对等)的替代方法/方式?

Unwrapping the API from the ComputeServiceContext 从ComputeServiceContext解开API

ComputeServiceContext context = ContextBuilder.newBuilder("aws-ec2")
    .credentials("accessKey", "secretAccessKey")
    .buildView(ComputeServiceContext.class);
ComputeService computeService = context.getComputeService();
AWSEC2Api ec2Api = context.unwrapApi(AWSEC2Api.class);

Building the API directly 直接构建API

AWSEC2Api ec2Api = ContextBuilder.newBuilder("aws-ec2")
    .credentials("accessKey", "secretAccessKey")
    .buildApi(AWSEC2Api.class);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将环境与JClouds-Chef API结合? - How to incorporate Environments with JClouds-Chef API? Jclouds和Rackspace:用于计划备份的API - Jclouds & Rackspace: API to schedule backup 创建JClouds SwiftApi时出错:无法实例化提供程序org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata - Error creating JClouds SwiftApi: Provider org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata could not be instantiated 如何通过Clojure使用JClouds和Rackspace启用CDN? - How to enable CDN with JClouds and Rackspace via Clojure? 如何在Apache JClouds中设置HTTP标头? - How to set HTTP header in Apache JClouds? 使用jclouds API仅在SoftLayer中更新对象的元数据 - Updating only metadata of an object in SoftLayer using jclouds API org.jclouds.openstack.nova.v2_0.domain.ServerCreated API - org.jclouds.openstack.nova.v2_0.domain.ServerCreated API 使用jclouds API创建aws-ec2实例 - Creating an aws-ec2 instance using jclouds API 为什么与jclouds一起使用的CloudWatch API getMetricStatisticsInRegion会引发UndeclaredThrowableException? - Why does the CloudWatch API getMetricStatisticsInRegion used with jclouds throw an UndeclaredThrowableException? 由于响应中有额外的空间,使用Jclouds API的Openstack juno生成URISyntaxException - Openstack juno with Jclouds API generating URISyntaxException because of an extra space in response
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM