@aws-sdk/client-codestar-notifications 3.180.0 → 3.183.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist-cjs/protocols/Aws_restJson1.js +19 -13
  3. package/dist-es/CodestarNotifications.js +54 -61
  4. package/dist-es/CodestarNotificationsClient.js +22 -28
  5. package/dist-es/commands/CreateNotificationRuleCommand.js +21 -28
  6. package/dist-es/commands/DeleteNotificationRuleCommand.js +21 -28
  7. package/dist-es/commands/DeleteTargetCommand.js +21 -28
  8. package/dist-es/commands/DescribeNotificationRuleCommand.js +21 -28
  9. package/dist-es/commands/ListEventTypesCommand.js +21 -28
  10. package/dist-es/commands/ListNotificationRulesCommand.js +21 -28
  11. package/dist-es/commands/ListTagsForResourceCommand.js +21 -28
  12. package/dist-es/commands/ListTargetsCommand.js +21 -28
  13. package/dist-es/commands/SubscribeCommand.js +21 -28
  14. package/dist-es/commands/TagResourceCommand.js +21 -28
  15. package/dist-es/commands/UnsubscribeCommand.js +21 -28
  16. package/dist-es/commands/UntagResourceCommand.js +21 -28
  17. package/dist-es/commands/UpdateNotificationRuleCommand.js +21 -28
  18. package/dist-es/endpoints.js +8 -8
  19. package/dist-es/models/CodestarNotificationsServiceException.js +5 -10
  20. package/dist-es/models/models_0.js +207 -130
  21. package/dist-es/pagination/ListEventTypesPaginator.js +25 -68
  22. package/dist-es/pagination/ListNotificationRulesPaginator.js +25 -68
  23. package/dist-es/pagination/ListTargetsPaginator.js +25 -68
  24. package/dist-es/protocols/Aws_restJson1.js +954 -1293
  25. package/dist-es/runtimeConfig.browser.js +26 -12
  26. package/dist-es/runtimeConfig.js +30 -12
  27. package/dist-es/runtimeConfig.native.js +8 -5
  28. package/dist-es/runtimeConfig.shared.js +8 -11
  29. package/package.json +33 -33
@@ -1,1328 +1,993 @@
1
- import { __assign, __awaiter, __generator, __read } from "tslib";
2
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
2
  import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
4
3
  import { v4 as generateIdempotencyToken } from "uuid";
5
4
  import { CodestarNotificationsServiceException as __BaseException } from "../models/CodestarNotificationsServiceException";
6
5
  import { AccessDeniedException, ConcurrentModificationException, ConfigurationException, InvalidNextTokenException, LimitExceededException, ResourceAlreadyExistsException, ResourceNotFoundException, ValidationException, } from "../models/models_0";
7
- export var serializeAws_restJson1CreateNotificationRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
8
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
9
- var _c;
10
- return __generator(this, function (_d) {
11
- switch (_d.label) {
12
- case 0: return [4, context.endpoint()];
13
- case 1:
14
- _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
15
- headers = {
16
- "content-type": "application/json",
17
- };
18
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/createNotificationRule";
19
- body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ ClientRequestToken: (_c = input.ClientRequestToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }, (input.DetailType != null && { DetailType: input.DetailType })), (input.EventTypeIds != null && {
20
- EventTypeIds: serializeAws_restJson1EventTypeIds(input.EventTypeIds, context),
21
- })), (input.Name != null && { Name: input.Name })), (input.Resource != null && { Resource: input.Resource })), (input.Status != null && { Status: input.Status })), (input.Tags != null && { Tags: serializeAws_restJson1Tags(input.Tags, context) })), (input.Targets != null && { Targets: serializeAws_restJson1Targets(input.Targets, context) })));
22
- return [2, new __HttpRequest({
23
- protocol: protocol,
24
- hostname: hostname,
25
- port: port,
26
- method: "POST",
27
- headers: headers,
28
- path: resolvedPath,
29
- body: body,
30
- })];
31
- }
6
+ export const serializeAws_restJson1CreateNotificationRuleCommand = async (input, context) => {
7
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
8
+ const headers = {
9
+ "content-type": "application/json",
10
+ };
11
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createNotificationRule";
12
+ let body;
13
+ body = JSON.stringify({
14
+ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(),
15
+ ...(input.DetailType != null && { DetailType: input.DetailType }),
16
+ ...(input.EventTypeIds != null && {
17
+ EventTypeIds: serializeAws_restJson1EventTypeIds(input.EventTypeIds, context),
18
+ }),
19
+ ...(input.Name != null && { Name: input.Name }),
20
+ ...(input.Resource != null && { Resource: input.Resource }),
21
+ ...(input.Status != null && { Status: input.Status }),
22
+ ...(input.Tags != null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }),
23
+ ...(input.Targets != null && { Targets: serializeAws_restJson1Targets(input.Targets, context) }),
32
24
  });
