@guardian/cdk 62.1.3 → 62.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  export * from "./policies";
2
2
  export * from "./roles";
3
3
  export * from "./fastly-logs-iam";
4
+ export * from "./janus-assumable-role";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constructs/iam/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constructs/iam/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./policies"), exports);
18
18
  __exportStar(require("./roles"), exports);
19
19
  __exportStar(require("./fastly-logs-iam"), exports);
20
+ __exportStar(require("./janus-assumable-role"), exports);
20
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constructs/iam/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0CAAwB;AACxB,oDAAkC","sourcesContent":["export * from \"./policies\";\nexport * from \"./roles\";\nexport * from \"./fastly-logs-iam\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constructs/iam/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0CAAwB;AACxB,oDAAkC;AAClC,yDAAuC","sourcesContent":["export * from \"./policies\";\nexport * from \"./roles\";\nexport * from \"./fastly-logs-iam\";\nexport * from \"./janus-assumable-role\";\n"]}
@@ -0,0 +1,34 @@
1
+ import type { GuStack } from "../core";
2
+ import { GuRole } from "./roles";
3
+ export interface GuJanusAssumableRoleProps {
4
+ /**
5
+ * Tells Janus which ProvisionedRole this IAM role is part of.
6
+ */
7
+ janusPermission: string;
8
+ /**
9
+ * A friendly name for this IAM role to be shown in Janus.
10
+ * It should help Janus users to choose the right role.
11
+ */
12
+ janusName?: string;
13
+ /**
14
+ * A description of this IAM role to be shown in Janus.
15
+ * It should help Janus users to choose the right role.
16
+ */
17
+ janusDescription?: string;
18
+ }
19
+ /**
20
+ * Construct that creates an IAM role with the additional tags that Janus uses to find the role
21
+ * and its metadata.
22
+ *
23
+ * ```typescript
24
+ * new GuJanusAssumableRole(stack, {
25
+ * janusPermission: "some-app-dev",
26
+ * janusName: "Some App Developer",
27
+ * janusDescription: "Description of role that will be shown in Janus.",
28
+ * })
29
+ * ```
30
+ */
31
+ export declare class GuJanusAssumableRole extends GuRole {
32
+ constructor(scope: GuStack, props: GuJanusAssumableRoleProps);
33
+ }
34
+ //# sourceMappingURL=janus-assumable-role.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"janus-assumable-role.d.ts","sourceRoot":"","sources":["../../../src/constructs/iam/janus-assumable-role.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,oBAAqB,SAAQ,MAAM;gBAClC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,yBAAyB;CAiB7D"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GuJanusAssumableRole = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ const aws_iam_1 = require("aws-cdk-lib/aws-iam");
6
+ const aws_ssm_1 = require("aws-cdk-lib/aws-ssm");
7
+ const roles_1 = require("./roles");
8
+ /**
9
+ * Construct that creates an IAM role with the additional tags that Janus uses to find the role
10
+ * and its metadata.
11
+ *
12
+ * ```typescript
13
+ * new GuJanusAssumableRole(stack, {
14
+ * janusPermission: "some-app-dev",
15
+ * janusName: "Some App Developer",
16
+ * janusDescription: "Description of role that will be shown in Janus.",
17
+ * })
18
+ * ```
19
+ */
20
+ class GuJanusAssumableRole extends roles_1.GuRole {
21
+ constructor(scope, props) {
22
+ // Existing SSM param in stack account that holds Janus user ARN
23
+ const janusArnParamValue = aws_ssm_1.StringParameter.valueForStringParameter(scope, "/security/janus/user-arn");
24
+ super(scope, `${props.janusPermission}Role`, {
25
+ // Will be assumed by Janus user
26
+ assumedBy: new aws_iam_1.ArnPrincipal(janusArnParamValue),
27
+ });
28
+ const tags = aws_cdk_lib_1.Tags.of(this);
29
+ tags.add("gu:janus:discoverable", "true");
30
+ tags.add("gu:janus:permission", props.janusPermission);
31
+ if (props.janusName) {
32
+ tags.add("gu:janus:name", props.janusName);
33
+ }
34
+ if (props.janusDescription) {
35
+ tags.add("gu:janus:description", props.janusDescription);
36
+ }
37
+ }
38
+ }
39
+ exports.GuJanusAssumableRole = GuJanusAssumableRole;
40
+ //# sourceMappingURL=janus-assumable-role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"janus-assumable-role.js","sourceRoot":"","sources":["../../../src/constructs/iam/janus-assumable-role.ts"],"names":[],"mappings":";;;AAAA,6CAAmC;AACnC,iDAAmD;AACnD,iDAAsD;AAEtD,mCAAiC;AAqBjC;;;;;;;;;;;GAWG;AACH,MAAa,oBAAqB,SAAQ,cAAM;IAC9C,YAAY,KAAc,EAAE,KAAgC;QAC1D,gEAAgE;QAChE,MAAM,kBAAkB,GAAG,yBAAe,CAAC,uBAAuB,CAAC,KAAK,EAAE,0BAA0B,CAAC,CAAC;QACtG,KAAK,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,eAAe,MAAM,EAAE;YAC3C,gCAAgC;YAChC,SAAS,EAAE,IAAI,sBAAY,CAAC,kBAAkB,CAAC;SAChD,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,kBAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;QACvD,IAAI,KAAK,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;SAC5C;QACD,IAAI,KAAK,CAAC,gBAAgB,EAAE;YAC1B,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;SAC1D;IACH,CAAC;CACF;AAlBD,oDAkBC","sourcesContent":["import { Tags } from \"aws-cdk-lib\";\nimport { ArnPrincipal } from \"aws-cdk-lib/aws-iam\";\nimport { StringParameter } from \"aws-cdk-lib/aws-ssm\";\nimport type { GuStack } from \"../core\";\nimport { GuRole } from \"./roles\";\n\nexport interface GuJanusAssumableRoleProps {\n /**\n * Tells Janus which ProvisionedRole this IAM role is part of.\n */\n janusPermission: string;\n\n /**\n * A friendly name for this IAM role to be shown in Janus.\n * It should help Janus users to choose the right role.\n */\n janusName?: string;\n\n /**\n * A description of this IAM role to be shown in Janus.\n * It should help Janus users to choose the right role.\n */\n janusDescription?: string;\n}\n\n/**\n * Construct that creates an IAM role with the additional tags that Janus uses to find the role\n * and its metadata.\n *\n * ```typescript\n * new GuJanusAssumableRole(stack, {\n * janusPermission: \"some-app-dev\",\n * janusName: \"Some App Developer\",\n * janusDescription: \"Description of role that will be shown in Janus.\",\n * })\n * ```\n */\nexport class GuJanusAssumableRole extends GuRole {\n constructor(scope: GuStack, props: GuJanusAssumableRoleProps) {\n // Existing SSM param in stack account that holds Janus user ARN\n const janusArnParamValue = StringParameter.valueForStringParameter(scope, \"/security/janus/user-arn\");\n super(scope, `${props.janusPermission}Role`, {\n // Will be assumed by Janus user\n assumedBy: new ArnPrincipal(janusArnParamValue),\n });\n const tags = Tags.of(this);\n tags.add(\"gu:janus:discoverable\", \"true\");\n tags.add(\"gu:janus:permission\", props.janusPermission);\n if (props.janusName) {\n tags.add(\"gu:janus:name\", props.janusName);\n }\n if (props.janusDescription) {\n tags.add(\"gu:janus:description\", props.janusDescription);\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@guardian/cdk",
3
3
  "description": "Generic Guardian flavoured AWS CDK components",
4
- "version": "62.1.3",
4
+ "version": "62.2.0",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "files": [
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@changesets/cli": "2.29.7",
35
- "@guardian/eslint-config": "12.0.1",
35
+ "@guardian/eslint-config": "13.0.0",
36
36
  "@guardian/eslint-plugin-tsdoc-required": "^0.1.3",
37
37
  "@guardian/tsconfig": "^1.0.1",
38
38
  "@types/git-url-parse": "^9.0.3",