List of usage examples for com.amazonaws.services.rds AmazonRDS restoreDBClusterToPointInTime
DBCluster restoreDBClusterToPointInTime( RestoreDBClusterToPointInTimeRequest restoreDBClusterToPointInTimeRequest);
Restores a DB cluster to an arbitrary point in time.
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 www . jav a2s .co m*/ 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()); }