33
- }); };
34
- export var serializeAws_restJson1DeleteNotificationRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
35
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
36
- return __generator(this, function (_c) {
37
- switch (_c.label) {
38
- case 0: return [4, context.endpoint()];
39
- case 1:
40
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
41
- headers = {
42
- "content-type": "application/json",
43
- };
44
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/deleteNotificationRule";
45
- body = JSON.stringify(__assign({}, (input.Arn != null && { Arn: input.Arn })));
46
- return [2, new __HttpRequest({
47
- protocol: protocol,
48
- hostname: hostname,
49
- port: port,
50
- method: "POST",
51
- headers: headers,
52
- path: resolvedPath,
53
- body: body,
54
- })];
55
- }
25
+ return new __HttpRequest({
26
+ protocol,
27
+ hostname,
28
+ port,
29
+ method: "POST",
30
+ headers,
31
+ path: resolvedPath,
32
+ body,
56
33
  });
57
- }); };
58
- export var serializeAws_restJson1DeleteTargetCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
59
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
60
- return __generator(this, function (_c) {
61
- switch (_c.label) {
62
- case 0: return [4, context.endpoint()];
63
- case 1:
64
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
65
- headers = {
66
- "content-type": "application/json",
67
- };
68
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/deleteTarget";
69
- body = JSON.stringify(__assign(__assign({}, (input.ForceUnsubscribeAll != null && { ForceUnsubscribeAll: input.ForceUnsubscribeAll })), (input.TargetAddress != null && { TargetAddress: input.TargetAddress })));
70
- return [2, new __HttpRequest({
71
- protocol: protocol,
72
- hostname: hostname,
73
- port: port,
74
- method: "POST",
75
- headers: headers,
76
- path: resolvedPath,
77
- body: body,
78
- })];
79
- }
34
+ };
35
+ export const serializeAws_restJson1DeleteNotificationRuleCommand = async (input, context) => {
36
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
37
+ const headers = {
38
+ "content-type": "application/json",
39
+ };
40
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteNotificationRule";
41
+ let body;
42
+ body = JSON.stringify({
43
+ ...(input.Arn != null && { Arn: input.Arn }),
80
44
  });
81
- }); };
82
- export var serializeAws_restJson1DescribeNotificationRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
83
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
84
- return __generator(this, function (_c) {
85
- switch (_c.label) {
86
- case 0: return [4, context.endpoint()];
87
- case 1:
88
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
89
- headers = {
90
- "content-type": "application/json",
91
- };
92
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/describeNotificationRule";
93
- body = JSON.stringify(__assign({}, (input.Arn != null && { Arn: input.Arn })));
94
- return [2, new __HttpRequest({
95
- protocol: protocol,
96
- hostname: hostname,
97
- port: port,
98
- method: "POST",
99
- headers: headers,
100
- path: resolvedPath,
101
- body: body,
102
- })];
103
- }
45
+ return new __HttpRequest({
46
+ protocol,
47
+ hostname,
48
+ port,
49
+ method: "POST",
50
+ headers,
51
+ path: resolvedPath,
52
+ body,
104
53
  });
105
- }); };
106
- export var serializeAws_restJson1ListEventTypesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
107
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
108
- return __generator(this, function (_c) {
109
- switch (_c.label) {
110
- case 0: return [4, context.endpoint()];
111
- case 1:
112
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
113
- headers = {
114
- "content-type": "application/json",
115
- };
116
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/listEventTypes";
117
- body = JSON.stringify(__assign(__assign(__assign({}, (input.Filters != null && { Filters: serializeAws_restJson1ListEventTypesFilters(input.Filters, context) })), (input.MaxResults != null && { MaxResults: input.MaxResults })), (input.NextToken != null && { NextToken: input.NextToken })));
118
- return [2, new __HttpRequest({
119
- protocol: protocol,
120
- hostname: hostname,
121
- port: port,
122
- method: "POST",
123
- headers: headers,
124
- path: resolvedPath,
125
- body: body,
126
- })];
127
- }
54
+ };
55
+ export const serializeAws_restJson1DeleteTargetCommand = async (input, context) => {
56
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
57
+ const headers = {
58
+ "content-type": "application/json",
59
+ };
60
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteTarget";
61
+ let body;
62
+ body = JSON.stringify({
63
+ ...(input.ForceUnsubscribeAll != null && { ForceUnsubscribeAll: input.ForceUnsubscribeAll }),
64
+ ...(input.TargetAddress != null && { TargetAddress: input.TargetAddress }),
128
65
  });
129
- }); };
130
- export var serializeAws_restJson1ListNotificationRulesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
131
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
132
- return __generator(this, function (_c) {
133
- switch (_c.label) {
134
- case 0: return [4, context.endpoint()];
135
- case 1:
136
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
137
- headers = {
138
- "content-type": "application/json",
139
- };
140
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/listNotificationRules";
141
- body = JSON.stringify(__assign(__assign(__assign({}, (input.Filters != null && {
142
- Filters: serializeAws_restJson1ListNotificationRulesFilters(input.Filters, context),
143
- })), (input.MaxResults != null && { MaxResults: input.MaxResults })), (input.NextToken != null && { NextToken: input.NextToken })));
144
- return [2, new __HttpRequest({
145
- protocol: protocol,
146
- hostname: hostname,
147
- port: port,
148
- method: "POST",
149
- headers: headers,
150
- path: resolvedPath,
151
- body: body,
152
- })];
153
- }
66
+ return new __HttpRequest({
67
+ protocol,
68
+ hostname,
69
+ port,
70
+ method: "POST",
71
+ headers,
72
+ path: resolvedPath,
73
+ body,
154
74
  });
155
- }); };
156
- export var serializeAws_restJson1ListTagsForResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
157
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
158
- return __generator(this, function (_c) {
159
- switch (_c.label) {
160
- case 0: return [4, context.endpoint()];
161
- case 1:
162
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
163
- headers = {
164
- "content-type": "application/json",
165
- };
166
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/listTagsForResource";
167
- body = JSON.stringify(__assign({}, (input.Arn != null && { Arn: input.Arn })));
168
- return [2, new __HttpRequest({
169
- protocol: protocol,
170
- hostname: hostname,
171
- port: port,
172
- method: "POST",
173
- headers: headers,
174
- path: resolvedPath,
175
- body: body,
176
- })];
177
- }
75
+ };
76
+ export const serializeAws_restJson1DescribeNotificationRuleCommand = async (input, context) => {
77
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
78
+ const headers = {
79
+ "content-type": "application/json",
80
+ };
81
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeNotificationRule";
82
+ let body;
83
+ body = JSON.stringify({
84
+ ...(input.Arn != null && { Arn: input.Arn }),
178
85
  });
179
- }); };
180
- export var serializeAws_restJson1ListTargetsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
181
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
182
- return __generator(this, function (_c) {
183
- switch (_c.label) {
184
- case 0: return [4, context.endpoint()];
185
- case 1:
186
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
187
- headers = {
188
- "content-type": "application/json",
189
- };
190
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/listTargets";
191
- body = JSON.stringify(__assign(__assign(__assign({}, (input.Filters != null && { Filters: serializeAws_restJson1ListTargetsFilters(input.Filters, context) })), (input.MaxResults != null && { MaxResults: input.MaxResults })), (input.NextToken != null && { NextToken: input.NextToken })));
192
- return [2, new __HttpRequest({
193
- protocol: protocol,
194
- hostname: hostname,
195
- port: port,
196
- method: "POST",
197
- headers: headers,
198
- path: resolvedPath,
199
- body: body,
200
- })];
201
- }
86
+ return new __HttpRequest({
87
+ protocol,
88
+ hostname,
89
+ port,
90
+ method: "POST",
91
+ headers,
92
+ path: resolvedPath,
93
+ body,
202
94
  });
203
- }); };
204
- export var serializeAws_restJson1SubscribeCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
205
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
206
- return __generator(this, function (_c) {
207
- switch (_c.label) {
208
- case 0: return [4, context.endpoint()];
209
- case 1:
210
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
211
- headers = {
212
- "content-type": "application/json",
213
- };
214
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/subscribe";
215
- body = JSON.stringify(__assign(__assign(__assign({}, (input.Arn != null && { Arn: input.Arn })), (input.ClientRequestToken != null && { ClientRequestToken: input.ClientRequestToken })), (input.Target != null && { Target: serializeAws_restJson1Target(input.Target, context) })));
216
- return [2, new __HttpRequest({
217
- protocol: protocol,
218
- hostname: hostname,
219
- port: port,
220
- method: "POST",
221
- headers: headers,
222
- path: resolvedPath,
223
- body: body,
224
- })];
225
- }
95
+ };
96
+ export const serializeAws_restJson1ListEventTypesCommand = async (input, context) => {
97
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
98
+ const headers = {
99
+ "content-type": "application/json",
100
+ };
101
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listEventTypes";
102
+ let body;
103
+ body = JSON.stringify({
104
+ ...(input.Filters != null && { Filters: serializeAws_restJson1ListEventTypesFilters(input.Filters, context) }),
105
+ ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
106
+ ...(input.NextToken != null && { NextToken: input.NextToken }),
226
107
  });
227
- }); };
228
- export var serializeAws_restJson1TagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
229
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
230
- return __generator(this, function (_c) {
231
- switch (_c.label) {
232
- case 0: return [4, context.endpoint()];
233
- case 1:
234
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
235
- headers = {
236
- "content-type": "application/json",
237
- };
238
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tagResource";
239
- body = JSON.stringify(__assign(__assign({}, (input.Arn != null && { Arn: input.Arn })), (input.Tags != null && { Tags: serializeAws_restJson1Tags(input.Tags, context) })));
240
- return [2, new __HttpRequest({
241
- protocol: protocol,
242
- hostname: hostname,
243
- port: port,
244
- method: "POST",
245
- headers: headers,
246
- path: resolvedPath,
247
- body: body,
248
- })];
249
- }
108
+ return new __HttpRequest({
109
+ protocol,
110
+ hostname,
111
+ port,
112
+ method: "POST",
113
+ headers,
114
+ path: resolvedPath,
115
+ body,
250
116
  });
251
- }); };
252
- export var serializeAws_restJson1UnsubscribeCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
253
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
254
- return __generator(this, function (_c) {
255
- switch (_c.label) {
256
- case 0: return [4, context.endpoint()];
257
- case 1:
258
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
259
- headers = {
260
- "content-type": "application/json",
261
- };
262
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/unsubscribe";
263
- body = JSON.stringify(__assign(__assign({}, (input.Arn != null && { Arn: input.Arn })), (input.TargetAddress != null && { TargetAddress: input.TargetAddress })));
264
- return [2, new __HttpRequest({
265
- protocol: protocol,
266
- hostname: hostname,
267
- port: port,
268
- method: "POST",
269
- headers: headers,
270
- path: resolvedPath,
271
- body: body,
272
- })];
273
- }
117
+ };
118
+ export const serializeAws_restJson1ListNotificationRulesCommand = async (input, context) => {
119
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
120
+ const headers = {
121
+ "content-type": "application/json",
122
+ };
123
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listNotificationRules";
124
+ let body;
125
+ body = JSON.stringify({
126
+ ...(input.Filters != null && {
127
+ Filters: serializeAws_restJson1ListNotificationRulesFilters(input.Filters, context),
128
+ }),
129
+ ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
130
+ ...(input.NextToken != null && { NextToken: input.NextToken }),
274
131
  });
275
- }); };
276
- export var serializeAws_restJson1UntagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
277
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
278
- return __generator(this, function (_c) {
279
- switch (_c.label) {
280
- case 0: return [4, context.endpoint()];
281
- case 1:
282
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
283
- headers = {};
284
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/untagResource/{Arn}";
285
- resolvedPath = __resolvedPath(resolvedPath, input, "Arn", function () { return input.Arn; }, "{Arn}", false);
286
- query = map({
287
- tagKeys: [function () { return input.TagKeys !== void 0; }, function () { return (input.TagKeys || []).map(function (_entry) { return _entry; }); }],
288
- });
289
- return [2, new __HttpRequest({
290
- protocol: protocol,
291
- hostname: hostname,
292
- port: port,
293
- method: "POST",
294
- headers: headers,
295
- path: resolvedPath,
296
- query: query,
297
- body: body,
298
- })];
299
- }
132
+ return new __HttpRequest({
133
+ protocol,
134
+ hostname,
135
+ port,
136
+ method: "POST",
137
+ headers,
138
+ path: resolvedPath,
139
+ body,
300
140
  });
301
- }); };
302
- export var serializeAws_restJson1UpdateNotificationRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
303
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
304
- return __generator(this, function (_c) {
305
- switch (_c.label) {
306
- case 0: return [4, context.endpoint()];
307
- case 1:
308
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
309
- headers = {
310
- "content-type": "application/json",
311
- };
312
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/updateNotificationRule";
313
- body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.Arn != null && { Arn: input.Arn })), (input.DetailType != null && { DetailType: input.DetailType })), (input.EventTypeIds != null && {
314
- EventTypeIds: serializeAws_restJson1EventTypeIds(input.EventTypeIds, context),
315
- })), (input.Name != null && { Name: input.Name })), (input.Status != null && { Status: input.Status })), (input.Targets != null && { Targets: serializeAws_restJson1Targets(input.Targets, context) })));
316
- return [2, new __HttpRequest({
317
- protocol: protocol,
318
- hostname: hostname,
319
- port: port,
320
- method: "POST",
321
- headers: headers,
322
- path: resolvedPath,
323
- body: body,
324
- })];
325
- }
141
+ };
142
+ export const serializeAws_restJson1ListTagsForResourceCommand = async (input, context) => {
143
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
144
+ const headers = {
145
+ "content-type": "application/json",
146
+ };
147
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listTagsForResource";
148
+ let body;
149
+ body = JSON.stringify({
150
+ ...(input.Arn != null && { Arn: input.Arn }),
326
151
  });
327
- }); };
328
- export var deserializeAws_restJson1CreateNotificationRuleCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
329
- var contents, data, _a, _b;
330
- return __generator(this, function (_c) {
331
- switch (_c.label) {
332
- case 0:
333
- if (output.statusCode !== 200 && output.statusCode >= 300) {
334
- return [2, deserializeAws_restJson1CreateNotificationRuleCommandError(output, context)];
335
- }
336
- contents = map({
337
- $metadata: deserializeMetadata(output),
338
- });
339
- _a = __expectNonNull;
340
- _b = __expectObject;
341
- return [4, parseBody(output.body, context)];
342
- case 1:
343
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
344
- if (data.Arn != null) {
345
- contents.Arn = __expectString(data.Arn);
346
- }
347
- return [2, contents];
348
- }
152
+ return new __HttpRequest({
153
+ protocol,
154
+ hostname,
155
+ port,
156
+ method: "POST",
157
+ headers,
158
+ path: resolvedPath,
159
+ body,
349
160
  });
350
- }); };
351
- var deserializeAws_restJson1CreateNotificationRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
352
- var parsedOutput, _a, errorCode, _b, parsedBody;
353
- var _c;
354
- return __generator(this, function (_d) {
355
- switch (_d.label) {
356
- case 0:
357
- _a = [__assign({}, output)];
358
- _c = {};
359
- return [4, parseBody(output.body, context)];
360
- case 1:
361
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
362
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
363
- _b = errorCode;
364
- switch (_b) {
365
- case "AccessDeniedException": return [3, 2];
366
- case "com.amazonaws.codestarnotifications#AccessDeniedException": return [3, 2];
367
- case "ConcurrentModificationException": return [3, 4];
368
- case "com.amazonaws.codestarnotifications#ConcurrentModificationException": return [3, 4];
369
- case "ConfigurationException": return [3, 6];
370
- case "com.amazonaws.codestarnotifications#ConfigurationException": return [3, 6];
371
- case "LimitExceededException": return [3, 8];
372
- case "com.amazonaws.codestarnotifications#LimitExceededException": return [3, 8];
373
- case "ResourceAlreadyExistsException": return [3, 10];
374
- case "com.amazonaws.codestarnotifications#ResourceAlreadyExistsException": return [3, 10];
375
- case "ValidationException": return [3, 12];
376
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 12];
377
- }
378
- return [3, 14];
379
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
380
- case 3: throw _d.sent();
381
- case 4: return [4, deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context)];
382
- case 5: throw _d.sent();
383
- case 6: return [4, deserializeAws_restJson1ConfigurationExceptionResponse(parsedOutput, context)];
384
- case 7: throw _d.sent();
385
- case 8: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
386
- case 9: throw _d.sent();
387
- case 10: return [4, deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse(parsedOutput, context)];
388
- case 11: throw _d.sent();
389
- case 12: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
390
- case 13: throw _d.sent();
391
- case 14:
392
- parsedBody = parsedOutput.body;
393
- throwDefaultError({
394
- output: output,
395
- parsedBody: parsedBody,
396
- exceptionCtor: __BaseException,
397
- errorCode: errorCode,
398
- });
399
- _d.label = 15;
400
- case 15: return [2];
401
- }
161
+ };
162
+ export const serializeAws_restJson1ListTargetsCommand = async (input, context) => {
163
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
164
+ const headers = {
165
+ "content-type": "application/json",
166
+ };
167
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listTargets";
168
+ let body;
169
+ body = JSON.stringify({
170
+ ...(input.Filters != null && { Filters: serializeAws_restJson1ListTargetsFilters(input.Filters, context) }),
171
+ ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
172
+ ...(input.NextToken != null && { NextToken: input.NextToken }),
402
173
  });
403
- }); };
404
- export var deserializeAws_restJson1DeleteNotificationRuleCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
405
- var contents, data, _a, _b;
406
- return __generator(this, function (_c) {
407
- switch (_c.label) {
408
- case 0:
409
- if (output.statusCode !== 200 && output.statusCode >= 300) {
410
- return [2, deserializeAws_restJson1DeleteNotificationRuleCommandError(output, context)];
411
- }
412
- contents = map({
413
- $metadata: deserializeMetadata(output),
414
- });
415
- _a = __expectNonNull;
416
- _b = __expectObject;
417
- return [4, parseBody(output.body, context)];
418
- case 1:
419
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
420
- if (data.Arn != null) {
421
- contents.Arn = __expectString(data.Arn);
422
- }
423
- return [2, contents];
424
- }
174
+ return new __HttpRequest({
175
+ protocol,
176
+ hostname,
177
+ port,
178
+ method: "POST",
179
+ headers,
180
+ path: resolvedPath,
181
+ body,
425
182
  });
426
- }); };
427
- var deserializeAws_restJson1DeleteNotificationRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
428
- var parsedOutput, _a, errorCode, _b, parsedBody;
429
- var _c;
430
- return __generator(this, function (_d) {
431
- switch (_d.label) {
432
- case 0:
433
- _a = [__assign({}, output)];
434
- _c = {};
435
- return [4, parseBody(output.body, context)];
436
- case 1:
437
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
438
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
439
- _b = errorCode;
440
- switch (_b) {
441
- case "ConcurrentModificationException": return [3, 2];
442
- case "com.amazonaws.codestarnotifications#ConcurrentModificationException": return [3, 2];
443
- case "LimitExceededException": return [3, 4];
444
- case "com.amazonaws.codestarnotifications#LimitExceededException": return [3, 4];
445
- case "ValidationException": return [3, 6];
446
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 6];
447
- }
448
- return [3, 8];
449
- case 2: return [4, deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context)];
450
- case 3: throw _d.sent();
451
- case 4: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
452
- case 5: throw _d.sent();
453
- case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
454
- case 7: throw _d.sent();
455
- case 8:
456
- parsedBody = parsedOutput.body;
457
- throwDefaultError({
458
- output: output,
459
- parsedBody: parsedBody,
460
- exceptionCtor: __BaseException,
461
- errorCode: errorCode,
462
- });
463
- _d.label = 9;
464
- case 9: return [2];
465
- }
183
+ };
184
+ export const serializeAws_restJson1SubscribeCommand = async (input, context) => {
185
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
186
+ const headers = {
187
+ "content-type": "application/json",
188
+ };
189
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/subscribe";
190
+ let body;
191
+ body = JSON.stringify({
192
+ ...(input.Arn != null && { Arn: input.Arn }),
193
+ ...(input.ClientRequestToken != null && { ClientRequestToken: input.ClientRequestToken }),
194
+ ...(input.Target != null && { Target: serializeAws_restJson1Target(input.Target, context) }),
466
195
  });
467
- }); };
468
- export var deserializeAws_restJson1DeleteTargetCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
469
- var contents;
470
- return __generator(this, function (_a) {
471
- switch (_a.label) {
472
- case 0:
473
- if (output.statusCode !== 200 && output.statusCode >= 300) {
474
- return [2, deserializeAws_restJson1DeleteTargetCommandError(output, context)];
475
- }
476
- contents = map({
477
- $metadata: deserializeMetadata(output),
478
- });
479
- return [4, collectBody(output.body, context)];
480
- case 1:
481
- _a.sent();
482
- return [2, contents];
483
- }
196
+ return new __HttpRequest({
197
+ protocol,
198
+ hostname,
199
+ port,
200
+ method: "POST",
201
+ headers,
202
+ path: resolvedPath,
203
+ body,
484
204
  });
485
- }); };
486
- var deserializeAws_restJson1DeleteTargetCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
487
- var parsedOutput, _a, errorCode, _b, parsedBody;
488
- var _c;
489
- return __generator(this, function (_d) {
490
- switch (_d.label) {
491
- case 0:
492
- _a = [__assign({}, output)];
493
- _c = {};
494
- return [4, parseBody(output.body, context)];
495
- case 1:
496
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
497
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
498
- _b = errorCode;
499
- switch (_b) {
500
- case "ValidationException": return [3, 2];
501
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 2];
502
- }
503
- return [3, 4];
504
- case 2: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
505
- case 3: throw _d.sent();
506
- case 4:
507
- parsedBody = parsedOutput.body;
508
- throwDefaultError({
509
- output: output,
510
- parsedBody: parsedBody,
511
- exceptionCtor: __BaseException,
512
- errorCode: errorCode,
513
- });
514
- _d.label = 5;
515
- case 5: return [2];
516
- }
205
+ };
206
+ export const serializeAws_restJson1TagResourceCommand = async (input, context) => {
207
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
208
+ const headers = {
209
+ "content-type": "application/json",
210
+ };
211
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tagResource";
212
+ let body;
213
+ body = JSON.stringify({
214
+ ...(input.Arn != null && { Arn: input.Arn }),
215
+ ...(input.Tags != null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }),
517
216
  });
