@datadog/datadog-ci 2.11.0 → 2.13.0
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/README.md +5 -4
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/gate/api.d.ts +7 -0
- package/dist/commands/gate/api.js +41 -0
- package/dist/commands/gate/api.js.map +1 -0
- package/dist/commands/gate/cli.d.ts +1 -0
- package/dist/commands/gate/cli.js +5 -0
- package/dist/commands/gate/cli.js.map +1 -0
- package/dist/commands/gate/evaluate.d.ts +13 -0
- package/dist/commands/gate/evaluate.js +106 -0
- package/dist/commands/gate/evaluate.js.map +1 -0
- package/dist/commands/gate/interfaces.d.ts +31 -0
- package/dist/commands/gate/interfaces.js +3 -0
- package/dist/commands/gate/interfaces.js.map +1 -0
- package/dist/commands/gate/renderer.d.ts +8 -0
- package/dist/commands/gate/renderer.js +84 -0
- package/dist/commands/gate/renderer.js.map +1 -0
- package/dist/commands/gate/utils.d.ts +8 -0
- package/dist/commands/gate/utils.js +40 -0
- package/dist/commands/gate/utils.js.map +1 -0
- package/dist/commands/git-metadata/gitdb.js +1 -1
- package/dist/commands/git-metadata/gitdb.js.map +1 -1
- package/dist/commands/junit/api.d.ts +2 -3
- package/dist/commands/junit/api.js +1 -3
- package/dist/commands/junit/api.js.map +1 -1
- package/dist/commands/junit/interfaces.d.ts +1 -3
- package/dist/commands/junit/renderer.js +4 -4
- package/dist/commands/junit/renderer.js.map +1 -1
- package/dist/commands/junit/upload.d.ts +1 -0
- package/dist/commands/junit/upload.js +29 -14
- package/dist/commands/junit/upload.js.map +1 -1
- package/dist/commands/lambda/constants.d.ts +1 -3
- package/dist/commands/lambda/constants.js +2 -4
- package/dist/commands/lambda/constants.js.map +1 -1
- package/dist/commands/lambda/functions/commons.d.ts +2 -2
- package/dist/commands/lambda/functions/instrument.js +1 -1
- package/dist/commands/lambda/functions/instrument.js.map +1 -1
- package/dist/commands/sarif/renderer.d.ts +1 -0
- package/dist/commands/sarif/renderer.js +14 -2
- package/dist/commands/sarif/renderer.js.map +1 -1
- package/dist/commands/sarif/upload.js +5 -1
- package/dist/commands/sarif/upload.js.map +1 -1
- package/dist/commands/sourcemaps/upload.js +1 -0
- package/dist/commands/sourcemaps/upload.js.map +1 -1
- package/dist/commands/stepfunctions/awsCommands.d.ts +16 -0
- package/dist/commands/stepfunctions/awsCommands.js +215 -0
- package/dist/commands/stepfunctions/awsCommands.js.map +1 -0
- package/dist/commands/stepfunctions/cli.d.ts +1 -0
- package/dist/commands/stepfunctions/cli.js +6 -0
- package/dist/commands/stepfunctions/cli.js.map +1 -0
- package/dist/commands/stepfunctions/constants.d.ts +2 -0
- package/dist/commands/stepfunctions/constants.js +6 -0
- package/dist/commands/stepfunctions/constants.js.map +1 -0
- package/dist/commands/stepfunctions/helpers.d.ts +15 -0
- package/dist/commands/stepfunctions/helpers.js +55 -0
- package/dist/commands/stepfunctions/helpers.js.map +1 -0
- package/dist/commands/stepfunctions/instrument.d.ts +10 -0
- package/dist/commands/stepfunctions/instrument.js +242 -0
- package/dist/commands/stepfunctions/instrument.js.map +1 -0
- package/dist/commands/stepfunctions/uninstrument.d.ts +7 -0
- package/dist/commands/stepfunctions/uninstrument.js +140 -0
- package/dist/commands/stepfunctions/uninstrument.js.map +1 -0
- package/dist/commands/synthetics/index.d.ts +1 -0
- package/dist/commands/synthetics/index.js +3 -1
- package/dist/commands/synthetics/index.js.map +1 -1
- package/dist/helpers/ci.js +1 -1
- package/dist/helpers/ci.js.map +1 -1
- package/dist/helpers/logger.d.ts +4 -1
- package/dist/helpers/logger.js +12 -2
- package/dist/helpers/logger.js.map +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,215 @@
|
|
|
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.untagResource = exports.describeSubscriptionFilters = exports.deleteSubscriptionFilter = exports.enableStepFunctionLogs = exports.attachPolicyToStateMachineIamRole = exports.createLogsAccessPolicy = exports.createLogGroup = exports.tagResource = exports.putSubscriptionFilter = exports.listTagsForResource = exports.describeStateMachine = void 0;
|
|
13
|
+
const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
|
|
14
|
+
const client_iam_1 = require("@aws-sdk/client-iam");
|
|
15
|
+
const client_sfn_1 = require("@aws-sdk/client-sfn");
|
|
16
|
+
const helpers_1 = require("./helpers");
|
|
17
|
+
const describeStateMachine = (stepFunctionsClient, stepFunctionArn) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const input = { stateMachineArn: stepFunctionArn };
|
|
19
|
+
const command = new client_sfn_1.DescribeStateMachineCommand(input);
|
|
20
|
+
const data = yield stepFunctionsClient.send(command);
|
|
21
|
+
return data;
|
|
22
|
+
});
|
|
23
|
+
exports.describeStateMachine = describeStateMachine;
|
|
24
|
+
const listTagsForResource = (stepFunctionsClient, stepFunctionArn) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
const input = { resourceArn: stepFunctionArn };
|
|
26
|
+
const command = new client_sfn_1.ListTagsForResourceCommand(input);
|
|
27
|
+
const data = yield stepFunctionsClient.send(command);
|
|
28
|
+
return data;
|
|
29
|
+
});
|
|
30
|
+
exports.listTagsForResource = listTagsForResource;
|
|
31
|
+
const putSubscriptionFilter = (cloudWatchLogsClient, forwarderArn, filterName, logGroupName, stepFunctionArn, context, dryRun) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
// Running this function multiple times would not create duplicate filters (old filter with the same name would be overwritten).
|
|
33
|
+
// However, two filters with the same destination forwarder can exist when the filter names are different.
|
|
34
|
+
const input = {
|
|
35
|
+
destinationArn: forwarderArn,
|
|
36
|
+
filterName,
|
|
37
|
+
filterPattern: '',
|
|
38
|
+
logGroupName,
|
|
39
|
+
};
|
|
40
|
+
const command = new client_cloudwatch_logs_1.PutSubscriptionFilterCommand(input);
|
|
41
|
+
const commandName = 'PutSubscriptionFilter';
|
|
42
|
+
helpers_1.displayChanges(stepFunctionArn, context, commandName, dryRun, input);
|
|
43
|
+
if (!dryRun) {
|
|
44
|
+
const data = yield cloudWatchLogsClient.send(command);
|
|
45
|
+
// Even if the same filter name is created before, the response is still 200.
|
|
46
|
+
// there are no way to tell
|
|
47
|
+
context.stdout.write(`Subscription filter ${filterName} is created or the original filter ${filterName} is overwritten.\nt`);
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
exports.putSubscriptionFilter = putSubscriptionFilter;
|
|
52
|
+
const tagResource = (stepFunctionsClient, stepFunctionArn, tags, context, dryRun) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
const input = {
|
|
54
|
+
resourceArn: stepFunctionArn,
|
|
55
|
+
tags,
|
|
56
|
+
};
|
|
57
|
+
const command = new client_sfn_1.TagResourceCommand(input);
|
|
58
|
+
const commandName = 'TagResource';
|
|
59
|
+
helpers_1.displayChanges(stepFunctionArn, context, commandName, dryRun, input);
|
|
60
|
+
if (!dryRun) {
|
|
61
|
+
const data = yield stepFunctionsClient.send(command);
|
|
62
|
+
printSuccessfulMessage(commandName, context);
|
|
63
|
+
return data;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
exports.tagResource = tagResource;
|
|
67
|
+
const createLogGroup = (cloudWatchLogsClient, logGroupName, stepFunctionArn, context, dryRun) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
const input = {
|
|
69
|
+
logGroupName,
|
|
70
|
+
};
|
|
71
|
+
const command = new client_cloudwatch_logs_1.CreateLogGroupCommand(input);
|
|
72
|
+
const commandName = 'CreateLogGroup';
|
|
73
|
+
helpers_1.displayChanges(stepFunctionArn, context, commandName, dryRun, input);
|
|
74
|
+
try {
|
|
75
|
+
if (!dryRun) {
|
|
76
|
+
const data = yield cloudWatchLogsClient.send(command);
|
|
77
|
+
printSuccessfulMessage(commandName, context);
|
|
78
|
+
return data;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
// if a resource already exists it's a warning since we can use that resource instead of creating it
|
|
83
|
+
if (err instanceof Error && err.name === 'ResourceAlreadyExistsException') {
|
|
84
|
+
context.stdout.write(` -> [Info] ${err.message}. Skipping resource creation and continuing with instrumentation.\n`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
exports.createLogGroup = createLogGroup;
|
|
89
|
+
const createLogsAccessPolicy = (iamClient, describeStateMachineCommandOutput, stepFunctionArn, context, dryRun) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
// according to https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html#cloudwatch-iam-policy
|
|
91
|
+
const logsAccessPolicy = {
|
|
92
|
+
Version: '2012-10-17',
|
|
93
|
+
Statement: [
|
|
94
|
+
{
|
|
95
|
+
Effect: 'Allow',
|
|
96
|
+
Action: [
|
|
97
|
+
'logs:CreateLogDelivery',
|
|
98
|
+
'logs:CreateLogStream',
|
|
99
|
+
'logs:GetLogDelivery',
|
|
100
|
+
'logs:UpdateLogDelivery',
|
|
101
|
+
'logs:DeleteLogDelivery',
|
|
102
|
+
'logs:ListLogDeliveries',
|
|
103
|
+
'logs:PutLogEvents',
|
|
104
|
+
'logs:PutResourcePolicy',
|
|
105
|
+
'logs:DescribeResourcePolicies',
|
|
106
|
+
'logs:DescribeLogGroups',
|
|
107
|
+
],
|
|
108
|
+
Resource: '*',
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
const input = {
|
|
113
|
+
PolicyDocument: JSON.stringify(logsAccessPolicy),
|
|
114
|
+
PolicyName: helpers_1.buildLogAccessPolicyName(describeStateMachineCommandOutput),
|
|
115
|
+
};
|
|
116
|
+
const command = new client_iam_1.CreatePolicyCommand(input);
|
|
117
|
+
const commandName = 'CreatePolicy';
|
|
118
|
+
helpers_1.displayChanges(stepFunctionArn, context, commandName, dryRun, input);
|
|
119
|
+
try {
|
|
120
|
+
if (!dryRun) {
|
|
121
|
+
const data = yield iamClient.send(command);
|
|
122
|
+
printSuccessfulMessage(commandName, context);
|
|
123
|
+
return data;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
// if a resource already exists it's a warning since we can use that resource instead of creating it
|
|
128
|
+
if (err instanceof Error && err.name === 'ResourceAlreadyExistsException') {
|
|
129
|
+
context.stdout.write(` -> [Info] ${err.message}. Skipping resource creation and continuing with instrumentation.\n`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
exports.createLogsAccessPolicy = createLogsAccessPolicy;
|
|
134
|
+
const attachPolicyToStateMachineIamRole = (iamClient, describeStateMachineCommandOutput, accountId, stepFunctionArn, context, dryRun) => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
|
+
var _a;
|
|
136
|
+
const roleName = (_a = describeStateMachineCommandOutput === null || describeStateMachineCommandOutput === void 0 ? void 0 : describeStateMachineCommandOutput.roleArn) === null || _a === void 0 ? void 0 : _a.split('/')[1];
|
|
137
|
+
const policyArn = `arn:aws:iam::${accountId}:policy/${helpers_1.buildLogAccessPolicyName(describeStateMachineCommandOutput)}`;
|
|
138
|
+
const input = {
|
|
139
|
+
PolicyArn: policyArn,
|
|
140
|
+
RoleName: roleName,
|
|
141
|
+
};
|
|
142
|
+
const command = new client_iam_1.AttachRolePolicyCommand(input);
|
|
143
|
+
const commandName = 'AttachRolePolicy';
|
|
144
|
+
helpers_1.displayChanges(stepFunctionArn, context, commandName, dryRun, input);
|
|
145
|
+
if (!dryRun) {
|
|
146
|
+
const data = yield iamClient.send(command);
|
|
147
|
+
printSuccessfulMessage(commandName, context);
|
|
148
|
+
return data;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
exports.attachPolicyToStateMachineIamRole = attachPolicyToStateMachineIamRole;
|
|
152
|
+
const enableStepFunctionLogs = (stepFunctionsClient, stepFunction, logGroupArn, stepFunctionArn, context, dryRun) => __awaiter(void 0, void 0, void 0, function* () {
|
|
153
|
+
const input = {
|
|
154
|
+
stateMachineArn: stepFunction.stateMachineArn,
|
|
155
|
+
loggingConfiguration: {
|
|
156
|
+
destinations: [{ cloudWatchLogsLogGroup: { logGroupArn } }],
|
|
157
|
+
level: 'ALL',
|
|
158
|
+
includeExecutionData: true,
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
const previousParams = {
|
|
162
|
+
stateMachineArn: stepFunction.stateMachineArn,
|
|
163
|
+
loggingConfiguration: stepFunction.loggingConfiguration,
|
|
164
|
+
};
|
|
165
|
+
const command = new client_sfn_1.UpdateStateMachineCommand(input);
|
|
166
|
+
const commandName = 'UpdateStateMachine';
|
|
167
|
+
helpers_1.displayChanges(stepFunctionArn, context, commandName, dryRun, input, previousParams);
|
|
168
|
+
if (!dryRun) {
|
|
169
|
+
const data = yield stepFunctionsClient.send(command);
|
|
170
|
+
printSuccessfulMessage(commandName, context);
|
|
171
|
+
return data;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
exports.enableStepFunctionLogs = enableStepFunctionLogs;
|
|
175
|
+
const deleteSubscriptionFilter = (cloudWatchLogsClient, filterName, logGroupName, stepFunctionArn, context, dryRun) => __awaiter(void 0, void 0, void 0, function* () {
|
|
176
|
+
const input = {
|
|
177
|
+
filterName,
|
|
178
|
+
logGroupName,
|
|
179
|
+
};
|
|
180
|
+
const command = new client_cloudwatch_logs_1.DeleteSubscriptionFilterCommand(input);
|
|
181
|
+
const commandName = 'DeleteSubscriptionFilter';
|
|
182
|
+
helpers_1.displayChanges(stepFunctionArn, context, commandName, dryRun, input);
|
|
183
|
+
if (!dryRun) {
|
|
184
|
+
const data = yield cloudWatchLogsClient.send(command);
|
|
185
|
+
printSuccessfulMessage(commandName, context);
|
|
186
|
+
return data;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
exports.deleteSubscriptionFilter = deleteSubscriptionFilter;
|
|
190
|
+
const describeSubscriptionFilters = (cloudWatchLogsClient, logGroupName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
191
|
+
const input = { logGroupName };
|
|
192
|
+
const command = new client_cloudwatch_logs_1.DescribeSubscriptionFiltersCommand(input);
|
|
193
|
+
const data = yield cloudWatchLogsClient.send(command);
|
|
194
|
+
return data;
|
|
195
|
+
});
|
|
196
|
+
exports.describeSubscriptionFilters = describeSubscriptionFilters;
|
|
197
|
+
const printSuccessfulMessage = (commandName, context) => {
|
|
198
|
+
context.stdout.write(`${commandName} finished successfully!\n\n`);
|
|
199
|
+
};
|
|
200
|
+
const untagResource = (stepFunctionsClient, tagKeys, stepFunctionArn, context, dryRun) => __awaiter(void 0, void 0, void 0, function* () {
|
|
201
|
+
const input = {
|
|
202
|
+
resourceArn: stepFunctionArn,
|
|
203
|
+
tagKeys,
|
|
204
|
+
};
|
|
205
|
+
const command = new client_sfn_1.UntagResourceCommand(input);
|
|
206
|
+
const commandName = 'UntagResource';
|
|
207
|
+
helpers_1.displayChanges(stepFunctionArn, context, commandName, dryRun, input);
|
|
208
|
+
if (!dryRun) {
|
|
209
|
+
const data = yield stepFunctionsClient.send(command);
|
|
210
|
+
printSuccessfulMessage(commandName, context);
|
|
211
|
+
return data;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
exports.untagResource = untagResource;
|
|
215
|
+
//# sourceMappingURL=awsCommands.js.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Ac,CAAC,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IACpE,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACpD,sBAAsB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAE5C,OAAO,IAAI,CAAA;KACZ;AACH,CAAC,CAAA,CAAA;AApBY,QAAA,aAAa,iBAoBzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const instrument_1 = require("./instrument");
|
|
4
|
+
const uninstrument_1 = require("./uninstrument");
|
|
5
|
+
module.exports = [instrument_1.InstrumentStepFunctionsCommand, uninstrument_1.UninstrumentStepFunctionsCommand];
|
|
6
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/commands/stepfunctions/cli.ts"],"names":[],"mappings":";;AAAA,6CAA2D;AAC3D,iDAA+D;AAE/D,MAAM,CAAC,OAAO,GAAG,CAAC,2CAA8B,EAAE,+CAAgC,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TAG_VERSION_NAME = exports.DD_CI_IDENTIFYING_STRING = void 0;
|
|
4
|
+
exports.DD_CI_IDENTIFYING_STRING = 'DdCiLogGroupSubscription';
|
|
5
|
+
exports.TAG_VERSION_NAME = 'dd_sls_ci';
|
|
6
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/commands/stepfunctions/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG,0BAA0B,CAAA;AACrD,QAAA,gBAAgB,GAAG,WAAW,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DescribeStateMachineCommandOutput } from '@aws-sdk/client-sfn';
|
|
2
|
+
import { BaseContext } from 'clipanion';
|
|
3
|
+
export declare const displayChanges: (stepFunctionArn: string, context: BaseContext, commandName: string, dryRun: boolean, params: any, previousParams?: any) => void;
|
|
4
|
+
export declare const buildArn: (partition: string, service: string, region: string, accountId: string, resourceType: string, resourceId: string) => string;
|
|
5
|
+
export declare const buildLogGroupName: (stepFunctionName: string, env: string | undefined) => string;
|
|
6
|
+
export declare const buildSubscriptionFilterName: (stepFunctionName: string) => string;
|
|
7
|
+
export declare const isValidArn: (str: string) => boolean;
|
|
8
|
+
export declare const getStepFunctionLogGroupArn: (stepFunction: DescribeStateMachineCommandOutput) => string | undefined;
|
|
9
|
+
export declare const parseArn: (arn: string) => {
|
|
10
|
+
partition: string;
|
|
11
|
+
region: string;
|
|
12
|
+
accountId: string;
|
|
13
|
+
resourceName: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const buildLogAccessPolicyName: (stepFunction: DescribeStateMachineCommandOutput) => string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildLogAccessPolicyName = exports.parseArn = exports.getStepFunctionLogGroupArn = exports.isValidArn = exports.buildSubscriptionFilterName = exports.buildLogGroupName = exports.buildArn = exports.displayChanges = void 0;
|
|
4
|
+
const deep_object_diff_1 = require("deep-object-diff");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
const displayChanges = (stepFunctionArn, context, commandName, dryRun, params, previousParams) => {
|
|
7
|
+
context.stdout.write(`${'='.repeat(50)}`);
|
|
8
|
+
context.stdout.write(`\n${dryRun ? '\n[Dry Run] Planning for' : 'Will apply'} the following change:\n`);
|
|
9
|
+
context.stdout.write(`\nChanges for ${stepFunctionArn}\n`);
|
|
10
|
+
if (previousParams !== undefined) {
|
|
11
|
+
context.stdout.write(`\n${commandName}:\nFrom:\n${JSON.stringify(deep_object_diff_1.diff(params, previousParams), undefined, 2)}\nTo:\n${JSON.stringify(deep_object_diff_1.diff(previousParams, params), undefined, 2)}\n`);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
context.stdout.write(`\n${commandName}:\n${JSON.stringify(params, undefined, 2)}\n`);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.displayChanges = displayChanges;
|
|
18
|
+
const buildArn = (partition, service, region, accountId, resourceType, resourceId) => {
|
|
19
|
+
return `arn:${partition}:${service}:${region}:${accountId}:${resourceType}:${resourceId}`;
|
|
20
|
+
};
|
|
21
|
+
exports.buildArn = buildArn;
|
|
22
|
+
const buildLogGroupName = (stepFunctionName, env) => {
|
|
23
|
+
return `/aws/vendedlogs/states/${stepFunctionName}-Logs${env !== undefined ? '-' + env : ''}`;
|
|
24
|
+
};
|
|
25
|
+
exports.buildLogGroupName = buildLogGroupName;
|
|
26
|
+
const buildSubscriptionFilterName = (stepFunctionName) => {
|
|
27
|
+
return `${stepFunctionName}-${constants_1.DD_CI_IDENTIFYING_STRING}`;
|
|
28
|
+
};
|
|
29
|
+
exports.buildSubscriptionFilterName = buildSubscriptionFilterName;
|
|
30
|
+
const isValidArn = (str) => {
|
|
31
|
+
const arnFields = str.split(':');
|
|
32
|
+
return arnFields.length >= 7 && arnFields[0] === 'arn';
|
|
33
|
+
};
|
|
34
|
+
exports.isValidArn = isValidArn;
|
|
35
|
+
const getStepFunctionLogGroupArn = (stepFunction) => {
|
|
36
|
+
var _a, _b, _c;
|
|
37
|
+
const [logDestinations] = (_b = (_a = stepFunction.loggingConfiguration) === null || _a === void 0 ? void 0 : _a.destinations) !== null && _b !== void 0 ? _b : [{ cloudWatchLogsLogGroup: {} }];
|
|
38
|
+
return (_c = logDestinations.cloudWatchLogsLogGroup) === null || _c === void 0 ? void 0 : _c.logGroupArn;
|
|
39
|
+
};
|
|
40
|
+
exports.getStepFunctionLogGroupArn = getStepFunctionLogGroupArn;
|
|
41
|
+
const parseArn = (arn) => {
|
|
42
|
+
const [, partition, , region, accountId, , resourceName] = arn.split(':');
|
|
43
|
+
return {
|
|
44
|
+
partition,
|
|
45
|
+
region,
|
|
46
|
+
accountId,
|
|
47
|
+
resourceName,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
exports.parseArn = parseArn;
|
|
51
|
+
const buildLogAccessPolicyName = (stepFunction) => {
|
|
52
|
+
return `LogsDeliveryAccessPolicy-${stepFunction.name}`;
|
|
53
|
+
};
|
|
54
|
+
exports.buildLogAccessPolicyName = buildLogAccessPolicyName;
|
|
55
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/commands/stepfunctions/helpers.ts"],"names":[],"mappings":";;;AAEA,uDAAqC;AAErC,2CAAoD;AAE7C,MAAM,cAAc,GAAG,CAC5B,eAAuB,EACvB,OAAoB,EACpB,WAAmB,EACnB,MAAe,EACf,MAAW,EACX,cAAoB,EACd,EAAE;IACR,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,YAAY,0BAA0B,CAAC,CAAA;IACvG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,eAAe,IAAI,CAAC,CAAA;IAC1D,IAAI,cAAc,KAAK,SAAS,EAAE;QAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,KAAK,WAAW,aAAa,IAAI,CAAC,SAAS,CAAC,uBAAI,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,SAAS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,MAAM,0BAA0B,GAAG,CAAC,YAA+C,EAAsB,EAAE;;IAChH,MAAM,CAAC,eAAe,CAAC,GAAG,MAAA,MAAA,YAAY,CAAC,oBAAoB,0CAAE,YAAY,mCAAI,CAAC,EAAC,sBAAsB,EAAE,EAAE,EAAC,CAAC,CAAA;IAE3G,OAAO,MAAA,eAAe,CAAC,sBAAsB,0CAAE,WAAW,CAAA;AAC5D,CAAC,CAAA;AAJY,QAAA,0BAA0B,8BAItC;AAEM,MAAM,QAAQ,GAAG,CACtB,GAAW,EAMX,EAAE;IACF,MAAM,CAAC,EAAE,SAAS,EAAE,AAAD,EAAG,MAAM,EAAE,SAAS,EAAE,AAAD,EAAG,YAAY,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAEzE,OAAO;QACL,SAAS;QACT,MAAM;QACN,SAAS;QACT,YAAY;KACb,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,QAAQ,YAgBpB;AACM,MAAM,wBAAwB,GAAG,CAAC,YAA+C,EAAU,EAAE;IAClG,OAAO,4BAA4B,YAAY,CAAC,IAAI,EAAE,CAAA;AACxD,CAAC,CAAA;AAFY,QAAA,wBAAwB,4BAEpC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from 'clipanion';
|
|
2
|
+
export declare class InstrumentStepFunctionsCommand extends Command {
|
|
3
|
+
static usage: import("clipanion").Usage;
|
|
4
|
+
private dryRun;
|
|
5
|
+
private environment?;
|
|
6
|
+
private forwarderArn;
|
|
7
|
+
private service?;
|
|
8
|
+
private stepFunctionArns;
|
|
9
|
+
execute(): Promise<1 | 0>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
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.InstrumentStepFunctionsCommand = void 0;
|
|
13
|
+
const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
|
|
14
|
+
const client_iam_1 = require("@aws-sdk/client-iam");
|
|
15
|
+
const client_sfn_1 = require("@aws-sdk/client-sfn");
|
|
16
|
+
const clipanion_1 = require("clipanion");
|
|
17
|
+
const awsCommands_1 = require("./awsCommands");
|
|
18
|
+
const constants_1 = require("./constants");
|
|
19
|
+
const helpers_1 = require("./helpers");
|
|
20
|
+
const cliVersion = require('../../../package.json').version;
|
|
21
|
+
class InstrumentStepFunctionsCommand extends clipanion_1.Command {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.dryRun = false;
|
|
25
|
+
this.stepFunctionArns = [];
|
|
26
|
+
}
|
|
27
|
+
execute() {
|
|
28
|
+
var _a, _b, _c, _d, _e;
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
let validationError = false;
|
|
31
|
+
if (typeof this.forwarderArn !== 'string') {
|
|
32
|
+
this.context.stdout.write('[Error] `--forwarder` is required\n');
|
|
33
|
+
validationError = true;
|
|
34
|
+
}
|
|
35
|
+
else if (!helpers_1.isValidArn(this.forwarderArn)) {
|
|
36
|
+
this.context.stdout.write(`[Error] Invalid arn format for \`--forwarder\` ${this.forwarderArn}\n`);
|
|
37
|
+
validationError = true;
|
|
38
|
+
}
|
|
39
|
+
if (validationError) {
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
// remove duplicate step function arns
|
|
43
|
+
const stepFunctionArns = [...new Set(this.stepFunctionArns)];
|
|
44
|
+
if (stepFunctionArns.length === 0) {
|
|
45
|
+
this.context.stdout.write(`[Error] Must specify at least one \`--step-function\`\n`);
|
|
46
|
+
validationError = true;
|
|
47
|
+
}
|
|
48
|
+
for (const stepFunctionArn of stepFunctionArns) {
|
|
49
|
+
if (!helpers_1.isValidArn(stepFunctionArn)) {
|
|
50
|
+
this.context.stdout.write(`[Error] Invalid arn format for \`--step-function\` ${stepFunctionArn}\n`);
|
|
51
|
+
validationError = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (validationError) {
|
|
55
|
+
return 1;
|
|
56
|
+
}
|
|
57
|
+
let hasChanges = false;
|
|
58
|
+
// loop over step functions passed as parameters and generate a list of requests to make to AWS for each step function
|
|
59
|
+
for (const stepFunctionArn of stepFunctionArns) {
|
|
60
|
+
// use region from the step function arn to make requests to AWS
|
|
61
|
+
const arnObject = helpers_1.parseArn(stepFunctionArn);
|
|
62
|
+
const region = arnObject.region;
|
|
63
|
+
const cloudWatchLogsClient = new client_cloudwatch_logs_1.CloudWatchLogsClient({ region });
|
|
64
|
+
const stepFunctionsClient = new client_sfn_1.SFNClient({ region });
|
|
65
|
+
const iamClient = new client_iam_1.IAMClient({ region });
|
|
66
|
+
let describeStateMachineCommandOutput;
|
|
67
|
+
try {
|
|
68
|
+
describeStateMachineCommandOutput = yield awsCommands_1.describeStateMachine(stepFunctionsClient, stepFunctionArn);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
if (err instanceof Error) {
|
|
72
|
+
this.context.stdout.write(`\n[Error] ${err.message}. Unable to describe state machine ${stepFunctionArn}\n`);
|
|
73
|
+
}
|
|
74
|
+
return 1;
|
|
75
|
+
}
|
|
76
|
+
let listStepFunctionTagsResponse;
|
|
77
|
+
try {
|
|
78
|
+
listStepFunctionTagsResponse = yield awsCommands_1.listTagsForResource(stepFunctionsClient, stepFunctionArn);
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
if (err instanceof Error) {
|
|
82
|
+
this.context.stdout.write(`\n[Error] ${err.message}. Unable to fetch tags for Step Function ${stepFunctionArn}\n`);
|
|
83
|
+
}
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
const stepFunctionTagsToAdd = [];
|
|
87
|
+
// if env and service tags are not already set on step function, set these tags using the values passed as parameters
|
|
88
|
+
const hasEnvTag = (_a = listStepFunctionTagsResponse === null || listStepFunctionTagsResponse === void 0 ? void 0 : listStepFunctionTagsResponse.tags) === null || _a === void 0 ? void 0 : _a.some((tag) => tag.key === 'env');
|
|
89
|
+
if (!hasEnvTag && typeof this.environment === 'string') {
|
|
90
|
+
stepFunctionTagsToAdd.push({
|
|
91
|
+
key: 'env',
|
|
92
|
+
value: this.environment,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
else if (!hasEnvTag && this.environment === undefined) {
|
|
96
|
+
this.context.stdout.write('\n[Error] --env is required when a Step Function has no env tag\n');
|
|
97
|
+
return 1;
|
|
98
|
+
}
|
|
99
|
+
if (!((_b = listStepFunctionTagsResponse === null || listStepFunctionTagsResponse === void 0 ? void 0 : listStepFunctionTagsResponse.tags) === null || _b === void 0 ? void 0 : _b.some((tag) => tag.key === 'service')) &&
|
|
100
|
+
typeof this.service === 'string') {
|
|
101
|
+
stepFunctionTagsToAdd.push({ key: 'service', value: this.service });
|
|
102
|
+
}
|
|
103
|
+
// set version tag if it changed
|
|
104
|
+
if (!((_c = listStepFunctionTagsResponse === null || listStepFunctionTagsResponse === void 0 ? void 0 : listStepFunctionTagsResponse.tags) === null || _c === void 0 ? void 0 : _c.some((tag) => tag.key === constants_1.TAG_VERSION_NAME && tag.value === `v${cliVersion}`))) {
|
|
105
|
+
stepFunctionTagsToAdd.push({ key: constants_1.TAG_VERSION_NAME, value: `v${cliVersion}` });
|
|
106
|
+
}
|
|
107
|
+
if (stepFunctionTagsToAdd.length > 0) {
|
|
108
|
+
try {
|
|
109
|
+
yield awsCommands_1.tagResource(stepFunctionsClient, stepFunctionArn, stepFunctionTagsToAdd, this.context, this.dryRun);
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
if (err instanceof Error) {
|
|
113
|
+
this.context.stdout.write(`\n[Error] ${err.message}. Failed to tag resource for ${stepFunctionArn}\n`);
|
|
114
|
+
}
|
|
115
|
+
return 1;
|
|
116
|
+
}
|
|
117
|
+
hasChanges = true;
|
|
118
|
+
}
|
|
119
|
+
const stateMachineName = describeStateMachineCommandOutput.name;
|
|
120
|
+
const subscriptionFilterName = helpers_1.buildSubscriptionFilterName(stateMachineName);
|
|
121
|
+
const logLevel = (_d = describeStateMachineCommandOutput.loggingConfiguration) === null || _d === void 0 ? void 0 : _d.level;
|
|
122
|
+
if (logLevel === 'OFF') {
|
|
123
|
+
// if step function logging is disabled, create a log group, subscribe the forwarder to it, and enable step function logging to the created log group
|
|
124
|
+
const logGroupName = helpers_1.buildLogGroupName(stateMachineName, this.environment);
|
|
125
|
+
try {
|
|
126
|
+
yield awsCommands_1.createLogGroup(cloudWatchLogsClient, logGroupName, stepFunctionArn, this.context, this.dryRun);
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
if (err instanceof Error) {
|
|
130
|
+
this.context.stdout.write(`\n[Error] ${err.message}. Failed to Create Log Group ${logGroupName} for ${stepFunctionArn}\n`);
|
|
131
|
+
}
|
|
132
|
+
return 1;
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
yield awsCommands_1.putSubscriptionFilter(cloudWatchLogsClient, this.forwarderArn, subscriptionFilterName, logGroupName, stepFunctionArn, this.context, this.dryRun);
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
if (err instanceof Error) {
|
|
139
|
+
this.context.stdout.write(`\n[Error] ${err.message}. Failed to put subscription filter ${subscriptionFilterName} for Log Group ${logGroupName}\n`);
|
|
140
|
+
}
|
|
141
|
+
return 1;
|
|
142
|
+
}
|
|
143
|
+
const logGroupArn = helpers_1.buildArn(arnObject.partition, 'logs', arnObject.region, arnObject.accountId, 'log-group', `${logGroupName}:*`);
|
|
144
|
+
// Create Logs Access policy
|
|
145
|
+
try {
|
|
146
|
+
yield awsCommands_1.createLogsAccessPolicy(iamClient, describeStateMachineCommandOutput, stepFunctionArn, this.context, this.dryRun);
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
if (err instanceof Error) {
|
|
150
|
+
this.context.stdout.write(`\n[Error] ${err.message}. Failed to create logs access policy for ${stepFunctionArn}\n`);
|
|
151
|
+
}
|
|
152
|
+
return 1;
|
|
153
|
+
}
|
|
154
|
+
// Attach policy to state machine IAM role
|
|
155
|
+
try {
|
|
156
|
+
yield awsCommands_1.attachPolicyToStateMachineIamRole(iamClient, describeStateMachineCommandOutput, arnObject.accountId, stepFunctionArn, this.context, this.dryRun);
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
if (err instanceof Error) {
|
|
160
|
+
this.context.stdout.write(`\n[Error] ${err.message}. Failed to attach policy to state machine iam role for ${stepFunctionArn}\n`);
|
|
161
|
+
}
|
|
162
|
+
return 1;
|
|
163
|
+
}
|
|
164
|
+
// IAM policy on step function role should include log permissions now
|
|
165
|
+
try {
|
|
166
|
+
yield awsCommands_1.enableStepFunctionLogs(stepFunctionsClient, describeStateMachineCommandOutput, logGroupArn, stepFunctionArn, this.context, this.dryRun);
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
if (err instanceof Error) {
|
|
170
|
+
this.context.stdout.write(`\n[Error] ${err.message}. Failed to enable log group ${logGroupArn} for ${stepFunctionArn}\n`);
|
|
171
|
+
}
|
|
172
|
+
return 1;
|
|
173
|
+
}
|
|
174
|
+
hasChanges = true;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
// if step function logging is enabled, subscribe the forwarder to the log group in the step function logging config
|
|
178
|
+
const logGroupArn = helpers_1.getStepFunctionLogGroupArn(describeStateMachineCommandOutput);
|
|
179
|
+
if (logGroupArn === undefined) {
|
|
180
|
+
this.context.stdout.write('\n[Error] Unable to get Log Group arn from Step Function logging configuration\n');
|
|
181
|
+
return 1;
|
|
182
|
+
}
|
|
183
|
+
const logGroupName = helpers_1.parseArn(logGroupArn).resourceName;
|
|
184
|
+
// update step function logging config to have logLevel `ALL` and includeExecutionData `true` if not already configured
|
|
185
|
+
const includeExecutionData = (_e = describeStateMachineCommandOutput.loggingConfiguration) === null || _e === void 0 ? void 0 : _e.includeExecutionData;
|
|
186
|
+
if (logLevel !== 'ALL' || !includeExecutionData) {
|
|
187
|
+
try {
|
|
188
|
+
yield awsCommands_1.enableStepFunctionLogs(stepFunctionsClient, describeStateMachineCommandOutput, logGroupArn, stepFunctionArn, this.context, this.dryRun);
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
if (err instanceof Error) {
|
|
192
|
+
this.context.stdout.write(`\n[Error] ${err.message}. Failed to enable step function logs for ${stepFunctionArn} when logLevel is not ALL or includeExecutionData is not true\n`);
|
|
193
|
+
}
|
|
194
|
+
return 1;
|
|
195
|
+
}
|
|
196
|
+
hasChanges = true;
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
yield awsCommands_1.putSubscriptionFilter(cloudWatchLogsClient, this.forwarderArn, subscriptionFilterName, logGroupName, stepFunctionArn, this.context, this.dryRun);
|
|
200
|
+
}
|
|
201
|
+
catch (err) {
|
|
202
|
+
if (err instanceof Error) {
|
|
203
|
+
this.context.stdout.write(`\n[Error] ${err.message}. Failed to put subscription filter ${subscriptionFilterName} for ${stepFunctionArn}\n`);
|
|
204
|
+
}
|
|
205
|
+
return 1;
|
|
206
|
+
}
|
|
207
|
+
hasChanges = true;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (!hasChanges) {
|
|
211
|
+
this.context.stdout.write(`\nNo change is applied.\n `);
|
|
212
|
+
}
|
|
213
|
+
return 0;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
exports.InstrumentStepFunctionsCommand = InstrumentStepFunctionsCommand;
|
|
218
|
+
InstrumentStepFunctionsCommand.usage = clipanion_1.Command.Usage({
|
|
219
|
+
description: 'Subscribe Step Function Log Groups to a Datadog Forwarder',
|
|
220
|
+
details: '--step-function expects a Step Function ARN\n--forwarder expects a Lambda ARN',
|
|
221
|
+
examples: [
|
|
222
|
+
[
|
|
223
|
+
'View and apply changes to subscribe a Step Function Log Group to a Datadog Forwarder',
|
|
224
|
+
'datadog-ci stepfunctions instrument --step-function arn:aws:states:us-east-1:000000000000:stateMachine:ExampleStepFunction --forwarder arn:aws:lambda:us-east-1:000000000000:function:ExampleDatadogForwarder --env dev --service example-service',
|
|
225
|
+
],
|
|
226
|
+
[
|
|
227
|
+
'View changes to subscribe a Step Function Log Group to a Datadog Forwarder',
|
|
228
|
+
'datadog-ci stepfunctions instrument --step-function arn:aws:states:us-east-1:000000000000:stateMachine:ExampleStepFunction --forwarder arn:aws:lambda:us-east-1:000000000000:function:ExampleDatadogForwarder --env dev --service example-service --dry-run',
|
|
229
|
+
],
|
|
230
|
+
[
|
|
231
|
+
'View and apply changes to subscribe multiple Step Function Log Groups to a Datadog Forwarder',
|
|
232
|
+
'datadog-ci stepfunctions instrument --step-function arn:aws:states:us-east-1:000000000000:stateMachine:ExampleStepFunction1 --step-function arn:aws:states:us-east-1:000000000000:stateMachine:ExampleStepFunction2 --forwarder arn:aws:lambda:us-east-1:000000000000:function:ExampleDatadogForwarder --env dev --service example-service',
|
|
233
|
+
],
|
|
234
|
+
],
|
|
235
|
+
});
|
|
236
|
+
InstrumentStepFunctionsCommand.addPath('stepfunctions', 'instrument');
|
|
237
|
+
InstrumentStepFunctionsCommand.addOption('dryRun', clipanion_1.Command.Boolean('-d,--dry-run'));
|
|
238
|
+
InstrumentStepFunctionsCommand.addOption('environment', clipanion_1.Command.String('-e,--env'));
|
|
239
|
+
InstrumentStepFunctionsCommand.addOption('forwarderArn', clipanion_1.Command.String('--forwarder'));
|
|
240
|
+
InstrumentStepFunctionsCommand.addOption('service', clipanion_1.Command.String('--service'));
|
|
241
|
+
InstrumentStepFunctionsCommand.addOption('stepFunctionArns', clipanion_1.Command.Array('-s,--step-function'));
|
|
242
|
+
//# sourceMappingURL=instrument.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../src/commands/stepfunctions/instrument.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4EAAoE;AACpE,oDAA6C;AAC7C,oDAA6C;AAC7C,yCAAiC;AAEjC,+CASsB;AACtB,2CAA4C;AAC5C,uCAOkB;AAElB,MAAM,UAAU,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAA;AAE3D,MAAa,8BAA+B,SAAQ,mBAAO;IAA3D;;QAoBU,WAAM,GAAG,KAAK,CAAA;QAId,qBAAgB,GAAa,EAAE,CAAA;IA8RzC,CAAC;IA5Rc,OAAO;;;YAClB,IAAI,eAAe,GAAG,KAAK,CAAA;YAC3B,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ,EAAE;gBACzC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAA;gBAChE,eAAe,GAAG,IAAI,CAAA;aACvB;iBAAM,IAAI,CAAC,oBAAU,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;gBACzC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kDAAkD,IAAI,CAAC,YAAY,IAAI,CAAC,CAAA;gBAClG,eAAe,GAAG,IAAI,CAAA;aACvB;YAED,IAAI,eAAe,EAAE;gBACnB,OAAO,CAAC,CAAA;aACT;YAED,sCAAsC;YACtC,MAAM,gBAAgB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAA;YAE5D,IAAI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