awscdkkinesisfirehosedestinationsalpha

package module
v2.160.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

README

Amazon Kinesis Data Firehose Destinations Library

---

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


This library provides constructs for adding destinations to a Amazon Kinesis Data Firehose delivery stream. Destinations can be added by specifying the destinations prop when defining a delivery stream.

See Amazon Kinesis Data Firehose module README for usage examples.

import destinations "github.com/aws/aws-cdk-go/awscdkkinesisfirehosedestinationsalpha"

Documentation

Overview

CDK Destinations Constructs for AWS Kinesis Firehose

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewS3Bucket_Override

func NewS3Bucket_Override(s S3Bucket, bucket awss3.IBucket, props *S3BucketProps)

Experimental.

Types

type BackupMode

type BackupMode string

Options for S3 record backup of a delivery stream.

Example:

// Enable backup of all source records (to an S3 bucket created by CDK).
var bucket bucket
// Explicitly provide an S3 bucket to which all source records will be backed up.
var backupBucket bucket

firehose.NewDeliveryStream(this, jsii.String("Delivery Stream Backup All"), &DeliveryStreamProps{
	Destinations: []iDestination{
		destinations.NewS3Bucket(bucket, &S3BucketProps{
			S3Backup: &DestinationS3BackupProps{
				Mode: destinations.BackupMode_ALL,
			},
		}),
	},
})
firehose.NewDeliveryStream(this, jsii.String("Delivery Stream Backup All Explicit Bucket"), &DeliveryStreamProps{
	Destinations: []*iDestination{
		destinations.NewS3Bucket(bucket, &S3BucketProps{
			S3Backup: &DestinationS3BackupProps{
				Bucket: backupBucket,
			},
		}),
	},
})
// Explicitly provide an S3 prefix under which all source records will be backed up.
// Explicitly provide an S3 prefix under which all source records will be backed up.
firehose.NewDeliveryStream(this, jsii.String("Delivery Stream Backup All Explicit Prefix"), &DeliveryStreamProps{
	Destinations: []*iDestination{
		destinations.NewS3Bucket(bucket, &S3BucketProps{
			S3Backup: &DestinationS3BackupProps{
				Mode: destinations.BackupMode_ALL,
				DataOutputPrefix: jsii.String("mybackup"),
			},
		}),
	},
})

Experimental.

const (
	// All records are backed up.
	// Experimental.
	BackupMode_ALL BackupMode = "ALL"
	// Only records that failed to deliver or transform are backed up.
	// Experimental.
	BackupMode_FAILED BackupMode = "FAILED"
)

type CommonDestinationProps

type CommonDestinationProps struct {
	// If true, log errors when data transformation or data delivery fails.
	//
	// If `logGroup` is provided, this will be implicitly set to `true`.
	// Default: true - errors are logged.
	//
	// Experimental.
	Logging *bool `field:"optional" json:"logging" yaml:"logging"`
	// The CloudWatch log group where log streams will be created to hold error logs.
	// Default: - if `logging` is set to `true`, a log group will be created for you.
	//
	// Experimental.
	LogGroup awslogs.ILogGroup `field:"optional" json:"logGroup" yaml:"logGroup"`
	// The data transformation that should be performed on the data before writing to the destination.
	// Default: - no data transformation will occur.
	//
	// Experimental.
	Processor awscdkkinesisfirehosealpha.IDataProcessor `field:"optional" json:"processor" yaml:"processor"`
	// The IAM role associated with this destination.
	//
	// Assumed by Kinesis Data Firehose to invoke processors and write to destinations.
	// Default: - a role will be created with default permissions.
	//
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
	// The configuration for backing up source records to S3.
	// Default: - source records will not be backed up to S3.
	//
	// Experimental.
	S3Backup *DestinationS3BackupProps `field:"optional" json:"s3Backup" yaml:"s3Backup"`
}

Generic properties for defining a delivery stream destination.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import kinesisfirehose_alpha "github.com/aws/aws-cdk-go/awscdkkinesisfirehosealpha"
import kinesisfirehose_destinations_alpha "github.com/aws/aws-cdk-go/awscdkkinesisfirehosedestinationsalpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var bucket bucket
var compression compression
var dataProcessor iDataProcessor
var key key
var logGroup logGroup
var role role
var size size

