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(rds): add clusterArn property to IServerlessCluster #10741

Merged
merged 9 commits into from Oct 6, 2020

Conversation

asterikx
Copy link
Contributor

@asterikx asterikx commented Oct 6, 2020

This PR adds a property clusterArn to IServerlessCluster. 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

@asterikx asterikx changed the title feat(module): add clusterArn property to IServerlessCluster feat(rds): add clusterArn property to IServerlessCluster Oct 6, 2020
Copy link
Contributor

@shivlaks shivlaks left a 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 🙂

yarn.lock Outdated Show resolved Hide resolved
Comment on lines 637 to 651
// THEN
expect(stack).to(haveOutput({
exportName,
outputValue: {
'Fn::Join': [
'',
[
'arn:',
{ Ref: 'AWS::Partition' },
':rds:us-test-1:12345:cluster:',
{ Ref: 'DatabaseB269D8BB' },
],
],
},
}));
Copy link
Contributor

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?

Copy link
Contributor Author

@asterikx asterikx Oct 6, 2020

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:

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?

Copy link
Contributor Author

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?

Copy link
Contributor Author

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 ;)

Copy link
Contributor

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 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perfect, thanks :)

packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed shivlaks’s stale review October 6, 2020 20:39

Pull request has been modified.

skinny85
skinny85 previously approved these changes Oct 6, 2020
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

LGTM!

@mergify mergify bot dismissed skinny85’s stale review October 6, 2020 21:23

Pull request has been modified.

Copy link
Contributor

@shivlaks shivlaks left a 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!!

@shivlaks shivlaks added the pr-linter/exempt-readme The PR linter will not require README changes label Oct 6, 2020
@skinny85 skinny85 assigned shivlaks and unassigned skinny85 Oct 6, 2020
@mergify
Copy link
Contributor

mergify bot commented Oct 6, 2020

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-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 4a2f96d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Oct 6, 2020

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).

@mergify mergify bot merged commit 1559fe9 into aws:master Oct 6, 2020
@asterikx asterikx deleted the serverlesscluster-resource-arn-prop branch October 6, 2020 23:46
mergify bot pushed a commit that referenced this pull request Feb 29, 2024
### 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*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-linter/exempt-readme The PR linter will not require README changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[rds] Add resource ARN property to IServerlessCluster
4 participants