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

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

Introduction

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

Prototype


public void setPort(Integer port) 

Source Link

Document

The port number on which the new DB cluster accepts connections.

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");
    }/* www  .  j  a  v a2s . 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());

}