@datadog/datadog-ci-plugin-lambda 3.21.0 → 3.21.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.
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
@@ -0,0 +1,397 @@
1
+ import ora from 'ora';
2
+ import { PluginCommand as InstrumentCommand } from '../commands/instrument';
3
+ import { PluginCommand as UninstrumentCommand } from '../commands/uninstrument';
4
+ /**
5
+ * @returns a header indicating which `lambda` subcommand is running.
6
+ * @param command current selected lambda subcommand.
7
+ *
8
+ * ```txt
9
+ * [Dry Run] 🐶 Instrumenting Lambda function
10
+ * ```
11
+ */
12
+ export declare const renderLambdaHeader: (commandType: InstrumentCommand | UninstrumentCommand, isDryRun: boolean) => string;
13
+ /**
14
+ * @param commandType the type of command being used.
15
+ * @returns a message indicating that no functions are specified depending on the given command.
16
+ *
17
+ * ```txt
18
+ * [Error] No functions specified for instrumentation.
19
+ * or
20
+ * [Error] No functions specified for uninstrumentation.
21
+ * ```
22
+ */
23
+ export declare const renderNoFunctionsSpecifiedError: (commandType: InstrumentCommand | UninstrumentCommand) => string;
24
+ /**
25
+ * @returns a message indicating that both options `--extensionVersion` and `--forwarder` are set.
26
+ *
27
+ * ```txt
28
+ * [Error] "extensionVersion" and "forwarder" should not be used at the same time.
29
+ * ```
30
+ */
31
+ export declare const renderExtensionAndForwarderOptionsBothSetError: () => string;
32
+ /**
33
+ * @param functionsCommandUsed a boolean indicating which command was used for the specified functions.
34
+ * @returns a message indicating that option `--functions-regex`
35
+ * is being used along with either `--functions` or the parameter
36
+ * `functions` in a config file.
37
+ *
38
+ * ```txt
39
+ * [Error] "--functions" and "--functions-regex" should not be used at the same time.
40
+ * or
41
+ * [Error] Functions in config file and "--functions-regex" should not be used at the same time.
42
+ * ```
43
+ */
44
+ export declare const renderFunctionsAndFunctionsRegexOptionsBothSetError: (functionsCommandUsed: boolean) => string;
45
+ /**
46
+ * @returns a message indicating that `--functions-regex` argument contains `:` which is mainly used with ARNs.
47
+ *
48
+ * ```txt
49
+ * [Error] "--functions-regex" isn't meant to be used with ARNs.
50
+ * ```
51
+ */
52
+ export declare const renderRegexSetWithARNError: () => string;
53
+ /**
54
+ * @param error an error message or an object of type `unknown`*.
55
+ * @returns a message indicating that an error occurred while grouping functions.
56
+ *
57
+ * * Using unknown since we're not type guarding.
58
+ *
59
+ * ```txt
60
+ * [Error] Couldn't group functions. The provided error goes here!
61
+ * ```
62
+ */
63
+ export declare const renderCouldntGroupFunctionsError: (error: unknown) => string;
64
+ /**
65
+ * @param error an error message or an object of type `unknown`*.
66
+ * @returns a message indicating that an error occurred while updating.
67
+ *
68
+ * * Using unknown since we're not type guarding.
69
+ *
70
+ * ```txt
71
+ * [Error] Failure during update. The provided error goes here!
72
+ * ```
73
+ */
74
+ export declare const renderFailureDuringUpdateError: (error: unknown) => string;
75
+ /**
76
+ * @param warning the message to warn about.
77
+ * @returns the provided warning prefixed by {@link warningTag}.
78
+ *
79
+ * ```txt
80
+ * [Warning] The provided warning goes here!
81
+ * ```
82
+ */
83
+ export declare const renderWarning: (warning: string) => string;
84
+ /**
85
+ * @param message the message to set with the success tag.
86
+ * @returns the provided message prefixed by {@link successCheckmarkTag}.
87
+ *
88
+ * ```txt
89
+ * [✔] The provided message goes here!
90
+ * ```
91
+ */
92
+ export declare const renderSuccess: (message: string) => string;
93
+ /**
94
+ * @param message the message to set with the fail tag.
95
+ * @returns the provided message prefixed by {@link failCrossTag}.
96
+ *
97
+ * ```txt
98
+ * [✖] The provided message goes here!
99
+ * ```
100
+ */
101
+ export declare const renderFail: (message: string) => string;
102
+ /**
103
+ * @param sourceCodeIntegrationError the error encountered when trying to enable source code integration.
104
+ * @returns a warning message, with the source code integration error attached.
105
+ *
106
+ * ```txt
107
+ * [Warning] Couldn't add source code integration. The provided error goes here!
108
+ * ```
109
+ */
110
+ export declare const renderSourceCodeIntegrationWarning: (sourceCodeIntegrationError: unknown) => string;
111
+ /**
112
+ * @returns a message suggesting to instrument in dev or staging environment first.
113
+ *
114
+ * ```txt
115
+ * [Warning] Instrument your Lambda functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run `uninstrument` with the same arguments to revert the changes.
116
+ * ```
117
+ */
118
+ export declare const renderInstrumentInStagingFirst: () => string;
119
+ /**
120
+ * @returns a soft warning message indicating that functions are going to be updated.
121
+ *
122
+ * ```txt
123
+ * Functions to be updated:
124
+ * ```
125
+ */
126
+ export declare const renderFunctionsToBeUpdated: () => string;
127
+ /**
128
+ * @returns a warning message reminding the user to lock versions for production.
129
+ *
130
+ * ```txt
131
+ * [Warning] At least one latest layer version is being used. Ensure to lock in versions for production applications using `--layerVersion` and `--extensionVersion`.
132
+ * ```
133
+ */
134
+ export declare const renderEnsureToLockLayerVersionsWarning: () => string;
135
+ /**
136
+ * @returns a message indicating to configure AWS region.
137
+ *
138
+ * ```txt
139
+ * [!] Configure AWS region.
140
+ * ```
141
+ */
142
+ export declare const renderConfigureAWSRegion: () => string;
143
+ /**
144
+ * @returns a message indicating to configure Datadog settings.
145
+ *
146
+ * ```txt
147
+ * [!] Configure Datadog settings.
148
+ * ```
149
+ */
150
+ export declare const renderConfigureDatadog: () => string;
151
+ /**
152
+ * @returns a message indicating that no Lambda functions were found
153
+ * in the specified region.
154
+ *
155
+ * ```txt
156
+ * [Error] Couldn't find any Lambda functions in the specified region.
157
+ * ```
158
+ */
159
+ export declare const renderCouldntFindLambdaFunctionsInRegionError: () => string;
160
+ /**
161
+ * @param error an error message or an object of type `unknown`*.
162
+ * @returns a message indicating that no Lambda functions were fetched.
163
+ *
164
+ * * Using unknown since we're not type guarding.
165
+ *
166
+ * ```txt
167
+ * [Error] Couldn't fetch Lambda functions. The provided error goes here!
168
+ * ```
169
+ */
170
+ export declare const renderCouldntFetchLambdaFunctionsError: (error: unknown) => string;
171
+ /**
172
+ * @param tagsMissing an array containing the tags that are not configured
173
+ * @returns a message indicating which tags are not configured and where to
174
+ * learn more about Datadog's unified service tagging.
175
+ *
176
+ * ```txt
177
+ * [Warning] The service tag has not been configures. Learn more about Datadog unified service tagging: https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/#serverless-environment.
178
+ * ```
179
+ */
180
+ export declare const renderTagsNotConfiguredWarning: (tagsMissing: string[]) => string;
181
+ /**
182
+ * @returns a message indicating that the extra tags provided do not comply
183
+ * with the <key>:<value> array standard.
184
+ *
185
+ * ```txt
186
+ * [Error] Extra tags do not comply with the <key>:<value> array.
187
+ * ```
188
+ */
189
+ export declare const renderExtraTagsDontComplyError: () => string;
190
+ /**
191
+ * @returns a message indicating that the `--layerVersion` argument provided is invalid.
192
+ *
193
+ * ```txt
194
+ * [Error] Invalid layer version "provided value".
195
+ * ```
196
+ */
197
+ export declare const renderInvalidLayerVersionError: (layerVersion?: string) => string;
198
+ /**
199
+ * @returns a message indicating that the `--extensionVersion` argument provided is invalid.
200
+ *
201
+ * ```txt
202
+ * [Error] Invalid extension version "provided value".
203
+ * ```
204
+ */
205
+ export declare const renderInvalidExtensionVersionError: (extensionVersion?: string) => string;
206
+ /**
207
+ * @returns a message indicating that the provided argument for a specific string boolean
208
+ * field was invalid.
209
+ *
210
+ * ```txt
211
+ * [Error] Invalid boolean specified for "string boolean field".
212
+ * ```
213
+ */
214
+ export declare const renderInvalidStringBooleanSpecifiedError: (stringBoolean: string) => string;
215
+ /**
216
+ * @param isDryRun a boolean to define if a prefix should be added.
217
+ * @returns a message indicating that no updates will be applied.
218
+ *
219
+ * ```txt
220
+ * [Dry Run] No updates will be applied.
221
+ * or
222
+ * No updates will be applied.
223
+ * ```
224
+ */
225
+ export declare const renderNoUpdatesApplied: (isDryRun: boolean) => string;
226
+ /**
227
+ * @param isDryRun a boolean to define if a prefix should be added.
228
+ * @returns a message indicating that updates will be applied.
229
+ *
230
+ * ```txt
231
+ * [Dry Run] Will apply the following updates:
232
+ * or
233
+ * Will apply the following updates:
234
+ * ```
235
+ */
236
+ export declare const renderWillApplyUpdates: (isDryRun: boolean) => string;
237
+ /**
238
+ * @returns a soft warning message indicating that confirmation is needed.
239
+ *
240
+ * ```txt
241
+ * [!] Confirmation needed.
242
+ * ```
243
+ */
244
+ export declare const renderConfirmationNeededSoftWarning: () => string;
245
+ /**
246
+ * @returns a soft warning message indicating that functions are being instrumented.
247
+ *
248
+ * ```txt
249
+ * [!] Instrumenting functions.
250
+ * ```
251
+ */
252
+ export declare const renderInstrumentingFunctionsSoftWarning: () => string;
253
+ /**
254
+ * @returns a soft warning message indicating the removal of instrumentation
255
+ * for functions.
256
+ *
257
+ * ```txt
258
+ * [!] Uninstrumenting functions.
259
+ * ```
260
+ */
261
+ export declare const renderUninstrumentingFunctionsSoftWarning: () => string;
262
+ /**
263
+ * @param functionsLength the number of Lambda functions that were fetched.
264
+ * @returns a message indicating that it fetched Lambda functions.
265
+ *
266
+ * ```txt
267
+ * Fetched 42 Lambda functions.
268
+ * ```
269
+ */
270
+ export declare const renderFetchedLambdaFunctions: (functionsLength: number) => string;
271
+ /**
272
+ * @param region the AWS region where the Lambda configs belong to.
273
+ * @param configsLength the number of Lambda configuration that were fetched.
274
+ * @returns a message indicating that it updated Lambda functions.
275
+ *
276
+ * ```txt
277
+ * [us-east-1] Fetched 42 Lambda configurations.
278
+ * ```
279
+ */
280
+ export declare const renderFetchedLambdaConfigurationsFromRegion: (region: string, configsLength: number) => string;
281
+ /**
282
+ * @param functionsLength the number of Lambda functions that were updated.
283
+ * @returns a message indicating that it updated Lambda functions.
284
+ *
285
+ * ```txt
286
+ * Updated 42 Lambda functions.
287
+ * ```
288
+ */
289
+ export declare const renderUpdatedLambdaFunctions: (functionsLength: number) => string;
290
+ /**
291
+ * @param region the AWS region where the Lambda functions belong to.
292
+ * @param functionsLength the number of Lambda functions that were updated.
293
+ * @returns a message indicating that it updated Lambda functions from a certain region.
294
+ *
295
+ * ```txt
296
+ * [us-east-1] Updated 42 Lambda functions.
297
+ * ```
298
+ */
299
+ export declare const renderUpdatedLambdaFunctionsFromRegion: (region: string, functionsLength: number) => string;
300
+ /**
301
+ * @returns a message indicating that it failed to fetch Lambda functions.
302
+ *
303
+ * ```txt
304
+ * Failed fetching Lambda functions.
305
+ * ```
306
+ */
307
+ export declare const renderFailedFetchingLambdaFunctions: () => string;
308
+ /**
309
+ * @param region the AWS region where the Lambda configs belong to.
310
+ * @returns a message indicating that it failed to fetch Lambda configurations.
311
+ * from a region.
312
+ *
313
+ * ```txt
314
+ * [us-east-1] Failed fetching Lambda configurations.
315
+ * ```
316
+ */
317
+ export declare const renderFailedFetchingLambdaConfigurationsFromRegion: (region: string) => string;
318
+ /**
319
+ * @param f the Lambda function which failed to update.
320
+ * @param error an error message or an object of type `unknown`*.
321
+ * @returns a message indicating that it failed while updating the Lambda function,
322
+ * and the given error.
323
+ *
324
+ * * Using unknown since we're not type guarding.
325
+ *
326
+ * ```txt
327
+ * [us-east-1] Failed updating ARN Provided error goes here..
328
+ * ```
329
+ */
330
+ export declare const renderFailedUpdatingLambdaFunction: (f: string, error: unknown) => string;
331
+ /**
332
+ * @returns a message indicating that it failed to update Lambda functions.
333
+ *
334
+ * ```txt
335
+ * Failed updating Lambda functions.
336
+ * ```
337
+ */
338
+ export declare const renderFailedUpdatingLambdaFunctions: () => string;
339
+ /**
340
+ * @returns a message indicating that it failed to update all Lambda functions.
341
+ *
342
+ * ```txt
343
+ * Failed updating every Lambda function.
344
+ * ```
345
+ */
346
+ export declare const renderFailedUpdatingEveryLambdaFunction: () => string;
347
+ /**
348
+ * @param region the AWS region where the Lambda configs belong to.
349
+ * @returns a message indicating that it failed to update all Lambda functions
350
+ * from the given region.
351
+ *
352
+ * ```txt
353
+ * [us-east-1] Failed updating every Lambda function.
354
+ * ```
355
+ */
356
+ export declare const renderFailedUpdatingEveryLambdaFunctionFromRegion: (region: string) => string;
357
+ /**
358
+ * Returns a spinner instance with text for lambda functions fetching.
359
+ *
360
+ * @returns an instance of an {@link ora} spinner.
361
+ *
362
+ * ```txt
363
+ * ⠋ Fetching Lambda functions.
364
+ * ```
365
+ */
366
+ export declare const fetchingFunctionsSpinner: () => ora.Ora;
367
+ /**
368
+ * Returns a spinner instance with text for lambda configurations fetching.
369
+ *
370
+ * @returns an instance of {@link ora} spinner.
371
+ *
372
+ * ```txt
373
+ * ⠋ [us-east-1] Fetching Lambda configurations.
374
+ * ```
375
+ */
376
+ export declare const fetchingFunctionsConfigSpinner: (region: string) => ora.Ora;
377
+ /**
378
+ * Returns a spinner instance with text for lambda functions updating.
379
+ *
380
+ * @returns an instance of an {@link ora} spinner.
381
+ *
382
+ * ```txt
383
+ * ⠋ Updating 5 Lambda functions.
384
+ * ```
385
+ */
386
+ export declare const updatingFunctionsSpinner: (functions: number) => ora.Ora;
387
+ /**
388
+ * Returns a spinner instance with text for Lambda functions being updated
389
+ * from the given region.
390
+ *
391
+ * @returns an instance of {@link ora} spinner.
392
+ *
393
+ * ```txt
394
+ * ⠋ [us-east-1] Updating Lambda functions.
395
+ * ```
396
+ */
397
+ export declare const updatingFunctionsConfigFromRegionSpinner: (region: string, functions: number) => ora.Ora;