commonDestinationProps := &CommonDestinationProps{
	Logging: jsii.Boolean(false),
	LogGroup: logGroup,
	Processor: dataProcessor,
	Role: role,
	S3Backup: &DestinationS3BackupProps{
		Bucket: bucket,
		BufferingInterval: cdk.Duration_Minutes(jsii.Number(30)),
		BufferingSize: size,
		Compression: compression,
		DataOutputPrefix: jsii.String("dataOutputPrefix"),
		EncryptionKey: key,
		ErrorOutputPrefix: jsii.String("errorOutputPrefix"),
		Logging: jsii.Boolean(false),
		LogGroup: logGroup,
		Mode: kinesisfirehose_destinations_alpha.BackupMode_ALL,
	},
}

Experimental.

type CommonDestinationS3Props

type CommonDestinationS3Props struct {
	// The length of time that Firehose buffers incoming data before delivering it to the S3 bucket.
	//
	// Minimum: Duration.seconds(0)
	// Maximum: Duration.seconds(900)
	// Default: Duration.seconds(300)
	//
	// Experimental.
	BufferingInterval awscdk.Duration `field:"optional" json:"bufferingInterval" yaml:"bufferingInterval"`
	// The size of the buffer that Kinesis Data Firehose uses for incoming data before delivering it to the S3 bucket.
	//
	// Minimum: Size.mebibytes(1)
	// Maximum: Size.mebibytes(128)
	// Default: Size.mebibytes(5)
	//
	// Experimental.
	BufferingSize awscdk.Size `field:"optional" json:"bufferingSize" yaml:"bufferingSize"`
	// The type of compression that Kinesis Data Firehose uses to compress the data that it delivers to the Amazon S3 bucket.
	//
	// The compression formats SNAPPY or ZIP cannot be specified for Amazon Redshift
	// destinations because they are not supported by the Amazon Redshift COPY operation
	// that reads from the S3 bucket.
	// Default: - UNCOMPRESSED.
	//
	// Experimental.
	Compression Compression `field:"optional" json:"compression" yaml:"compression"`
	// A prefix that Kinesis Data Firehose evaluates and adds to records before writing them to S3.
	//
	// This prefix appears immediately following the bucket name.
	// See: https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html
	//
	// Default: "YYYY/MM/DD/HH".
	//
	// Experimental.
	DataOutputPrefix *string `field:"optional" json:"dataOutputPrefix" yaml:"dataOutputPrefix"`
	// The AWS KMS key used to encrypt the data that it delivers to your Amazon S3 bucket.
	// Default: - Data is not encrypted.
	//
	// Experimental.
	EncryptionKey awskms.IKey `field:"optional" json:"encryptionKey" yaml:"encryptionKey"`
	// A prefix that Kinesis Data Firehose evaluates and adds to failed records before writing them to S3.
	//
	// This prefix appears immediately following the bucket name.
	// See: https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html
	//
	// Default: "YYYY/MM/DD/HH".
	//
	// Experimental.
	ErrorOutputPrefix *string `field:"optional" json:"errorOutputPrefix" yaml:"errorOutputPrefix"`
}

Common properties for defining a backup, intermediary, or final S3 destination for a Kinesis Data Firehose delivery stream.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import kinesisfirehose_destinations_alpha "github.com/aws/aws-cdk-go/awscdkkinesisfirehosedestinationsalpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var compression compression
var key key
var size size

commonDestinationS3Props := &CommonDestinationS3Props{
	BufferingInterval: cdk.Duration_Minutes(jsii.Number(30)),
	BufferingSize: size,
	Compression: compression,
	DataOutputPrefix: jsii.String("dataOutputPrefix"),
	EncryptionKey: key,
	ErrorOutputPrefix: jsii.String("errorOutputPrefix"),
}

Experimental.

type Compression

type Compression interface {
	// the string value of the Compression.
	// Experimental.
	Value() *string
}

Possible compression options Kinesis Data Firehose can use to compress data on delivery.

