@linzjs/cdk-tags 1.1.0 → 1.3.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.
- package/README.md +21 -3
- package/build/src/index.d.ts +4 -3
- package/build/src/index.js +7 -7
- package/build/src/index.js.map +1 -1
- package/build/src/tags.d.ts +14 -0
- package/build/src/tags.js +17 -12
- package/build/src/tags.js.map +1 -1
- package/package.json +4 -4
- package/build/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -2,22 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
CDK construct to apply common tags to constructs
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
## Usage
|
|
7
6
|
|
|
8
7
|
To apply the common set of tags for a s3 bucket:
|
|
9
8
|
|
|
10
9
|
```typescript
|
|
11
|
-
import {applyTags, SecurityClassification} from '@linzjs/cdk-tags';
|
|
10
|
+
import { applyTags, SecurityClassification } from '@linzjs/cdk-tags';
|
|
12
11
|
|
|
13
|
-
const bucket = new Bucket(this, 'ImageryArchive')
|
|
12
|
+
const bucket = new Bucket(this, 'ImageryArchive');
|
|
14
13
|
|
|
15
14
|
applyTags(bucket, {
|
|
16
15
|
application: 'basemaps',
|
|
17
16
|
group: 'li',
|
|
18
17
|
classification: SecurityClassification.Unclassified,
|
|
19
18
|
data: { isMaster: true, isPublic: true, role: TagDataRole.Archive },
|
|
19
|
+
criticality: 'low',
|
|
20
20
|
});
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
To apply the common set of tags for multiple constructs:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { applyTags, SecurityClassification, TagsBase } from '@linzjs/cdk-tags';
|
|
27
|
+
|
|
28
|
+
const commonTags: TagsBase = {
|
|
29
|
+
application: 'basemaps',
|
|
30
|
+
group: 'li',
|
|
31
|
+
classification: SecurityClassification.Unclassified,
|
|
32
|
+
data: { isMaster: true, isPublic: true, role: TagDataRole.Archive },
|
|
33
|
+
criticality: 'low',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const bucket1 = new Bucket(this, 'ImageryArchive');
|
|
37
|
+
const bucket2 = new Bucket(this, 'AnotherImageryArchive');
|
|
23
38
|
|
|
39
|
+
applyTags(bucket1, commonTags);
|
|
40
|
+
applyTags(bucket2, commonTags);
|
|
41
|
+
```
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { getGitBuildInfo } from './build
|
|
2
|
-
export { SecurityClassification } from './security
|
|
3
|
-
export {
|
|
1
|
+
export { getGitBuildInfo } from './build';
|
|
2
|
+
export { SecurityClassification } from './security';
|
|
3
|
+
export type { TagsBase } from './tags';
|
|
4
|
+
export { applyTags, applyTagsData } from './tags';
|
package/build/src/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.applyTagsData = exports.applyTags = exports.SecurityClassification = exports.getGitBuildInfo = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "getGitBuildInfo", { enumerable: true, get: function () { return
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "SecurityClassification", { enumerable: true, get: function () { return
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "applyTags", { enumerable: true, get: function () { return
|
|
10
|
-
Object.defineProperty(exports, "applyTagsData", { enumerable: true, get: function () { return
|
|
4
|
+
var build_1 = require("./build");
|
|
5
|
+
Object.defineProperty(exports, "getGitBuildInfo", { enumerable: true, get: function () { return build_1.getGitBuildInfo; } });
|
|
6
|
+
var security_1 = require("./security");
|
|
7
|
+
Object.defineProperty(exports, "SecurityClassification", { enumerable: true, get: function () { return security_1.SecurityClassification; } });
|
|
8
|
+
var tags_1 = require("./tags");
|
|
9
|
+
Object.defineProperty(exports, "applyTags", { enumerable: true, get: function () { return tags_1.applyTags; } });
|
|
10
|
+
Object.defineProperty(exports, "applyTagsData", { enumerable: true, get: function () { return tags_1.applyTagsData; } });
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/build/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAA0C;AAAjC,wGAAA,eAAe,OAAA;AACxB,uCAAoD;AAA3C,kHAAA,sBAAsB,OAAA;AAE/B,+BAAkD;AAAzC,iGAAA,SAAS,OAAA;AAAE,qGAAA,aAAa,OAAA"}
|
package/build/src/tags.d.ts
CHANGED
|
@@ -42,6 +42,20 @@ export interface TagsBase {
|
|
|
42
42
|
* @see https://www.digital.govt.nz/standards-and-guidance/governance/managing-online-channels/security-and-privacy-for-websites/foundations/classify-information/
|
|
43
43
|
*/
|
|
44
44
|
classification: SecurityClassification;
|
|
45
|
+
/**
|
|
46
|
+
* Criticality of the resources
|
|
47
|
+
*/
|
|
48
|
+
criticality: 'critical' | 'high' | 'medium' | 'low';
|
|
49
|
+
/**
|
|
50
|
+
* THe responder team listed in OpsGenie.
|
|
51
|
+
* @see https://toitutewhenua.app.opsgenie.com/teams/list
|
|
52
|
+
*/
|
|
53
|
+
responderTeam?: string;
|
|
54
|
+
/**
|
|
55
|
+
* skip collection of git info, commit, version etc
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
skipGitInfo?: boolean;
|
|
45
59
|
/** Data classification tags */
|
|
46
60
|
data?: TagsData;
|
|
47
61
|
}
|
package/build/src/tags.js
CHANGED
|
@@ -17,28 +17,33 @@ function applyTags(construct, ctx) {
|
|
|
17
17
|
if (ctx.data?.isPublic && ctx.classification !== security_js_1.SecurityClassification.Unclassified) {
|
|
18
18
|
throw new Error('Only unclassified constructs can be made public');
|
|
19
19
|
}
|
|
20
|
-
const buildInfo = (0, build_js_1.getGitBuildInfo)();
|
|
20
|
+
const buildInfo = ctx.skipGitInfo ? undefined : (0, build_js_1.getGitBuildInfo)();
|
|
21
21
|
// applications tags
|
|
22
|
-
tag(construct, 'linz
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
tag(construct, 'linz.app.name', ctx.application);
|
|
23
|
+
if (buildInfo)
|
|
24
|
+
tag(construct, 'linz.app.version', buildInfo.version);
|
|
25
|
+
tag(construct, 'linz.environment', ctx.environment);
|
|
25
26
|
// Ownership tags
|
|
26
|
-
tag(construct, 'linz
|
|
27
|
+
tag(construct, 'linz.group', ctx.group);
|
|
28
|
+
tag(construct, 'linz.responder.team', ctx.responderTeam ?? 'NotSet');
|
|
29
|
+
tag(construct, 'linz.app.criticality', ctx.criticality);
|
|
27
30
|
// Git Tags
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
if (buildInfo)
|
|
32
|
+
tag(construct, 'linz.git.hash', buildInfo.hash);
|
|
33
|
+
tag(construct, 'linz.git.repository', process.env['GITHUB_REPOSITORY'] ?? ctx.repository);
|
|
30
34
|
// Github actions build information
|
|
31
|
-
|
|
35
|
+
if (buildInfo)
|
|
36
|
+
tag(construct, 'linz.build.id', buildInfo.buildId);
|
|
32
37
|
// Security
|
|
33
|
-
tag(construct, 'linz
|
|
38
|
+
tag(construct, 'linz.security.classification', ctx.classification);
|
|
34
39
|
if (ctx.data)
|
|
35
40
|
applyTagsData(construct, ctx.data);
|
|
36
41
|
}
|
|
37
42
|
exports.applyTags = applyTags;
|
|
38
43
|
function applyTagsData(construct, tags) {
|
|
39
|
-
tag(construct, 'linz
|
|
40
|
-
tag(construct, 'linz
|
|
41
|
-
tag(construct, 'linz
|
|
44
|
+
tag(construct, 'linz.data.role', tags.role);
|
|
45
|
+
tag(construct, 'linz.data.is-master', String(tags.isMaster ?? false));
|
|
46
|
+
tag(construct, 'linz.data.is-public', String(tags.isPublic ?? false));
|
|
42
47
|
}
|
|
43
48
|
exports.applyTagsData = applyTagsData;
|
|
44
49
|
//# sourceMappingURL=tags.js.map
|
package/build/src/tags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/tags.ts"],"names":[],"mappings":";;;AAAA,6CAAmC;AAGnC,yCAA6C;AAE7C,+CAAuD;
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/tags.ts"],"names":[],"mappings":";;;AAAA,6CAAmC;AAGnC,yCAA6C;AAE7C,+CAAuD;AAoEvD,6EAA6E;AAC7E,SAAS,GAAG,CAAC,SAAqB,EAAE,GAAW,EAAE,KAAgC;IAC/E,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO;IAC1B,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO;IAEzB,kBAAI,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACrC,CAAC;AAED,SAAgB,SAAS,CAAC,SAAqB,EAAE,GAAa;IAC5D,iCAAiC;IACjC,IAAI,GAAG,CAAC,IAAI,EAAE,QAAQ,IAAI,GAAG,CAAC,cAAc,KAAK,oCAAsB,CAAC,YAAY,EAAE,CAAC;QACrF,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,0BAAe,GAAE,CAAC;IAElE,oBAAoB;IACpB,GAAG,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACjD,IAAI,SAAS;QAAE,GAAG,CAAC,SAAS,EAAE,kBAAkB,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACrE,GAAG,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IAEpD,iBAAiB;IACjB,GAAG,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,CAAC,K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
|
5
5
|
"types": "build/src/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
|
-
"build"
|
|
7
|
+
"build/src"
|
|
8
8
|
],
|
|
9
9
|
"author": {
|
|
10
10
|
"name": "Land Information New Zealand",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
|
-
"url": "git://github.com/linz/cdk-
|
|
26
|
+
"url": "git://github.com/linz/cdk-tags.git",
|
|
27
27
|
"type": "git"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@linzjs/style": "^5.2.0",
|
|
35
|
-
"@types/node": "^20.
|
|
35
|
+
"@types/node": "^20.12.8"
|
|
36
36
|
}
|
|
37
37
|
}
|