阅读415 返回首页    go 阿里云


JAVA SDK__集群操作SDK_SDK参考_容器服务-阿里云

您可以基于阿里云 SDK 通过编写代码的方式调用阿里云 API,进而实现对阿里云产品和服务的灵活部署和快速操作。

注意:使用过程中您会需要 AccessKey。您可以在 云账号 AccessKey 管理页面 创建并管理 AccessKey。

环境准备

通过以下地址查询下载最新版本 SDK:https://oss.sonatype.org/#nexus-search;gav~com.aliyun~aliyun-java-sdk-*~~~

从 Github 上下载源代码:https://github.com/aliyun/aliyun-openapi-java-sdk/

Maven 方式

  1. <repositories>
  2. <repository>
  3. <id>sonatype-nexus-staging</id>
  4. <name>Sonatype Nexus Staging</name>
  5. <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
  6. <releases>
  7. <enabled>true</enabled>
  8. </releases>
  9. <snapshots>
  10. <enabled>true</enabled>
  11. </snapshots>
  12. </repository>
  13. </repositories>
  14. <dependencies>
  15. <dependency>
  16. <groupId>com.aliyun</groupId>
  17. <artifactId>aliyun-java-sdk-core</artifactId>
  18. <version>2.3.3</version>
  19. </dependency>
  20. <dependency>
  21. <groupId>com.aliyun</groupId>
  22. <artifactId>aliyun-java-sdk-cs</artifactId>
  23. <version>2.0.2</version>
  24. </dependency>
  25. </dependencies>

Sample

  1. public static void main(String[] argc) throws Exception {
  2. String accessKeyID = "xx";
  3. String accessKeySecret = "xx";
  4. String region="cn-shenzhen"; // or other
  5. DescribeApiVersionRequest describeApiVersionRequest = new DescribeApiVersionRequest();
  6. IClientProfile profile = DefaultProfile.getProfile(region, accessKeyID, accessKeySecret);
  7. IAcsClient client = new DefaultAcsClient(profile);
  8. try {
  9. HttpResponse httpResponse
  10. = client.doAction(describeApiVersionRequest);
  11. System.out.println(httpResponse.getUrl());
  12. System.out.println(new String(httpResponse.getContent()));
  13. } catch (ClientException e) {
  14. e.printStackTrace();
  15. }
  16. }

最后更新:2016-11-23 16:03:52

  上一篇:go 状态表__附录_API参考_容器服务-阿里云
  下一篇:go PHP SDK__集群操作SDK_SDK参考_容器服务-阿里云