Skip to content

Commit

Permalink
Merge pull request KscSDK#183 from KscSDK/trunk
Browse files Browse the repository at this point in the history
Trunk
  • Loading branch information
金山云SDK authored Nov 18, 2019
2 parents b4f5fd5 + f488b68 commit affeaf5
Show file tree
Hide file tree
Showing 59 changed files with 1,192 additions and 29 deletions.
2 changes: 1 addition & 1 deletion ksc-sdk-java-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<artifactId>ksc-sdk-java-bom</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-cdn/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<artifactId>ksc-sdk-java-core</artifactId>
<name>KSC SDK for Java - Core</name>
Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-epc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<artifactId>ksc-sdk-java-epc</artifactId>
<name>KSC SDK for Java - epc</name>
Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-kec/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<artifactId>ksc-sdk-java-kec</artifactId>
<name>KSC SDK for Java - KEC</name>
Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-ket/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>

<artifactId>ksc-sdk-java-ket</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-kls/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ksc-sdk-java</artifactId>
<groupId>com.ksyun</groupId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-krds/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>

<name>KSC SDK for Java - krds</name>
Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-kvs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>

<artifactId>ksc-sdk-java-kvs</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-live/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ksc-sdk-java</artifactId>
<groupId>com.ksyun</groupId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-memcached/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ksc-sdk-java</artifactId>
<groupId>com.ksyun</groupId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-monitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<artifactId>ksc-sdk-java-monitor</artifactId>
<name>KSC SDK for Java - monitor</name>
Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-network/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<artifactId>ksc-sdk-java-network</artifactId>
<name>KSC SDK for Java - network</name>
Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-offline/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.ksyun</groupId>
<artifactId>ksc-sdk-java</artifactId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>

<artifactId>ksc-sdk-java-offline</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ksc-sdk-java-redis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ksc-sdk-java</artifactId>
<groupId>com.ksyun</groupId>
<version>0.3.6</version>
<version>0.3.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.ksc.redis.client.support;

import com.ksc.ClientConfiguration;
import com.ksc.auth.AWSCredentials;
import com.ksc.auth.AWSCredentialsProvider;
import com.ksc.metrics.RequestMetricCollector;
import com.ksc.redis.client.KscRedisClient;
import com.ksc.redis.model.RedisResponse;
import com.ksc.redis.model.backup.*;
import com.ksc.redis.transform.backup.*;

public class KscRedisBackupClient extends KscRedisClient {
public KscRedisBackupClient() {
super();
}

public KscRedisBackupClient(AWSCredentials awsCredentials, String az) {
super(awsCredentials, az);
}

public KscRedisBackupClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration, String az) {
super(awsCredentials, clientConfiguration, az);
}

public KscRedisBackupClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, String az) {
super(awsCredentialsProvider, clientConfiguration, az);
}

public KscRedisBackupClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector, String az) {
super(awsCredentialsProvider, clientConfiguration, requestMetricCollector, az);
}

public RedisResponse createSnapshot(CreateSnapshotRequest req) {
return doAction(new CreateSnapshotMarshaller().marshall(super.beforeMarshalling(req)), new CreateSnapshotUnmarshaller()).getKscResponse();
}

public RedisResponse deleteSnapshot(DeleteSnapshotRequest req) {
return doAction(new DeleteSnapshotMarshaller().marshall(super.beforeMarshalling(req)), new DeleteSnapshotUnmarshaller()).getKscResponse();
}

public RedisResponse restoreSnapshot(RestoreSnapshotRequest req) {
return doAction(new RestoreSnapshotMarshaller().marshall(super.beforeMarshalling(req)), new RestoreSnapshotUnmarshaller()).getKscResponse();
}

public RedisResponse<DescribeSnapshotResponse[]> describeSnapshot(DescribeSnapshotRequest req) {
return doAction(new DescribeSnapshotMarshaller().marshall(super.beforeMarshalling(req)), new DescribeSnapshotUnmarshaller()).getKscResponse();
}

public RedisResponse<DownloadSnapshotResponse> downloadSnapshot(DownloadSnapshotRequest req) {
return doAction(new DownloadSnapshotMarshaller().marshall(super.beforeMarshalling(req)), new DownloadSnapshotUnmarshaller()).getKscResponse();
}

public RedisResponse exportSnapshot(ExportSnapshotRequest req) {
return doAction(new ExportSnapshotMarshaller().marshall(super.beforeMarshalling(req)), new ExportSnapshotUnmarshaller()).getKscResponse();
}

