@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.
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +7 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/flare.d.ts +82 -0
- package/dist/commands/flare.js +636 -0
- package/dist/commands/flare.js.map +1 -0
- package/dist/commands/instrument.d.ts +10 -0
- package/dist/commands/instrument.js +405 -0
- package/dist/commands/instrument.js.map +1 -0
- package/dist/commands/uninstrument.d.ts +8 -0
- package/dist/commands/uninstrument.js +264 -0
- package/dist/commands/uninstrument.js.map +1 -0
- package/dist/constants.d.ts +87 -0
- package/dist/constants.js +159 -0
- package/dist/constants.js.map +1 -0
- package/dist/functions/commons.d.ts +131 -0
- package/dist/functions/commons.js +473 -0
- package/dist/functions/commons.js.map +1 -0
- package/dist/functions/instrument.d.ts +7 -0
- package/dist/functions/instrument.js +271 -0
- package/dist/functions/instrument.js.map +1 -0
- package/dist/functions/uninstrument.d.ts +7 -0
- package/dist/functions/uninstrument.js +156 -0
- package/dist/functions/uninstrument.js.map +1 -0
- package/dist/functions/versionChecker.d.ts +3 -0
- package/dist/functions/versionChecker.js +38 -0
- package/dist/functions/versionChecker.js.map +1 -0
- package/dist/interfaces.d.ts +91 -0
- package/dist/interfaces.js +3 -0
- package/dist/interfaces.js.map +1 -0
- package/dist/loggroup.d.ts +17 -0
- package/dist/loggroup.js +140 -0
- package/dist/loggroup.js.map +1 -0
- package/dist/prompt.d.ts +12 -0
- package/dist/prompt.js +265 -0
- package/dist/prompt.js.map +1 -0
- package/dist/renderers/__mocks__/instrument-uninstrument-renderer.d.ts +2 -0
- package/dist/renderers/__mocks__/instrument-uninstrument-renderer.js +11 -0
- package/dist/renderers/__mocks__/instrument-uninstrument-renderer.js.map +1 -0
- package/dist/renderers/common-renderer.d.ts +16 -0
- package/dist/renderers/common-renderer.js +23 -0
- package/dist/renderers/common-renderer.js.map +1 -0
- package/dist/renderers/instrument-uninstrument-renderer.d.ts +397 -0
- package/dist/renderers/instrument-uninstrument-renderer.js +506 -0
- package/dist/renderers/instrument-uninstrument-renderer.js.map +1 -0
- package/dist/tags.d.ts +8 -0
- package/dist/tags.js +74 -0
- package/dist/tags.js.map +1 -0
- package/package.json +9 -3
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.updatingFunctionsConfigFromRegionSpinner = exports.updatingFunctionsSpinner = exports.fetchingFunctionsConfigSpinner = exports.fetchingFunctionsSpinner = exports.renderFailedUpdatingEveryLambdaFunctionFromRegion = exports.renderFailedUpdatingEveryLambdaFunction = exports.renderFailedUpdatingLambdaFunctions = exports.renderFailedUpdatingLambdaFunction = exports.renderFailedFetchingLambdaConfigurationsFromRegion = exports.renderFailedFetchingLambdaFunctions = exports.renderUpdatedLambdaFunctionsFromRegion = exports.renderUpdatedLambdaFunctions = exports.renderFetchedLambdaConfigurationsFromRegion = exports.renderFetchedLambdaFunctions = exports.renderUninstrumentingFunctionsSoftWarning = exports.renderInstrumentingFunctionsSoftWarning = exports.renderConfirmationNeededSoftWarning = exports.renderWillApplyUpdates = exports.renderNoUpdatesApplied = exports.renderInvalidStringBooleanSpecifiedError = exports.renderInvalidExtensionVersionError = exports.renderInvalidLayerVersionError = exports.renderExtraTagsDontComplyError = exports.renderTagsNotConfiguredWarning = exports.renderCouldntFetchLambdaFunctionsError = exports.renderCouldntFindLambdaFunctionsInRegionError = exports.renderConfigureDatadog = exports.renderConfigureAWSRegion = exports.renderEnsureToLockLayerVersionsWarning = exports.renderFunctionsToBeUpdated = exports.renderInstrumentInStagingFirst = exports.renderSourceCodeIntegrationWarning = exports.renderFail = exports.renderSuccess = exports.renderWarning = exports.renderFailureDuringUpdateError = exports.renderCouldntGroupFunctionsError = exports.renderRegexSetWithARNError = exports.renderFunctionsAndFunctionsRegexOptionsBothSetError = exports.renderExtensionAndForwarderOptionsBothSetError = exports.renderNoFunctionsSpecifiedError = exports.renderLambdaHeader = void 0;
|
|
7
|
+
const renderer_1 = require("@datadog/datadog-ci-base/helpers/renderer");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const ora_1 = __importDefault(require("ora"));
|
|
10
|
+
const uninstrument_1 = require("../commands/uninstrument");
|
|
11
|
+
/**
|
|
12
|
+
* @returns a header indicating which `lambda` subcommand is running.
|
|
13
|
+
* @param command current selected lambda subcommand.
|
|
14
|
+
*
|
|
15
|
+
* ```txt
|
|
16
|
+
* [Dry Run] 🐶 Instrumenting Lambda function
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
const renderLambdaHeader = (commandType, isDryRun) => {
|
|
20
|
+
const prefix = isDryRun ? `${renderer_1.dryRunTag} ` : '';
|
|
21
|
+
let commandVerb = 'Instrumenting';
|
|
22
|
+
if (commandType === uninstrument_1.PluginCommand.prototype) {
|
|
23
|
+
commandVerb = 'Uninstrumenting';
|
|
24
|
+
}
|
|
25
|
+
return `\n${prefix}🐶 ${commandVerb} Lambda function\n`;
|
|
26
|
+
};
|
|
27
|
+
exports.renderLambdaHeader = renderLambdaHeader;
|
|
28
|
+
/**
|
|
29
|
+
* @param commandType the type of command being used.
|
|
30
|
+
* @returns a message indicating that no functions are specified depending on the given command.
|
|
31
|
+
*
|
|
32
|
+
* ```txt
|
|
33
|
+
* [Error] No functions specified for instrumentation.
|
|
34
|
+
* or
|
|
35
|
+
* [Error] No functions specified for uninstrumentation.
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
const renderNoFunctionsSpecifiedError = (commandType) => {
|
|
39
|
+
let commandWords = 'instrument';
|
|
40
|
+
if (commandType === uninstrument_1.PluginCommand.prototype) {
|
|
41
|
+
commandWords = 'remove instrumentation';
|
|
42
|
+
}
|
|
43
|
+
return (0, renderer_1.renderError)(`No functions specified to ${commandWords}.`);
|
|
44
|
+
};
|
|
45
|
+
exports.renderNoFunctionsSpecifiedError = renderNoFunctionsSpecifiedError;
|
|
46
|
+
/**
|
|
47
|
+
* @returns a message indicating that both options `--extensionVersion` and `--forwarder` are set.
|
|
48
|
+
*
|
|
49
|
+
* ```txt
|
|
50
|
+
* [Error] "extensionVersion" and "forwarder" should not be used at the same time.
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
const renderExtensionAndForwarderOptionsBothSetError = () => (0, renderer_1.renderError)('"extensionVersion" and "forwarder" should not be used at the same time.');
|
|
54
|
+
exports.renderExtensionAndForwarderOptionsBothSetError = renderExtensionAndForwarderOptionsBothSetError;
|
|
55
|
+
/**
|
|
56
|
+
* @param functionsCommandUsed a boolean indicating which command was used for the specified functions.
|
|
57
|
+
* @returns a message indicating that option `--functions-regex`
|
|
58
|
+
* is being used along with either `--functions` or the parameter
|
|
59
|
+
* `functions` in a config file.
|
|
60
|
+
*
|
|
61
|
+
* ```txt
|
|
62
|
+
* [Error] "--functions" and "--functions-regex" should not be used at the same time.
|
|
63
|
+
* or
|
|
64
|
+
* [Error] Functions in config file and "--functions-regex" should not be used at the same time.
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
const renderFunctionsAndFunctionsRegexOptionsBothSetError = (functionsCommandUsed) => {
|
|
68
|
+
const usedCommand = functionsCommandUsed ? '"--functions"' : 'Functions in config file';
|
|
69
|
+
return (0, renderer_1.renderError)(`${usedCommand} and "--functions-regex" should not be used at the same time.`);
|
|
70
|
+
};
|
|
71
|
+
exports.renderFunctionsAndFunctionsRegexOptionsBothSetError = renderFunctionsAndFunctionsRegexOptionsBothSetError;
|
|
72
|
+
/**
|
|
73
|
+
* @returns a message indicating that `--functions-regex` argument contains `:` which is mainly used with ARNs.
|
|
74
|
+
*
|
|
75
|
+
* ```txt
|
|
76
|
+
* [Error] "--functions-regex" isn't meant to be used with ARNs.
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
const renderRegexSetWithARNError = () => (0, renderer_1.renderError)(`"--functions-regex" isn't meant to be used with ARNs.`);
|
|
80
|
+
exports.renderRegexSetWithARNError = renderRegexSetWithARNError;
|
|
81
|
+
/**
|
|
82
|
+
* @param error an error message or an object of type `unknown`*.
|
|
83
|
+
* @returns a message indicating that an error occurred while grouping functions.
|
|
84
|
+
*
|
|
85
|
+
* * Using unknown since we're not type guarding.
|
|
86
|
+
*
|
|
87
|
+
* ```txt
|
|
88
|
+
* [Error] Couldn't group functions. The provided error goes here!
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
const renderCouldntGroupFunctionsError = (error) => (0, renderer_1.renderError)(`Couldn't group functions. ${error}`);
|
|
92
|
+
exports.renderCouldntGroupFunctionsError = renderCouldntGroupFunctionsError;
|
|
93
|
+
/**
|
|
94
|
+
* @param error an error message or an object of type `unknown`*.
|
|
95
|
+
* @returns a message indicating that an error occurred while updating.
|
|
96
|
+
*
|
|
97
|
+
* * Using unknown since we're not type guarding.
|
|
98
|
+
*
|
|
99
|
+
* ```txt
|
|
100
|
+
* [Error] Failure during update. The provided error goes here!
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
const renderFailureDuringUpdateError = (error) => (0, renderer_1.renderError)(`Failure during update. ${error}`);
|
|
104
|
+
exports.renderFailureDuringUpdateError = renderFailureDuringUpdateError;
|
|
105
|
+
/**
|
|
106
|
+
* @param warning the message to warn about.
|
|
107
|
+
* @returns the provided warning prefixed by {@link warningTag}.
|
|
108
|
+
*
|
|
109
|
+
* ```txt
|
|
110
|
+
* [Warning] The provided warning goes here!
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
const renderWarning = (warning) => `${renderer_1.warningTag} ${warning}\n`;
|
|
114
|
+
exports.renderWarning = renderWarning;
|
|
115
|
+
/**
|
|
116
|
+
* @param message the message to set with the success tag.
|
|
117
|
+
* @returns the provided message prefixed by {@link successCheckmarkTag}.
|
|
118
|
+
*
|
|
119
|
+
* ```txt
|
|
120
|
+
* [✔] The provided message goes here!
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
const renderSuccess = (message) => `${renderer_1.successCheckmarkTag} ${message}\n`;
|
|
124
|
+
exports.renderSuccess = renderSuccess;
|
|
125
|
+
/**
|
|
126
|
+
* @param message the message to set with the fail tag.
|
|
127
|
+
* @returns the provided message prefixed by {@link failCrossTag}.
|
|
128
|
+
*
|
|
129
|
+
* ```txt
|
|
130
|
+
* [✖] The provided message goes here!
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
const renderFail = (message) => `${renderer_1.failCrossTag} ${message}\n`;
|
|
134
|
+
exports.renderFail = renderFail;
|
|
135
|
+
/**
|
|
136
|
+
* @param sourceCodeIntegrationError the error encountered when trying to enable source code integration.
|
|
137
|
+
* @returns a warning message, with the source code integration error attached.
|
|
138
|
+
*
|
|
139
|
+
* ```txt
|
|
140
|
+
* [Warning] Couldn't add source code integration. The provided error goes here!
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
const renderSourceCodeIntegrationWarning = (sourceCodeIntegrationError) => `\n${(0, exports.renderWarning)(`Couldn't add source code integration, continuing without it. ${sourceCodeIntegrationError}.`)}`;
|
|
144
|
+
exports.renderSourceCodeIntegrationWarning = renderSourceCodeIntegrationWarning;
|
|
145
|
+
/**
|
|
146
|
+
* @returns a message suggesting to instrument in dev or staging environment first.
|
|
147
|
+
*
|
|
148
|
+
* ```txt
|
|
149
|
+
* [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.
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
const renderInstrumentInStagingFirst = () => `\n${(0, exports.renderWarning)(`Instrument your ${chalk_1.default
|
|
153
|
+
.hex('#FF9900')
|
|
154
|
+
.bold('Lambda')} functions in a dev or staging environment first. Should the instrumentation result be unsatisfactory, run \`${chalk_1.default.bold('uninstrument')}\` with the same arguments to revert the changes.`)}`;
|
|
155
|
+
exports.renderInstrumentInStagingFirst = renderInstrumentInStagingFirst;
|
|
156
|
+
/**
|
|
157
|
+
* @returns a soft warning message indicating that functions are going to be updated.
|
|
158
|
+
*
|
|
159
|
+
* ```txt
|
|
160
|
+
* Functions to be updated:
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
const renderFunctionsToBeUpdated = () => `\n${(0, renderer_1.renderSoftWarning)('Functions to be updated:')}`;
|
|
164
|
+
exports.renderFunctionsToBeUpdated = renderFunctionsToBeUpdated;
|
|
165
|
+
/**
|
|
166
|
+
* @returns a warning message reminding the user to lock versions for production.
|
|
167
|
+
*
|
|
168
|
+
* ```txt
|
|
169
|
+
* [Warning] At least one latest layer version is being used. Ensure to lock in versions for production applications using `--layerVersion` and `--extensionVersion`.
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
const renderEnsureToLockLayerVersionsWarning = () => `\t${(0, exports.renderWarning)('At least one latest layer version is being used. Ensure to lock in versions for production applications using `--layerVersion` and `--extensionVersion`.')}`;
|
|
173
|
+
exports.renderEnsureToLockLayerVersionsWarning = renderEnsureToLockLayerVersionsWarning;
|
|
174
|
+
/**
|
|
175
|
+
* @returns a message indicating to configure AWS region.
|
|
176
|
+
*
|
|
177
|
+
* ```txt
|
|
178
|
+
* [!] Configure AWS region.
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
const renderConfigureAWSRegion = () => `\n${(0, renderer_1.renderSoftWarning)('Configure AWS region.')}`;
|
|
182
|
+
exports.renderConfigureAWSRegion = renderConfigureAWSRegion;
|
|
183
|
+
/**
|
|
184
|
+
* @returns a message indicating to configure Datadog settings.
|
|
185
|
+
*
|
|
186
|
+
* ```txt
|
|
187
|
+
* [!] Configure Datadog settings.
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
const renderConfigureDatadog = () => `\n${(0, renderer_1.renderSoftWarning)('Configure Datadog settings.')}`;
|
|
191
|
+
exports.renderConfigureDatadog = renderConfigureDatadog;
|
|
192
|
+
/**
|
|
193
|
+
* @returns a message indicating that no Lambda functions were found
|
|
194
|
+
* in the specified region.
|
|
195
|
+
*
|
|
196
|
+
* ```txt
|
|
197
|
+
* [Error] Couldn't find any Lambda functions in the specified region.
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
const renderCouldntFindLambdaFunctionsInRegionError = () => (0, renderer_1.renderError)("Couldn't find any Lambda functions in the specified region.");
|
|
201
|
+
exports.renderCouldntFindLambdaFunctionsInRegionError = renderCouldntFindLambdaFunctionsInRegionError;
|
|
202
|
+
/**
|
|
203
|
+
* @param error an error message or an object of type `unknown`*.
|
|
204
|
+
* @returns a message indicating that no Lambda functions were fetched.
|
|
205
|
+
*
|
|
206
|
+
* * Using unknown since we're not type guarding.
|
|
207
|
+
*
|
|
208
|
+
* ```txt
|
|
209
|
+
* [Error] Couldn't fetch Lambda functions. The provided error goes here!
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
const renderCouldntFetchLambdaFunctionsError = (error) => (0, renderer_1.renderError)(`Couldn't fetch Lambda functions. ${error}`);
|
|
213
|
+
exports.renderCouldntFetchLambdaFunctionsError = renderCouldntFetchLambdaFunctionsError;
|
|
214
|
+
/**
|
|
215
|
+
* @param tagsMissing an array containing the tags that are not configured
|
|
216
|
+
* @returns a message indicating which tags are not configured and where to
|
|
217
|
+
* learn more about Datadog's unified service tagging.
|
|
218
|
+
*
|
|
219
|
+
* ```txt
|
|
220
|
+
* [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.
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
const renderTagsNotConfiguredWarning = (tagsMissing) => {
|
|
224
|
+
const tags = tagsMissing.join(', ').replace(/, ([^,]*)$/, ' and $1');
|
|
225
|
+
const plural = tagsMissing.length > 1;
|
|
226
|
+
return `\n${(0, exports.renderWarning)(`The ${tags} tag${plural ? 's have' : ' has'} not been configured. Learn more about Datadog unified service tagging: ${chalk_1.default.underline(chalk_1.default.blueBright('https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/#serverless-environment'))}.`)}`;
|
|
227
|
+
};
|
|
228
|
+
exports.renderTagsNotConfiguredWarning = renderTagsNotConfiguredWarning;
|
|
229
|
+
/**
|
|
230
|
+
* @returns a message indicating that the extra tags provided do not comply
|
|
231
|
+
* with the <key>:<value> array standard.
|
|
232
|
+
*
|
|
233
|
+
* ```txt
|
|
234
|
+
* [Error] Extra tags do not comply with the <key>:<value> array.
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
const renderExtraTagsDontComplyError = () => (0, renderer_1.renderError)('Extra tags do not comply with the <key>:<value> array.');
|
|
238
|
+
exports.renderExtraTagsDontComplyError = renderExtraTagsDontComplyError;
|
|
239
|
+
/**
|
|
240
|
+
* @returns a message indicating that the `--layerVersion` argument provided is invalid.
|
|
241
|
+
*
|
|
242
|
+
* ```txt
|
|
243
|
+
* [Error] Invalid layer version "provided value".
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
const renderInvalidLayerVersionError = (layerVersion) => (0, renderer_1.renderError)(`Invalid layer version "${layerVersion}".`);
|
|
247
|
+
exports.renderInvalidLayerVersionError = renderInvalidLayerVersionError;
|
|
248
|
+
/**
|
|
249
|
+
* @returns a message indicating that the `--extensionVersion` argument provided is invalid.
|
|
250
|
+
*
|
|
251
|
+
* ```txt
|
|
252
|
+
* [Error] Invalid extension version "provided value".
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
const renderInvalidExtensionVersionError = (extensionVersion) => (0, renderer_1.renderError)(`Invalid extension version "${extensionVersion}".`);
|
|
256
|
+
exports.renderInvalidExtensionVersionError = renderInvalidExtensionVersionError;
|
|
257
|
+
/**
|
|
258
|
+
* @returns a message indicating that the provided argument for a specific string boolean
|
|
259
|
+
* field was invalid.
|
|
260
|
+
*
|
|
261
|
+
* ```txt
|
|
262
|
+
* [Error] Invalid boolean specified for "string boolean field".
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
const renderInvalidStringBooleanSpecifiedError = (stringBoolean) => (0, renderer_1.renderError)(`Invalid boolean specified for ${stringBoolean}.`);
|
|
266
|
+
exports.renderInvalidStringBooleanSpecifiedError = renderInvalidStringBooleanSpecifiedError;
|
|
267
|
+
/**
|
|
268
|
+
* @param isDryRun a boolean to define if a prefix should be added.
|
|
269
|
+
* @returns a message indicating that no updates will be applied.
|
|
270
|
+
*
|
|
271
|
+
* ```txt
|
|
272
|
+
* [Dry Run] No updates will be applied.
|
|
273
|
+
* or
|
|
274
|
+
* No updates will be applied.
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
const renderNoUpdatesApplied = (isDryRun) => {
|
|
278
|
+
const prefix = isDryRun ? `${renderer_1.dryRunTag} ` : '';
|
|
279
|
+
return `\n${prefix}No updates will be applied.\n`;
|
|
280
|
+
};
|
|
281
|
+
exports.renderNoUpdatesApplied = renderNoUpdatesApplied;
|
|
282
|
+
/**
|
|
283
|
+
* @param isDryRun a boolean to define if a prefix should be added.
|
|
284
|
+
* @returns a message indicating that updates will be applied.
|
|
285
|
+
*
|
|
286
|
+
* ```txt
|
|
287
|
+
* [Dry Run] Will apply the following updates:
|
|
288
|
+
* or
|
|
289
|
+
* Will apply the following updates:
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
const renderWillApplyUpdates = (isDryRun) => {
|
|
293
|
+
const prefix = isDryRun ? `${renderer_1.dryRunTag} ` : '';
|
|
294
|
+
return `\n${prefix}Will apply the following updates:\n`;
|
|
295
|
+
};
|
|
296
|
+
exports.renderWillApplyUpdates = renderWillApplyUpdates;
|
|
297
|
+
/**
|
|
298
|
+
* @returns a soft warning message indicating that confirmation is needed.
|
|
299
|
+
*
|
|
300
|
+
* ```txt
|
|
301
|
+
* [!] Confirmation needed.
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
const renderConfirmationNeededSoftWarning = () => (0, renderer_1.renderSoftWarning)('Confirmation needed.');
|
|
305
|
+
exports.renderConfirmationNeededSoftWarning = renderConfirmationNeededSoftWarning;
|
|
306
|
+
/**
|
|
307
|
+
* @returns a soft warning message indicating that functions are being instrumented.
|
|
308
|
+
*
|
|
309
|
+
* ```txt
|
|
310
|
+
* [!] Instrumenting functions.
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
const renderInstrumentingFunctionsSoftWarning = () => (0, renderer_1.renderSoftWarning)('Instrumenting functions.');
|
|
314
|
+
exports.renderInstrumentingFunctionsSoftWarning = renderInstrumentingFunctionsSoftWarning;
|
|
315
|
+
/**
|
|
316
|
+
* @returns a soft warning message indicating the removal of instrumentation
|
|
317
|
+
* for functions.
|
|
318
|
+
*
|
|
319
|
+
* ```txt
|
|
320
|
+
* [!] Uninstrumenting functions.
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
const renderUninstrumentingFunctionsSoftWarning = () => (0, renderer_1.renderSoftWarning)('Uninstrumenting functions.');
|
|
324
|
+
exports.renderUninstrumentingFunctionsSoftWarning = renderUninstrumentingFunctionsSoftWarning;
|
|
325
|
+
/**
|
|
326
|
+
* @param functionsLength the number of Lambda functions that were fetched.
|
|
327
|
+
* @returns a message indicating that it fetched Lambda functions.
|
|
328
|
+
*
|
|
329
|
+
* ```txt
|
|
330
|
+
* Fetched 42 Lambda functions.
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
const renderFetchedLambdaFunctions = (functionsLength) => {
|
|
334
|
+
const plural = functionsLength > 1;
|
|
335
|
+
return `Fetched ${chalk_1.default.bold(functionsLength)} ${chalk_1.default.hex('#FF9900').bold('Lambda')} function${plural ? 's' : ''}.\n`;
|
|
336
|
+
};
|
|
337
|
+
exports.renderFetchedLambdaFunctions = renderFetchedLambdaFunctions;
|
|
338
|
+
/**
|
|
339
|
+
* @param region the AWS region where the Lambda configs belong to.
|
|
340
|
+
* @param configsLength the number of Lambda configuration that were fetched.
|
|
341
|
+
* @returns a message indicating that it updated Lambda functions.
|
|
342
|
+
*
|
|
343
|
+
* ```txt
|
|
344
|
+
* [us-east-1] Fetched 42 Lambda configurations.
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
const renderFetchedLambdaConfigurationsFromRegion = (region, configsLength) => `${chalk_1.default.bold(`[${region}]`)} Fetched ${chalk_1.default.bold(configsLength)} ${chalk_1.default
|
|
348
|
+
.hex('#FF9900')
|
|
349
|
+
.bold('Lambda')} configurations.\n`;
|
|
350
|
+
exports.renderFetchedLambdaConfigurationsFromRegion = renderFetchedLambdaConfigurationsFromRegion;
|
|
351
|
+
/**
|
|
352
|
+
* @param functionsLength the number of Lambda functions that were updated.
|
|
353
|
+
* @returns a message indicating that it updated Lambda functions.
|
|
354
|
+
*
|
|
355
|
+
* ```txt
|
|
356
|
+
* Updated 42 Lambda functions.
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
const renderUpdatedLambdaFunctions = (functionsLength) => {
|
|
360
|
+
const plural = functionsLength > 1;
|
|
361
|
+
return `Updated ${chalk_1.default.bold(functionsLength)} ${chalk_1.default.hex('#FF9900').bold('Lambda')} function${plural ? 's' : ''}.\n`;
|
|
362
|
+
};
|
|
363
|
+
exports.renderUpdatedLambdaFunctions = renderUpdatedLambdaFunctions;
|
|
364
|
+
/**
|
|
365
|
+
* @param region the AWS region where the Lambda functions belong to.
|
|
366
|
+
* @param functionsLength the number of Lambda functions that were updated.
|
|
367
|
+
* @returns a message indicating that it updated Lambda functions from a certain region.
|
|
368
|
+
*
|
|
369
|
+
* ```txt
|
|
370
|
+
* [us-east-1] Updated 42 Lambda functions.
|
|
371
|
+
* ```
|
|
372
|
+
*/
|
|
373
|
+
const renderUpdatedLambdaFunctionsFromRegion = (region, functionsLength) => {
|
|
374
|
+
const plural = functionsLength > 1;
|
|
375
|
+
return `${chalk_1.default.bold(`[${region}]`)} Updated ${chalk_1.default.bold(functionsLength)} ${chalk_1.default
|
|
376
|
+
.hex('#FF9900')
|
|
377
|
+
.bold('Lambda')} function${plural ? 's' : ''}.\n`;
|
|
378
|
+
};
|
|
379
|
+
exports.renderUpdatedLambdaFunctionsFromRegion = renderUpdatedLambdaFunctionsFromRegion;
|
|
380
|
+
/**
|
|
381
|
+
* @returns a message indicating that it failed to fetch Lambda functions.
|
|
382
|
+
*
|
|
383
|
+
* ```txt
|
|
384
|
+
* Failed fetching Lambda functions.
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
const renderFailedFetchingLambdaFunctions = () => `Failed fetching ${chalk_1.default.hex('#FF9900').bold('Lambda')} configurations.\n`;
|
|
388
|
+
exports.renderFailedFetchingLambdaFunctions = renderFailedFetchingLambdaFunctions;
|
|
389
|
+
/**
|
|
390
|
+
* @param region the AWS region where the Lambda configs belong to.
|
|
391
|
+
* @returns a message indicating that it failed to fetch Lambda configurations.
|
|
392
|
+
* from a region.
|
|
393
|
+
*
|
|
394
|
+
* ```txt
|
|
395
|
+
* [us-east-1] Failed fetching Lambda configurations.
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
const renderFailedFetchingLambdaConfigurationsFromRegion = (region) => `${chalk_1.default.bold(`[${region}]`)} Failed fetching ${chalk_1.default.hex('#FF9900').bold('Lambda')} configurations.\n`;
|
|
399
|
+
exports.renderFailedFetchingLambdaConfigurationsFromRegion = renderFailedFetchingLambdaConfigurationsFromRegion;
|
|
400
|
+
/**
|
|
401
|
+
* @param f the Lambda function which failed to update.
|
|
402
|
+
* @param error an error message or an object of type `unknown`*.
|
|
403
|
+
* @returns a message indicating that it failed while updating the Lambda function,
|
|
404
|
+
* and the given error.
|
|
405
|
+
*
|
|
406
|
+
* * Using unknown since we're not type guarding.
|
|
407
|
+
*
|
|
408
|
+
* ```txt
|
|
409
|
+
* [us-east-1] Failed updating ARN Provided error goes here..
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
const renderFailedUpdatingLambdaFunction = (f, error) => (0, renderer_1.renderError)(`Failed updating ${chalk_1.default.bold(f)} ${error}`);
|
|
413
|
+
exports.renderFailedUpdatingLambdaFunction = renderFailedUpdatingLambdaFunction;
|
|
414
|
+
/**
|
|
415
|
+
* @returns a message indicating that it failed to update Lambda functions.
|
|
416
|
+
*
|
|
417
|
+
* ```txt
|
|
418
|
+
* Failed updating Lambda functions.
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
const renderFailedUpdatingLambdaFunctions = () => `Failed updating ${chalk_1.default.hex('#FF9900').bold('Lambda')} functions.\n`;
|
|
422
|
+
exports.renderFailedUpdatingLambdaFunctions = renderFailedUpdatingLambdaFunctions;
|
|
423
|
+
/**
|
|
424
|
+
* @returns a message indicating that it failed to update all Lambda functions.
|
|
425
|
+
*
|
|
426
|
+
* ```txt
|
|
427
|
+
* Failed updating every Lambda function.
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
const renderFailedUpdatingEveryLambdaFunction = () => `Failed updating every ${chalk_1.default.hex('#FF9900').bold('Lambda')} function.\n`;
|
|
431
|
+
exports.renderFailedUpdatingEveryLambdaFunction = renderFailedUpdatingEveryLambdaFunction;
|
|
432
|
+
/**
|
|
433
|
+
* @param region the AWS region where the Lambda configs belong to.
|
|
434
|
+
* @returns a message indicating that it failed to update all Lambda functions
|
|
435
|
+
* from the given region.
|
|
436
|
+
*
|
|
437
|
+
* ```txt
|
|
438
|
+
* [us-east-1] Failed updating every Lambda function.
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
const renderFailedUpdatingEveryLambdaFunctionFromRegion = (region) => `${chalk_1.default.bold(`[${region}]`)} Failed updating every ${chalk_1.default.hex('#FF9900').bold('Lambda')} function.\n`;
|
|
442
|
+
exports.renderFailedUpdatingEveryLambdaFunctionFromRegion = renderFailedUpdatingEveryLambdaFunctionFromRegion;
|
|
443
|
+
/**
|
|
444
|
+
* Returns a spinner instance with text for lambda functions fetching.
|
|
445
|
+
*
|
|
446
|
+
* @returns an instance of an {@link ora} spinner.
|
|
447
|
+
*
|
|
448
|
+
* ```txt
|
|
449
|
+
* ⠋ Fetching Lambda functions.
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
const fetchingFunctionsSpinner = () => (0, ora_1.default)({
|
|
453
|
+
color: 'magenta',
|
|
454
|
+
discardStdin: false,
|
|
455
|
+
text: `Fetching ${chalk_1.default.hex('#FF9900').bold('Lambda')} functions.\n`,
|
|
456
|
+
});
|
|
457
|
+
exports.fetchingFunctionsSpinner = fetchingFunctionsSpinner;
|
|
458
|
+
/**
|
|
459
|
+
* Returns a spinner instance with text for lambda configurations fetching.
|
|
460
|
+
*
|
|
461
|
+
* @returns an instance of {@link ora} spinner.
|
|
462
|
+
*
|
|
463
|
+
* ```txt
|
|
464
|
+
* ⠋ [us-east-1] Fetching Lambda configurations.
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
const fetchingFunctionsConfigSpinner = (region) => (0, ora_1.default)({
|
|
468
|
+
color: 'magenta',
|
|
469
|
+
discardStdin: false,
|
|
470
|
+
text: `${chalk_1.default.bold(`[${region}]`)} Fetching ${chalk_1.default.hex('#FF9900').bold('Lambda')} configurations.\n`,
|
|
471
|
+
});
|
|
472
|
+
exports.fetchingFunctionsConfigSpinner = fetchingFunctionsConfigSpinner;
|
|
473
|
+
/**
|
|
474
|
+
* Returns a spinner instance with text for lambda functions updating.
|
|
475
|
+
*
|
|
476
|
+
* @returns an instance of an {@link ora} spinner.
|
|
477
|
+
*
|
|
478
|
+
* ```txt
|
|
479
|
+
* ⠋ Updating 5 Lambda functions.
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
const updatingFunctionsSpinner = (functions) => (0, ora_1.default)({
|
|
483
|
+
color: 'magenta',
|
|
484
|
+
discardStdin: false,
|
|
485
|
+
text: `Updating ${chalk_1.default.bold(functions)} ${chalk_1.default.hex('#FF9900').bold('Lambda')} functions.\n`,
|
|
486
|
+
});
|
|
487
|
+
exports.updatingFunctionsSpinner = updatingFunctionsSpinner;
|
|
488
|
+
/**
|
|
489
|
+
* Returns a spinner instance with text for Lambda functions being updated
|
|
490
|
+
* from the given region.
|
|
491
|
+
*
|
|
492
|
+
* @returns an instance of {@link ora} spinner.
|
|
493
|
+
*
|
|
494
|
+
* ```txt
|
|
495
|
+
* ⠋ [us-east-1] Updating Lambda functions.
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
const updatingFunctionsConfigFromRegionSpinner = (region, functions) => (0, ora_1.default)({
|
|
499
|
+
color: 'magenta',
|
|
500
|
+
discardStdin: false,
|
|
501
|
+
text: `${chalk_1.default.bold(`[${region}]`)} Updating ${chalk_1.default.bold(functions)} ${chalk_1.default
|
|
502
|
+
.hex('#FF9900')
|
|
503
|
+
.bold('Lambda')} functions.\n`,
|
|
504
|
+
});
|
|
505
|
+
exports.updatingFunctionsConfigFromRegionSpinner = updatingFunctionsConfigFromRegionSpinner;
|
|
506
|
+
//# sourceMappingURL=instrument-uninstrument-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrument-uninstrument-renderer.js","sourceRoot":"","sources":["../../src/renderers/instrument-uninstrument-renderer.ts"],"names":[],"mappings":";;;;;;AAAA,wEAOkD;AAClD,kDAAyB;AACzB,8CAAqB;AAGrB,2DAA6E;AAE7E;;;;;;;GAOG;AACI,MAAM,kBAAkB,GAAG,CAAC,WAAoD,EAAE,QAAiB,EAAE,EAAE;IAC5G,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,oBAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAE9C,IAAI,WAAW,GAAG,eAAe,CAAA;IACjC,IAAI,WAAW,KAAK,4BAAmB,CAAC,SAAS,EAAE;QACjD,WAAW,GAAG,iB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AAA;AALS,QAAA,wBAAwB,4BAKjC;AAEJ;;;;;;;;;GASG;AACI,MAAM,wCAAwC,GAAG,CAAC,MAAc,EAAE,SAAiB,EAAE,EAAE,CAC5F,IAAA,aAAG,EAAC;IACF,KAAK,EAAE,SAAS;IAChB,YAAY,EAAE,KAAK;IACnB,IAAI,EAAE,GAAG,eAAK,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,CAAC,aAAa,eAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,eAAK;SAC1E,GAAG,CAAC,SAAS,CAAC;SACd,IAAI,CAAC,QAAQ,CAAC,eAAe;CACjC,CAAC,CAAA;AAPS,QAAA,wCAAwC,4CAOjD"}
|
package/dist/tags.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LambdaClient, TagResourceCommandInput, UntagResourceCommandInput } from '@aws-sdk/client-lambda';
|
|
2
|
+
import { TagConfiguration } from './interfaces';
|
|
3
|
+
export declare const applyTagConfig: (lambdaClient: LambdaClient, config: TagConfiguration) => Promise<void>;
|
|
4
|
+
export declare const tagResource: (client: LambdaClient, input: TagResourceCommandInput) => Promise<void>;
|
|
5
|
+
export declare const untagResource: (client: LambdaClient, input: UntagResourceCommandInput) => Promise<void>;
|
|
6
|
+
export declare const calculateTagUpdateRequest: (lambdaClient: LambdaClient, functionARN: string) => Promise<TagConfiguration | undefined>;
|
|
7
|
+
export declare const calculateTagRemoveRequest: (lambdaClient: LambdaClient, functionARN: string) => Promise<TagConfiguration | undefined>;
|
|
8
|
+
export declare const hasVersionTag: (client: LambdaClient, functionARN: string) => Promise<boolean>;
|
package/dist/tags.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.hasVersionTag = exports.calculateTagRemoveRequest = exports.calculateTagUpdateRequest = exports.untagResource = exports.tagResource = exports.applyTagConfig = void 0;
|
|
13
|
+
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
14
|
+
const version_1 = require("@datadog/datadog-ci-base/version");
|
|
15
|
+
const constants_1 = require("./constants");
|
|
16
|
+
const applyTagConfig = (lambdaClient, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const { tagResourceCommandInput, untagResourceCommandInput } = config;
|
|
18
|
+
if (tagResourceCommandInput !== undefined) {
|
|
19
|
+
yield (0, exports.tagResource)(lambdaClient, tagResourceCommandInput);
|
|
20
|
+
}
|
|
21
|
+
if (untagResourceCommandInput !== undefined) {
|
|
22
|
+
yield (0, exports.untagResource)(lambdaClient, untagResourceCommandInput);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
exports.applyTagConfig = applyTagConfig;
|
|
26
|
+
const tagResource = (client, input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
const command = new client_lambda_1.TagResourceCommand(input);
|
|
28
|
+
yield client.send(command);
|
|
29
|
+
});
|
|
30
|
+
exports.tagResource = tagResource;
|
|
31
|
+
const untagResource = (client, input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
const command = new client_lambda_1.UntagResourceCommand(input);
|
|
33
|
+
yield client.send(command);
|
|
34
|
+
});
|
|
35
|
+
exports.untagResource = untagResource;
|
|
36
|
+
const calculateTagUpdateRequest = (lambdaClient, functionARN) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
const config = {};
|
|
38
|
+
const versionTagPresent = yield (0, exports.hasVersionTag)(lambdaClient, functionARN);
|
|
39
|
+
if (!versionTagPresent) {
|
|
40
|
+
config.tagResourceCommandInput = {
|
|
41
|
+
Resource: functionARN,
|
|
42
|
+
Tags: {
|
|
43
|
+
[constants_1.TAG_VERSION_NAME]: `v${version_1.cliVersion}`,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
return config;
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
});
|
|
50
|
+
exports.calculateTagUpdateRequest = calculateTagUpdateRequest;
|
|
51
|
+
const calculateTagRemoveRequest = (lambdaClient, functionARN) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
const config = {};
|
|
53
|
+
const versionTagPresent = yield (0, exports.hasVersionTag)(lambdaClient, functionARN);
|
|
54
|
+
if (versionTagPresent) {
|
|
55
|
+
config.untagResourceCommandInput = {
|
|
56
|
+
Resource: functionARN,
|
|
57
|
+
TagKeys: [constants_1.TAG_VERSION_NAME],
|
|
58
|
+
};
|
|
59
|
+
return config;
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
});
|
|
63
|
+
exports.calculateTagRemoveRequest = calculateTagRemoveRequest;
|
|
64
|
+
const hasVersionTag = (client, functionARN) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
const input = {
|
|
66
|
+
Resource: functionARN,
|
|
67
|
+
};
|
|
68
|
+
const command = new client_lambda_1.ListTagsCommand(input);
|
|
69
|
+
const response = yield client.send(command);
|
|
70
|
+
const { Tags } = response;
|
|
71
|
+
return Tags !== undefined && Tags[constants_1.TAG_VERSION_NAME] === `v${version_1.cliVersion}`;
|
|
72
|
+
});
|
|
73
|
+
exports.hasVersionTag = hasVersionTag;
|
|
74
|
+
//# sourceMappingURL=tags.js.map
|
package/dist/tags.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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Apache-2.0",
|
|
5
|
+
"description": "Datadog CI plugin for `lambda` commands",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"datadog",
|
|
8
|
+
"datadog-ci",
|
|
9
|
+
"plugin"
|
|
10
|
+
],
|
|
5
11
|
"homepage": "https://github.com/DataDog/datadog-ci/tree/master/packages/plugin-lambda",
|
|
6
12
|
"repository": {
|
|
7
13
|
"type": "git",
|
|
@@ -29,7 +35,7 @@
|
|
|
29
35
|
"prepack": "yarn package:clean-dist"
|
|
30
36
|
},
|
|
31
37
|
"peerDependencies": {
|
|
32
|
-
"@datadog/datadog-ci": "3.21.
|
|
38
|
+
"@datadog/datadog-ci": "3.21.1"
|
|
33
39
|
},
|
|
34
40
|
"dependencies": {
|
|
35
41
|
"@aws-sdk/client-cloudwatch-logs": "^3.709.0",
|
|
@@ -37,7 +43,7 @@
|
|
|
37
43
|
"@aws-sdk/credential-provider-ini": "^3.709.0",
|
|
38
44
|
"@aws-sdk/credential-providers": "^3.709.0",
|
|
39
45
|
"@aws-sdk/types": "^3.887.0",
|
|
40
|
-
"@datadog/datadog-ci-base": "3.21.
|
|
46
|
+
"@datadog/datadog-ci-base": "3.21.1",
|
|
41
47
|
"@smithy/property-provider": "^2.0.12",
|
|
42
48
|
"@smithy/util-retry": "^2.0.4",
|
|
43
49
|
"chalk": "3.0.0",
|