@datadog/datadog-ci-plugin-ecs-fargate 0.0.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.
@@ -0,0 +1,526 @@
1
+ /// <reference types="node" />
2
+ import { Readable, Writable } from "stream";
3
+
4
+ //#region ../../node_modules/typanion/lib/types.d.ts
5
+ declare type BoundCoercionFn = () => BoundCoercionFn;
6
+ declare type CoercionFn = (v: any) => BoundCoercionFn;
7
+ declare type Coercion = [string, BoundCoercionFn];
8
+ declare type LooseTest<U> = (value: U, test?: ValidationState) => boolean;
9
+ declare type ValidationState = {
10
+ p?: string;
11
+ errors?: string[];
12
+ coercions?: Coercion[];
13
+ coercion?: CoercionFn;
14
+ };
15
+ //#endregion
16
+ //#region ../../node_modules/clipanion/lib/format.d.ts
17
+ interface ColorFormat {
18
+ header(str: string): string;
19
+ bold(str: string): string;
20
+ error(str: string): string;
21
+ code(str: string): string;
22
+ }
23
+ //#endregion
24
+ //#region ../../node_modules/clipanion/lib/advanced/options/utils.d.ts
25
+ declare const isOptionSymbol: unique symbol;
26
+ //#endregion
27
+ //#region ../../node_modules/clipanion/lib/advanced/Cli.d.ts
28
+ /**
29
+ * The base context of the CLI.
30
+ *
31
+ * All Contexts have to extend it.
32
+ */
33
+ declare type BaseContext = {
34
+ /**
35
+ * Environment variables.
36
+ *
37
+ * @default
38
+ * process.env
39
+ */
40
+ env: Record<string, string | undefined>;
41
+ /**
42
+ * The input stream of the CLI.
43
+ *
44
+ * @default
45
+ * process.stdin
46
+ */
47
+ stdin: Readable;
48
+ /**
49
+ * The output stream of the CLI.
50
+ *
51
+ * @default
52
+ * process.stdout
53
+ */
54
+ stdout: Writable;
55
+ /**
56
+ * The error stream of the CLI.
57
+ *
58
+ * @default
59
+ * process.stderr
60
+ */
61
+ stderr: Writable;
62
+ /**
63
+ * Whether colors should be enabled.
64
+ */
65
+ colorDepth: number;
66
+ };
67
+ declare type CliOptions = Readonly<{
68
+ /**
69
+ * The label of the binary.
70
+ *
71
+ * Shown at the top of the usage information.
72
+ */
73
+ binaryLabel?: string;
74
+ /**
75
+ * The name of the binary.
76
+ *
77
+ * Included in the path and the examples of the definitions.
78
+ */
79
+ binaryName: string;
80
+ /**
81
+ * The version of the binary.
82
+ *
83
+ * Shown at the top of the usage information.
84
+ */
85
+ binaryVersion?: string;
86
+ /**
87
+ * If `true`, the Cli will hook into the process standard streams to catch
88
+ * the output produced by console.log and redirect them into the context
89
+ * streams. Note: stdin isn't captured at the moment.
90
+ *
91
+ * @default
92
+ * false
93
+ */
94
+ enableCapture: boolean;
95
+ /**
96
+ * If `true`, the Cli will use colors in the output. If `false`, it won't.
97
+ * If `undefined`, Clipanion will infer the correct value from the env.
98
+ */
99
+ enableColors?: boolean;
100
+ }>;
101
+ declare type MiniCli<Context extends BaseContext> = CliOptions & {
102
+ /**
103
+ * Returns an Array representing the definitions of all registered commands.
104
+ */
105
+ definitions(): Array<Definition>;
106
+ /**
107
+ * Formats errors using colors.
108
+ *
109
+ * @param error The error to format. If `error.name` is `'Error'`, it is replaced with `'Internal Error'`.
110
+ * @param opts.command The command whose usage will be included in the formatted error.
111
+ */
112
+ error(error: Error, opts?: {
113
+ command?: Command<Context> | null;
114
+ }): string;
115
+ /**
116
+ * Returns a rich color format if colors are enabled, or a plain text format otherwise.
117
+ *
118
+ * @param colored Forcefully enable or disable colors.
119
+ */
120
+ format(colored?: boolean): ColorFormat;
121
+ /**
122
+ * Compiles a command and its arguments using the `CommandBuilder`.
123
+ *
124
+ * @param input An array containing the name of the command and its arguments
125
+ *
126
+ * @returns The compiled `Command`, with its properties populated with the arguments.
127
+ */
128
+ process(input: Array<string>, context?: Partial<Context>): Command<Context>;
129
+ /**
130
+ * Runs a command.
131
+ *
132
+ * @param input An array containing the name of the command and its arguments
133
+ * @param context Overrides the Context of the main `Cli` instance
134
+ *
135
+ * @returns The exit code of the command
136
+ */
137
+ run(input: Array<string>, context?: Partial<Context>): Promise<number>;
138
+ /**
139
+ * Returns the usage of a command.
140
+ *
141
+ * @param command The `Command` whose usage will be returned or `null` to return the usage of all commands.
142
+ * @param opts.detailed If `true`, the usage of a command will also include its description, details, and examples. Doesn't have any effect if `command` is `null` or doesn't have a `usage` property.
143
+ * @param opts.prefix The prefix displayed before each command. Defaults to `$`.
144
+ */
145
+ usage(command?: CommandClass<Context> | Command<Context> | null, opts?: {
146
+ detailed?: boolean;
147
+ prefix?: string;
148
+ }): string;
149
+ };
150
+ //#endregion
151
+ //#region ../../node_modules/clipanion/lib/advanced/Command.d.ts
152
+ /**
153
+ * The usage of a Command.
154
+ */
155
+ declare type Usage = {
156
+ /**
157
+ * The category of the command.
158
+ *
159
+ * Included in the detailed usage.
160
+ */
161
+ category?: string;
162
+ /**
163
+ * The short description of the command, formatted as Markdown.
164
+ *
165
+ * Included in the detailed usage.
166
+ */
167
+ description?: string;
168
+ /**
169
+ * The extended details of the command, formatted as Markdown.
170
+ *
171
+ * Included in the detailed usage.
172
+ */
173
+ details?: string;
174
+ /**
175
+ * Examples of the command represented as an Array of tuples.
176
+ *
177
+ * The first element of the tuple represents the description of the example.
178
+ *
179
+ * The second element of the tuple represents the command of the example.
180
+ * If present, the leading `$0` is replaced with `cli.binaryName`.
181
+ */
182
+ examples?: Array<[string, string]>;
183
+ };
184
+ /**
185
+ * The definition of a Command.
186
+ */
187
+ declare type Definition = Usage & {
188
+ /**
189
+ * The path of the command, starting with `cli.binaryName`.
190
+ */
191
+ path: string;
192
+ /**
193
+ * The detailed usage of the command.
194
+ */
195
+ usage: string;
196
+ /**
197
+ * The various options registered on the command.
198
+ */
199
+ options: Array<{
200
+ definition: string;
201
+ description?: string;
202
+ required: boolean;
203
+ }>;
204
+ };
205
+ declare type CommandClass<Context extends BaseContext = BaseContext> = {
206
+ new (): Command<Context>;
207
+ paths?: Array<Array<string>>;
208
+ schema?: Array<LooseTest<{
209
+ [key: string]: unknown;
210
+ }>>;
211
+ usage?: Usage;
212
+ };
213
+ /**
214
+ * Base abstract class for CLI commands. The main thing to remember is to
215
+ * declare an async `execute` member function that will be called when the
216
+ * command is invoked from the CLI, and optionally a `paths` property to
217
+ * declare the set of paths under which the command should be exposed.
218
+ */
219
+ declare abstract class Command<Context extends BaseContext = BaseContext> {
220
+ /**
221
+ * @deprecated Do not use this; prefer the static `paths` property instead.
222
+ */
223
+ paths?: undefined;
224
+ /**
225
+ * Defined to prevent a common typo.
226
+ */
227
+ static path: never;
228
+ /**
229
+ * Paths under which the command should be exposed.
230
+ */
231
+ static paths?: Array<Array<string>>;
232
+ /**
233
+ * Defines the usage information for the given command.
234
+ */
235
+ static Usage(usage: Usage): Usage;
236
+ /**
237
+ * Contains the usage information for the command. If undefined, the
238
+ * command will be hidden from the general listing.
239
+ */
240
+ static usage?: Usage;
241
+ /**
242
+ * Defines a schema to apply before running the `execute` method. The
243
+ * schema is expected to be generated by Typanion.
244
+ *
245
+ * @see https://github.com/arcanis/typanion
246
+ */
247
+ static schema?: Array<LooseTest<{
248
+ [key: string]: unknown;
249
+ }>>;
250
+ /**
251
+ * Standard function that'll get executed by `Cli#run` and `Cli#runExit`.
252
+ *
253
+ * Expected to return an exit code or nothing (which Clipanion will treat
254
+ * as if 0 had been returned).
255
+ */
256
+ abstract execute(): Promise<number | void>;
257
+ /**
258
+ * Standard error handler which will simply rethrow the error. Can be used
259
+ * to add custom logic to handle errors from the command or simply return
260
+ * the parent class error handling.
261
+ */
262
+ catch(error: any): Promise<void>;
263
+ /**
264
+ * Predefined that will be set to true if `-h,--help` has been used, in
265
+ * which case `Command#execute` won't be called.
266
+ */
267
+ help: boolean;
268
+ /**
269
+ * Predefined variable that will be populated with a miniature API that can
270
+ * be used to query Clipanion and forward commands.
271
+ */
272
+ cli: MiniCli<Context>;
273
+ /**
274
+ * Predefined variable that will be populated with the context of the
275
+ * application.
276
+ */
277
+ context: Context;
278
+ /**
279
+ * Predefined variable that will be populated with the path that got used
280
+ * to access the command currently being executed.
281
+ */
282
+ path: Array<string>;
283
+ validateAndExecute(): Promise<number>;
284
+ /**
285
+ * Used to detect option definitions.
286
+ */
287
+ static isOption: typeof isOptionSymbol;
288
+ /**
289
+ * Just an helper to use along with the `paths` fields, to make it
290
+ * clearer that a command is the default one.
291
+ *
292
+ * @example
293
+ * class MyCommand extends Command {
294
+ * static paths = [Command.Default];
295
+ * }
296
+ */
297
+ static Default: never[];
298
+ }
299
+ //#endregion
300
+ //#region ../base/dist/helpers/serverless/ssi/injection-spec.d.ts
301
+ declare const LIBCS: readonly ["glibc", "musl"];
302
+ type Libc = (typeof LIBCS)[number];
303
+ //#endregion
304
+ //#region ../base/dist/helpers/serverless/ssi/tracing.d.ts
305
+ declare const TRACING_MODES: readonly ["manual", "disabled", "inject"];
306
+ type TracingMode = (typeof TRACING_MODES)[number];
307
+ //#endregion
308
+ //#region ../base/dist/helpers/logger.d.ts
309
+ declare enum LogLevel {
310
+ DEBUG = 1,
311
+ INFO = 2,
312
+ WARN = 3,
313
+ ERROR = 4
314
+ }
315
+ interface LoggerOptions {
316
+ shouldIncludeTimestamp?: boolean;
317
+ /**
318
+ * When `true`, every log call emits a single-line JSON object instead of
319
+ * ANSI-coloured text. Useful when Datadog itself (or any other log
320
+ * pipeline) ingests CLI output: each line parses cleanly and `level` is
321
+ * preserved instead of every `error` showing up as `info`.
322
+ */
323
+ jsonOutput?: boolean;
324
+ }
325
+ declare class Logger {
326
+ private loglevel;
327
+ private rawWriteMessage;
328
+ private shouldIncludeTimestamp;
329
+ private jsonOutput;
330
+ constructor(writeMessage: (s: string) => void, loglevel: LogLevel, shouldIncludeTimestampOrOptions?: boolean | LoggerOptions);
331
+ setLogLevel(newLogLevel: LogLevel): void;
332
+ setShouldIncludeTime(newShouldIncludeTimestamp: boolean): void;
333
+ setJsonOutput(newJsonOutput: boolean): void;
334
+ isJsonOutput(): boolean;
335
+ error(s: string): void;
336
+ warn(s: string): void;
337
+ info(s: string): void;
338
+ debug(s: string): void;
339
+ private emit;
340
+ }
341
+ //#endregion
342
+ //#region ../base/dist/index.d.ts
343
+ type CommandContext = BaseContext & {
344
+ builtinPlugins: string[];
345
+ };
346
+ /**
347
+ * This command should be extended by **every** command in the monorepo.
348
+ */
349
+ declare abstract class BaseCommand extends Command<CommandContext> {
350
+ protected logFormat: "text" | "json";
351
+ private _logger?;
352
+ get logger(): Logger;
353
+ }
354
+ //#endregion
355
+ //#region ../base/dist/commands/ecs-fargate/common.d.ts
356
+ type EcsFargateConfigOptions = Partial<{
357
+ taskDefinitions: string[];
358
+ region: string;
359
+ profile: string;
360
+ ecsServices: string[];
361
+ cluster: string;
362
+ apiKeySecretArn: string;
363
+ agentImage: string;
364
+ agentSocket: boolean;
365
+ logCollection: boolean;
366
+ service: string;
367
+ environment: string;
368
+ version: string;
369
+ extraTags: string;
370
+ envVars: string[];
371
+ sourceCodeIntegration: boolean;
372
+ uploadGitMetadata: boolean;
373
+ tracing: TracingMode;
374
+ language: string;
375
+ tracerVersion: string;
376
+ tracerLibc: Libc;
377
+ containerName: string;
378
+ logLevel: string;
379
+ appsec: boolean;
380
+ llmobs: string;
381
+ }>;
382
+ /**
383
+ * What `instrument` and `uninstrument` have in common: which task definitions to rewrite, which
384
+ * services to roll the new revision out to, and how to reach AWS. Both name their targets the same
385
+ * way, so the flags naming them are declared and validated once.
386
+ *
387
+ * A subcommand adds its own flags, reports them through `additionalConfig`, and validates them in
388
+ * `additionalErrors`.
389
+ */
390
+ declare abstract class EcsFargateCommand extends BaseCommand {
391
+ protected dryRun: boolean;
392
+ private taskDefinitions;
393
+ private region;
394
+ private profile;
395
+ private ecsServices;
396
+ private cluster;
397
+ private configPath;
398
+ private fips;
399
+ private fipsIgnoreError;
400
+ private fipsConfig;
401
+ get dryRunPrefix(): string;
402
+ /**
403
+ * The configuration the subcommand's own flags contribute.
404
+ */
405
+ get additionalConfig(): Partial<EcsFargateConfigOptions>;
406
+ enableFips(): void;
407
+ /**
408
+ * The configuration to run with, along with everything wrong with it. The caller reports the
409
+ * problems, so that a run with several mistakes in it names them all at once.
410
+ */
411
+ ensureConfig(): Promise<[EcsFargateConfigOptions, string[]]>;
412
+ /**
413
+ * Everything wrong with the configuration that only the subcommand can tell is wrong.
414
+ */
415
+ protected additionalErrors(_config: EcsFargateConfigOptions): string[];
416
+ }
417
+ //#endregion
418
+ //#region ../base/dist/commands/ecs-fargate/instrument.d.ts
419
+ declare class EcsFargateInstrumentCommand extends EcsFargateCommand {
420
+ static paths: string[][];
421
+ static usage: Usage;
422
+ private apiKeySecretArn;
423
+ private agentImage;
424
+ private noAgentSocket;
425
+ private logCollection;
426
+ private service;
427
+ private environment;
428
+ private version;
429
+ private extraTags;
430
+ private envVars;
431
+ private sourceCodeIntegration;
432
+ private uploadGitMetadata;
433
+ private tracing;
434
+ private language;
435
+ private tracerVersion;
436
+ private tracerLibc;
437
+ private containerName;
438
+ private logLevel;
439
+ private appsec;
440
+ private llmobs;
441
+ get additionalConfig(): Partial<EcsFargateConfigOptions>;
442
+ execute(): Promise<number | void>;
443
+ protected additionalErrors(config: EcsFargateConfigOptions): string[];
444
+ }
445
+ //#endregion
446
+ //#region src/commands/instrument.d.ts
447
+ declare class PluginCommand$1 extends EcsFargateInstrumentCommand {
448
+ execute(): Promise<0 | 1>;
449
+ /**
450
+ * Instruments one app's task definition and points its services at the revision that comes out.
451
+ *
452
+ * Apps are independent on purpose: one this command cannot instrument leaves the others on their
453
+ * new revision rather than holding back a rollout that would have worked.
454
+ *
455
+ * @returns whether the app was instrumented and every one of its services runs the new revision.
456
+ */
457
+ private processApp;
458
+ /**
459
+ * Instruments the app's task definition, reporting what it did.
460
+ *
461
+ * @returns the ARN of the revision the app's services should be pointed at, or `undefined` on a
462
+ * dry run, which registers none.
463
+ */
464
+ private instrument;
465
+ /**
466
+ * What the task definitions are instrumented with, leaving aside how the Agent gets its API key.
467
+ *
468
+ * The Agent image is left as the user gave it, absent included: the default depends on whether the
469
+ * task runs Linux or Windows, which only the transform reading the task definition can tell.
470
+ */
471
+ private buildSettings;
472
+ /**
473
+ * How the Agent reads the API key: a Secrets Manager reference, or the key itself.
474
+ *
475
+ * Reports why it cannot be resolved and returns `undefined`, before the command does any work that
476
+ * would have to be undone.
477
+ */
478
+ private resolveApiKey;
479
+ /**
480
+ * Whether the API key works, checked before it is written into a task definition so that a key
481
+ * that cannot report telemetry is caught here rather than in a running task.
482
+ *
483
+ * A key held in Secrets Manager is not read by this command, so it goes unchecked.
484
+ */
485
+ private isApiKeyValid;
486
+ }
487
+ //#endregion
488
+ //#region ../base/dist/commands/ecs-fargate/uninstrument.d.ts
489
+ declare class EcsFargateUninstrumentCommand extends EcsFargateCommand {
490
+ static paths: string[][];
491
+ static usage: Usage;
492
+ private envVars;
493
+ get additionalConfig(): Partial<EcsFargateConfigOptions>;
494
+ execute(): Promise<number | void>;
495
+ }
496
+ //#endregion
497
+ //#region src/commands/uninstrument.d.ts
498
+ declare class PluginCommand extends EcsFargateUninstrumentCommand {
499
+ execute(): Promise<0 | 1>;
500
+ /**
501
+ * Reverts one app's task definition and points its services at the revision that comes out.
502
+ *
503
+ * @returns whether the app was uninstrumented and every one of its services runs the new revision.
504
+ */
505
+ private processApp;
506
+ /**
507
+ * Reverts instrumentation on the app's task definition, reporting what it did.
508
+ *
509
+ * @returns the ARN of the revision the app's services should be pointed at, or `undefined` on a
510
+ * dry run, which registers none.
511
+ */
512
+ private uninstrument;
513
+ }
514
+ //#endregion
515
+ //#region dist/.bundle-entry.d.ts
516
+ declare const commands: {
517
+ instrument: {
518
+ PluginCommand: typeof PluginCommand$1;
519
+ };
520
+ uninstrument: {
521
+ PluginCommand: typeof PluginCommand;
522
+ };
523
+ };
524
+ //#endregion
525
+ export { commands };
526
+ //# sourceMappingURL=bundle.d.ts.map