518
- }); };
519
- export var deserializeAws_restJson1DescribeNotificationRuleCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
520
- var contents, data, _a, _b;
521
- return __generator(this, function (_c) {
522
- switch (_c.label) {
523
- case 0:
524
- if (output.statusCode !== 200 && output.statusCode >= 300) {
525
- return [2, deserializeAws_restJson1DescribeNotificationRuleCommandError(output, context)];
526
- }
527
- contents = map({
528
- $metadata: deserializeMetadata(output),
529
- });
530
- _a = __expectNonNull;
531
- _b = __expectObject;
532
- return [4, parseBody(output.body, context)];
533
- case 1:
534
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
535
- if (data.Arn != null) {
536
- contents.Arn = __expectString(data.Arn);
537
- }
538
- if (data.CreatedBy != null) {
539
- contents.CreatedBy = __expectString(data.CreatedBy);
540
- }
541
- if (data.CreatedTimestamp != null) {
542
- contents.CreatedTimestamp = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.CreatedTimestamp)));
543
- }
544
- if (data.DetailType != null) {
545
- contents.DetailType = __expectString(data.DetailType);
546
- }
547
- if (data.EventTypes != null) {
548
- contents.EventTypes = deserializeAws_restJson1EventTypeBatch(data.EventTypes, context);
549
- }
550
- if (data.LastModifiedTimestamp != null) {
551
- contents.LastModifiedTimestamp = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.LastModifiedTimestamp)));
552
- }
553
- if (data.Name != null) {
554
- contents.Name = __expectString(data.Name);
555
- }
556
- if (data.Resource != null) {
557
- contents.Resource = __expectString(data.Resource);
558
- }
559
- if (data.Status != null) {
560
- contents.Status = __expectString(data.Status);
561
- }
562
- if (data.Tags != null) {
563
- contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
564
- }
565
- if (data.Targets != null) {
566
- contents.Targets = deserializeAws_restJson1TargetsBatch(data.Targets, context);
567
- }
568
- return [2, contents];
569
- }
217
+ return new __HttpRequest({
218
+ protocol,
219
+ hostname,
220
+ port,
221
+ method: "POST",
222
+ headers,
223
+ path: resolvedPath,
224
+ body,
570
225
  });
571
- }); };
572
- var deserializeAws_restJson1DescribeNotificationRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
573
- var parsedOutput, _a, errorCode, _b, parsedBody;
574
- var _c;
575
- return __generator(this, function (_d) {
576
- switch (_d.label) {
577
- case 0:
578
- _a = [__assign({}, output)];
579
- _c = {};
580
- return [4, parseBody(output.body, context)];
581
- case 1:
582
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
583
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
584
- _b = errorCode;
585
- switch (_b) {
586
- case "ResourceNotFoundException": return [3, 2];
587
- case "com.amazonaws.codestarnotifications#ResourceNotFoundException": return [3, 2];
588
- case "ValidationException": return [3, 4];
589
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 4];
590
- }
591
- return [3, 6];
592
- case 2: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
593
- case 3: throw _d.sent();
594
- case 4: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
595
- case 5: throw _d.sent();
596
- case 6:
597
- parsedBody = parsedOutput.body;
598
- throwDefaultError({
599
- output: output,
600
- parsedBody: parsedBody,
601
- exceptionCtor: __BaseException,
602
- errorCode: errorCode,
603
- });
604
- _d.label = 7;
605
- case 7: return [2];
606
- }
226
+ };
227
+ export const serializeAws_restJson1UnsubscribeCommand = async (input, context) => {
228
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
229
+ const headers = {
230
+ "content-type": "application/json",
231
+ };
232
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/unsubscribe";
233
+ let body;
234
+ body = JSON.stringify({
235
+ ...(input.Arn != null && { Arn: input.Arn }),
236
+ ...(input.TargetAddress != null && { TargetAddress: input.TargetAddress }),
607
237
  });
608
- }); };
609
- export var deserializeAws_restJson1ListEventTypesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
610
- var contents, data, _a, _b;
611
- return __generator(this, function (_c) {
612
- switch (_c.label) {
613
- case 0:
614
- if (output.statusCode !== 200 && output.statusCode >= 300) {
615
- return [2, deserializeAws_restJson1ListEventTypesCommandError(output, context)];
616
- }
617
- contents = map({
618
- $metadata: deserializeMetadata(output),
619
- });
620
- _a = __expectNonNull;
621
- _b = __expectObject;
622
- return [4, parseBody(output.body, context)];
623
- case 1:
624
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
625
- if (data.EventTypes != null) {
626
- contents.EventTypes = deserializeAws_restJson1EventTypeBatch(data.EventTypes, context);
627
- }
628
- if (data.NextToken != null) {
629
- contents.NextToken = __expectString(data.NextToken);
630
- }
631
- return [2, contents];
632
- }
238
+ return new __HttpRequest({
239
+ protocol,
240
+ hostname,
241
+ port,
242
+ method: "POST",
243
+ headers,
244
+ path: resolvedPath,
245
+ body,
633
246
  });
634
- }); };
635
- var deserializeAws_restJson1ListEventTypesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
636
- var parsedOutput, _a, errorCode, _b, parsedBody;
637
- var _c;
638
- return __generator(this, function (_d) {
639
- switch (_d.label) {
640
- case 0:
641
- _a = [__assign({}, output)];
642
- _c = {};
643
- return [4, parseBody(output.body, context)];
644
- case 1:
645
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
646
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
647
- _b = errorCode;
648
- switch (_b) {
649
- case "InvalidNextTokenException": return [3, 2];
650
- case "com.amazonaws.codestarnotifications#InvalidNextTokenException": return [3, 2];
651
- case "ValidationException": return [3, 4];
652
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 4];
653
- }
654
- return [3, 6];
655
- case 2: return [4, deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context)];
656
- case 3: throw _d.sent();
657
- case 4: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
658
- case 5: throw _d.sent();
659
- case 6:
660
- parsedBody = parsedOutput.body;
661
- throwDefaultError({
662
- output: output,
663
- parsedBody: parsedBody,
664
- exceptionCtor: __BaseException,
665
- errorCode: errorCode,
666
- });
667
- _d.label = 7;
668
- case 7: return [2];
669
- }
247
+ };
248
+ export const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
249
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
250
+ const headers = {};
251
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/untagResource/{Arn}";
252
+ resolvedPath = __resolvedPath(resolvedPath, input, "Arn", () => input.Arn, "{Arn}", false);
253
+ const query = map({
254
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
670
255
  });
