Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kinesisfirehose): add HTTP Endpoint and Datadog destination #33657

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
fix: add default compression and add some test coverage
  • Loading branch information
Benjamin Pottier authored and benjaminpottier committed Mar 5, 2025
commit e90ec981a2300e969857f0dae3d1b67457f820e2
3 changes: 2 additions & 1 deletion packages/aws-cdk-lib/aws-kinesisfirehose/lib/datadog.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HTTPAttribute, HTTPBackupMode, HTTPEndpoint } from './http-endpoint';
import { HTTPAttribute, HTTPBackupMode, HTTPCompression, HTTPEndpoint } from './http-endpoint';
import { ISecret } from '../../aws-secretsmanager';
import { Duration, Size } from '../../core';

@@ -118,6 +118,7 @@ export class Datadog extends HTTPEndpoint {
url: props.url,
secret: props.apiKey,
},
requestCompression: HTTPCompression.GZIP,
bufferingHints: {
interval: Duration.seconds(60),
size: Size.mebibytes(4),
Original file line number Diff line number Diff line change
@@ -151,7 +151,7 @@ export class HTTPEndpoint implements IDestination {
}) ?? {};

const { backupConfig, dependables: backupDependables } = createBackupConfig(scope, role, {
mode: S3BackupMode.FAILED,
mode: this.props.backupMode === HTTPBackupMode.ALL ? S3BackupMode.ALL : S3BackupMode.FAILED,
})!; // Probably not a good idea?

if (this.props.endpointConfig.secret) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import * as cdk from '../..';
import { Match, Template } from '../../assertions';
import * as iam from '../../aws-iam';
import * as secretsmanager from '../../aws-secretsmanager';
import * as firehose from '../lib';

describe('HTTP destination', () => {
let stack: cdk.Stack;

beforeEach(() => {
stack = new cdk.Stack();
});

it('provides defaults when only required configuration is provided', () => {
new firehose.DeliveryStream(stack, 'DeliveryStream', {
destination: new firehose.HTTPEndpoint({
endpointConfig: {
url: 'https://test-endpoint.com',
},
attributes: [{
name: 'source',
value: 'test',
}],
}),
});

Template.fromStack(stack).hasResourceProperties('AWS::KinesisFirehose::DeliveryStream', {
HttpEndpointDestinationConfiguration: {
RoleARN: {
'Fn::GetAtt': [
'DeliveryStreamHTTPDestinationRoleD8ECD827',
'Arn',
],
},
CloudWatchLoggingOptions: {
Enabled: true,
},
RequestConfiguration: {
ContentEncoding: 'NONE',
},
S3BackupMode: 'FailedDataOnly',
S3Configuration: {
RoleARN: {
'Fn::GetAtt': [
'DeliveryStreamHTTPDestinationRoleD8ECD827',
'Arn',
],
},
},
},
});
});
});