文档中心 > SDK包使用
SDK包使用

最近更新时间:2022-09-22

1、下载jar包和pom包

https://dbaas-openapi-sdk.oss-cn-north-2.unicloudsrv.com/dbaas-openapi-sdk-v1.0.jar

https://dbaas-openapi-sdk.oss-cn-north-2.unicloudsrv.com/dbaas-openapi-sdk-v1.0.pom

2、安装sdk进入本地maven仓库

mvn install:install-file -Dfile=./dbaas-openapi-sdk-v1.0.jar  -DpomFile=./dbaas-openapi-sdk-v1.0.pom

引用依赖

<dependency>

    <groupId>com.unicloud.openapi</groupId>

    <artifactId>dbaas-openapi-sdk</artifactId>

    <version>v1.0</version>

</dependency>

3、使用demo

package demo.openapi;


import com.unicloud.dbaas.ApiClient;

import com.unicloud.dbaas.ApiException;

import com.unicloud.dbaas.client.*;

import com.unicloud.dbaas.client.model.PageResponseBackupListVo;


public class DbaasExample {

    public static void main(String[] args) throws ApiException {

        RdsBackupRestoreControllerApi api = new RdsBackupRestoreControllerApi();

        String key = "zEl1os171Wsewc9L9L";

        String secret = "RzsPEDLWQzerfnsSaJhVdmoZZfw7G5jG6zt";

        String region = "cn-beijing";

        ApiClient apiClient = new ApiClient().setVerifyingSsl(false).setBasePath("https://api.unicloud.com").setAccessKeyId(key).setAccessKeySecret(secret).setRegionId(region);

        apiClient.setDebugging(true);

        api.setApiClient(apiClient);

        PageResponseBackupListVo response = api.describeBackups("mysql-ggf8sz8t7gj4", "2022-09-15 18:00", 1, 30, "2022-09-07 02:00");

        System.out.println("res" + response);

    }

}