671
- }); };
672
- export var deserializeAws_restJson1ListNotificationRulesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
673
- var contents, data, _a, _b;
674
- return __generator(this, function (_c) {
675
- switch (_c.label) {
676
- case 0:
677
- if (output.statusCode !== 200 && output.statusCode >= 300) {
678
- return [2, deserializeAws_restJson1ListNotificationRulesCommandError(output, context)];
679
- }
680
- contents = map({
681
- $metadata: deserializeMetadata(output),
682
- });
683
- _a = __expectNonNull;
684
- _b = __expectObject;
685
- return [4, parseBody(output.body, context)];
686
- case 1:
687
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
688
- if (data.NextToken != null) {
689
- contents.NextToken = __expectString(data.NextToken);
690
- }
691
- if (data.NotificationRules != null) {
692
- contents.NotificationRules = deserializeAws_restJson1NotificationRuleBatch(data.NotificationRules, context);
693
- }
694
- return [2, contents];
695
- }
256
+ let body;
257
+ return new __HttpRequest({
258
+ protocol,
259
+ hostname,
260
+ port,
261
+ method: "POST",
262
+ headers,
263
+ path: resolvedPath,
264
+ query,
265
+ body,
696
266
  });
697
- }); };
698
- var deserializeAws_restJson1ListNotificationRulesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
699
- var parsedOutput, _a, errorCode, _b, parsedBody;
700
- var _c;
701
- return __generator(this, function (_d) {
702
- switch (_d.label) {
703
- case 0:
704
- _a = [__assign({}, output)];
705
- _c = {};
706
- return [4, parseBody(output.body, context)];
707
- case 1:
708
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
709
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
710
- _b = errorCode;
711
- switch (_b) {
712
- case "InvalidNextTokenException": return [3, 2];
713
- case "com.amazonaws.codestarnotifications#InvalidNextTokenException": return [3, 2];
714
- case "ValidationException": return [3, 4];
715
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 4];
716
- }
717
- return [3, 6];
718
- case 2: return [4, deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context)];
719
- case 3: throw _d.sent();
720
- case 4: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
721
- case 5: throw _d.sent();
722
- case 6:
723
- parsedBody = parsedOutput.body;
724
- throwDefaultError({
725
- output: output,
726
- parsedBody: parsedBody,
727
- exceptionCtor: __BaseException,
728
- errorCode: errorCode,
729
- });
730
- _d.label = 7;
731
- case 7: return [2];
732
- }
267
+ };
268
+ export const serializeAws_restJson1UpdateNotificationRuleCommand = async (input, context) => {
269
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
270
+ const headers = {
271
+ "content-type": "application/json",
272
+ };
273
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateNotificationRule";
274
+ let body;
275
+ body = JSON.stringify({
276
+ ...(input.Arn != null && { Arn: input.Arn }),
277
+ ...(input.DetailType != null && { DetailType: input.DetailType }),
278
+ ...(input.EventTypeIds != null && {
279
+ EventTypeIds: serializeAws_restJson1EventTypeIds(input.EventTypeIds, context),
280
+ }),
281
+ ...(input.Name != null && { Name: input.Name }),
282
+ ...(input.Status != null && { Status: input.Status }),
283
+ ...(input.Targets != null && { Targets: serializeAws_restJson1Targets(input.Targets, context) }),
733
284
  });
734
- }); };
735
- export var deserializeAws_restJson1ListTagsForResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
736
- var contents, data, _a, _b;
737
- return __generator(this, function (_c) {
738
- switch (_c.label) {
739
- case 0:
740
- if (output.statusCode !== 200 && output.statusCode >= 300) {
741
- return [2, deserializeAws_restJson1ListTagsForResourceCommandError(output, context)];
742
- }
743
- contents = map({
744
- $metadata: deserializeMetadata(output),
745
- });
746
- _a = __expectNonNull;
747
- _b = __expectObject;
748
- return [4, parseBody(output.body, context)];
749
- case 1:
750
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
751
- if (data.Tags != null) {
752
- contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
753
- }
754
- return [2, contents];
755
- }
285
+ return new __HttpRequest({
286
+ protocol,
287
+ hostname,
288
+ port,
289
+ method: "POST",
290
+ headers,
291
+ path: resolvedPath,
292
+ body,
756
293
  });
757
- }); };
758
- var deserializeAws_restJson1ListTagsForResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
759
- var parsedOutput, _a, errorCode, _b, parsedBody;
760
- var _c;
761
- return __generator(this, function (_d) {
762
- switch (_d.label) {
763
- case 0:
764
- _a = [__assign({}, output)];
765
- _c = {};
766
- return [4, parseBody(output.body, context)];
767
- case 1:
768
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
769
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
770
- _b = errorCode;
771
- switch (_b) {
772
- case "ResourceNotFoundException": return [3, 2];
773
- case "com.amazonaws.codestarnotifications#ResourceNotFoundException": return [3, 2];
774
- case "ValidationException": return [3, 4];
775
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 4];
776
- }
777
- return [3, 6];
778
- case 2: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
779
- case 3: throw _d.sent();
780
- case 4: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
781
- case 5: throw _d.sent();
782
- case 6:
783
- parsedBody = parsedOutput.body;
784
- throwDefaultError({
785
- output: output,
786
- parsedBody: parsedBody,
787
- exceptionCtor: __BaseException,
788
- errorCode: errorCode,
789
- });
790
- _d.label = 7;
791
- case 7: return [2];
792
- }
294
+ };
295
+ export const deserializeAws_restJson1CreateNotificationRuleCommand = async (output, context) => {
296
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
297
+ return deserializeAws_restJson1CreateNotificationRuleCommandError(output, context);
298
+ }
299
+ const contents = map({
300
+ $metadata: deserializeMetadata(output),
793
301
  });
794
- }); };
795
- export var deserializeAws_restJson1ListTargetsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
796
- var contents, data, _a, _b;
797
- return __generator(this, function (_c) {
798
- switch (_c.label) {
799
- case 0:
800
- if (output.statusCode !== 200 && output.statusCode >= 300) {
801
- return [2, deserializeAws_restJson1ListTargetsCommandError(output, context)];
802
- }
803
- contents = map({
804
- $metadata: deserializeMetadata(output),
805
- });
806
- _a = __expectNonNull;
807
- _b = __expectObject;
808
- return [4, parseBody(output.body, context)];
809
- case 1:
810
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
811
- if (data.NextToken != null) {
812
- contents.NextToken = __expectString(data.NextToken);
813
- }
814
- if (data.Targets != null) {
815
- contents.Targets = deserializeAws_restJson1TargetsBatch(data.Targets, context);
816
- }
817
- return [2, contents];
818
- }
302
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
303
+ if (data.Arn != null) {
304
+ contents.Arn = __expectString(data.Arn);
305
+ }
306
+ return contents;
307
+ };
308
+ const deserializeAws_restJson1CreateNotificationRuleCommandError = async (output, context) => {
309
+ const parsedOutput = {
310
+ ...output,
311
+ body: await parseErrorBody(output.body, context),
312
+ };
313
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
314
+ switch (errorCode) {
315
+ case "AccessDeniedException":
316
+ case "com.amazonaws.codestarnotifications#AccessDeniedException":
317
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
318
+ case "ConcurrentModificationException":
319
+ case "com.amazonaws.codestarnotifications#ConcurrentModificationException":
320
+ throw await deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context);
321
+ case "ConfigurationException":
322
+ case "com.amazonaws.codestarnotifications#ConfigurationException":
323
+ throw await deserializeAws_restJson1ConfigurationExceptionResponse(parsedOutput, context);
324
+ case "LimitExceededException":
325
+ case "com.amazonaws.codestarnotifications#LimitExceededException":
326
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
327
+ case "ResourceAlreadyExistsException":
328
+ case "com.amazonaws.codestarnotifications#ResourceAlreadyExistsException":
329
+ throw await deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse(parsedOutput, context);
330
+ case "ValidationException":
331
+ case "com.amazonaws.codestarnotifications#ValidationException":
332
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
333
+ default:
334
+ const parsedBody = parsedOutput.body;
335
+ throwDefaultError({
336
+ output,
337
+ parsedBody,
338
+ exceptionCtor: __BaseException,
339
+ errorCode,
340
+ });
341
+ }
342
+ };
343
+ export const deserializeAws_restJson1DeleteNotificationRuleCommand = async (output, context) => {
344
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
345
+ return deserializeAws_restJson1DeleteNotificationRuleCommandError(output, context);
346
+ }
347
+ const contents = map({
348
+ $metadata: deserializeMetadata(output),
819
349
  });
820
- }); };
821
- var deserializeAws_restJson1ListTargetsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
822
- var parsedOutput, _a, errorCode, _b, parsedBody;
823
- var _c;
824
- return __generator(this, function (_d) {
825
- switch (_d.label) {
826
- case 0:
827
- _a = [__assign({}, output)];
828
- _c = {};
829
- return [4, parseBody(output.body, context)];
830
- case 1:
831
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
832
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
833
- _b = errorCode;
834
- switch (_b) {
835
- case "InvalidNextTokenException": return [3, 2];
836
- case "com.amazonaws.codestarnotifications#InvalidNextTokenException": return [3, 2];
837
- case "ValidationException": return [3, 4];
838
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 4];
839
- }
840
- return [3, 6];
841
- case 2: return [4, deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context)];
842
- case 3: throw _d.sent();
843
- case 4: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
844
- case 5: throw _d.sent();
845
- case 6:
846
- parsedBody = parsedOutput.body;
847
- throwDefaultError({
848
- output: output,
849
- parsedBody: parsedBody,
850
- exceptionCtor: __BaseException,
851
- errorCode: errorCode,
852
- });
853
- _d.label = 7;
854
- case 7: return [2];
855
- }
350
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
351
+ if (data.Arn != null) {
352
+ contents.Arn = __expectString(data.Arn);
353
+ }
354
+ return contents;
355
+ };
356
+ const deserializeAws_restJson1DeleteNotificationRuleCommandError = async (output, context) => {
357
+ const parsedOutput = {
358
+ ...output,
359
+ body: await parseErrorBody(output.body, context),
360
+ };
361
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
362
+ switch (errorCode) {
363
+ case "ConcurrentModificationException":
364
+ case "com.amazonaws.codestarnotifications#ConcurrentModificationException":
365
+ throw await deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context);
366
+ case "LimitExceededException":
367
+ case "com.amazonaws.codestarnotifications#LimitExceededException":
368
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
369
+ case "ValidationException":
370
+ case "com.amazonaws.codestarnotifications#ValidationException":
371
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
372
+ default:
373
+ const parsedBody = parsedOutput.body;
374
+ throwDefaultError({
375
+ output,
376
+ parsedBody,
377
+ exceptionCtor: __BaseException,
378
+ errorCode,
379
+ });
380
+ }
381
+ };
382
+ export const deserializeAws_restJson1DeleteTargetCommand = async (output, context) => {
383
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
384
+ return deserializeAws_restJson1DeleteTargetCommandError(output, context);
385
+ }
386
+ const contents = map({
387
+ $metadata: deserializeMetadata(output),
856
388
  });
