Example usage for com.amazonaws.services.rds.model RestoreDBClusterToPointInTimeRequest RestoreDBClusterToPointInTimeRequest

List of usage examples for com.amazonaws.services.rds.model RestoreDBClusterToPointInTimeRequest RestoreDBClusterToPointInTimeRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.rds.model RestoreDBClusterToPointInTimeRequest RestoreDBClusterToPointInTimeRequest.

Prototype

RestoreDBClusterToPointInTimeRequest

Source Link

Usage

From source file:jp.classmethod.aws.gradle.rds.AmazonRDSRestoreDbClusterToPointInTimeTask.java

License:Apache License

@TaskAction
public void restoreDbClusterToPointInTime() { // NOPMD
    // to enable conventionMappings feature
    String dbClusterIdentifier = getDbClusterIdentifier();

    if (dbClusterIdentifier == null) {
        throw new GradleException("dbClusterIdentifier is not specified");
    }/*from  ww  w.  j  a va 2  s . c om*/

    AmazonRDSPluginExtension ext = getProject().getExtensions().getByType(AmazonRDSPluginExtension.class);
    AmazonRDS rds = ext.getClient();

    RestoreDBClusterToPointInTimeRequest request = new RestoreDBClusterToPointInTimeRequest()
            .withDBClusterIdentifier(dbClusterIdentifier).withDBSubnetGroupName(getDbSubnetGroupName())
            .withKmsKeyId(getKmsKeyId()).withRestoreType(getRestoreType()).withRestoreToTime(getRestoreToTime())
            .withSourceDBClusterIdentifier(getSourceDBClusterIdentifier())
            .withUseLatestRestorableTime(getUseLatestRestorableTime())
            .withVpcSecurityGroupIds(getVpcSecurityGroupIds())
            .withTags(getTags().entrySet().stream()
                    .map(it -> new Tag().withKey(it.getKey().toString()).withValue(it.getValue().toString()))
                    .collect(Collectors.toList()));
    if (getPort() != 0) {
        request.setPort(getPort());
    }
    dbCluster = rds.restoreDBClusterToPointInTime(request);
    getLogger().info("Restored an RDS cluster to point in time: {}", dbCluster.getDBClusterIdentifier());

}