-
Notifications
You must be signed in to change notification settings - Fork 4k
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(pipelines): allow disabling of KMS keys #10396
Changes from 4 commits
6d2f23b
84a3e31
845291f
ef81751
c28e0f8
9cb3671
df3ef4c
b66bf0e
6ff7653
98c67d7
9d58892
bd3bdbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Aws, ResourceEnvironment } from '@aws-cdk/core'; | ||
import { IAction } from './action'; | ||
|
||
/** | ||
* Helper routines to work with Actions | ||
* | ||
* Can't put these on Action themselves since we only have an interface | ||
* and every library would need to reimplement everything (there is no | ||
* `ActionBase`). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we introduce it now and add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could have, but since we have a ticket for properly refactoring |
||
* | ||
* So here go the members that should have gone onto the Action class | ||
* but can't. | ||
* | ||
* It was probably my own idea but I don't want it anymore: | ||
* https://github.com/aws/aws-cdk/issues/10393 | ||
*/ | ||
export class EnhancedAction { | ||
constructor(private readonly action: IAction) { | ||
} | ||
|
||
/** | ||
* The environment this action runs in | ||
*/ | ||
public get env(): ResourceEnvironment { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have to say, I don't love this class. I feel like this would be better served as a helper function, or private method in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is effectively a helper function, except modeled as a richer class instead of a static method. The following: new EnhancedAction(action).env
ActionHelpers.env(action) Are effectively the same thing. Except the first feels "better" to me. It's more OO. It's like Rich Wrappers in Scala (except explicit instead of implicit). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't agree that a class whose only possible usage is interface Whatevs {
value: string;
} , you should do this: class Whatevs {
private _value: string;
public get value(): string { return this._value; }
public set value(value: string): void { this._value = value; }
} because it's "more OO".
I don't actually think this should be a static method. This should be a private method of the |
||
return { | ||
account: (this.action.actionProperties.role?.env.account | ||
?? this.action.actionProperties?.resource?.env.account | ||
?? this.action.actionProperties.account | ||
?? Aws.ACCOUNT_ID), | ||
region: (this.action.actionProperties.resource?.env.region | ||
?? this.action.actionProperties.region | ||
?? Aws.REGION), | ||
}; | ||
} | ||
|
||
}; |
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.
Isn't our standard to use
lib/private/
for private classes. What's the_
prefix in the file name?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.
We have both (I started the
lib/private
convention, Elad prefers the_prefix.ts
convention). At the moment my opinion is that one or a few files can have a_
prefix. If there grow to be too many, move to a/private/
folder.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.
Feels weird. We should standardize to one of the two.
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.
+1 on moving this to
private/
(there are a few different private files in this module already, maybe it makes sense to move those there as well).