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

@aws-cdk/aws-pipes-alpha: add missing L2 constructs that implement ILogDestination interface #31671

Closed
2 tasks
garysassano opened this issue Oct 6, 2024 · 2 comments · Fixed by #31672
Closed
2 tasks
Labels
@aws-cdk/aws-logs Related to Amazon CloudWatch Logs effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@garysassano
Copy link

Describe the feature

Current Behavior

Currently, to add a CloudWatch log group as a destination for a Pipe, developers must manually implement the ILogDestination interface:

const logGroup = new LogGroup(this, "LogGroup", {
  retention: RetentionDays.THREE_MONTHS,
  removalPolicy: RemovalPolicy.DESTROY,
});

const cwLogGroupDestination: ILogDestination = {
  bind: () => ({
    parameters: {
      cloudwatchLogsLogDestination: {
        logGroupArn: logGroup.logGroupArn,
      },
    },
  }),
  grantPush: (grantee) => {
    logGroup.grantWrite(grantee);
  },
};

new Pipe(this, "Pipe", {
  logDestinations: [cwLogGroupDestination],
});

Proposed Solution

We should introduce three new L2 constructs implementing the ILogDestination interface to improve developer experience. The expected usage would be more straightforward:

const logGroup = new LogGroup(this, "LogGroup", {
  retention: RetentionDays.THREE_MONTHS,
  removalPolicy: RemovalPolicy.DESTROY,
});

new Pipe(this, "Pipe", {
  logDestinations: [new CloudwatchLogsLogDestination(logGroup)],
});

Implementation Details

We need to create three classes that implement ILogDestination, corresponding to the options defined in the LogDestinationParameters interface:

  1. CloudwatchLogsLogDestination
  2. FirehoseLogDestination
  3. S3LogDestination

These class names align with the existing property names in the LogDestinationParameters interface:

/**
 * Log destination configuration parameters.
 */
export interface LogDestinationParameters {
    /**
     * The logging configuration settings for the pipe.
     *
     * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipelogconfiguration.html#cfn-pipes-pipe-pipelogconfiguration-cloudwatchlogslogdestination
     *
     * @default - none
     */
    readonly cloudwatchLogsLogDestination?: CfnPipe.CloudwatchLogsLogDestinationProperty;
    /**
     * The Amazon Kinesis Data Firehose logging configuration settings for the pipe.
     *
     * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipelogconfiguration.html#cfn-pipes-pipe-pipelogconfiguration-firehoselogdestination
     *
     * @default - none
     */
    readonly firehoseLogDestination?: CfnPipe.FirehoseLogDestinationProperty;
    /**
     * The Amazon S3 logging configuration settings for the pipe.
     *
     * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipelogconfiguration.html#cfn-pipes-pipe-pipelogconfiguration-s3logdestination
     *
     * @default - none
     */
    readonly s3LogDestination?: CfnPipe.S3LogDestinationProperty;
}

Use Case

This enhancement will significantly improve the developer experience when working with log destinations in CDK Pipes, making it more consistent with the expected L2 construct patterns.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.161.1

Environment details (OS name and version, etc.)

Ubuntu 24.04

@garysassano garysassano added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 6, 2024
@github-actions github-actions bot added the @aws-cdk/aws-logs Related to Amazon CloudWatch Logs label Oct 6, 2024
@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Oct 6, 2024
@mergify mergify bot closed this as completed in #31672 Nov 27, 2024
@mergify mergify bot closed this as completed in af5345e Nov 27, 2024
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

1 similar comment
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2024
mazyu36 pushed a commit to mazyu36/aws-cdk that referenced this issue Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-logs Related to Amazon CloudWatch Logs effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants