Search in sources :

Example 1 with RdsBackupPolicy

use of com.alibaba.otter.canal.parse.inbound.mysql.rds.data.RdsBackupPolicy in project canal by alibaba.

the class DescribeBackupPolicyRequest method processResult.

@Override
protected RdsBackupPolicy processResult(HttpResponse response) throws Exception {
    String result = EntityUtils.toString(response.getEntity());
    JSONObject jsonObj = JSON.parseObject(result);
    RdsBackupPolicy policy = new RdsBackupPolicy();
    policy.setBackupRetentionPeriod(jsonObj.getString("BackupRetentionPeriod"));
    policy.setBackupLog(jsonObj.getString("BackupLog").equalsIgnoreCase("Enable"));
    policy.setLogBackupRetentionPeriod(jsonObj.getIntValue("LogBackupRetentionPeriod"));
    policy.setPreferredBackupPeriod(jsonObj.getString("PreferredBackupPeriod"));
    policy.setPreferredBackupTime(jsonObj.getString("PreferredBackupTime"));
    return policy;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) RdsBackupPolicy(com.alibaba.otter.canal.parse.inbound.mysql.rds.data.RdsBackupPolicy)

Example 2 with RdsBackupPolicy

use of com.alibaba.otter.canal.parse.inbound.mysql.rds.data.RdsBackupPolicy in project canal by alibaba.

the class RdsBinlogOpenApiTest method testSimple.

@Test
public void testSimple() throws Throwable {
    Date startTime = DateUtils.parseDate("2018-08-10 12:00:00", new String[] { "yyyy-MM-dd HH:mm:ss" });
    Date endTime = DateUtils.parseDate("2018-08-11 12:00:00", new String[] { "yyyy-MM-dd HH:mm:ss" });
    String url = "https://rds.aliyuncs.com/";
    String ak = "";
    String sk = "";
    String dbInstanceId = "";
    RdsBackupPolicy backupPolicy = RdsBinlogOpenApi.queryBinlogBackupPolicy(url, ak, sk, dbInstanceId);
    System.out.println(backupPolicy);
    List<BinlogFile> binlogFiles = RdsBinlogOpenApi.listBinlogFiles(url, ak, sk, dbInstanceId, startTime, endTime);
    System.out.println(binlogFiles);
}
Also used : BinlogFile(com.alibaba.otter.canal.parse.inbound.mysql.rds.data.BinlogFile) RdsBackupPolicy(com.alibaba.otter.canal.parse.inbound.mysql.rds.data.RdsBackupPolicy) Date(java.util.Date) Test(org.junit.Test)

Aggregations

RdsBackupPolicy (com.alibaba.otter.canal.parse.inbound.mysql.rds.data.RdsBackupPolicy)2 JSONObject (com.alibaba.fastjson.JSONObject)1 BinlogFile (com.alibaba.otter.canal.parse.inbound.mysql.rds.data.BinlogFile)1 Date (java.util.Date)1 Test (org.junit.Test)1