You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I thought of an alternative convention to get rid of the .build() and to make the code more readable.
Something like this:
exampleFunction.addToRolePolicy(PolicyStatementFactory.buildPolicyStatement()// this returns a sub-class of the official PolicyStatement.setEffect(Effect.ALLOW).addResource(exampleBucket.bucketArn).addActions([Action.S3.LIST_BUCKET,Action.S3.PUT_OBJECT])// no final .build() here);
Basically, you wouldn't instantiate an object of class PolicyStatementFactory, but you'd use a static method to get an empty object of class GeneratedPolicyStatement, which would be a sub-class of PolicyStatement. I think this is also what @lusentis had in mind :)
The text was updated successfully, but these errors were encountered:
I thought of an alternative convention to get rid of the
.build()
and to make the code more readable.Something like this:
Basically, you wouldn't instantiate an object of class PolicyStatementFactory, but you'd use a static method to get an empty object of class
GeneratedPolicyStatement
, which would be a sub-class ofPolicyStatement
. I think this is also what @lusentis had in mind :)The text was updated successfully, but these errors were encountered: