日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

Java SDK for Cassandra OpenAPI使用參考

歡迎使用阿里云開發者工具套件(Alibaba Cloud SDK for Java),此部分為OpenAPI的SDK文檔說明。Alibaba Cloud SDK for Java讓您不用復雜編程即可對云數據庫Cassandra實例進行管理,包括創建、升級、刪除實例、白名單、標簽管理等,有別于訪問Cassandra實例的SDK。本教程介紹如何安裝并開始使用Alibaba Cloud SDK for Java。

前提條件

已創建AccessKey,具體請參見獲取AccessKey

在線調試和生成SDK示例

OpenAPI Explorer提供在線調用云產品API、動態生成SDK示例代碼和快速檢索接口等功能,能顯著降低使用API的難度,推薦您使用。進入頁面后,選擇Cassandra產品,系統提供了接口列表,并且每個接口提供了各個語言的調試demo。

下載并安裝Alibaba Cloud SDK for Java

您可以通過添加Maven依賴或者導入Jar文件來安裝Alibaba Cloud SDK for Java,詳細說明請參見安裝Alibaba Cloud SDK for Java

說明

通過Maven下載SDK包時,請下載最新版本。

示例demo

調用DescribeClusterRequest獲取Cassandra集群信息

  1. 設置環境參數

    DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",
                    "LTAI4FnvzUftE**********", "PxPzgelK1XCkWBXW***********");
    // 以下非必選項,可默認
    DefaultProfile.addEndpoint(
                            "cn-hangzhou",    // 地域ID
                            "cassandra",    // 產品編碼
                            "cassandra.aliyuncs.com"    // 接入地址,即域名
    );
  2. 初始化客戶端

    IAcsClient client = new DefaultAcsClient(profile);
  3. 構造請求對象

    DescribeClusterRequest request = new DescribeClusterRequest();
    request.setClusterId("cds-wz9bui92****697r");
  4. 請求調用

    DescribeClusterResponse response;
    try {
            response = client.getAcsResponse(request);
            System.out.println(new Gson().toJson(response));
    } catch (ClientException e) {
            e.printStackTrace();
    }

參考示例

DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",
                "ak******************", "akSecret********************");
DefaultProfile.addEndpoint(
                "cn-hangzhou",    // 地域ID
                "cassandra",    // 產品編碼
                "cassandra.aliyuncs.com"    // 接入地址,即域名
);
IAcsClient client = new DefaultAcsClient(profile);
DescribeClusterRequest request = new DescribeClusterRequest();
request.setClusterId("cds-wz9bui92****697r");
DescribeClusterResponse response;
try {
        response = client.getAcsResponse(request);
        System.out.println(new Gson().toJson(response));
} catch (ClientException e) {
        e.printStackTrace();
}

響應示例

{
  "RequestId": "3B235CE2-2339-42A8-A11D-5F7548519AD2",
  "Cluster": {
    "Status": "Running",
    "MajorVersion": "3.11",
    "CreatedTime": "2020-04-21T08:50:04Z",
    "ClusterId": "cds-wz9bui92****6973",
    "MinorVersion": "3.11.9",
    "PayType": "PayAsYouGo",
    "LockMode": "Expired",
    "IsLatestVersion": true,
    "MaintainEndTime": "22:00Z",
    "DataCenterCount": 1,
    "ClusterName": "auto_test20200421170214",
    "MaintainStartTime": "18:00Z",
    "Tags": {
      "Tag": [
        {
          "Value": "1",
          "Key": "test"
        },
        {
          "Value": "2",
          "Key": "test2"
        }
      ]
    }
  }
}

調用CreateCluster創建Cassandra集群

  1. 設置環境參數

    DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",
                    "LTAI4FnvzUftE**********", "PxPzgelK1XCkWBXW***********");
    // 以下非必選項,可默認
    DefaultProfile.addEndpoint(
                            "cn-hangzhou",    // 地域ID
                            "cassandra",    // 產品編碼
                            "cassandra.aliyuncs.com"    // 接入地址,即域名
    );
  2. 初始化客戶端

    IAcsClient client = new DefaultAcsClient(profile);
  3. 構造請求對象

    CreateClusterRequest request = new CreateClusterRequest();
    //必填參數
    request.setPayType("PayAsYouGo");
    request.setRegionId("cn-hangzhou");
    request.setZoneId("cn-hangzhou-e");
    request.setMajorVersion("3.11");
    request.setInstanceType("cassandra.c.large");
    request.setNodeCount("2");
    request.setVpcId("vpc-wz9s6dl6nttp1****ydur");
    request.setVswitchId("vsw-wz9c90poaus9q****1dxl");
    //非必填參數
    request.setPeriodUnit("Year");//若付費類型為Subscription則該參數必須傳入。
    request.setPeriod("12");//若付費類型為Subscription則該參數必須傳入。
    request.setAutoRenew("false");//若付費類型為Subscription則該參數必須傳入。
    request.setAutoRenewPeriod("3");//若付費類型為Subscription則該參數必須傳入。
    request.setClientToken("ETnLKlblzczshOTUbOCzxxxxxxxxxx");
    request.setClusterName("cassandra_01");
    request.setDataCenterName("cassandra_dc_01");
    request.setDiskType("cloud_ssd");
    request.setDiskSize("160");
    request.setPassword("Cassandra1@!");
  4. 請求調用

    CreateClusterResponse response;
    try {
            response = client.getAcsResponse(request);
            System.out.println(new Gson().toJson(response));
    } catch (ClientException e) {
            e.printStackTrace();
    }

