Example usage for com.amazonaws.services.kinesisfirehose.model RedshiftDestinationUpdate RedshiftDestinationUpdate

List of usage examples for com.amazonaws.services.kinesisfirehose.model RedshiftDestinationUpdate RedshiftDestinationUpdate

Introduction

In this page you can find the example usage for com.amazonaws.services.kinesisfirehose.model RedshiftDestinationUpdate RedshiftDestinationUpdate.

Prototype

RedshiftDestinationUpdate

Source Link

Usage

From source file:AmazonKinesisFirehoseToRedshiftSample.java

License:Open Source License

/**
 * Method to update redshift destination with updated copy options.
 *///from  w  w w . j a  v a 2s.  com
private static void updateDeliveryStream() {
    DeliveryStreamDescription deliveryStreamDescription = describeDeliveryStream(deliveryStreamName);

    LOG.info("Updating DeliveryStream Destination: " + deliveryStreamName + " with new configuration options");
    // get(0) -> DeliveryStream currently supports only one destination per DeliveryStream
    UpdateDestinationRequest updateDestinationRequest = new UpdateDestinationRequest()
            .withDeliveryStreamName(deliveryStreamName)
            .withCurrentDeliveryStreamVersionId(deliveryStreamDescription.getVersionId())
            .withDestinationId(deliveryStreamDescription.getDestinations().get(0).getDestinationId());

    CopyCommand updatedCopyCommand = new CopyCommand().withDataTableName(dataTableName)
            .withCopyOptions(updatedCopyOptions);
    RedshiftDestinationUpdate redshiftDestinationUpdate = new RedshiftDestinationUpdate()
            .withCopyCommand(updatedCopyCommand);

    updateDestinationRequest.setRedshiftDestinationUpdate(redshiftDestinationUpdate);

    // Update DeliveryStream destination with new configuration options such as s3Prefix and Buffering Hints.
    // Can also update Compression format, KMS key values and IAM Role.
    firehoseClient.updateDestination(updateDestinationRequest);
}