Example usage for com.amazonaws.services.kinesisfirehose.model DeliveryStreamDescription getDestinations

List of usage examples for com.amazonaws.services.kinesisfirehose.model DeliveryStreamDescription getDestinations

Introduction

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

Prototype


public java.util.List<DestinationDescription> getDestinations() 

Source Link

Document

The destinations.

Usage

From source file:AmazonKinesisFirehoseToRedshiftSample.java

License:Open Source License

/**
 * Method to update redshift destination with updated copy options.
 *//*  www.  j  a  v  a2 s. 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);
}

From source file:AmazonKinesisFirehoseToS3Sample.java

License:Open Source License

/**
 * Method to update s3 destination with updated s3Prefix, and buffering hints values.
 *
 * @throws Exception/*from  w  w w. ja v a 2  s .c o m*/
 */
private static void updateDeliveryStream() throws Exception {
    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());

    S3DestinationUpdate s3DestinationUpdate = new S3DestinationUpdate();
    s3DestinationUpdate.withPrefix(updateS3ObjectPrefix);

    BufferingHints bufferingHints = null;
    if (updateSizeInMBs != null || updateIntervalInSeconds != null) {
        bufferingHints = new BufferingHints();
        bufferingHints.setSizeInMBs(updateSizeInMBs);
        bufferingHints.setIntervalInSeconds(updateIntervalInSeconds);
    }
    s3DestinationUpdate.setBufferingHints(bufferingHints);

    // Update the role policy with new s3Prefix configuration
    putRolePolicy(updateS3ObjectPrefix);

    updateDestinationRequest.setS3DestinationUpdate(s3DestinationUpdate);

    // 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);
}