feat(spec2cdk): add actions() method to Grants classes#36987
feat(spec2cdk): add actions() method to Grants classes#36987mergify[bot] merged 11 commits intomainfrom
actions() method to Grants classes#36987Conversation
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
| "/* eslint-disable prettier/prettier, @stylistic/max-len */ | ||
| import * as sns from "./sns.generated"; | ||
| import * as iam from "aws-cdk-lib/aws-iam"; | ||
| import * as cdk from "aws-cdk-lib"; |
There was a problem hiding this comment.
Whatever needs changing to make this to import from core directly
| import * as cdk from "aws-cdk-lib"; | |
| import * as cdk from "aws-cdk-lib/core"; |
There was a problem hiding this comment.
Hmm this test is misleading, because in @aws-cdk/aws-elasticache-alpha, we already have:
import * as cdk from "aws-cdk-lib/core";and in aws-sns we have:
import * as cdk from "../../core/lib";|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue StatusRule:
This pull request spent 28 minutes 54 seconds in the queue, with no time running CI. Required conditions to merge
ReasonThe merge conditions cannot be satisfied due to failing checks HintYou may have to fix your CI before adding the pull request to the queue again. |
Merge Queue Status
This pull request spent 28 minutes 54 seconds in the queue, with no time running CI. Required conditions to merge
ReasonThe merge conditions cannot be satisfied due to failing checks HintYou may have to fix your CI before adding the pull request to the queue again. |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status
This pull request spent 7 seconds in the queue, with no time running CI. Required conditions to merge
|
|
Comments on closed issues and PRs are hard for our team to see. |
Overview
We have a mechanism to generate specific grant methods (in
<Resource>Grants) classes using agrants.jsonfile as a source of truth. So, for instance, if we configure methodspublishandsubscribein the file, we will get apublish()and asubscribe()method in the class.But it's also important to have an open ended method, that allows users to assign arbitrary permissions to the resource in question. This is already being done in the manually written Grants classes, and the convention that arose was to call this methods
actions(). This PR introduces the generation of such methods, alongside the specific ones declared in the file.An example:
Implementation notes
The method signature takes three parameter:
grantee,actionsandoptions. Let's focus onoptionsbecause the other two are straightforward. The type of this parameter can be eitherPermissionsOptionsorEncryptedPermissionsOptions, depending on whether the resource is an "encrypted resource". See definitions below.A resource is considered encrypted (a better name would have been "encryptable", but it's too late now), if at least one of the specific methods define a
keyActionsarray, or if the attributeisEncryptedis set to true for the resource. This is a new attribute, being introduced in this PR.The generated code of the specific methods was now changed to take advantage of this new common method. So, for example, the methods in
TopicGrantsare now:By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license