aws / aws/aws-cdk

aws_apigateway: obtain DomainName instead of IDomainName

Open
#28,203 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-apigateway effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Make it possible to retrieve the DomainName from the arn. Now it is only possible on retrieving the IDomainName, not the DomainName.

### Use Case

With apigateway v1 it is possible to add Api Mappings to a certain stage in your API gateway. This feature is recently added and ported from apigateway v2.

The addApiMapping method can be used on the DomainName. When the DomainName is created in another stack, and shared inside a project, we only can get the IDomainName and not the DomainName. The IDomainName is retrieved using the following code:

` const domainName = DomainName.fromDomainNameAttributes(this, "DomainName", {
domainName: xxx,
domainNameAliasHostedZoneId: yyy,
domainNameAliasTarget: zzz,
});
`

As this is returning an IDomainName I can not perform addApiMapping on it.

### Proposed Solution

It would be nice if we could do

`
const domainName: DomainName = DomainName.fromAttributes(this, "att", {
domainNameArn: "arn:xxx:xxx:xxx"
})
`

### 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.111.0

### Environment details (OS name and version, etc.)

Mac

Contributor guide

Open the contributing guide

Research direction

Start with the aws_apigateway DomainName entry points shown in the issue: fromDomainNameAttributes, the proposed fromAttributes, and addApiMapping. Compare how an imported IDomainName is exposed with the concrete DomainName API, then inspect existing API Gateway import tests if available. Done means a DomainName can be retrieved from a domainNameArn and used with addApiMapping when shared across stacks.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
api, cloud
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.