參考示例

DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",
                "ak******************", "akSecret********************");
DefaultProfile.addEndpoint(
                "cn-hangzhou",    // 地域ID
                "cassandra",    // 產品編碼
                "cassandra.aliyuncs.com"    // 接入地址,即域名
);
IAcsClient client = new DefaultAcsClient(profile);
CreateClusterRequest request = new CreateClusterRequest();
//必填參數
request.setPayType("PayAsYouGo");
request.setRegionId("cn-hangzhou");
request.setZoneId("cn-hangzhou-e");
request.setMajorVersion("3.11");
request.setInstanceType("cassandra.c.large");
request.setNodeCount("2");
request.setVpcId("vpc-wz9s6dl6nttp1****ydur");
request.setVswitchId("vsw-wz9c90poaus9q****1dxl");
//非必填參數
request.setPeriodUnit("Year");//若付費類型為Subscription則該參數必須傳入。
request.setPeriod("12");//若付費類型為Subscription則該參數必須傳入。
request.setAutoRenew("false");//若付費類型為Subscription則該參數必須傳入。
request.setAutoRenewPeriod("3");//若付費類型為Subscription則該參數必須傳入。
request.setClientToken("ETnLKlblzczshOTUbOCzxxxxxxxxxx");
request.setClusterName("cassandra_01");
request.setDataCenterName("cassandra_dc_01");
request.setDiskType("cloud_ssd");
request.setDiskSize("160");
request.setPassword("Cassandra1@!");
CreateClusterResponse response;
try {
        response = client.getAcsResponse(request);
        System.out.println(new Gson().toJson(response));
} catch (ClientException e) {
        e.printStackTrace();
}

響應示例

{
    "ClusterId":"hb-bp16o0pd5****582s",
    "RequestId":"728C7EAF-4844-4D42-9BBE-DFFFBB77CF33"
}

調用ResizeNodeCount擴容數據中心的節點

  1. 設置環境參數

    DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",
                    "LTAI4FnvzUftE**********", "PxPzgelK1XCkWBXW***********");
    // 以下非必選項,可默認
    DefaultProfile.addEndpoint(
                            "cn-hangzhou",    // 地域ID
                            "cassandra",    // 產品編碼
                            "cassandra.aliyuncs.com"    // 接入地址,即域名
    );
  2. 初始化客戶端

    IAcsClient client = new DefaultAcsClient(profile);
  3. 構造請求對象

    ResizeNodeCountRequest request = new ResizeNodeCountRequest();
    request.setClusterId("cds-bp1b136j****5d59");
    request.setDataCenterId("cn-hangzhou-g");
    request.setNodeCount("3");
  4. 請求調用

    ResizeNodeCountResponse response;
    try {
            response = client.getAcsResponse(request);
            System.out.println(new Gson().toJson(response));
    } catch (ClientException e) {
            e.printStackTrace();
    }

參考示例

DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",
                "ak******************", "akSecret********************");
DefaultProfile.addEndpoint(
                "cn-hangzhou",    // 地域ID
                "cassandra",    // 產品編碼
                "cassandra.aliyuncs.com"    // 接入地址,即域名
);
IAcsClient client = new DefaultAcsClient(profile);
ResizeNodeCountRequest request = new ResizeNodeCounttaRequest();
request.setClusterId("cds-bp1b136j****5d59");
request.setDataCenterId("cn-hangzhou-g");
request.setNodeCount("3");
ResizeNodeCountResponse response;
try {
        response = client.getAcsResponse(request);
        System.out.println(new Gson().toJson(response));
} catch (ClientException e) {
        e.printStackTrace();
}

響應示例

{
    "RequestId": "D7D3088F-AA4F-49C3-BB46-B04F3E35041A"
}

調用DeleteCluster刪除Cassandra集群

  1. 設置環境參數

    DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",
                    "LTAI4FnvzUftE**********", "PxPzgelK1XCkWBXW***********");
    // 以下非必選項,可默認
    DefaultProfile.addEndpoint(
                            "cn-hangzhou",    // 地域ID
                            "cassandra",    // 產品編碼
                            "cassandra.aliyuncs.com"    // 接入地址,即域名
    );
  2. 初始化客戶端

    IAcsClient client = new DefaultAcsClient(profile);
  3. 構造請求對象

    DeleteClusterRequest request = new DeleteClusterRequest();
    request.setClusterId("cds-bp1hy2ipk****46k");
  4. 請求調用

    DeleteClusterResponse response;
    try {
            response = client.getAcsResponse(request);
            System.out.println(new Gson().toJson(response));
    } catch (ClientException e) {
            e.printStackTrace();
    }

參考示例

DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",
                "ak******************", "akSecret********************");
DefaultProfile.addEndpoint(
                "cn-hangzhou",    // 地域ID
                "cassandra",    // 產品編碼
                "cassandra.aliyuncs.com"    // 接入地址,即域名
);
IAcsClient client = new DefaultAcsClient(profile);
DeleteClusterRequest request = new DeleteClusterRequest();
request.setClusterId("cds-bp1hy2ipk****46k");
DeleteClusterResponse response;
try {
        response = client.getAcsResponse(request);
        System.out.println(new Gson().toJson(response));
} catch (ClientException e) {
        e.printStackTrace();
}

響應示例

{
    "RequestId":"728C7EAF-4844-4D42-9BBE-DFFFBB77CF33"
}