@aligent/aws-wrappers 0.1.2 → 0.2.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 +56 -0
- package/cjs/index.cjs +267 -0
- package/cjs/package.json +2 -1
- package/cjs/src/index.d.ts +1 -0
- package/cjs/src/scheduler/scheduler.d.ts +83 -0
- package/docs/classes/DynamoDBService.md +65 -34
- package/docs/classes/S3Service.md +73 -33
- package/docs/classes/SNSService.md +28 -8
- package/docs/classes/SQSService.md +30 -11
- package/docs/classes/SSMService.md +66 -9
- package/docs/classes/SchedulerService.md +269 -0
- package/docs/classes/SecretsManagerService.md +119 -7
- package/docs/classes/StepFunctionsService.md +9 -9
- package/docs/modules.md +1 -0
- package/esm/index.mjs +267 -1
- package/esm/package.json +2 -1
- package/esm/src/index.d.ts +1 -0
- package/esm/src/scheduler/scheduler.d.ts +83 -0
- package/package.json +2 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: StepFunctionsService
|
|
8
8
|
|
|
9
|
-
Defined in: [sfn/sfn.ts:
|
|
9
|
+
Defined in: [sfn/sfn.ts:36](https://github.com/aligent/microservice-development-utilities/blob/1c8403742cbf82a4bd82725126d0860e0996e39d/packages/aws-wrappers/src/sfn/sfn.ts#L36)
|
|
10
10
|
|
|
11
11
|
Wrapper around the AWS Step Functions client providing structured
|
|
12
12
|
Powertools logging and X-Ray tracing by default.
|
|
@@ -19,7 +19,7 @@ Powertools logging and X-Ray tracing by default.
|
|
|
19
19
|
|
|
20
20
|
> **new StepFunctionsService**(`opts?`): `StepFunctionsService`
|
|
21
21
|
|
|
22
|
-
Defined in: [sfn/sfn.ts:
|
|
22
|
+
Defined in: [sfn/sfn.ts:46](https://github.com/aligent/microservice-development-utilities/blob/1c8403742cbf82a4bd82725126d0860e0996e39d/packages/aws-wrappers/src/sfn/sfn.ts#L46)
|
|
23
23
|
|
|
24
24
|
#### Parameters
|
|
25
25
|
|
|
@@ -34,10 +34,10 @@ the wrapper does not apply X-Ray instrumentation.
|
|
|
34
34
|
|
|
35
35
|
###### logger?
|
|
36
36
|
|
|
37
|
-
`
|
|
37
|
+
`LoggerInterface`
|
|
38
38
|
|
|
39
|
-
Optional Powertools logger. Defaults to
|
|
40
|
-
`
|
|
39
|
+
Optional Powertools logger. Defaults to `new Logger()`,
|
|
40
|
+
which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
41
41
|
|
|
42
42
|
#### Returns
|
|
43
43
|
|
|
@@ -51,7 +51,7 @@ Optional Powertools logger. Defaults to a logger with
|
|
|
51
51
|
|
|
52
52
|
> **describeExecution**(`input`): `Promise`\<`DescribeExecutionCommandOutput`\>
|
|
53
53
|
|
|
54
|
-
Defined in: [sfn/sfn.ts:
|
|
54
|
+
Defined in: [sfn/sfn.ts:79](https://github.com/aligent/microservice-development-utilities/blob/1c8403742cbf82a4bd82725126d0860e0996e39d/packages/aws-wrappers/src/sfn/sfn.ts#L79)
|
|
55
55
|
|
|
56
56
|
Describe an existing Step Functions execution.
|
|
57
57
|
|
|
@@ -73,7 +73,7 @@ Describe an existing Step Functions execution.
|
|
|
73
73
|
|
|
74
74
|
> **listExecutions**(`input`): `Promise`\<`ExecutionListItem`[]\>
|
|
75
75
|
|
|
76
|
-
Defined in: [sfn/sfn.ts:
|
|
76
|
+
Defined in: [sfn/sfn.ts:56](https://github.com/aligent/microservice-development-utilities/blob/1c8403742cbf82a4bd82725126d0860e0996e39d/packages/aws-wrappers/src/sfn/sfn.ts#L56)
|
|
77
77
|
|
|
78
78
|
List all executions for a state machine, auto-paginating across all
|
|
79
79
|
pages. Typically bounded by `statusFilter` and state-machine retention,
|
|
@@ -97,7 +97,7 @@ so the flat-array shape is safe in practice.
|
|
|
97
97
|
|
|
98
98
|
> **startExecution**(`input`): `Promise`\<`StartExecutionCommandOutput`\>
|
|
99
99
|
|
|
100
|
-
Defined in: [sfn/sfn.ts:
|
|
100
|
+
Defined in: [sfn/sfn.ts:69](https://github.com/aligent/microservice-development-utilities/blob/1c8403742cbf82a4bd82725126d0860e0996e39d/packages/aws-wrappers/src/sfn/sfn.ts#L69)
|
|
101
101
|
|
|
102
102
|
Start a new Step Functions execution.
|
|
103
103
|
|
|
@@ -119,7 +119,7 @@ Start a new Step Functions execution.
|
|
|
119
119
|
|
|
120
120
|
> **stopExecution**(`input`): `Promise`\<`StopExecutionCommandOutput`\>
|
|
121
121
|
|
|
122
|
-
Defined in: [sfn/sfn.ts:
|
|
122
|
+
Defined in: [sfn/sfn.ts:89](https://github.com/aligent/microservice-development-utilities/blob/1c8403742cbf82a4bd82725126d0860e0996e39d/packages/aws-wrappers/src/sfn/sfn.ts#L89)
|
|
123
123
|
|
|
124
124
|
Stop an in-progress Step Functions execution.
|
|
125
125
|
|
package/docs/modules.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
- [DynamoDBService](classes/DynamoDBService.md)
|
|
10
10
|
- [S3Service](classes/S3Service.md)
|
|
11
|
+
- [SchedulerService](classes/SchedulerService.md)
|
|
11
12
|
- [SecretsManagerService](classes/SecretsManagerService.md)
|
|
12
13
|
- [SNSService](classes/SNSService.md)
|
|
13
14
|
- [SQSService](classes/SQSService.md)
|
package/esm/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { DynamoDBDocumentClient, paginateQuery, paginateScan, GetCommand, PutCom
|
|
|
4
4
|
import xray from 'aws-xray-sdk-core';
|
|
5
5
|
import { S3Client, PutObjectCommand, GetObjectCommand, HeadObjectCommand, CopyObjectCommand, paginateListObjectsV2, DeleteObjectCommand, DeleteObjectsCommand } from '@aws-sdk/client-s3';
|
|
6
6
|
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
7
|
+
import { SchedulerClient, CreateScheduleCommand, GetScheduleCommand, UpdateScheduleCommand, DeleteScheduleCommand, paginateListSchedules, CreateScheduleGroupCommand, GetScheduleGroupCommand, DeleteScheduleGroupCommand, paginateListScheduleGroups } from '@aws-sdk/client-scheduler';
|
|
7
8
|
import { SecretsManagerClient, CreateSecretCommand, UpdateSecretCommand, PutSecretValueCommand, DeleteSecretCommand, GetSecretValueCommand } from '@aws-sdk/client-secrets-manager';
|
|
8
9
|
import { SFNClient, paginateListExecutions, StartExecutionCommand, DescribeExecutionCommand, StopExecutionCommand } from '@aws-sdk/client-sfn';
|
|
9
10
|
import { SNSClient, PublishCommand, PublishBatchCommand } from '@aws-sdk/client-sns';
|
|
@@ -38,6 +39,18 @@ var __assign = function() {
|
|
|
38
39
|
return __assign.apply(this, arguments);
|
|
39
40
|
};
|
|
40
41
|
|
|
42
|
+
function __rest(s, e) {
|
|
43
|
+
var t = {};
|
|
44
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
45
|
+
t[p] = s[p];
|
|
46
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
47
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
48
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
49
|
+
t[p[i]] = s[p[i]];
|
|
50
|
+
}
|
|
51
|
+
return t;
|
|
52
|
+
}
|
|
53
|
+
|
|
41
54
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
42
55
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
43
56
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -1055,6 +1068,259 @@ var S3Service = /** @class */ (function () {
|
|
|
1055
1068
|
return S3Service;
|
|
1056
1069
|
}());
|
|
1057
1070
|
|
|
1071
|
+
/**
|
|
1072
|
+
* `CreateSchedule` / `UpdateSchedule` inputs carry the payload handed to the
|
|
1073
|
+
* target at `Target.Input` — arbitrary text or JSON that routinely contains
|
|
1074
|
+
* PII (customer IDs, order contents, etc.), the same risk profile as SFN's
|
|
1075
|
+
* execution `input`.
|
|
1076
|
+
*
|
|
1077
|
+
* This can't go through the package's usual `filterFieldsForLogLevel` helper:
|
|
1078
|
+
* that helper picks **top-level** keys only, and the sensitive field is nested
|
|
1079
|
+
* one level down inside `Target`. Allowlisting `Target` would leak `Input`;
|
|
1080
|
+
* omitting `Target` would lose operationally-useful fields (`Arn`, `RoleArn`,
|
|
1081
|
+
* `RetryPolicy`, `DeadLetterConfig`, the target-type params). So this is a
|
|
1082
|
+
* bespoke case: keep every top-level field and shallow-strip only
|
|
1083
|
+
* `Target.Input`.
|
|
1084
|
+
*
|
|
1085
|
+
* At `DEBUG` the input is returned unchanged — operators who set
|
|
1086
|
+
* `POWERTOOLS_LOG_LEVEL=DEBUG` have opted into seeing payloads and PII.
|
|
1087
|
+
*/
|
|
1088
|
+
function redactTargetInput(logger, input) {
|
|
1089
|
+
var _a;
|
|
1090
|
+
if (logger.getLevelName() === 'DEBUG')
|
|
1091
|
+
return input;
|
|
1092
|
+
if (((_a = input.Target) === null || _a === void 0 ? void 0 : _a.Input) === undefined)
|
|
1093
|
+
return input;
|
|
1094
|
+
var _b = input.Target; _b.Input; var safeTarget = __rest(_b, ["Input"]);
|
|
1095
|
+
return __assign(__assign({}, input), { Target: safeTarget });
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Wrapper around the AWS EventBridge Scheduler client providing structured
|
|
1099
|
+
* Powertools logging and X-Ray tracing by default.
|
|
1100
|
+
*
|
|
1101
|
+
* Covers CRUD on schedules and their groups. Named `SchedulerService` (not
|
|
1102
|
+
* `EventBridgeSchedulerService`) so it doesn't collide with a future wrapper
|
|
1103
|
+
* over the separate EventBridge bus/rules API (`@aws-sdk/client-eventbridge`).
|
|
1104
|
+
*
|
|
1105
|
+
* `FlexibleTimeWindow` is required by `CreateSchedule` and is passed through
|
|
1106
|
+
* untouched — the wrapper bakes in no default, so the caller must state their
|
|
1107
|
+
* intent (`{ Mode: 'OFF' }` for a fixed-time schedule).
|
|
1108
|
+
*/
|
|
1109
|
+
var SchedulerService = /** @class */ (function () {
|
|
1110
|
+
/**
|
|
1111
|
+
* @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
|
|
1112
|
+
* which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
1113
|
+
* @param opts.client - Optional pre-configured `SchedulerClient`. When
|
|
1114
|
+
* supplied, the wrapper does not apply X-Ray instrumentation.
|
|
1115
|
+
*/
|
|
1116
|
+
function SchedulerService(opts) {
|
|
1117
|
+
var _a, _b;
|
|
1118
|
+
this.client = (_a = opts === null || opts === void 0 ? void 0 : opts.client) !== null && _a !== void 0 ? _a : xray.captureAWSv3Client(new SchedulerClient());
|
|
1119
|
+
this.logger = (_b = opts === null || opts === void 0 ? void 0 : opts.logger) !== null && _b !== void 0 ? _b : new Logger();
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Create a new schedule. At INFO the log line omits `Target.Input` (the
|
|
1123
|
+
* target payload, a PII carrier); `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the
|
|
1124
|
+
* full input.
|
|
1125
|
+
*/
|
|
1126
|
+
SchedulerService.prototype.createSchedule = function (input) {
|
|
1127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1128
|
+
return __generator(this, function (_a) {
|
|
1129
|
+
this.logger.info('Creating schedule', { input: redactTargetInput(this.logger, input) });
|
|
1130
|
+
return [2 /*return*/, this.client.send(new CreateScheduleCommand(input))];
|
|
1131
|
+
});
|
|
1132
|
+
});
|
|
1133
|
+
};
|
|
1134
|
+
/**
|
|
1135
|
+
* Fetch a schedule's full configuration.
|
|
1136
|
+
*/
|
|
1137
|
+
SchedulerService.prototype.getSchedule = function (input) {
|
|
1138
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1139
|
+
return __generator(this, function (_a) {
|
|
1140
|
+
this.logger.info('Getting schedule', { input: input });
|
|
1141
|
+
return [2 /*return*/, this.client.send(new GetScheduleCommand(input))];
|
|
1142
|
+
});
|
|
1143
|
+
});
|
|
1144
|
+
};
|
|
1145
|
+
/**
|
|
1146
|
+
* Update an existing schedule.
|
|
1147
|
+
*
|
|
1148
|
+
* **`UpdateSchedule` has PUT (full-replacement) semantics.** Any field you
|
|
1149
|
+
* omit is reset to its default — this is not a partial patch. To change one
|
|
1150
|
+
* attribute, `getSchedule` first and resend the complete configuration with
|
|
1151
|
+
* that attribute modified, or you will silently erase `ScheduleExpression`,
|
|
1152
|
+
* `Target`, `Description`, `StartDate`, etc. The wrapper does not merge on
|
|
1153
|
+
* your behalf: deep-merging a `Target` (with its mutually-exclusive
|
|
1154
|
+
* target-type params) has no single correct semantics.
|
|
1155
|
+
*
|
|
1156
|
+
* At INFO the log line omits `Target.Input`; `POWERTOOLS_LOG_LEVEL=DEBUG`
|
|
1157
|
+
* unlocks the full input.
|
|
1158
|
+
*/
|
|
1159
|
+
SchedulerService.prototype.updateSchedule = function (input) {
|
|
1160
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1161
|
+
return __generator(this, function (_a) {
|
|
1162
|
+
this.logger.info('Updating schedule', { input: redactTargetInput(this.logger, input) });
|
|
1163
|
+
return [2 /*return*/, this.client.send(new UpdateScheduleCommand(input))];
|
|
1164
|
+
});
|
|
1165
|
+
});
|
|
1166
|
+
};
|
|
1167
|
+
/**
|
|
1168
|
+
* Delete a schedule.
|
|
1169
|
+
*/
|
|
1170
|
+
SchedulerService.prototype.deleteSchedule = function (input) {
|
|
1171
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1172
|
+
return __generator(this, function (_a) {
|
|
1173
|
+
this.logger.info('Deleting schedule', { input: input });
|
|
1174
|
+
return [2 /*return*/, this.client.send(new DeleteScheduleCommand(input))];
|
|
1175
|
+
});
|
|
1176
|
+
});
|
|
1177
|
+
};
|
|
1178
|
+
/**
|
|
1179
|
+
* List schedules, auto-paginating across all pages. Bounded in practice by
|
|
1180
|
+
* the account's schedule count and the `GroupName` / `NamePrefix` / `State`
|
|
1181
|
+
* filters, so the flat-array shape is safe.
|
|
1182
|
+
*/
|
|
1183
|
+
SchedulerService.prototype.listSchedules = function (input) {
|
|
1184
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1185
|
+
var paginator, schedules, _a, paginator_1, paginator_1_1, page, e_1_1;
|
|
1186
|
+
var _b, e_1, _c, _d;
|
|
1187
|
+
return __generator(this, function (_e) {
|
|
1188
|
+
switch (_e.label) {
|
|
1189
|
+
case 0:
|
|
1190
|
+
this.logger.info('Listing schedules', { input: input });
|
|
1191
|
+
paginator = paginateListSchedules({ client: this.client }, input !== null && input !== void 0 ? input : {});
|
|
1192
|
+
schedules = [];
|
|
1193
|
+
_e.label = 1;
|
|
1194
|
+
case 1:
|
|
1195
|
+
_e.trys.push([1, 6, 7, 12]);
|
|
1196
|
+
_a = true, paginator_1 = __asyncValues(paginator);
|
|
1197
|
+
_e.label = 2;
|
|
1198
|
+
case 2: return [4 /*yield*/, paginator_1.next()];
|
|
1199
|
+
case 3:
|
|
1200
|
+
if (!(paginator_1_1 = _e.sent(), _b = paginator_1_1.done, !_b)) return [3 /*break*/, 5];
|
|
1201
|
+
_d = paginator_1_1.value;
|
|
1202
|
+
_a = false;
|
|
1203
|
+
page = _d;
|
|
1204
|
+
if (page.Schedules)
|
|
1205
|
+
schedules.push.apply(schedules, page.Schedules);
|
|
1206
|
+
_e.label = 4;
|
|
1207
|
+
case 4:
|
|
1208
|
+
_a = true;
|
|
1209
|
+
return [3 /*break*/, 2];
|
|
1210
|
+
case 5: return [3 /*break*/, 12];
|
|
1211
|
+
case 6:
|
|
1212
|
+
e_1_1 = _e.sent();
|
|
1213
|
+
e_1 = { error: e_1_1 };
|
|
1214
|
+
return [3 /*break*/, 12];
|
|
1215
|
+
case 7:
|
|
1216
|
+
_e.trys.push([7, , 10, 11]);
|
|
1217
|
+
if (!(!_a && !_b && (_c = paginator_1.return))) return [3 /*break*/, 9];
|
|
1218
|
+
return [4 /*yield*/, _c.call(paginator_1)];
|
|
1219
|
+
case 8:
|
|
1220
|
+
_e.sent();
|
|
1221
|
+
_e.label = 9;
|
|
1222
|
+
case 9: return [3 /*break*/, 11];
|
|
1223
|
+
case 10:
|
|
1224
|
+
if (e_1) throw e_1.error;
|
|
1225
|
+
return [7 /*endfinally*/];
|
|
1226
|
+
case 11: return [7 /*endfinally*/];
|
|
1227
|
+
case 12: return [2 /*return*/, schedules];
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
});
|
|
1231
|
+
};
|
|
1232
|
+
/**
|
|
1233
|
+
* Create a new schedule group. Groups are containers for schedules and are
|
|
1234
|
+
* typically IaC-managed; use this for dynamically-provisioned groups only.
|
|
1235
|
+
*/
|
|
1236
|
+
SchedulerService.prototype.createScheduleGroup = function (input) {
|
|
1237
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1238
|
+
return __generator(this, function (_a) {
|
|
1239
|
+
this.logger.info('Creating schedule group', { input: input });
|
|
1240
|
+
return [2 /*return*/, this.client.send(new CreateScheduleGroupCommand(input))];
|
|
1241
|
+
});
|
|
1242
|
+
});
|
|
1243
|
+
};
|
|
1244
|
+
/**
|
|
1245
|
+
* Fetch a schedule group's configuration.
|
|
1246
|
+
*/
|
|
1247
|
+
SchedulerService.prototype.getScheduleGroup = function (input) {
|
|
1248
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1249
|
+
return __generator(this, function (_a) {
|
|
1250
|
+
this.logger.info('Getting schedule group', { input: input });
|
|
1251
|
+
return [2 /*return*/, this.client.send(new GetScheduleGroupCommand(input))];
|
|
1252
|
+
});
|
|
1253
|
+
});
|
|
1254
|
+
};
|
|
1255
|
+
/**
|
|
1256
|
+
* Delete a schedule group. Deleting a group also deletes every schedule it
|
|
1257
|
+
* contains, asynchronously — the API has no `UpdateScheduleGroup`, so this
|
|
1258
|
+
* is the only mutating group operation besides create.
|
|
1259
|
+
*/
|
|
1260
|
+
SchedulerService.prototype.deleteScheduleGroup = function (input) {
|
|
1261
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1262
|
+
return __generator(this, function (_a) {
|
|
1263
|
+
this.logger.info('Deleting schedule group', { input: input });
|
|
1264
|
+
return [2 /*return*/, this.client.send(new DeleteScheduleGroupCommand(input))];
|
|
1265
|
+
});
|
|
1266
|
+
});
|
|
1267
|
+
};
|
|
1268
|
+
/**
|
|
1269
|
+
* List schedule groups, auto-paginating across all pages. Bounded in
|
|
1270
|
+
* practice by the account's group count and the `NamePrefix` filter.
|
|
1271
|
+
*/
|
|
1272
|
+
SchedulerService.prototype.listScheduleGroups = function (input) {
|
|
1273
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1274
|
+
var paginator, groups, _a, paginator_2, paginator_2_1, page, e_2_1;
|
|
1275
|
+
var _b, e_2, _c, _d;
|
|
1276
|
+
return __generator(this, function (_e) {
|
|
1277
|
+
switch (_e.label) {
|
|
1278
|
+
case 0:
|
|
1279
|
+
this.logger.info('Listing schedule groups', { input: input });
|
|
1280
|
+
paginator = paginateListScheduleGroups({ client: this.client }, input !== null && input !== void 0 ? input : {});
|
|
1281
|
+
groups = [];
|
|
1282
|
+
_e.label = 1;
|
|
1283
|
+
case 1:
|
|
1284
|
+
_e.trys.push([1, 6, 7, 12]);
|
|
1285
|
+
_a = true, paginator_2 = __asyncValues(paginator);
|
|
1286
|
+
_e.label = 2;
|
|
1287
|
+
case 2: return [4 /*yield*/, paginator_2.next()];
|
|
1288
|
+
case 3:
|
|
1289
|
+
if (!(paginator_2_1 = _e.sent(), _b = paginator_2_1.done, !_b)) return [3 /*break*/, 5];
|
|
1290
|
+
_d = paginator_2_1.value;
|
|
1291
|
+
_a = false;
|
|
1292
|
+
page = _d;
|
|
1293
|
+
if (page.ScheduleGroups)
|
|
1294
|
+
groups.push.apply(groups, page.ScheduleGroups);
|
|
1295
|
+
_e.label = 4;
|
|
1296
|
+
case 4:
|
|
1297
|
+
_a = true;
|
|
1298
|
+
return [3 /*break*/, 2];
|
|
1299
|
+
case 5: return [3 /*break*/, 12];
|
|
1300
|
+
case 6:
|
|
1301
|
+
e_2_1 = _e.sent();
|
|
1302
|
+
e_2 = { error: e_2_1 };
|
|
1303
|
+
return [3 /*break*/, 12];
|
|
1304
|
+
case 7:
|
|
1305
|
+
_e.trys.push([7, , 10, 11]);
|
|
1306
|
+
if (!(!_a && !_b && (_c = paginator_2.return))) return [3 /*break*/, 9];
|
|
1307
|
+
return [4 /*yield*/, _c.call(paginator_2)];
|
|
1308
|
+
case 8:
|
|
1309
|
+
_e.sent();
|
|
1310
|
+
_e.label = 9;
|
|
1311
|
+
case 9: return [3 /*break*/, 11];
|
|
1312
|
+
case 10:
|
|
1313
|
+
if (e_2) throw e_2.error;
|
|
1314
|
+
return [7 /*endfinally*/];
|
|
1315
|
+
case 11: return [7 /*endfinally*/];
|
|
1316
|
+
case 12: return [2 /*return*/, groups];
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1319
|
+
});
|
|
1320
|
+
};
|
|
1321
|
+
return SchedulerService;
|
|
1322
|
+
}());
|
|
1323
|
+
|
|
1058
1324
|
/**
|
|
1059
1325
|
* Fields safe to log at INFO level. Omits `SecretString` and `SecretBinary` —
|
|
1060
1326
|
* the secret material itself. `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full
|
|
@@ -1900,4 +2166,4 @@ var SSMService = /** @class */ (function () {
|
|
|
1900
2166
|
return SSMService;
|
|
1901
2167
|
}());
|
|
1902
2168
|
|
|
1903
|
-
export { DynamoDBService, S3Service, SNSService, SQSService, SSMService, SecretsManagerService, StepFunctionsService };
|
|
2169
|
+
export { DynamoDBService, S3Service, SNSService, SQSService, SSMService, SchedulerService, SecretsManagerService, StepFunctionsService };
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aligent/aws-wrappers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
|
|
5
5
|
"main": "./cjs/index.cjs",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@aws-lambda-powertools/logger": "^2.33.1",
|
|
34
34
|
"@aws-sdk/client-dynamodb": "^3.1068.0",
|
|
35
35
|
"@aws-sdk/client-s3": "^3.1068.0",
|
|
36
|
+
"@aws-sdk/client-scheduler": "^3.1077.0",
|
|
36
37
|
"@aws-sdk/client-secrets-manager": "^3.1068.0",
|
|
37
38
|
"@aws-sdk/client-sfn": "^3.1068.0",
|
|
38
39
|
"@aws-sdk/client-sns": "^3.1068.0",
|
package/esm/src/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { DynamoDBService } from './dynamodb/dynamodb.js';
|
|
2
2
|
export { S3Service } from './s3/s3.js';
|
|
3
|
+
export { SchedulerService } from './scheduler/scheduler.js';
|
|
3
4
|
export { SecretsManagerService } from './secrets-manager/secrets-manager.js';
|
|
4
5
|
export { StepFunctionsService } from './sfn/sfn.js';
|
|
5
6
|
export { SNSService } from './sns/sns.js';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
|
|
2
|
+
import { CreateScheduleCommandInput, CreateScheduleCommandOutput, CreateScheduleGroupCommandInput, CreateScheduleGroupCommandOutput, DeleteScheduleCommandInput, DeleteScheduleCommandOutput, DeleteScheduleGroupCommandInput, DeleteScheduleGroupCommandOutput, GetScheduleCommandInput, GetScheduleCommandOutput, GetScheduleGroupCommandInput, GetScheduleGroupCommandOutput, ListScheduleGroupsCommandInput, ListSchedulesCommandInput, ScheduleGroupSummary, SchedulerClient, ScheduleSummary, UpdateScheduleCommandInput, UpdateScheduleCommandOutput } from '@aws-sdk/client-scheduler';
|
|
3
|
+
/**
|
|
4
|
+
* Wrapper around the AWS EventBridge Scheduler client providing structured
|
|
5
|
+
* Powertools logging and X-Ray tracing by default.
|
|
6
|
+
*
|
|
7
|
+
* Covers CRUD on schedules and their groups. Named `SchedulerService` (not
|
|
8
|
+
* `EventBridgeSchedulerService`) so it doesn't collide with a future wrapper
|
|
9
|
+
* over the separate EventBridge bus/rules API (`@aws-sdk/client-eventbridge`).
|
|
10
|
+
*
|
|
11
|
+
* `FlexibleTimeWindow` is required by `CreateSchedule` and is passed through
|
|
12
|
+
* untouched — the wrapper bakes in no default, so the caller must state their
|
|
13
|
+
* intent (`{ Mode: 'OFF' }` for a fixed-time schedule).
|
|
14
|
+
*/
|
|
15
|
+
export declare class SchedulerService {
|
|
16
|
+
private readonly client;
|
|
17
|
+
private readonly logger;
|
|
18
|
+
/**
|
|
19
|
+
* @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
|
|
20
|
+
* which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
21
|
+
* @param opts.client - Optional pre-configured `SchedulerClient`. When
|
|
22
|
+
* supplied, the wrapper does not apply X-Ray instrumentation.
|
|
23
|
+
*/
|
|
24
|
+
constructor(opts?: {
|
|
25
|
+
logger?: LoggerInterface;
|
|
26
|
+
client?: SchedulerClient;
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Create a new schedule. At INFO the log line omits `Target.Input` (the
|
|
30
|
+
* target payload, a PII carrier); `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the
|
|
31
|
+
* full input.
|
|
32
|
+
*/
|
|
33
|
+
createSchedule(input: CreateScheduleCommandInput): Promise<CreateScheduleCommandOutput>;
|
|
34
|
+
/**
|
|
35
|
+
* Fetch a schedule's full configuration.
|
|
36
|
+
*/
|
|
37
|
+
getSchedule(input: GetScheduleCommandInput): Promise<GetScheduleCommandOutput>;
|
|
38
|
+
/**
|
|
39
|
+
* Update an existing schedule.
|
|
40
|
+
*
|
|
41
|
+
* **`UpdateSchedule` has PUT (full-replacement) semantics.** Any field you
|
|
42
|
+
* omit is reset to its default — this is not a partial patch. To change one
|
|
43
|
+
* attribute, `getSchedule` first and resend the complete configuration with
|
|
44
|
+
* that attribute modified, or you will silently erase `ScheduleExpression`,
|
|
45
|
+
* `Target`, `Description`, `StartDate`, etc. The wrapper does not merge on
|
|
46
|
+
* your behalf: deep-merging a `Target` (with its mutually-exclusive
|
|
47
|
+
* target-type params) has no single correct semantics.
|
|
48
|
+
*
|
|
49
|
+
* At INFO the log line omits `Target.Input`; `POWERTOOLS_LOG_LEVEL=DEBUG`
|
|
50
|
+
* unlocks the full input.
|
|
51
|
+
*/
|
|
52
|
+
updateSchedule(input: UpdateScheduleCommandInput): Promise<UpdateScheduleCommandOutput>;
|
|
53
|
+
/**
|
|
54
|
+
* Delete a schedule.
|
|
55
|
+
*/
|
|
56
|
+
deleteSchedule(input: DeleteScheduleCommandInput): Promise<DeleteScheduleCommandOutput>;
|
|
57
|
+
/**
|
|
58
|
+
* List schedules, auto-paginating across all pages. Bounded in practice by
|
|
59
|
+
* the account's schedule count and the `GroupName` / `NamePrefix` / `State`
|
|
60
|
+
* filters, so the flat-array shape is safe.
|
|
61
|
+
*/
|
|
62
|
+
listSchedules(input?: ListSchedulesCommandInput): Promise<ScheduleSummary[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Create a new schedule group. Groups are containers for schedules and are
|
|
65
|
+
* typically IaC-managed; use this for dynamically-provisioned groups only.
|
|
66
|
+
*/
|
|
67
|
+
createScheduleGroup(input: CreateScheduleGroupCommandInput): Promise<CreateScheduleGroupCommandOutput>;
|
|
68
|
+
/**
|
|
69
|
+
* Fetch a schedule group's configuration.
|
|
70
|
+
*/
|
|
71
|
+
getScheduleGroup(input: GetScheduleGroupCommandInput): Promise<GetScheduleGroupCommandOutput>;
|
|
72
|
+
/**
|
|
73
|
+
* Delete a schedule group. Deleting a group also deletes every schedule it
|
|
74
|
+
* contains, asynchronously — the API has no `UpdateScheduleGroup`, so this
|
|
75
|
+
* is the only mutating group operation besides create.
|
|
76
|
+
*/
|
|
77
|
+
deleteScheduleGroup(input: DeleteScheduleGroupCommandInput): Promise<DeleteScheduleGroupCommandOutput>;
|
|
78
|
+
/**
|
|
79
|
+
* List schedule groups, auto-paginating across all pages. Bounded in
|
|
80
|
+
* practice by the account's group count and the `NamePrefix` filter.
|
|
81
|
+
*/
|
|
82
|
+
listScheduleGroups(input?: ListScheduleGroupsCommandInput): Promise<ScheduleGroupSummary[]>;
|
|
83
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aligent/aws-wrappers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
|
|
5
5
|
"main": "./cjs/index.cjs",
|
|
6
6
|
"module": "./esm/index.mjs",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@aws-lambda-powertools/logger": "^2.33.1",
|
|
34
34
|
"@aws-sdk/client-dynamodb": "^3.1068.0",
|
|
35
35
|
"@aws-sdk/client-s3": "^3.1068.0",
|
|
36
|
+
"@aws-sdk/client-scheduler": "^3.1077.0",
|
|
36
37
|
"@aws-sdk/client-secrets-manager": "^3.1068.0",
|
|
37
38
|
"@aws-sdk/client-sfn": "^3.1068.0",
|
|
38
39
|
"@aws-sdk/client-sns": "^3.1068.0",
|