857
- }); };
858
- export var deserializeAws_restJson1SubscribeCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
859
- var contents, data, _a, _b;
860
- return __generator(this, function (_c) {
861
- switch (_c.label) {
862
- case 0:
863
- if (output.statusCode !== 200 && output.statusCode >= 300) {
864
- return [2, deserializeAws_restJson1SubscribeCommandError(output, context)];
865
- }
866
- contents = map({
867
- $metadata: deserializeMetadata(output),
868
- });
869
- _a = __expectNonNull;
870
- _b = __expectObject;
871
- return [4, parseBody(output.body, context)];
872
- case 1:
873
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
874
- if (data.Arn != null) {
875
- contents.Arn = __expectString(data.Arn);
876
- }
877
- return [2, contents];
878
- }
389
+ await collectBody(output.body, context);
390
+ return contents;
391
+ };
392
+ const deserializeAws_restJson1DeleteTargetCommandError = async (output, context) => {
393
+ const parsedOutput = {
394
+ ...output,
395
+ body: await parseErrorBody(output.body, context),
396
+ };
397
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
398
+ switch (errorCode) {
399
+ case "ValidationException":
400
+ case "com.amazonaws.codestarnotifications#ValidationException":
401
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
402
+ default:
403
+ const parsedBody = parsedOutput.body;
404
+ throwDefaultError({
405
+ output,
406
+ parsedBody,
407
+ exceptionCtor: __BaseException,
408
+ errorCode,
409
+ });
410
+ }
411
+ };
412
+ export const deserializeAws_restJson1DescribeNotificationRuleCommand = async (output, context) => {
413
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
414
+ return deserializeAws_restJson1DescribeNotificationRuleCommandError(output, context);
415
+ }
416
+ const contents = map({
417
+ $metadata: deserializeMetadata(output),
879
418
  });
880
- }); };
881
- var deserializeAws_restJson1SubscribeCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
882
- var parsedOutput, _a, errorCode, _b, parsedBody;
883
- var _c;
884
- return __generator(this, function (_d) {
885
- switch (_d.label) {
886
- case 0:
887
- _a = [__assign({}, output)];
888
- _c = {};
889
- return [4, parseBody(output.body, context)];
890
- case 1:
891
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
892
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
893
- _b = errorCode;
894
- switch (_b) {
895
- case "ConfigurationException": return [3, 2];
896
- case "com.amazonaws.codestarnotifications#ConfigurationException": return [3, 2];
897
- case "ResourceNotFoundException": return [3, 4];
898
- case "com.amazonaws.codestarnotifications#ResourceNotFoundException": return [3, 4];
899
- case "ValidationException": return [3, 6];
900
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 6];
901
- }
902
- return [3, 8];
903
- case 2: return [4, deserializeAws_restJson1ConfigurationExceptionResponse(parsedOutput, context)];
904
- case 3: throw _d.sent();
905
- case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
906
- case 5: throw _d.sent();
907
- case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
908
- case 7: throw _d.sent();
909
- case 8:
910
- parsedBody = parsedOutput.body;
911
- throwDefaultError({
912
- output: output,
913
- parsedBody: parsedBody,
914
- exceptionCtor: __BaseException,
915
- errorCode: errorCode,
916
- });
917
- _d.label = 9;
918
- case 9: return [2];
919
- }
419
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
420
+ if (data.Arn != null) {
421
+ contents.Arn = __expectString(data.Arn);
422
+ }
423
+ if (data.CreatedBy != null) {
424
+ contents.CreatedBy = __expectString(data.CreatedBy);
425
+ }
426
+ if (data.CreatedTimestamp != null) {
427
+ contents.CreatedTimestamp = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.CreatedTimestamp)));
428
+ }
429
+ if (data.DetailType != null) {
430
+ contents.DetailType = __expectString(data.DetailType);
431
+ }
432
+ if (data.EventTypes != null) {
433
+ contents.EventTypes = deserializeAws_restJson1EventTypeBatch(data.EventTypes, context);
434
+ }
435
+ if (data.LastModifiedTimestamp != null) {
436
+ contents.LastModifiedTimestamp = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.LastModifiedTimestamp)));
437
+ }
438
+ if (data.Name != null) {
439
+ contents.Name = __expectString(data.Name);
440
+ }
441
+ if (data.Resource != null) {
442
+ contents.Resource = __expectString(data.Resource);
443
+ }
444
+ if (data.Status != null) {
445
+ contents.Status = __expectString(data.Status);
446
+ }
447
+ if (data.Tags != null) {
448
+ contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
449
+ }
450
+ if (data.Targets != null) {
451
+ contents.Targets = deserializeAws_restJson1TargetsBatch(data.Targets, context);
452
+ }
453
+ return contents;
454
+ };
455
+ const deserializeAws_restJson1DescribeNotificationRuleCommandError = async (output, context) => {
456
+ const parsedOutput = {
457
+ ...output,
458
+ body: await parseErrorBody(output.body, context),
459
+ };
460
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
461
+ switch (errorCode) {
462
+ case "ResourceNotFoundException":
463
+ case "com.amazonaws.codestarnotifications#ResourceNotFoundException":
464
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
465
+ case "ValidationException":
466
+ case "com.amazonaws.codestarnotifications#ValidationException":
467
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
468
+ default:
469
+ const parsedBody = parsedOutput.body;
470
+ throwDefaultError({
471
+ output,
472
+ parsedBody,
473
+ exceptionCtor: __BaseException,
474
+ errorCode,
475
+ });
476
+ }
477
+ };
478
+ export const deserializeAws_restJson1ListEventTypesCommand = async (output, context) => {
479
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
480
+ return deserializeAws_restJson1ListEventTypesCommandError(output, context);
481
+ }
482
+ const contents = map({
483
+ $metadata: deserializeMetadata(output),
920
484
  });
921
- }); };
922
- export var deserializeAws_restJson1TagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
923
- var contents, data, _a, _b;
924
- return __generator(this, function (_c) {
925
- switch (_c.label) {
926
- case 0:
927
- if (output.statusCode !== 200 && output.statusCode >= 300) {
928
- return [2, deserializeAws_restJson1TagResourceCommandError(output, context)];
929
- }
930
- contents = map({
931
- $metadata: deserializeMetadata(output),
932
- });
933
- _a = __expectNonNull;
934
- _b = __expectObject;
935
- return [4, parseBody(output.body, context)];
936
- case 1:
937
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
938
- if (data.Tags != null) {
939
- contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
940
- }
941
- return [2, contents];
942
- }
485
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
486
+ if (data.EventTypes != null) {
487
+ contents.EventTypes = deserializeAws_restJson1EventTypeBatch(data.EventTypes, context);
488
+ }
489
+ if (data.NextToken != null) {
490
+ contents.NextToken = __expectString(data.NextToken);
491
+ }
492
+ return contents;
493
+ };
494
+ const deserializeAws_restJson1ListEventTypesCommandError = async (output, context) => {
495
+ const parsedOutput = {
496
+ ...output,
497
+ body: await parseErrorBody(output.body, context),
498
+ };
499
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
500
+ switch (errorCode) {
501
+ case "InvalidNextTokenException":
502
+ case "com.amazonaws.codestarnotifications#InvalidNextTokenException":
503
+ throw await deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context);
504
+ case "ValidationException":
505
+ case "com.amazonaws.codestarnotifications#ValidationException":
506
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
507
+ default:
508
+ const parsedBody = parsedOutput.body;
509
+ throwDefaultError({
510
+ output,
511
+ parsedBody,
512
+ exceptionCtor: __BaseException,
513
+ errorCode,
514
+ });
515
+ }
516
+ };
517
+ export const deserializeAws_restJson1ListNotificationRulesCommand = async (output, context) => {
518
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
519
+ return deserializeAws_restJson1ListNotificationRulesCommandError(output, context);
520
+ }
521
+ const contents = map({
522
+ $metadata: deserializeMetadata(output),
943
523
  });
944
- }); };
945
- var deserializeAws_restJson1TagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
946
- var parsedOutput, _a, errorCode, _b, parsedBody;
947
- var _c;
948
- return __generator(this, function (_d) {
949
- switch (_d.label) {
950
- case 0:
951
- _a = [__assign({}, output)];
952
- _c = {};
953
- return [4, parseBody(output.body, context)];
954
- case 1:
955
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
956
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
957
- _b = errorCode;
958
- switch (_b) {
959
- case "ConcurrentModificationException": return [3, 2];
960
- case "com.amazonaws.codestarnotifications#ConcurrentModificationException": return [3, 2];
961
- case "LimitExceededException": return [3, 4];
962
- case "com.amazonaws.codestarnotifications#LimitExceededException": return [3, 4];
963
- case "ResourceNotFoundException": return [3, 6];
964
- case "com.amazonaws.codestarnotifications#ResourceNotFoundException": return [3, 6];
965
- case "ValidationException": return [3, 8];
966
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 8];
967
- }
968
- return [3, 10];
969
- case 2: return [4, deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context)];
970
- case 3: throw _d.sent();
971
- case 4: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
972
- case 5: throw _d.sent();
973
- case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
974
- case 7: throw _d.sent();
975
- case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
976
- case 9: throw _d.sent();
977
- case 10:
978
- parsedBody = parsedOutput.body;
979
- throwDefaultError({
980
- output: output,
981
- parsedBody: parsedBody,
982
- exceptionCtor: __BaseException,
983
- errorCode: errorCode,
984
- });
985
- _d.label = 11;
986
- case 11: return [2];
987
- }
524
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
525
+ if (data.NextToken != null) {
526
+ contents.NextToken = __expectString(data.NextToken);
527
+ }
528
+ if (data.NotificationRules != null) {
529
+ contents.NotificationRules = deserializeAws_restJson1NotificationRuleBatch(data.NotificationRules, context);
530
+ }
531
+ return contents;
532
+ };
533
+ const deserializeAws_restJson1ListNotificationRulesCommandError = async (output, context) => {
534
+ const parsedOutput = {
535
+ ...output,
536
+ body: await parseErrorBody(output.body, context),
537
+ };
538
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
539
+ switch (errorCode) {
540
+ case "InvalidNextTokenException":
541
+ case "com.amazonaws.codestarnotifications#InvalidNextTokenException":
542
+ throw await deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context);
543
+ case "ValidationException":
544
+ case "com.amazonaws.codestarnotifications#ValidationException":
545
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
546
+ default:
547
+ const parsedBody = parsedOutput.body;
548
+ throwDefaultError({
549
+ output,
550
+ parsedBody,
551
+ exceptionCtor: __BaseException,
552
+ errorCode,
553
+ });
554
+ }
555
+ };
556
+ export const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
557
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
558
+ return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
559
+ }
560
+ const contents = map({
561
+ $metadata: deserializeMetadata(output),
988
562
  });
