[英]How access native provider API with Jclouds 1.7
使用JClouds(最高版本1.6.x),可以使用以下慣用法訪問本機EC2提供程序API:
AWSEC2Client ec2Client = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi());
實際上,我是從文檔頁面復制的: http : //jclouds.apache.org/guides/aws/
事實證明,在最新版本中,此方法已被刪除。 是否存在訪問提供商特定功能(安全組,密鑰對等)的替代方法/方式?
從ComputeServiceContext解開API
ComputeServiceContext context = ContextBuilder.newBuilder("aws-ec2")
.credentials("accessKey", "secretAccessKey")
.buildView(ComputeServiceContext.class);
ComputeService computeService = context.getComputeService();
AWSEC2Api ec2Api = context.unwrapApi(AWSEC2Api.class);
直接構建API
AWSEC2Api ec2Api = ContextBuilder.newBuilder("aws-ec2")
.credentials("accessKey", "secretAccessKey")
.buildApi(AWSEC2Api.class);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.