@infrascan/aws-cloudwatch-logs-scanner 0.3.1 → 0.3.2

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,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/generated/client.ts
@@ -24,7 +34,10 @@ __export(client_exports, {
24
34
  });
25
35
  module.exports = __toCommonJS(client_exports);
26
36
  var import_client_cloudwatch_logs = require("@aws-sdk/client-cloudwatch-logs");
37
+ var import_debug = __toESM(require("debug"));
38
+ var clientDebug = (0, import_debug.default)("cloudwatch-logs:client");
27
39
  function getClient(credentials, context, retryStrategy) {
40
+ clientDebug("Creating instance with context", context);
28
41
  return new import_client_cloudwatch_logs.CloudWatchLogsClient({
29
42
  credentials,
30
43
  region: context.region,
@@ -1,6 +1,9 @@
1
1
  // src/generated/client.ts
2
2
  import { CloudWatchLogsClient } from "@aws-sdk/client-cloudwatch-logs";
3
+ import debug from "debug";
4
+ var clientDebug = debug("cloudwatch-logs:client");
3
5
  function getClient(credentials, context, retryStrategy) {
6
+ clientDebug("Creating instance with context", context);
4
7
  return new CloudWatchLogsClient({
5
8
  credentials,
6
9
  region: context.region,
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/generated/getters.ts
@@ -26,9 +36,11 @@ __export(getters_exports, {
26
36
  module.exports = __toCommonJS(getters_exports);
27
37
  var import_core = require("@infrascan/core");
28
38
  var import_client_cloudwatch_logs = require("@aws-sdk/client-cloudwatch-logs");
39
+ var import_debug = __toESM(require("debug"));
29
40
  async function DescribeLogGroups(client, stateConnector, context) {
41
+ const getterDebug = (0, import_debug.default)("cloudwatch-logs:DescribeLogGroups");
30
42
  const state = [];
31
- console.log("cloudwatch-logs DescribeLogGroups");
43
+ getterDebug("Fetching state");
32
44
  let pagingToken;
33
45
  do {
34
46
  const preparedParams = {};
@@ -42,6 +54,11 @@ async function DescribeLogGroups(client, stateConnector, context) {
42
54
  _result: result
43
55
  });
44
56
  pagingToken = result.nextToken;
57
+ if (pagingToken != null) {
58
+ getterDebug("Found pagination token in response");
59
+ } else {
60
+ getterDebug("No pagination token found in response");
61
+ }
45
62
  } catch (err) {
46
63
  if (err instanceof import_client_cloudwatch_logs.CloudWatchLogsServiceException) {
47
64
  if (err?.$retryable) {
@@ -55,6 +72,7 @@ async function DescribeLogGroups(client, stateConnector, context) {
55
72
  pagingToken = void 0;
56
73
  }
57
74
  } while (pagingToken != null);
75
+ getterDebug("Recording state");
58
76
  await stateConnector.onServiceScanCompleteCallback(
59
77
  context.account,
60
78
  context.region,
@@ -64,8 +82,9 @@ async function DescribeLogGroups(client, stateConnector, context) {
64
82
  );
65
83
  }
66
84
  async function DescribeSubscriptionFilters(client, stateConnector, context) {
85
+ const getterDebug = (0, import_debug.default)("cloudwatch-logs:DescribeSubscriptionFilters");
67
86
  const state = [];
68
- console.log("cloudwatch-logs DescribeSubscriptionFilters");
87
+ getterDebug("Fetching state");
69
88
  const resolvers = [
70
89
  {
71
90
  Key: "logGroupName",
@@ -92,6 +111,11 @@ async function DescribeSubscriptionFilters(client, stateConnector, context) {
92
111
  _result: result
93
112
  });
94
113
  pagingToken = result.nextToken;
114
+ if (pagingToken != null) {
115
+ getterDebug("Found pagination token in response");
116
+ } else {
117
+ getterDebug("No pagination token found in response");
118
+ }
95
119
  } catch (err) {
96
120
  if (err instanceof import_client_cloudwatch_logs.CloudWatchLogsServiceException) {
97
121
  if (err?.$retryable) {
@@ -106,6 +130,7 @@ async function DescribeSubscriptionFilters(client, stateConnector, context) {
106
130
  }
107
131
  } while (pagingToken != null);
108
132
  }
133
+ getterDebug("Recording state");
109
134
  await stateConnector.onServiceScanCompleteCallback(
110
135
  context.account,
111
136
  context.region,
@@ -5,9 +5,11 @@ import {
5
5
  DescribeLogGroupsCommand,
6
6
  DescribeSubscriptionFiltersCommand
7
7
  } from "@aws-sdk/client-cloudwatch-logs";
8
+ import debug from "debug";
8
9
  async function DescribeLogGroups(client, stateConnector, context) {
10
+ const getterDebug = debug("cloudwatch-logs:DescribeLogGroups");
9
11
  const state = [];
10
- console.log("cloudwatch-logs DescribeLogGroups");
12
+ getterDebug("Fetching state");
11
13
  let pagingToken;
12
14
  do {
13
15
  const preparedParams = {};
@@ -21,6 +23,11 @@ async function DescribeLogGroups(client, stateConnector, context) {
21
23
  _result: result
22
24
  });
23
25
  pagingToken = result.nextToken;
26
+ if (pagingToken != null) {
27
+ getterDebug("Found pagination token in response");
28
+ } else {
29
+ getterDebug("No pagination token found in response");
30
+ }
24
31
  } catch (err) {
25
32
  if (err instanceof CloudWatchLogsServiceException) {
26
33
  if (err?.$retryable) {
@@ -34,6 +41,7 @@ async function DescribeLogGroups(client, stateConnector, context) {
34
41
  pagingToken = void 0;
35
42
  }
36
43
  } while (pagingToken != null);
44
+ getterDebug("Recording state");
37
45
  await stateConnector.onServiceScanCompleteCallback(
38
46
  context.account,
39
47
  context.region,
@@ -43,8 +51,9 @@ async function DescribeLogGroups(client, stateConnector, context) {
43
51
  );
44
52
  }
45
53
  async function DescribeSubscriptionFilters(client, stateConnector, context) {
54
+ const getterDebug = debug("cloudwatch-logs:DescribeSubscriptionFilters");
46
55
  const state = [];
47
- console.log("cloudwatch-logs DescribeSubscriptionFilters");
56
+ getterDebug("Fetching state");
48
57
  const resolvers = [
49
58
  {
50
59
  Key: "logGroupName",
@@ -71,6 +80,11 @@ async function DescribeSubscriptionFilters(client, stateConnector, context) {
71
80
  _result: result
72
81
  });
73
82
  pagingToken = result.nextToken;
83
+ if (pagingToken != null) {
84
+ getterDebug("Found pagination token in response");
85
+ } else {
86
+ getterDebug("No pagination token found in response");
87
+ }
74
88
  } catch (err) {
75
89
  if (err instanceof CloudWatchLogsServiceException) {
76
90
  if (err?.$retryable) {
@@ -85,6 +99,7 @@ async function DescribeSubscriptionFilters(client, stateConnector, context) {
85
99
  }
86
100
  } while (pagingToken != null);
87
101
  }
102
+ getterDebug("Recording state");
88
103
  await stateConnector.onServiceScanCompleteCallback(
89
104
  context.account,
90
105
  context.region,
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/generated/graph.ts
@@ -25,19 +35,33 @@ __export(graph_exports, {
25
35
  });
26
36
  module.exports = __toCommonJS(graph_exports);
27
37
  var import_core = require("@infrascan/core");
38
+ var import_debug = __toESM(require("debug"));
39
+ var nodesDebug = (0, import_debug.default)("cloudwatch-logs:nodes");
28
40
  async function getNodes(stateConnector, context) {
41
+ nodesDebug("Fetching nodes");
29
42
  const state = [];
43
+ nodesDebug(
44
+ "Evaluating CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}"
45
+ );
30
46
  const DescribeSubscriptionFiltersNodes = await (0, import_core.evaluateSelector)(
31
47
  context.account,
32
48
  context.region,
33
49
  "CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}",
34
50
  stateConnector
35
51
  );
52
+ nodesDebug(
53
+ `Evaluated CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}: ${DescribeSubscriptionFiltersNodes.length} Nodes found`
54
+ );
36
55
  state.push(...DescribeSubscriptionFiltersNodes);
37
56
  return state.map((node) => (0, import_core.formatNode)(node, "CloudWatchLogs", context, true));
38
57
  }
58
+ var edgesDebug = (0, import_debug.default)("cloudwatch-logs:edges");
39
59
  async function getEdges(stateConnector) {
60
+ edgesDebug("Fetching edges");
40
61
  const edges = [];
62
+ edgesDebug(
63
+ "Evaluating CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]"
64
+ );
41
65
  const DescribeSubscriptionFiltersState1 = await (0, import_core.evaluateSelectorGlobally)(
42
66
  "CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]",
43
67
  stateConnector
@@ -53,6 +77,9 @@ async function getEdges(stateConnector) {
53
77
  }
54
78
  return (0, import_core.formatEdge)(source, target);
55
79
  });
80
+ edgesDebug(
81
+ `Evaluated CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]: ${DescribeSubscriptionFiltersEdges1.length} Edges found`
82
+ );
56
83
  edges.push(...DescribeSubscriptionFiltersEdges1);
57
84
  return edges;
58
85
  }
@@ -6,19 +6,33 @@ import {
6
6
  filterState,
7
7
  formatEdge
8
8
  } from "@infrascan/core";
9
+ import debug from "debug";
10
+ var nodesDebug = debug("cloudwatch-logs:nodes");
9
11
  async function getNodes(stateConnector, context) {
12
+ nodesDebug("Fetching nodes");
10
13
  const state = [];
14
+ nodesDebug(
15
+ "Evaluating CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}"
16
+ );
11
17
  const DescribeSubscriptionFiltersNodes = await evaluateSelector(
12
18
  context.account,
13
19
  context.region,
14
20
  "CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}",
15
21
  stateConnector
16
22
  );
23
+ nodesDebug(
24
+ `Evaluated CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}: ${DescribeSubscriptionFiltersNodes.length} Nodes found`
25
+ );
17
26
  state.push(...DescribeSubscriptionFiltersNodes);
18
27
  return state.map((node) => formatNode(node, "CloudWatchLogs", context, true));
19
28
  }
29
+ var edgesDebug = debug("cloudwatch-logs:edges");
20
30
  async function getEdges(stateConnector) {
31
+ edgesDebug("Fetching edges");
21
32
  const edges = [];
33
+ edgesDebug(
34
+ "Evaluating CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]"
35
+ );
22
36
  const DescribeSubscriptionFiltersState1 = await evaluateSelectorGlobally(
23
37
  "CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]",
24
38
  stateConnector
@@ -34,6 +48,9 @@ async function getEdges(stateConnector) {
34
48
  }
35
49
  return formatEdge(source, target);
36
50
  });
51
+ edgesDebug(
52
+ `Evaluated CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]: ${DescribeSubscriptionFiltersEdges1.length} Edges found`
53
+ );
37
54
  edges.push(...DescribeSubscriptionFiltersEdges1);
38
55
  return edges;
39
56
  }
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -26,7 +36,10 @@ module.exports = __toCommonJS(src_exports);
26
36
 
27
37
  // src/generated/client.ts
28
38
  var import_client_cloudwatch_logs = require("@aws-sdk/client-cloudwatch-logs");
39
+ var import_debug = __toESM(require("debug"));
40
+ var clientDebug = (0, import_debug.default)("cloudwatch-logs:client");
29
41
  function getClient(credentials, context, retryStrategy) {
42
+ clientDebug("Creating instance with context", context);
30
43
  return new import_client_cloudwatch_logs.CloudWatchLogsClient({
31
44
  credentials,
32
45
  region: context.region,
@@ -37,9 +50,11 @@ function getClient(credentials, context, retryStrategy) {
37
50
  // src/generated/getters.ts
38
51
  var import_core = require("@infrascan/core");
39
52
  var import_client_cloudwatch_logs2 = require("@aws-sdk/client-cloudwatch-logs");
53
+ var import_debug2 = __toESM(require("debug"));
40
54
  async function DescribeLogGroups(client, stateConnector, context) {
55
+ const getterDebug = (0, import_debug2.default)("cloudwatch-logs:DescribeLogGroups");
41
56
  const state = [];
42
- console.log("cloudwatch-logs DescribeLogGroups");
57
+ getterDebug("Fetching state");
43
58
  let pagingToken;
44
59
  do {
45
60
  const preparedParams = {};
@@ -53,6 +68,11 @@ async function DescribeLogGroups(client, stateConnector, context) {
53
68
  _result: result
54
69
  });
55
70
  pagingToken = result.nextToken;
71
+ if (pagingToken != null) {
72
+ getterDebug("Found pagination token in response");
73
+ } else {
74
+ getterDebug("No pagination token found in response");
75
+ }
56
76
  } catch (err) {
57
77
  if (err instanceof import_client_cloudwatch_logs2.CloudWatchLogsServiceException) {
58
78
  if (err?.$retryable) {
@@ -66,6 +86,7 @@ async function DescribeLogGroups(client, stateConnector, context) {
66
86
  pagingToken = void 0;
67
87
  }
68
88
  } while (pagingToken != null);
89
+ getterDebug("Recording state");
69
90
  await stateConnector.onServiceScanCompleteCallback(
70
91
  context.account,
71
92
  context.region,
@@ -75,8 +96,9 @@ async function DescribeLogGroups(client, stateConnector, context) {
75
96
  );
76
97
  }
77
98
  async function DescribeSubscriptionFilters(client, stateConnector, context) {
99
+ const getterDebug = (0, import_debug2.default)("cloudwatch-logs:DescribeSubscriptionFilters");
78
100
  const state = [];
79
- console.log("cloudwatch-logs DescribeSubscriptionFilters");
101
+ getterDebug("Fetching state");
80
102
  const resolvers = [
81
103
  {
82
104
  Key: "logGroupName",
@@ -103,6 +125,11 @@ async function DescribeSubscriptionFilters(client, stateConnector, context) {
103
125
  _result: result
104
126
  });
105
127
  pagingToken = result.nextToken;
128
+ if (pagingToken != null) {
129
+ getterDebug("Found pagination token in response");
130
+ } else {
131
+ getterDebug("No pagination token found in response");
132
+ }
106
133
  } catch (err) {
107
134
  if (err instanceof import_client_cloudwatch_logs2.CloudWatchLogsServiceException) {
108
135
  if (err?.$retryable) {
@@ -117,6 +144,7 @@ async function DescribeSubscriptionFilters(client, stateConnector, context) {
117
144
  }
118
145
  } while (pagingToken != null);
119
146
  }
147
+ getterDebug("Recording state");
120
148
  await stateConnector.onServiceScanCompleteCallback(
121
149
  context.account,
122
150
  context.region,
@@ -128,19 +156,33 @@ async function DescribeSubscriptionFilters(client, stateConnector, context) {
128
156
 
129
157
  // src/generated/graph.ts
130
158
  var import_core2 = require("@infrascan/core");
159
+ var import_debug3 = __toESM(require("debug"));
160
+ var nodesDebug = (0, import_debug3.default)("cloudwatch-logs:nodes");
131
161
  async function getNodes(stateConnector, context) {
162
+ nodesDebug("Fetching nodes");
132
163
  const state = [];
164
+ nodesDebug(
165
+ "Evaluating CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}"
166
+ );
133
167
  const DescribeSubscriptionFiltersNodes = await (0, import_core2.evaluateSelector)(
134
168
  context.account,
135
169
  context.region,
136
170
  "CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}",
137
171
  stateConnector
138
172
  );
173
+ nodesDebug(
174
+ `Evaluated CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}: ${DescribeSubscriptionFiltersNodes.length} Nodes found`
175
+ );
139
176
  state.push(...DescribeSubscriptionFiltersNodes);
140
177
  return state.map((node) => (0, import_core2.formatNode)(node, "CloudWatchLogs", context, true));
141
178
  }
179
+ var edgesDebug = (0, import_debug3.default)("cloudwatch-logs:edges");
142
180
  async function getEdges(stateConnector) {
181
+ edgesDebug("Fetching edges");
143
182
  const edges = [];
183
+ edgesDebug(
184
+ "Evaluating CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]"
185
+ );
144
186
  const DescribeSubscriptionFiltersState1 = await (0, import_core2.evaluateSelectorGlobally)(
145
187
  "CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]",
146
188
  stateConnector
@@ -156,6 +198,9 @@ async function getEdges(stateConnector) {
156
198
  }
157
199
  return (0, import_core2.formatEdge)(source, target);
158
200
  });
201
+ edgesDebug(
202
+ `Evaluated CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]: ${DescribeSubscriptionFiltersEdges1.length} Edges found`
203
+ );
159
204
  edges.push(...DescribeSubscriptionFiltersEdges1);
160
205
  return edges;
161
206
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,9 @@
1
1
  // src/generated/client.ts
2
2
  import { CloudWatchLogsClient } from "@aws-sdk/client-cloudwatch-logs";
3
+ import debug from "debug";
4
+ var clientDebug = debug("cloudwatch-logs:client");
3
5
  function getClient(credentials, context, retryStrategy) {
6
+ clientDebug("Creating instance with context", context);
4
7
  return new CloudWatchLogsClient({
5
8
  credentials,
6
9
  region: context.region,
@@ -15,9 +18,11 @@ import {
15
18
  DescribeLogGroupsCommand,
16
19
  DescribeSubscriptionFiltersCommand
17
20
  } from "@aws-sdk/client-cloudwatch-logs";
21
+ import debug2 from "debug";
18
22
  async function DescribeLogGroups(client, stateConnector, context) {
23
+ const getterDebug = debug2("cloudwatch-logs:DescribeLogGroups");
19
24
  const state = [];
20
- console.log("cloudwatch-logs DescribeLogGroups");
25
+ getterDebug("Fetching state");
21
26
  let pagingToken;
22
27
  do {
23
28
  const preparedParams = {};
@@ -31,6 +36,11 @@ async function DescribeLogGroups(client, stateConnector, context) {
31
36
  _result: result
32
37
  });
33
38
  pagingToken = result.nextToken;
39
+ if (pagingToken != null) {
40
+ getterDebug("Found pagination token in response");
41
+ } else {
42
+ getterDebug("No pagination token found in response");
43
+ }
34
44
  } catch (err) {
35
45
  if (err instanceof CloudWatchLogsServiceException) {
36
46
  if (err?.$retryable) {
@@ -44,6 +54,7 @@ async function DescribeLogGroups(client, stateConnector, context) {
44
54
  pagingToken = void 0;
45
55
  }
46
56
  } while (pagingToken != null);
57
+ getterDebug("Recording state");
47
58
  await stateConnector.onServiceScanCompleteCallback(
48
59
  context.account,
49
60
  context.region,
@@ -53,8 +64,9 @@ async function DescribeLogGroups(client, stateConnector, context) {
53
64
  );
54
65
  }
55
66
  async function DescribeSubscriptionFilters(client, stateConnector, context) {
67
+ const getterDebug = debug2("cloudwatch-logs:DescribeSubscriptionFilters");
56
68
  const state = [];
57
- console.log("cloudwatch-logs DescribeSubscriptionFilters");
69
+ getterDebug("Fetching state");
58
70
  const resolvers = [
59
71
  {
60
72
  Key: "logGroupName",
@@ -81,6 +93,11 @@ async function DescribeSubscriptionFilters(client, stateConnector, context) {
81
93
  _result: result
82
94
  });
83
95
  pagingToken = result.nextToken;
96
+ if (pagingToken != null) {
97
+ getterDebug("Found pagination token in response");
98
+ } else {
99
+ getterDebug("No pagination token found in response");
100
+ }
84
101
  } catch (err) {
85
102
  if (err instanceof CloudWatchLogsServiceException) {
86
103
  if (err?.$retryable) {
@@ -95,6 +112,7 @@ async function DescribeSubscriptionFilters(client, stateConnector, context) {
95
112
  }
96
113
  } while (pagingToken != null);
97
114
  }
115
+ getterDebug("Recording state");
98
116
  await stateConnector.onServiceScanCompleteCallback(
99
117
  context.account,
100
118
  context.region,
@@ -112,19 +130,33 @@ import {
112
130
  filterState,
113
131
  formatEdge
114
132
  } from "@infrascan/core";
133
+ import debug3 from "debug";
134
+ var nodesDebug = debug3("cloudwatch-logs:nodes");
115
135
  async function getNodes(stateConnector, context) {
136
+ nodesDebug("Fetching nodes");
116
137
  const state = [];
138
+ nodesDebug(
139
+ "Evaluating CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}"
140
+ );
117
141
  const DescribeSubscriptionFiltersNodes = await evaluateSelector(
118
142
  context.account,
119
143
  context.region,
120
144
  "CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}",
121
145
  stateConnector
122
146
  );
147
+ nodesDebug(
148
+ `Evaluated CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[].{id:logGroupName,name:logGroupName}: ${DescribeSubscriptionFiltersNodes.length} Nodes found`
149
+ );
123
150
  state.push(...DescribeSubscriptionFiltersNodes);
124
151
  return state.map((node) => formatNode(node, "CloudWatchLogs", context, true));
125
152
  }
153
+ var edgesDebug = debug3("cloudwatch-logs:edges");
126
154
  async function getEdges(stateConnector) {
155
+ edgesDebug("Fetching edges");
127
156
  const edges = [];
157
+ edgesDebug(
158
+ "Evaluating CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]"
159
+ );
128
160
  const DescribeSubscriptionFiltersState1 = await evaluateSelectorGlobally(
129
161
  "CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]",
130
162
  stateConnector
@@ -140,6 +172,9 @@ async function getEdges(stateConnector) {
140
172
  }
141
173
  return formatEdge(source, target);
142
174
  });
175
+ edgesDebug(
176
+ `Evaluated CloudWatchLogs|DescribeSubscriptionFilters|[]._result.subscriptionFilters[]: ${DescribeSubscriptionFiltersEdges1.length} Edges found`
177
+ );
143
178
  edges.push(...DescribeSubscriptionFiltersEdges1);
144
179
  return edges;
145
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrascan/aws-cloudwatch-logs-scanner",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Infrascan scanner definition for AWS Cloudwatch Logs",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -42,17 +42,19 @@
42
42
  },
43
43
  "homepage": "https://github.com/infrascan/infrascan#readme",
44
44
  "devDependencies": {
45
- "@aws-sdk/credential-providers": "^3.428.0",
45
+ "@aws-sdk/credential-providers": "3.624.0",
46
46
  "@infrascan/aws-codegen": "^0.1.0",
47
47
  "@infrascan/fs-connector": "^0.2.2",
48
- "@infrascan/shared-types": "^0.5.0",
48
+ "@infrascan/shared-types": "^0.5.1",
49
49
  "@infrascan/tsconfig": "*",
50
50
  "aws-sdk-client-mock": "^3.0.0",
51
51
  "eslint-config-codegen": "^1.0.0",
52
- "tap": "^18.7.0"
52
+ "tap": "^18.7.0",
53
+ "@types/debug": "^4"
53
54
  },
54
55
  "dependencies": {
55
- "@aws-sdk/client-cloudwatch-logs": "3.428.0",
56
- "@infrascan/core": "0.4.0"
56
+ "@aws-sdk/client-cloudwatch-logs": "3.624.0",
57
+ "@infrascan/core": "0.4.1",
58
+ "debug": "^4"
57
59
  }
58
- }
60
+ }