989
- }); };
990
- export var deserializeAws_restJson1UnsubscribeCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
991
- var contents, data, _a, _b;
992
- return __generator(this, function (_c) {
993
- switch (_c.label) {
994
- case 0:
995
- if (output.statusCode !== 200 && output.statusCode >= 300) {
996
- return [2, deserializeAws_restJson1UnsubscribeCommandError(output, context)];
997
- }
998
- contents = map({
999
- $metadata: deserializeMetadata(output),
1000
- });
1001
- _a = __expectNonNull;
1002
- _b = __expectObject;
1003
- return [4, parseBody(output.body, context)];
1004
- case 1:
1005
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
1006
- if (data.Arn != null) {
1007
- contents.Arn = __expectString(data.Arn);
1008
- }
1009
- return [2, contents];
1010
- }
563
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
564
+ if (data.Tags != null) {
565
+ contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
566
+ }
567
+ return contents;
568
+ };
569
+ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
570
+ const parsedOutput = {
571
+ ...output,
572
+ body: await parseErrorBody(output.body, context),
573
+ };
574
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
575
+ switch (errorCode) {
576
+ case "ResourceNotFoundException":
577
+ case "com.amazonaws.codestarnotifications#ResourceNotFoundException":
578
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
579
+ case "ValidationException":
580
+ case "com.amazonaws.codestarnotifications#ValidationException":
581
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
582
+ default:
583
+ const parsedBody = parsedOutput.body;
584
+ throwDefaultError({
585
+ output,
586
+ parsedBody,
587
+ exceptionCtor: __BaseException,
588
+ errorCode,
589
+ });
590
+ }
591
+ };
592
+ export const deserializeAws_restJson1ListTargetsCommand = async (output, context) => {
593
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
594
+ return deserializeAws_restJson1ListTargetsCommandError(output, context);
595
+ }
596
+ const contents = map({
597
+ $metadata: deserializeMetadata(output),
1011
598
  });
1012
- }); };
1013
- var deserializeAws_restJson1UnsubscribeCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1014
- var parsedOutput, _a, errorCode, _b, parsedBody;
1015
- var _c;
1016
- return __generator(this, function (_d) {
1017
- switch (_d.label) {
1018
- case 0:
1019
- _a = [__assign({}, output)];
1020
- _c = {};
1021
- return [4, parseBody(output.body, context)];
1022
- case 1:
1023
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1024
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1025
- _b = errorCode;
1026
- switch (_b) {
1027
- case "ValidationException": return [3, 2];
1028
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 2];
1029
- }
1030
- return [3, 4];
1031
- case 2: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
1032
- case 3: throw _d.sent();
1033
- case 4:
1034
- parsedBody = parsedOutput.body;
1035
- throwDefaultError({
1036
- output: output,
1037
- parsedBody: parsedBody,
1038
- exceptionCtor: __BaseException,
1039
- errorCode: errorCode,
1040
- });
1041
- _d.label = 5;
1042
- case 5: return [2];
1043
- }
599
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
600
+ if (data.NextToken != null) {
601
+ contents.NextToken = __expectString(data.NextToken);
602
+ }
603
+ if (data.Targets != null) {
604
+ contents.Targets = deserializeAws_restJson1TargetsBatch(data.Targets, context);
605
+ }
606
+ return contents;
607
+ };
608
+ const deserializeAws_restJson1ListTargetsCommandError = async (output, context) => {
609
+ const parsedOutput = {
610
+ ...output,
611
+ body: await parseErrorBody(output.body, context),
612
+ };
613
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
614
+ switch (errorCode) {
615
+ case "InvalidNextTokenException":
616
+ case "com.amazonaws.codestarnotifications#InvalidNextTokenException":
617
+ throw await deserializeAws_restJson1InvalidNextTokenExceptionResponse(parsedOutput, context);
618
+ case "ValidationException":
619
+ case "com.amazonaws.codestarnotifications#ValidationException":
620
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
621
+ default:
622
+ const parsedBody = parsedOutput.body;
623
+ throwDefaultError({
624
+ output,
625
+ parsedBody,
626
+ exceptionCtor: __BaseException,
627
+ errorCode,
628
+ });
629
+ }
630
+ };
631
+ export const deserializeAws_restJson1SubscribeCommand = async (output, context) => {
632
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
633
+ return deserializeAws_restJson1SubscribeCommandError(output, context);
634
+ }
635
+ const contents = map({
636
+ $metadata: deserializeMetadata(output),
1044
637
  });
1045
- }); };
1046
- export var deserializeAws_restJson1UntagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1047
- var contents;
1048
- return __generator(this, function (_a) {
1049
- switch (_a.label) {
1050
- case 0:
1051
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1052
- return [2, deserializeAws_restJson1UntagResourceCommandError(output, context)];
1053
- }
1054
- contents = map({
1055
- $metadata: deserializeMetadata(output),
1056
- });
1057
- return [4, collectBody(output.body, context)];
1058
- case 1:
1059
- _a.sent();
1060
- return [2, contents];
1061
- }
638
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
639
+ if (data.Arn != null) {
640
+ contents.Arn = __expectString(data.Arn);
641
+ }
642
+ return contents;
643
+ };
644
+ const deserializeAws_restJson1SubscribeCommandError = async (output, context) => {
645
+ const parsedOutput = {
646
+ ...output,
647
+ body: await parseErrorBody(output.body, context),
648
+ };
649
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
650
+ switch (errorCode) {
651
+ case "ConfigurationException":
652
+ case "com.amazonaws.codestarnotifications#ConfigurationException":
653
+ throw await deserializeAws_restJson1ConfigurationExceptionResponse(parsedOutput, context);
654
+ case "ResourceNotFoundException":
655
+ case "com.amazonaws.codestarnotifications#ResourceNotFoundException":
656
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
657
+ case "ValidationException":
658
+ case "com.amazonaws.codestarnotifications#ValidationException":
659
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
660
+ default:
661
+ const parsedBody = parsedOutput.body;
662
+ throwDefaultError({
663
+ output,
664
+ parsedBody,
665
+ exceptionCtor: __BaseException,
666
+ errorCode,
667
+ });
668
+ }
669
+ };
670
+ export const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
671
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
672
+ return deserializeAws_restJson1TagResourceCommandError(output, context);
673
+ }
674
+ const contents = map({
675
+ $metadata: deserializeMetadata(output),
1062
676
  });
1063
- }); };
1064
- var deserializeAws_restJson1UntagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1065
- var parsedOutput, _a, errorCode, _b, parsedBody;
1066
- var _c;
1067
- return __generator(this, function (_d) {
1068
- switch (_d.label) {
1069
- case 0:
1070
- _a = [__assign({}, output)];
1071
- _c = {};
1072
- return [4, parseBody(output.body, context)];
1073
- case 1:
1074
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1075
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1076
- _b = errorCode;
1077
- switch (_b) {
1078
- case "ConcurrentModificationException": return [3, 2];
1079
- case "com.amazonaws.codestarnotifications#ConcurrentModificationException": return [3, 2];
1080
- case "LimitExceededException": return [3, 4];
1081
- case "com.amazonaws.codestarnotifications#LimitExceededException": return [3, 4];
1082
- case "ResourceNotFoundException": return [3, 6];
1083
- case "com.amazonaws.codestarnotifications#ResourceNotFoundException": return [3, 6];
1084
- case "ValidationException": return [3, 8];
1085
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 8];
1086
- }
1087
- return [3, 10];
1088
- case 2: return [4, deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context)];
1089
- case 3: throw _d.sent();
1090
- case 4: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
1091
- case 5: throw _d.sent();
1092
- case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1093
- case 7: throw _d.sent();
1094
- case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
1095
- case 9: throw _d.sent();
1096
- case 10:
1097
- parsedBody = parsedOutput.body;
1098
- throwDefaultError({
1099
- output: output,
1100
- parsedBody: parsedBody,
1101
- exceptionCtor: __BaseException,
1102
- errorCode: errorCode,
1103
- });
1104
- _d.label = 11;
1105
- case 11: return [2];
1106
- }
677
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
678
+ if (data.Tags != null) {
679
+ contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
680
+ }
681
+ return contents;
682
+ };
683
+ const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
684
+ const parsedOutput = {
685
+ ...output,
686
+ body: await parseErrorBody(output.body, context),
687
+ };
688
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
689
+ switch (errorCode) {
690
+ case "ConcurrentModificationException":
691
+ case "com.amazonaws.codestarnotifications#ConcurrentModificationException":
692
+ throw await deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context);
693
+ case "LimitExceededException":
694
+ case "com.amazonaws.codestarnotifications#LimitExceededException":
695
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
696
+ case "ResourceNotFoundException":
697
+ case "com.amazonaws.codestarnotifications#ResourceNotFoundException":
698
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
699
+ case "ValidationException":
700
+ case "com.amazonaws.codestarnotifications#ValidationException":
701
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
702
+ default:
703
+ const parsedBody = parsedOutput.body;
704
+ throwDefaultError({
705
+ output,
706
+ parsedBody,
707
+ exceptionCtor: __BaseException,
708
+ errorCode,
709
+ });
710
+ }
711
+ };
712
+ export const deserializeAws_restJson1UnsubscribeCommand = async (output, context) => {
713
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
714
+ return deserializeAws_restJson1UnsubscribeCommandError(output, context);
715
+ }
716
+ const contents = map({
717
+ $metadata: deserializeMetadata(output),
1107
718
  });
1108
- }); };
1109
- export var deserializeAws_restJson1UpdateNotificationRuleCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1110
- var contents;
1111
- return __generator(this, function (_a) {
1112
- switch (_a.label) {
1113
- case 0:
1114
- if (output.statusCode !== 200 && output.statusCode >= 300) {
1115
- return [2, deserializeAws_restJson1UpdateNotificationRuleCommandError(output, context)];
1116
- }
1117
- contents = map({
1118
- $metadata: deserializeMetadata(output),
1119
- });
1120
- return [4, collectBody(output.body, context)];
1121
- case 1:
1122
- _a.sent();
1123
- return [2, contents];
1124
- }
719
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
720
+ if (data.Arn != null) {
721
+ contents.Arn = __expectString(data.Arn);
722
+ }
723
+ return contents;
724
+ };
725
+ const deserializeAws_restJson1UnsubscribeCommandError = async (output, context) => {
726
+ const parsedOutput = {
727
+ ...output,
728
+ body: await parseErrorBody(output.body, context),
729
+ };
730
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
731
+ switch (errorCode) {
732
+ case "ValidationException":
733
+ case "com.amazonaws.codestarnotifications#ValidationException":
734
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
735
+ default:
736
+ const parsedBody = parsedOutput.body;
737
+ throwDefaultError({
738
+ output,
739
+ parsedBody,
740
+ exceptionCtor: __BaseException,
741
+ errorCode,
742
+ });
743
+ }
744
+ };
745
+ export const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
746
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
747
+ return deserializeAws_restJson1UntagResourceCommandError(output, context);
748
+ }
749
+ const contents = map({
750
+ $metadata: deserializeMetadata(output),
1125
751
  });
