@datadog/datadog-ci-plugin-lambda 3.21.0 → 3.21.1

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.
Files changed (49) hide show
  1. package/dist/cli.d.ts +1 -0
  2. package/dist/cli.js +7 -0
  3. package/dist/cli.js.map +1 -0
  4. package/dist/commands/flare.d.ts +82 -0
  5. package/dist/commands/flare.js +636 -0
  6. package/dist/commands/flare.js.map +1 -0
  7. package/dist/commands/instrument.d.ts +10 -0
  8. package/dist/commands/instrument.js +405 -0
  9. package/dist/commands/instrument.js.map +1 -0
  10. package/dist/commands/uninstrument.d.ts +8 -0
  11. package/dist/commands/uninstrument.js +264 -0
  12. package/dist/commands/uninstrument.js.map +1 -0
  13. package/dist/constants.d.ts +87 -0
  14. package/dist/constants.js +159 -0
  15. package/dist/constants.js.map +1 -0
  16. package/dist/functions/commons.d.ts +131 -0
  17. package/dist/functions/commons.js +473 -0
  18. package/dist/functions/commons.js.map +1 -0
  19. package/dist/functions/instrument.d.ts +7 -0
  20. package/dist/functions/instrument.js +271 -0
  21. package/dist/functions/instrument.js.map +1 -0
  22. package/dist/functions/uninstrument.d.ts +7 -0
  23. package/dist/functions/uninstrument.js +156 -0
  24. package/dist/functions/uninstrument.js.map +1 -0
  25. package/dist/functions/versionChecker.d.ts +3 -0
  26. package/dist/functions/versionChecker.js +38 -0
  27. package/dist/functions/versionChecker.js.map +1 -0
  28. package/dist/interfaces.d.ts +91 -0
  29. package/dist/interfaces.js +3 -0
  30. package/dist/interfaces.js.map +1 -0
  31. package/dist/loggroup.d.ts +17 -0
  32. package/dist/loggroup.js +140 -0
  33. package/dist/loggroup.js.map +1 -0
  34. package/dist/prompt.d.ts +12 -0
  35. package/dist/prompt.js +265 -0
  36. package/dist/prompt.js.map +1 -0
  37. package/dist/renderers/__mocks__/instrument-uninstrument-renderer.d.ts +2 -0
  38. package/dist/renderers/__mocks__/instrument-uninstrument-renderer.js +11 -0
  39. package/dist/renderers/__mocks__/instrument-uninstrument-renderer.js.map +1 -0
  40. package/dist/renderers/common-renderer.d.ts +16 -0
  41. package/dist/renderers/common-renderer.js +23 -0
  42. package/dist/renderers/common-renderer.js.map +1 -0
  43. package/dist/renderers/instrument-uninstrument-renderer.d.ts +397 -0
  44. package/dist/renderers/instrument-uninstrument-renderer.js +506 -0
  45. package/dist/renderers/instrument-uninstrument-renderer.js.map +1 -0
  46. package/dist/tags.d.ts +8 -0
  47. package/dist/tags.js +74 -0
  48. package/dist/tags.js.map +1 -0
  49. package/package.json +9 -3
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const flare_1 = require("./commands/flare");
4
+ const instrument_1 = require("./commands/instrument");
5
+ const uninstrument_1 = require("./commands/uninstrument");
6
+ module.exports = [instrument_1.PluginCommand, uninstrument_1.PluginCommand, flare_1.PluginCommand];
7
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAAA,4CAAoE;AACpE,sDAAwE;AACxE,0DAA4E;AAE5E,MAAM,CAAC,OAAO,GAAG,CAAC,0BAAiB,EAAE,4BAAmB,EAAE,qBAAkB,CAAC,CAAA"}
@@ -0,0 +1,82 @@
1
+ import { CloudWatchLogsClient, OutputLogEvent } from '@aws-sdk/client-cloudwatch-logs';
2
+ import { FunctionConfiguration, LambdaClient } from '@aws-sdk/client-lambda';
3
+ import { LambdaFlareCommand } from '@datadog/datadog-ci-base/commands/lambda/flare';
4
+ export declare class PluginCommand extends LambdaFlareCommand {
5
+ private apiKey?;
6
+ private credentials?;
7
+ private config;
8
+ /**
9
+ * Entry point for the `lambda flare` command.
10
+ * Gathers config, logs, tags, project files, and more from a
11
+ * Lambda function and sends them to Datadog support.
12
+ * @returns 0 if the command ran successfully, 1 otherwise.
13
+ */
14
+ execute(): Promise<0 | 1>;
15
+ }
16
+ /**
17
+ * Summarizes the Lambda config as to not flood the terminal
18
+ * @param config
19
+ * @returns a summarized config
20
+ */
21
+ export declare const summarizeConfig: (config: any) => any;
22
+ /**
23
+ * Gets the LOG_STREAM_COUNT latest log stream names, sorted by last event time
24
+ * @param cwlClient CloudWatch Logs client
25
+ * @param logGroupName name of the log group
26
+ * @param startMillis start time in milliseconds or undefined if no start time is specified
27
+ * @param endMillis end time in milliseconds or undefined if no end time is specified
28
+ * @returns an array of the last LOG_STREAM_COUNT log stream names or an empty array if no log streams are found
29
+ * @throws Error if the log streams cannot be retrieved
30
+ */
31
+ export declare const getLogStreamNames: (cwlClient: CloudWatchLogsClient, logGroupName: string, startMillis?: number, endMillis?: number) => Promise<string[]>;
32
+ /**
33
+ * Gets the log events for a log stream
34
+ * @param cwlClient
35
+ * @param logGroupName
36
+ * @param logStreamName
37
+ * @param startMillis
38
+ * @param endMillis
39
+ * @returns the log events or an empty array if no log events are found
40
+ * @throws Error if the log events cannot be retrieved
41
+ */
42
+ export declare const getLogEvents: (cwlClient: CloudWatchLogsClient, logGroupName: string, logStreamName: string, startMillis?: number, endMillis?: number) => Promise<OutputLogEvent[]>;
43
+ /**
44
+ * Gets all CloudWatch logs for a function
45
+ * @param region
46
+ * @param functionName
47
+ * @param startMillis start time in milliseconds or undefined if no end time is specified
48
+ * @param endMillis end time in milliseconds or undefined if no end time is specified
49
+ * @returns a map of log stream names to log events or an empty map if no logs are found
50
+ */
51
+ export declare const getAllLogs: (region: string, functionName: string, startMillis?: number, endMillis?: number) => Promise<Map<string, OutputLogEvent[]>>;
52
+ /**
53
+ * Gets the tags for a function
54
+ * @param lambdaClient
55
+ * @param region
56
+ * @param arn
57
+ * @returns the tags or an empty object if no tags are found
58
+ * @throws Error if the tags cannot be retrieved
59
+ */
60
+ export declare const getTags: (lambdaClient: LambdaClient, region: string, arn: string) => Promise<Record<string, string>>;
61
+ /**
62
+ * Convert the log events to a CSV string
63
+ * @param logEvents array of log events
64
+ * @returns the CSV string
65
+ */
66
+ export declare const convertToCSV: (logEvents: OutputLogEvent[]) => string;
67
+ /**
68
+ * @param ms number of milliseconds to sleep
69
+ */
70
+ export declare const sleep: (ms: number) => Promise<void>;
71
+ /**
72
+ * Get the framework used based on the files in the directory
73
+ * @returns the framework used or undefined if no framework is found
74
+ */
75
+ export declare const getFramework: () => string;
76
+ /**
77
+ * Generate the insights file
78
+ * @param insightsFilePath path to the insights file
79
+ * @param isDryRun whether or not this is a dry run
80
+ * @param config Lambda function configuration
81
+ */
82
+ export declare const generateInsightsFile: (insightsFilePath: string, isDryRun: boolean, config: FunctionConfiguration) => void;