I was going through the design principles docs. It...
# random
a
I was going through the design principles docs. It has this snippet of code which contains a couple of random
-
(hyphens), what are these? I’ve never seen these before, is this something new in javascript? Code snippet for reference :-
Copy code
cron.attachPermissions([
  new cdk.aws() -
    iam.PolicyStatement({
      actions: ["execute-api:Invoke"],
      effect: cdk.aws - iam.Effect.ALLOW,
      resources: [
        `arn:aws:execute-api:${region}:${account}:${api.httpApiId}/*`,
      ],
    }),
]);
a
Haahaha weird.
Might wrong formatting.
a
oh lol! That’d be weird. 😂
f
Oh no.. it’s definitely bad formatting, should be:
Copy code
import { PolicyStatement, Effect } from "@aws-cdk/aws-iam";

cron.attachPermissions([
  new PolicyStatement({
    actions: ["execute-api:Invoke"],
    effect: Effect.ALLOW,
    resources: [
      `arn:aws:execute-api:${region}:${account}:${api.httpApiId}/*`,
    ],
  }),
]);
Updated the doc
a
okay, good to know and thank you. I thought how did I miss a new js operator. 😅