Example:

// Compress data delivered to S3 using Snappy
var bucket bucket

s3Destination := destinations.NewS3Bucket(bucket, &S3BucketProps{
	Compression: destinations.Compression_SNAPPY(),
})
firehose.NewDeliveryStream(this, jsii.String("Delivery Stream"), &DeliveryStreamProps{
	Destinations: []iDestination{
		s3Destination,
	},
})

Experimental.

func Compression_GZIP

func Compression_GZIP() Compression

func Compression_HADOOP_SNAPPY

func Compression_HADOOP_SNAPPY() Compression

func Compression_Of

func Compression_Of(value *string) Compression

Creates a new Compression instance with a custom value. Experimental.

func Compression_SNAPPY

func Compression_SNAPPY() Compression

func Compression_ZIP

func Compression_ZIP() Compression

type DestinationS3BackupProps

type DestinationS3BackupProps struct {
	// The length of time that Firehose buffers incoming data before delivering it to the S3 bucket.
	//
	// Minimum: Duration.seconds(0)
	// Maximum: Duration.seconds(900)
	// Default: Duration.seconds(300)
	//
	// Experimental.
	BufferingInterval awscdk.Duration `field:"optional" json:"bufferingInterval" yaml:"bufferingInterval"`
	// The size of the buffer that Kinesis Data Firehose uses for incoming data before delivering it to the S3 bucket.
	//
	// Minimum: Size.mebibytes(1)
	// Maximum: Size.mebibytes(128)
	// Default: Size.mebibytes(5)
	//
	// Experimental.
	BufferingSize awscdk.Size `field:"optional" json:"bufferingSize" yaml:"bufferingSize"`
	// The type of compression that Kinesis Data Firehose uses to compress the data that it delivers to the Amazon S3 bucket.
	//
	// The compression formats SNAPPY or ZIP cannot be specified for Amazon Redshift
	// destinations because they are not supported by the Amazon Redshift COPY operation
	// that reads from the S3 bucket.
	// Default: - UNCOMPRESSED.
	//
	// Experimental.
	Compression Compression `field:"optional" json:"compression" yaml:"compression"`
	// A prefix that Kinesis Data Firehose evaluates and adds to records before writing them to S3.
	//
	// This prefix appears immediately following the bucket name.
	// See: https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html
	//
	// Default: "YYYY/MM/DD/HH".
	//
	// Experimental.
	DataOutputPrefix *string `field:"optional" json:"dataOutputPrefix" yaml:"dataOutputPrefix"`
	// The AWS KMS key used to encrypt the data that it delivers to your Amazon S3 bucket.
	// Default: - Data is not encrypted.
	//
	// Experimental.
	EncryptionKey awskms.IKey `field:"optional" json:"encryptionKey" yaml:"encryptionKey"`
	// A prefix that Kinesis Data Firehose evaluates and adds to failed records before writing them to S3.
	//
	// This prefix appears immediately following the bucket name.
	// See: https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html
	//
	// Default: "YYYY/MM/DD/HH".
	//
	// Experimental.
	ErrorOutputPrefix *string `field:"optional" json:"errorOutputPrefix" yaml:"errorOutputPrefix"`
	// The S3 bucket that will store data and failed records.
	// Default: - If `mode` is set to `BackupMode.ALL` or `BackupMode.FAILED`, a bucket will be created for you.
	//
	// Experimental.
	Bucket awss3.IBucket `field:"optional" json:"bucket" yaml:"bucket"`
	// If true, log errors when data transformation or data delivery fails.
	//
	// If `logGroup` is provided, this will be implicitly set to `true`.
	// Default: true - errors are logged.
	//
	// Experimental.
	Logging *bool `field:"optional" json:"logging" yaml:"logging"`
	// The CloudWatch log group where log streams will be created to hold error logs.
	// Default: - if `logging` is set to `true`, a log group will be created for you.
	//
	// Experimental.
	LogGroup awslogs.ILogGroup `field:"optional" json:"logGroup" yaml:"logGroup"`
	// Indicates the mode by which incoming records should be backed up to S3, if any.
	//
	// If `bucket` is provided, this will be implicitly set to `BackupMode.ALL`.
	// Default: - If `bucket` is provided, the default will be `BackupMode.ALL`. Otherwise,
	// source records are not backed up to S3.
	//
	// Experimental.
	Mode BackupMode `field:"optional" json:"mode" yaml:"mode"`
}