1126
- }); };
1127
- var deserializeAws_restJson1UpdateNotificationRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1128
- var parsedOutput, _a, errorCode, _b, parsedBody;
1129
- var _c;
1130
- return __generator(this, function (_d) {
1131
- switch (_d.label) {
1132
- case 0:
1133
- _a = [__assign({}, output)];
1134
- _c = {};
1135
- return [4, parseBody(output.body, context)];
1136
- case 1:
1137
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
1138
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1139
- _b = errorCode;
1140
- switch (_b) {
1141
- case "ConfigurationException": return [3, 2];
1142
- case "com.amazonaws.codestarnotifications#ConfigurationException": return [3, 2];
1143
- case "ResourceNotFoundException": return [3, 4];
1144
- case "com.amazonaws.codestarnotifications#ResourceNotFoundException": return [3, 4];
1145
- case "ValidationException": return [3, 6];
1146
- case "com.amazonaws.codestarnotifications#ValidationException": return [3, 6];
1147
- }
1148
- return [3, 8];
1149
- case 2: return [4, deserializeAws_restJson1ConfigurationExceptionResponse(parsedOutput, context)];
1150
- case 3: throw _d.sent();
1151
- case 4: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
1152
- case 5: throw _d.sent();
1153
- case 6: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
1154
- case 7: throw _d.sent();
1155
- case 8:
1156
- parsedBody = parsedOutput.body;
1157
- throwDefaultError({
1158
- output: output,
1159
- parsedBody: parsedBody,
1160
- exceptionCtor: __BaseException,
1161
- errorCode: errorCode,
1162
- });
1163
- _d.label = 9;
1164
- case 9: return [2];
1165
- }
752
+ await collectBody(output.body, context);
753
+ return contents;
754
+ };
755
+ const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
756
+ const parsedOutput = {
757
+ ...output,
758
+ body: await parseErrorBody(output.body, context),
759
+ };
760
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
761
+ switch (errorCode) {
762
+ case "ConcurrentModificationException":
763
+ case "com.amazonaws.codestarnotifications#ConcurrentModificationException":
764
+ throw await deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context);
765
+ case "LimitExceededException":
766
+ case "com.amazonaws.codestarnotifications#LimitExceededException":
767
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
768
+ case "ResourceNotFoundException":
769
+ case "com.amazonaws.codestarnotifications#ResourceNotFoundException":
770
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
771
+ case "ValidationException":
772
+ case "com.amazonaws.codestarnotifications#ValidationException":
773
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
774
+ default:
775
+ const parsedBody = parsedOutput.body;
776
+ throwDefaultError({
777
+ output,
778
+ parsedBody,
779
+ exceptionCtor: __BaseException,
780
+ errorCode,
781
+ });
782
+ }
783
+ };
784
+ export const deserializeAws_restJson1UpdateNotificationRuleCommand = async (output, context) => {
785
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
786
+ return deserializeAws_restJson1UpdateNotificationRuleCommandError(output, context);
787
+ }
788
+ const contents = map({
789
+ $metadata: deserializeMetadata(output),
1166
790
  });
