-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(rds): add clusterArn property to IServerlessCluster #10741
feat(rds): add clusterArn property to IServerlessCluster #10741
Conversation
…rikx/aws-cdk into serverlesscluster-resource-arn-prop
…rikx/aws-cdk into serverlesscluster-resource-arn-prop
…rikx/aws-cdk into serverlesscluster-resource-arn-prop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asterikx looks good, thanks for the contribution!
I left some minor suggestions. We also need to drop the yarn.lock
before we can merge this one in 🙂
// THEN | ||
expect(stack).to(haveOutput({ | ||
exportName, | ||
outputValue: { | ||
'Fn::Join': [ | ||
'', | ||
[ | ||
'arn:', | ||
{ Ref: 'AWS::Partition' }, | ||
':rds:us-test-1:12345:cluster:', | ||
{ Ref: 'DatabaseB269D8BB' }, | ||
], | ||
], | ||
}, | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not directly compare the cluster.clusterArn
property to the expected value?
Is an output required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's actually not. I just took inspiration from the DocDB construct tests:
aws-cdk/packages/@aws-cdk/aws-docdb/lib/instance.ts
Lines 101 to 108 in 0297f31
public get instanceArn(): string { | |
return cdk.Stack.of(this).formatArn({ | |
service: 'docdb', | |
resource: 'db', | |
sep: ':', | |
resourceName: this.instanceIdentifier, | |
}); | |
} |
Should I compare the values directly instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tired:
test.deepEqual(cluster.clusterArn, 'arn:rds:us-test-1:12345:cluster:DatabaseB269D8BB');
but that one fails with:
AssertionError: 'arn:${Token[AWS.Partition.3]}:rds:us-test-1:12345:cluster:${Token[TOKEN.13366]}' deepEqual 'arn:rds:us-test-1:12345:cluster:DatabaseB269D8BB'
Can you point me to an example on how to compare values directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect including token placeholders isn't the way to go ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'd need to do a stack.resolve(cluster.clusterArn)
to resolve the tokens 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asterikx awesome! thanks for contributing!!
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
### Issue # (if applicable) ### Reason for this change This is to bring parity with #10741, we need the cluster arn to enable data api manually waiting for #28574. ### Description of changes This adds a clusterArn property to IDatabaseCluster ### Description of how you validated changes The changes have been validated through a unit test ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This PR adds a property
clusterArn
toIServerlessCluster
. This simplifies the usage of the Data API which requires passing the ARN of the cluster in Data API calls.closes #10736
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license