public RedisResponse setTimingSnapshot(SetTimingSnapshotRequest req) {
return doAction(new SetTimingSnapshotMarshaller().marshall(super.beforeMarshalling(req)), new SetTimingSnapshotUnmarshaller()).getKscResponse();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,16 @@ public RedisResponse<ListReadOnlyRedisResponse[]> listReadOnlyRedis(ListReadOnly
return doAction(new ListReadOnlyRedisMarshaller().marshall(super.beforeMarshalling(listReadOnlyRedisRequest)),
new ListReadOnlyRedisUnmarshaller()).getKscResponse();
}

public RedisResponse<StatisticDBInstancesResponse> statisticDBInstances(StatisticDBInstancesRequest req) {
return doAction(new StatisticDBInstancesMarshaller().marshall(super.beforeMarshalling(req)), new StatisticDBInstancesUnmarshaller()).getKscResponse();
}

public DescribeRegionsResponse describeRegions(DescribeRegionsRequest req) {
return doAction(new DescribeRegionsMarshaller().marshall(super.beforeMarshalling(req)), new DescribeRegionsUnmarshaller()).getKscResponse();
}

public DescribeAvailabilityZonesResponse describeAvailabilityZones(DescribeAvailabilityZonesRequest req) {
return doAction(new DescribeAvailabilityZonesMarshaller().marshall(super.beforeMarshalling(req)), new DescribeAvailabilityZonesUnmarshaller()).getKscResponse();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public static <T> RedisResponse<T> invoke(JsonParser jsonParser, Class<T> clazz)
return redisResponse;
}

public static <T> T invoke1(JsonParser jsonParser, Class<T> clazz) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
return objectMapper.convertValue(objectMapper.readTree(jsonParser), clazz);
}

/**
* Jackson parses JSON objects as strings
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.ksc.redis.model.backup;

import com.ksc.KscWebServiceRequest;
import com.ksc.Request;
import com.ksc.model.DryRunSupportedRequest;
import com.ksc.redis.transform.backup.CreateSnapshotMarshaller;

import java.io.Serializable;

public class CreateSnapshotRequest extends KscWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest<CreateSnapshotRequest> {
private String cacheId;
private String name;

public String getCacheId() {
return cacheId;
}

public void setCacheId(String cacheId) {
this.cacheId = cacheId;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Override
public Request<CreateSnapshotRequest> getDryRunRequest() {
Request<CreateSnapshotRequest> request = new CreateSnapshotMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.ksc.redis.model.backup;

import com.ksc.KscWebServiceRequest;
import com.ksc.Request;
import com.ksc.model.DryRunSupportedRequest;
import com.ksc.redis.transform.backup.DeleteSnapshotMarshaller;

import java.io.Serializable;

public class DeleteSnapshotRequest extends KscWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest<DeleteSnapshotRequest> {
private String snapshotId;

public String getSnapshotId() {
return snapshotId;
}

public void setSnapshotId(String snapshotId) {
this.snapshotId = snapshotId;
}

@Override
public Request<DeleteSnapshotRequest> getDryRunRequest() {
Request<DeleteSnapshotRequest> request = new DeleteSnapshotMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.ksc.redis.model.backup;

import com.ksc.KscWebServiceRequest;
import com.ksc.Request;
import com.ksc.model.DryRunSupportedRequest;
import com.ksc.redis.transform.backup.DescribeSnapshotMarshaller;

import java.io.Serializable;

public class DescribeSnapshotRequest extends KscWebServiceRequest implements Serializable, Cloneable, DryRunSupportedRequest<DescribeSnapshotRequest> {
private String cacheId;

public String getCacheId() {
return cacheId;
}

public void setCacheId(String cacheId) {
this.cacheId = cacheId;
}

@Override
public Request<DescribeSnapshotRequest> getDryRunRequest() {
Request<DescribeSnapshotRequest> request = new DescribeSnapshotMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.ksc.redis.model.backup;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.Date;

@JsonIgnoreProperties(ignoreUnknown = true)
public class DescribeSnapshotResponse {
private String snapshotId;
private String name;
private String cacheId;
private String type;
private String status;
private Date createTime;
private String resourceSize;

public String getSnapshotId() {
return snapshotId;
}

public void setSnapshotId(String snapshotId) {
this.snapshotId = snapshotId;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getCacheId() {
return cacheId;
}

public void setCacheId(String cacheId) {
this.cacheId = cacheId;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

public Date getCreateTime() {
return createTime;
}

public void setCreateTime(Date createTime) {
this.createTime = createTime;
}

public String getResourceSize() {
return resourceSize;
}

public void setResourceSize(String resourceSize) {
this.resourceSize = resourceSize;
}
}
Loading

0 comments on commit affeaf5

Please sign in to comment.