Properties for defining an S3 backup destination.

S3 backup is available for all destinations, regardless of whether the final destination is S3 or not.

Example:

// Enable backup of all source records (to an S3 bucket created by CDK).
var bucket bucket
// Explicitly provide an S3 bucket to which all source records will be backed up.
var backupBucket bucket

firehose.NewDeliveryStream(this, jsii.String("Delivery Stream Backup All"), &DeliveryStreamProps{
	Destinations: []iDestination{
		destinations.NewS3Bucket(bucket, &S3BucketProps{
			S3Backup: &DestinationS3BackupProps{
				Mode: destinations.BackupMode_ALL,
			},
		}),
	},
})
firehose.NewDeliveryStream(this, jsii.String("Delivery Stream Backup All Explicit Bucket"), &DeliveryStreamProps{
	Destinations: []*iDestination{
		destinations.NewS3Bucket(bucket, &S3BucketProps{
			S3Backup: &DestinationS3BackupProps{
				Bucket: backupBucket,
			},
		}),
	},
})
// Explicitly provide an S3 prefix under which all source records will be backed up.
// Explicitly provide an S3 prefix under which all source records will be backed up.
firehose.NewDeliveryStream(this, jsii.String("Delivery Stream Backup All Explicit Prefix"), &DeliveryStreamProps{
	Destinations: []*iDestination{
		destinations.NewS3Bucket(bucket, &S3BucketProps{
			S3Backup: &DestinationS3BackupProps{
				Mode: destinations.BackupMode_ALL,
				DataOutputPrefix: jsii.String("mybackup"),
			},
		}),
	},
})

Experimental.

type S3Bucket

type S3Bucket interface {
	awscdkkinesisfirehosealpha.IDestination
	// Binds this destination to the Kinesis Data Firehose delivery stream.
	//
	// Implementers should use this method to bind resources to the stack and initialize values using the provided stream.
	// Experimental.
	Bind(scope constructs.Construct, _options *awscdkkinesisfirehosealpha.DestinationBindOptions) *awscdkkinesisfirehosealpha.DestinationConfig
}

An S3 bucket destination for data from a Kinesis Data Firehose delivery stream.

Example:

import firehose "github.com/aws/aws-cdk-go/awscdkkinesisfirehosealpha"
import destinations "github.com/aws/aws-cdk-go/awscdkkinesisfirehosedestinationsalpha"

bucket := s3.NewBucket(this, jsii.String("MyBucket"))
stream := firehose.NewDeliveryStream(this, jsii.String("MyStream"), &DeliveryStreamProps{
	Destinations: []iDestination{
		destinations.NewS3Bucket(bucket),
	},
})

topicRule := iot.NewTopicRule(this, jsii.String("TopicRule"), &TopicRuleProps{
	Sql: iot.IotSql_FromStringAsVer20160323(jsii.String("SELECT * FROM 'device/+/data'")),
	Actions: []iAction{
		actions.NewFirehosePutRecordAction(stream, &FirehosePutRecordActionProps{
			BatchMode: jsii.Boolean(true),
			RecordSeparator: actions.FirehoseRecordSeparator_NEWLINE,
		}),
	},
})

Experimental.

func NewS3Bucket

func NewS3Bucket(bucket awss3.IBucket, props *S3BucketProps) S3Bucket

Experimental.

type S3BucketProps