1167
- }); };
1168
- var map = __map;
1169
- var deserializeAws_restJson1AccessDeniedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1170
- var contents, data, exception;
1171
- return __generator(this, function (_a) {
1172
- contents = map({});
1173
- data = parsedOutput.body;
1174
- if (data.Message != null) {
1175
- contents.Message = __expectString(data.Message);
1176
- }
1177
- exception = new AccessDeniedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1178
- return [2, __decorateServiceException(exception, parsedOutput.body)];
791
+ await collectBody(output.body, context);
792
+ return contents;
793
+ };
794
+ const deserializeAws_restJson1UpdateNotificationRuleCommandError = async (output, context) => {
795
+ const parsedOutput = {
796
+ ...output,
797
+ body: await parseErrorBody(output.body, context),
798
+ };
799
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
800
+ switch (errorCode) {
801
+ case "ConfigurationException":
802
+ case "com.amazonaws.codestarnotifications#ConfigurationException":
803
+ throw await deserializeAws_restJson1ConfigurationExceptionResponse(parsedOutput, context);
804
+ case "ResourceNotFoundException":
805
+ case "com.amazonaws.codestarnotifications#ResourceNotFoundException":
806
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
807
+ case "ValidationException":
808
+ case "com.amazonaws.codestarnotifications#ValidationException":
809
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
810
+ default:
811
+ const parsedBody = parsedOutput.body;
812
+ throwDefaultError({
813
+ output,
814
+ parsedBody,
815
+ exceptionCtor: __BaseException,
816
+ errorCode,
817
+ });
818
+ }
819
+ };
820
+ const map = __map;
821
+ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
822
+ const contents = map({});
823
+ const data = parsedOutput.body;
824
+ if (data.Message != null) {
825
+ contents.Message = __expectString(data.Message);
826
+ }
827
+ const exception = new AccessDeniedException({
828
+ $metadata: deserializeMetadata(parsedOutput),
829
+ ...contents,
1179
830
  });
1180
- }); };
1181
- var deserializeAws_restJson1ConcurrentModificationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1182
- var contents, data, exception;
1183
- return __generator(this, function (_a) {
1184
- contents = map({});
1185
- data = parsedOutput.body;
1186
- if (data.Message != null) {
1187
- contents.Message = __expectString(data.Message);
1188
- }
1189
- exception = new ConcurrentModificationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1190
- return [2, __decorateServiceException(exception, parsedOutput.body)];
831
+ return __decorateServiceException(exception, parsedOutput.body);
832
+ };
833
+ const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (parsedOutput, context) => {
834
+ const contents = map({});
835
+ const data = parsedOutput.body;
836
+ if (data.Message != null) {
837
+ contents.Message = __expectString(data.Message);
838
+ }
839
+ const exception = new ConcurrentModificationException({
840
+ $metadata: deserializeMetadata(parsedOutput),
841
+ ...contents,
1191
842
  });
1192
- }); };
1193
- var deserializeAws_restJson1ConfigurationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1194
- var contents, data, exception;
1195
- return __generator(this, function (_a) {
1196
- contents = map({});
1197
- data = parsedOutput.body;
1198
- if (data.Message != null) {
1199
- contents.Message = __expectString(data.Message);
1200
- }
1201
- exception = new ConfigurationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1202
- return [2, __decorateServiceException(exception, parsedOutput.body)];
843
+ return __decorateServiceException(exception, parsedOutput.body);
844
+ };
845
+ const deserializeAws_restJson1ConfigurationExceptionResponse = async (parsedOutput, context) => {
846
+ const contents = map({});
847
+ const data = parsedOutput.body;
848
+ if (data.Message != null) {
849
+ contents.Message = __expectString(data.Message);
850
+ }
851
+ const exception = new ConfigurationException({
852
+ $metadata: deserializeMetadata(parsedOutput),
853
+ ...contents,
1203
854
  });
1204
- }); };
1205
- var deserializeAws_restJson1InvalidNextTokenExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1206
- var contents, data, exception;
1207
- return __generator(this, function (_a) {
1208
- contents = map({});
1209
- data = parsedOutput.body;
1210
- if (data.Message != null) {
1211
- contents.Message = __expectString(data.Message);
1212
- }
1213
- exception = new InvalidNextTokenException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1214
- return [2, __decorateServiceException(exception, parsedOutput.body)];
855
+ return __decorateServiceException(exception, parsedOutput.body);
856
+ };
857
+ const deserializeAws_restJson1InvalidNextTokenExceptionResponse = async (parsedOutput, context) => {
858
+ const contents = map({});
859
+ const data = parsedOutput.body;
860
+ if (data.Message != null) {
861
+ contents.Message = __expectString(data.Message);
862
+ }
863
+ const exception = new InvalidNextTokenException({
864
+ $metadata: deserializeMetadata(parsedOutput),
865
+ ...contents,
1215
866
  });
1216
- }); };
1217
- var deserializeAws_restJson1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1218
- var contents, data, exception;
1219
- return __generator(this, function (_a) {
1220
- contents = map({});
1221
- data = parsedOutput.body;
1222
- if (data.Message != null) {
1223
- contents.Message = __expectString(data.Message);
1224
- }
1225
- exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1226
- return [2, __decorateServiceException(exception, parsedOutput.body)];
867
+ return __decorateServiceException(exception, parsedOutput.body);
868
+ };
869
+ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
870
+ const contents = map({});
871
+ const data = parsedOutput.body;
872
+ if (data.Message != null) {
873
+ contents.Message = __expectString(data.Message);
874
+ }
875
+ const exception = new LimitExceededException({
876
+ $metadata: deserializeMetadata(parsedOutput),
877
+ ...contents,
1227
878
  });
1228
- }); };
1229
- var deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1230
- var contents, data, exception;
1231
- return __generator(this, function (_a) {
1232
- contents = map({});
1233
- data = parsedOutput.body;
1234
- if (data.Message != null) {
1235
- contents.Message = __expectString(data.Message);
1236
- }
1237
- exception = new ResourceAlreadyExistsException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1238
- return [2, __decorateServiceException(exception, parsedOutput.body)];
879
+ return __decorateServiceException(exception, parsedOutput.body);
880
+ };
881
+ const deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse = async (parsedOutput, context) => {
882
+ const contents = map({});
883
+ const data = parsedOutput.body;
884
+ if (data.Message != null) {
885
+ contents.Message = __expectString(data.Message);
886
+ }
887
+ const exception = new ResourceAlreadyExistsException({
888
+ $metadata: deserializeMetadata(parsedOutput),
889
+ ...contents,
1239
890
  });
1240
- }); };
1241
- var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1242
- var contents, data, exception;
1243
- return __generator(this, function (_a) {
1244
- contents = map({});
1245
- data = parsedOutput.body;
1246
- if (data.Message != null) {
1247
- contents.Message = __expectString(data.Message);
1248
- }
1249
- exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1250
- return [2, __decorateServiceException(exception, parsedOutput.body)];
891
+ return __decorateServiceException(exception, parsedOutput.body);
892
+ };
893
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
894
+ const contents = map({});
895
+ const data = parsedOutput.body;
896
+ if (data.Message != null) {
897
+ contents.Message = __expectString(data.Message);
898
+ }
899
+ const exception = new ResourceNotFoundException({
900
+ $metadata: deserializeMetadata(parsedOutput),
901
+ ...contents,
1251
902
  });
1252
- }); };
1253
- var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
1254
- var contents, data, exception;
1255
- return __generator(this, function (_a) {
1256
- contents = map({});
1257
- data = parsedOutput.body;
1258
- if (data.Message != null) {
1259
- contents.Message = __expectString(data.Message);
1260
- }
1261
- exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
1262
- return [2, __decorateServiceException(exception, parsedOutput.body)];
903
+ return __decorateServiceException(exception, parsedOutput.body);
904
+ };
905
+ const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
906
+ const contents = map({});
907
+ const data = parsedOutput.body;
908
+ if (data.Message != null) {
909
+ contents.Message = __expectString(data.Message);
910
+ }
911
+ const exception = new ValidationException({
912
+ $metadata: deserializeMetadata(parsedOutput),
913
+ ...contents,
1263
914
  });
1264
- }); };
1265
- var serializeAws_restJson1EventTypeIds = function (input, context) {
915
+ return __decorateServiceException(exception, parsedOutput.body);
916
+ };
917
+ const serializeAws_restJson1EventTypeIds = (input, context) => {
1266
918
  return input
1267
- .filter(function (e) { return e != null; })
1268
- .map(function (entry) {
919
+ .filter((e) => e != null)
920
+ .map((entry) => {
1269
921
  return entry;
1270
922
  });
1271
923
  };
1272
- var serializeAws_restJson1ListEventTypesFilter = function (input, context) {
1273
- return __assign(__assign({}, (input.Name != null && { Name: input.Name })), (input.Value != null && { Value: input.Value }));
924
+ const serializeAws_restJson1ListEventTypesFilter = (input, context) => {
925
+ return {
926
+ ...(input.Name != null && { Name: input.Name }),
927
+ ...(input.Value != null && { Value: input.Value }),
928
+ };
1274
929
  };
1275
- var serializeAws_restJson1ListEventTypesFilters = function (input, context) {
930
+ const serializeAws_restJson1ListEventTypesFilters = (input, context) => {
1276
931
  return input
1277
- .filter(function (e) { return e != null; })
1278
- .map(function (entry) {
932
+ .filter((e) => e != null)
933
+ .map((entry) => {
1279
934
  return serializeAws_restJson1ListEventTypesFilter(entry, context);
1280
935
  });
1281
936
  };
1282
- var serializeAws_restJson1ListNotificationRulesFilter = function (input, context) {
1283
- return __assign(__assign({}, (input.Name != null && { Name: input.Name })), (input.Value != null && { Value: input.Value }));
937
+ const serializeAws_restJson1ListNotificationRulesFilter = (input, context) => {
938
+ return {
939
+ ...(input.Name != null && { Name: input.Name }),
940
+ ...(input.Value != null && { Value: input.Value }),
941
+ };
1284
942
  };
1285
- var serializeAws_restJson1ListNotificationRulesFilters = function (input, context) {
943
+ const serializeAws_restJson1ListNotificationRulesFilters = (input, context) => {
1286
944
  return input
1287
- .filter(function (e) { return e != null; })
1288
- .map(function (entry) {
945
+ .filter((e) => e != null)
946
+ .map((entry) => {
1289
947
  return serializeAws_restJson1ListNotificationRulesFilter(entry, context);
1290
948
  });
1291
949
  };
1292
- var serializeAws_restJson1ListTargetsFilter = function (input, context) {
1293
- return __assign(__assign({}, (input.Name != null && { Name: input.Name })), (input.Value != null && { Value: input.Value }));
950
+ const serializeAws_restJson1ListTargetsFilter = (input, context) => {
951
+ return {
952
+ ...(input.Name != null && { Name: input.Name }),
953
+ ...(input.Value != null && { Value: input.Value }),
954
+ };
1294
955
  };
1295
- var serializeAws_restJson1ListTargetsFilters = function (input, context) {
956
+ const serializeAws_restJson1ListTargetsFilters = (input, context) => {
1296
957
  return input
1297
- .filter(function (e) { return e != null; })
1298
- .map(function (entry) {
958
+ .filter((e) => e != null)
959
+ .map((entry) => {
1299
960
  return serializeAws_restJson1ListTargetsFilter(entry, context);
1300
961
  });
1301
962
  };
1302
- var serializeAws_restJson1Tags = function (input, context) {
1303
- return Object.entries(input).reduce(function (acc, _a) {
1304
- var _b;
1305
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
963
+ const serializeAws_restJson1Tags = (input, context) => {
964
+ return Object.entries(input).reduce((acc, [key, value]) => {
1306
965
  if (value === null) {
1307
966
  return acc;
1308
967
  }
1309
- return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
968
+ return {
969
+ ...acc,
970
+ [key]: value,
971
+ };
1310
972
  }, {});
1311
973
  };
1312
- var serializeAws_restJson1Target = function (input, context) {
1313
- return __assign(__assign({}, (input.TargetAddress != null && { TargetAddress: input.TargetAddress })), (input.TargetType != null && { TargetType: input.TargetType }));
974
+ const serializeAws_restJson1Target = (input, context) => {
975
+ return {
976
+ ...(input.TargetAddress != null && { TargetAddress: input.TargetAddress }),
977
+ ...(input.TargetType != null && { TargetType: input.TargetType }),
978
+ };
1314
979
  };
1315
- var serializeAws_restJson1Targets = function (input, context) {
980
+ const serializeAws_restJson1Targets = (input, context) => {
1316
981
  return input
1317
- .filter(function (e) { return e != null; })
1318
- .map(function (entry) {
982
+ .filter((e) => e != null)
983
+ .map((entry) => {
1319
984
  return serializeAws_restJson1Target(entry, context);
1320
985
  });
1321
986
  };
1322
- var deserializeAws_restJson1EventTypeBatch = function (output, context) {
1323
- var retVal = (output || [])
1324
- .filter(function (e) { return e != null; })
1325
- .map(function (entry) {
987
+ const deserializeAws_restJson1EventTypeBatch = (output, context) => {
988
+ const retVal = (output || [])
989
+ .filter((e) => e != null)
990
+ .map((entry) => {
1326
991
  if (entry === null) {
1327
992
  return null;
1328
993
  }
@@ -1330,7 +995,7 @@ var deserializeAws_restJson1EventTypeBatch = function (output, context) {
1330
995
  });
1331
996
  return retVal;
1332
997
  };
1333
- var deserializeAws_restJson1EventTypeSummary = function (output, context) {
998
+ const deserializeAws_restJson1EventTypeSummary = (output, context) => {
1334
999
  return {
1335
1000
  EventTypeId: __expectString(output.EventTypeId),
1336
1001
  EventTypeName: __expectString(output.EventTypeName),
@@ -1338,10 +1003,10 @@ var deserializeAws_restJson1EventTypeSummary = function (output, context) {
1338
1003
  ServiceName: __expectString(output.ServiceName),
1339
1004
  };
1340
1005
  };
1341
- var deserializeAws_restJson1NotificationRuleBatch = function (output, context) {
1342
- var retVal = (output || [])
1343
- .filter(function (e) { return e != null; })
1344
- .map(function (entry) {
1006
+ const deserializeAws_restJson1NotificationRuleBatch = (output, context) => {
1007
+ const retVal = (output || [])
1008
+ .filter((e) => e != null)
1009
+ .map((entry) => {
1345
1010
  if (entry === null) {
1346
1011
  return null;
1347
1012
  }
@@ -1349,26 +1014,27 @@ var deserializeAws_restJson1NotificationRuleBatch = function (output, context) {
1349
1014
  });
1350
1015
  return retVal;
1351
1016
  };
1352
- var deserializeAws_restJson1NotificationRuleSummary = function (output, context) {
1017
+ const deserializeAws_restJson1NotificationRuleSummary = (output, context) => {
1353
1018
  return {
1354
1019
  Arn: __expectString(output.Arn),
1355
1020
  Id: __expectString(output.Id),
1356
1021
  };
1357
1022
  };
1358
- var deserializeAws_restJson1Tags = function (output, context) {
1359
- return Object.entries(output).reduce(function (acc, _a) {
1360
- var _b;
1361
- var _c = __read(_a, 2), key = _c[0], value = _c[1];
1023
+ const deserializeAws_restJson1Tags = (output, context) => {
1024
+ return Object.entries(output).reduce((acc, [key, value]) => {
1362
1025
  if (value === null) {
1363
1026
  return acc;
1364
1027
  }
1365
- return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
1028
+ return {
1029
+ ...acc,
1030
+ [key]: __expectString(value),
1031
+ };
1366
1032
  }, {});
1367
1033
  };
1368
- var deserializeAws_restJson1TargetsBatch = function (output, context) {
1369
- var retVal = (output || [])
1370
- .filter(function (e) { return e != null; })
1371
- .map(function (entry) {
1034
+ const deserializeAws_restJson1TargetsBatch = (output, context) => {
1035
+ const retVal = (output || [])
1036
+ .filter((e) => e != null)
1037
+ .map((entry) => {
1372
1038
  if (entry === null) {
1373
1039
  return null;
1374
1040
  }
@@ -1376,51 +1042,46 @@ var deserializeAws_restJson1TargetsBatch = function (output, context) {
1376
1042
  });
1377
1043
  return retVal;
1378
1044
  };
1379
- var deserializeAws_restJson1TargetSummary = function (output, context) {
1045
+ const deserializeAws_restJson1TargetSummary = (output, context) => {
1380
1046
  return {
1381
1047
  TargetAddress: __expectString(output.TargetAddress),
1382
1048
  TargetStatus: __expectString(output.TargetStatus),
1383
1049
  TargetType: __expectString(output.TargetType),
1384
1050
  };
1385
1051
  };
1386
- var deserializeMetadata = function (output) {
1387
- var _a;
1388
- return ({
1389
- httpStatusCode: output.statusCode,
1390
- requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
1391
- extendedRequestId: output.headers["x-amz-id-2"],
1392
- cfId: output.headers["x-amz-cf-id"],
1393
- });
1394
- };
1395
- var collectBody = function (streamBody, context) {
1396
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
1052
+ const deserializeMetadata = (output) => ({
1053
+ httpStatusCode: output.statusCode,
1054
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
1055
+ extendedRequestId: output.headers["x-amz-id-2"],
1056
+ cfId: output.headers["x-amz-cf-id"],
1057
+ });
1058
+ const collectBody = (streamBody = new Uint8Array(), context) => {
1397
1059
  if (streamBody instanceof Uint8Array) {
1398
1060
  return Promise.resolve(streamBody);
1399
1061
  }
1400
1062
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1401
1063
  };
1402
- var collectBodyString = function (streamBody, context) {
1403
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
1404
- };
1405
- var isSerializableHeaderValue = function (value) {
1406
- return value !== undefined &&
1407
- value !== null &&
1408
- value !== "" &&
1409
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1410
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1411
- };
1412
- var parseBody = function (streamBody, context) {
1413
- return collectBodyString(streamBody, context).then(function (encoded) {
1414
- if (encoded.length) {
1415
- return JSON.parse(encoded);
1416
- }
1417
- return {};
1418
- });
1064
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1065
+ const isSerializableHeaderValue = (value) => value !== undefined &&
1066
+ value !== null &&
1067
+ value !== "" &&
1068
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1069
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1070
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1071
+ if (encoded.length) {
1072
+ return JSON.parse(encoded);
1073
+ }
1074
+ return {};
1075
+ });
1076
+ const parseErrorBody = async (errorBody, context) => {
1077
+ const value = await parseBody(errorBody, context);
1078
+ value.message = value.message ?? value.Message;
1079
+ return value;
1419
1080
  };
1420
- var loadRestJsonErrorCode = function (output, data) {
1421
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
1422
- var sanitizeErrorCode = function (rawValue) {
1423
- var cleanValue = rawValue;
1081
+ const loadRestJsonErrorCode = (output, data) => {
1082
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1083
+ const sanitizeErrorCode = (rawValue) => {
1084
+ let cleanValue = rawValue;
1424
1085
  if (typeof cleanValue === "number") {
1425
1086
  cleanValue = cleanValue.toString();
1426
1087
  }
@@ -1435,7 +1096,7 @@ var loadRestJsonErrorCode = function (output, data) {
1435
1096
  }
1436
1097
  return cleanValue;
1437
1098
  };
1438
- var headerKey = findKey(output.headers, "x-amzn-errortype");
1099
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
1439
1100
  if (headerKey !== undefined) {
1440
1101
  return sanitizeErrorCode(output.headers[headerKey]);
1441
1102
  }