Skip to content

Commit

Permalink
feat(cdk): expose authorizer id and authorization type (#31622)
Browse files Browse the repository at this point in the history
### Issue # (if applicable)

Closes #31605.

### Reason for this change

I need to access the authorizer id and type to be able to import the authorizer in another CDK project

### Description of changes

I have added a public readonly variable for the authorizationType that was previously a string in the return object from the bind function. 
I have also added a getter that will return the authorizerId after the first binding. If not bound yet it will throw an error.

### Description of how you validated changes

I have added unit tests for all changed files.

### 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*
  • Loading branch information
JonWallsten authored Oct 8, 2024
1 parent 0a56c0d commit daaf0aa
Show file tree
Hide file tree
Showing 35 changed files with 420 additions and 166 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "d7d3785243d748927f2a8d6edcecf909f96191df27a815e305aaeba98bcd2c64.zip"
"S3Key": "9b3143f6d2fe3103f2f3162c221163ad6a5a0ba2219cc1e5af2e300325588714.zip"
},
"Handler": "index.handler",
"Role": {
Expand Down Expand Up @@ -360,7 +360,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "54deaef2af5b9afbfc9cbcbb9261b1c0d4cce6560831d7ae1959f3da899011c8.zip"
"S3Key": "0793b3c94d0be9d628975dbbcd1dc523196de50a41fb1920880248ae3c24259b.zip"
},
"Handler": "index.handler",
"Role": {
Expand Down Expand Up @@ -497,6 +497,14 @@
]
]
}
},
"AuthorizerId": {
"Value": {
"Ref": "MyHttpApiLambdaAuthorizerB8A0E2A4"
}
},
"AuthorizationType": {
"Value": "CUSTOM"
}
},
"Parameters": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ new CfnOutput(stack, 'URL', {
});
new CfnOutput(stack, 'URLWithDefaultAuthorizer', {
value: httpApiWithDefaultAuthorizer.url!,
});
});
new CfnOutput(stack, 'AuthorizerId', {
value: authorizer.authorizerId,
});
new CfnOutput(stack, 'AuthorizationType', {
value: authorizer.authorizationType,
});
Loading

0 comments on commit daaf0aa

Please sign in to comment.