type S3BucketProps struct {
	// The length of time that Firehose buffers incoming data before delivering it to the S3 bucket.
	//
	// Minimum: Duration.seconds(0)
	// Maximum: Duration.seconds(900)
	// Default: Duration.seconds(300)
	//
	// Experimental.
	BufferingInterval awscdk.Duration `field:"optional" json:"bufferingInterval" yaml:"bufferingInterval"`
	// The size of the buffer that Kinesis Data Firehose uses for incoming data before delivering it to the S3 bucket.
	//
	// Minimum: Size.mebibytes(1)
	// Maximum: Size.mebibytes(128)
	// Default: Size.mebibytes(5)
	//
	// Experimental.
	BufferingSize awscdk.Size `field:"optional" json:"bufferingSize" yaml:"bufferingSize"`
	// The type of compression that Kinesis Data Firehose uses to compress the data that it delivers to the Amazon S3 bucket.
	//
	// The compression formats SNAPPY or ZIP cannot be specified for Amazon Redshift
	// destinations because they are not supported by the Amazon Redshift COPY operation
	// that reads from the S3 bucket.
	// Default: - UNCOMPRESSED.
	//
	// Experimental.
	Compression Compression `field:"optional" json:"compression" yaml:"compression"`
	// A prefix that Kinesis Data Firehose evaluates and adds to records before writing them to S3.
	//
	// This prefix appears immediately following the bucket name.
	// See: https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html
	//
	// Default: "YYYY/MM/DD/HH".
	//
	// Experimental.
	DataOutputPrefix *string `field:"optional" json:"dataOutputPrefix" yaml:"dataOutputPrefix"`
	// The AWS KMS key used to encrypt the data that it delivers to your Amazon S3 bucket.
	// Default: - Data is not encrypted.
	//
	// Experimental.
	EncryptionKey awskms.IKey `field:"optional" json:"encryptionKey" yaml:"encryptionKey"`
	// A prefix that Kinesis Data Firehose evaluates and adds to failed records before writing them to S3.
	//
	// This prefix appears immediately following the bucket name.
	// See: https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html
	//
	// Default: "YYYY/MM/DD/HH".
	//
	// Experimental.
	ErrorOutputPrefix *string `field:"optional" json:"errorOutputPrefix" yaml:"errorOutputPrefix"`
	// If true, log errors when data transformation or data delivery fails.
	//
	// If `logGroup` is provided, this will be implicitly set to `true`.
	// Default: true - errors are logged.
	//
	// Experimental.
	Logging *bool `field:"optional" json:"logging" yaml:"logging"`
	// The CloudWatch log group where log streams will be created to hold error logs.
	// Default: - if `logging` is set to `true`, a log group will be created for you.
	//
	// Experimental.
	LogGroup awslogs.ILogGroup `field:"optional" json:"logGroup" yaml:"logGroup"`
	// The data transformation that should be performed on the data before writing to the destination.
	// Default: - no data transformation will occur.
	//
	// Experimental.
	Processor awscdkkinesisfirehosealpha.IDataProcessor `field:"optional" json:"processor" yaml:"processor"`
	// The IAM role associated with this destination.
	//
	// Assumed by Kinesis Data Firehose to invoke processors and write to destinations.
	// Default: - a role will be created with default permissions.
	//
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
	// The configuration for backing up source records to S3.
	// Default: - source records will not be backed up to S3.
	//
	// Experimental.
	S3Backup *DestinationS3BackupProps `field:"optional" json:"s3Backup" yaml:"s3Backup"`
}

Props for defining an S3 destination of a Kinesis Data Firehose delivery stream.

Example:

var bucket bucket
// Provide a Lambda function that will transform records before delivery, with custom
// buffering and retry configuration
lambdaFunction := lambda.NewFunction(this, jsii.String("Processor"), &FunctionProps{
	Runtime: lambda.Runtime_NODEJS_LATEST(),
	Handler: jsii.String("index.handler"),
	Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("process-records"))),
})
lambdaProcessor := firehose.NewLambdaFunctionProcessor(lambdaFunction, &DataProcessorProps{
	BufferInterval: awscdk.Duration_Minutes(jsii.Number(5)),
	BufferSize: awscdk.Size_Mebibytes(jsii.Number(5)),
	Retries: jsii.Number(5),
})
s3Destination := destinations.NewS3Bucket(bucket, &S3BucketProps{
	Processor: lambdaProcessor,
})
firehose.NewDeliveryStream(this, jsii.String("Delivery Stream"), &DeliveryStreamProps{
	Destinations: []iDestination{
		s3Destination,
	},
})

Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL