Skip to content

Conversation

otaviomacedo
Copy link
Contributor

@otaviomacedo otaviomacedo commented Aug 5, 2025

First batch of L2 interfaces that extend the new I[ResourceName]Ref interfaces. Example:

export interface IDomainName extends IResource, IDomainNameRef {

The goal is to allow classes that now only consume L2 resources, to consume both L1 or L2 via this new interface. Continuing with the example, this is what ApiMappingProps looks like:

export interface ApiMappingProps {
  ...
  /**
   * custom domain name of the mapping target
   */
  readonly domainName: IDomainName; // <-- L2 interface
  ...
}

At the moment, ApiMappingProps.domainName can only be an L2. This change will allow us to make ApiMappingProps more generic:

export interface ApiMappingProps {
  ...
  /**
   * custom domain name of the mapping target
   */
  readonly domainName: IDomainNameRef;
  ...
}
const dn = new CfnDomainName(stack, 'DomainName', {
  domainName,
});

new ApiMapping(stack, 'Mapping', {
  // More generic: we can still use an L2, but also an L1, as in this case, 
  // since CfnDomainName also extends IDomainNameRef
  domainName: dn, 

  api,
  stage: beta,
  apiMappingKey: 'beta',
});

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team August 5, 2025 09:32
@github-actions github-actions bot added the p2 label Aug 5, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Aug 5, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter fails with the following errors:

❌ Features must contain a change to a README file.
❌ Features must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

@otaviomacedo otaviomacedo changed the title feat: L2 interfaces extend ICfn[ResourceName] feat: make L2 interfaces extend I[ResourceName]Ref Aug 13, 2025
Copy link
Contributor

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 Aug 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contribution/core This is a PR that came from AWS. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants