閱讀415 返回首頁    go iPhone_iPad_Mac_手機_平板_蘋果apple


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參考_容器服務-阿裏雲