@aws-sdk/client-sso-oidc 3.185.0 → 3.188.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist-es/SSOOIDC.js +14 -21
- package/dist-es/SSOOIDCClient.js +20 -26
- package/dist-es/commands/CreateTokenCommand.js +21 -28
- package/dist-es/commands/RegisterClientCommand.js +21 -28
- package/dist-es/commands/StartDeviceAuthorizationCommand.js +21 -28
- package/dist-es/endpoints.js +8 -8
- package/dist-es/models/SSOOIDCServiceException.js +5 -10
- package/dist-es/models/models_0.js +174 -163
- package/dist-es/protocols/Aws_restJson1.js +454 -560
- package/dist-es/runtimeConfig.browser.js +25 -12
- package/dist-es/runtimeConfig.js +29 -12
- package/dist-es/runtimeConfig.native.js +8 -5
- package/dist-es/runtimeConfig.shared.js +8 -11
- package/package.json +30 -30
|
@@ -1,597 +1,491 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, throwDefaultError, } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { AccessDeniedException, AuthorizationPendingException, ExpiredTokenException, InternalServerException, InvalidClientException, InvalidClientMetadataException, InvalidGrantException, InvalidRequestException, InvalidScopeException, SlowDownException, UnauthorizedClientException, UnsupportedGrantTypeException, } from "../models/models_0";
|
|
5
4
|
import { SSOOIDCServiceException as __BaseException } from "../models/SSOOIDCServiceException";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
method: "POST",
|
|
23
|
-
headers: headers,
|
|
24
|
-
path: resolvedPath,
|
|
25
|
-
body: body,
|
|
26
|
-
})];
|
|
27
|
-
}
|
|
5
|
+
export const serializeAws_restJson1CreateTokenCommand = async (input, context) => {
|
|
6
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
7
|
+
const headers = {
|
|
8
|
+
"content-type": "application/json",
|
|
9
|
+
};
|
|
10
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/token";
|
|
11
|
+
let body;
|
|
12
|
+
body = JSON.stringify({
|
|
13
|
+
...(input.clientId != null && { clientId: input.clientId }),
|
|
14
|
+
...(input.clientSecret != null && { clientSecret: input.clientSecret }),
|
|
15
|
+
...(input.code != null && { code: input.code }),
|
|
16
|
+
...(input.deviceCode != null && { deviceCode: input.deviceCode }),
|
|
17
|
+
...(input.grantType != null && { grantType: input.grantType }),
|
|
18
|
+
...(input.redirectUri != null && { redirectUri: input.redirectUri }),
|
|
19
|
+
...(input.refreshToken != null && { refreshToken: input.refreshToken }),
|
|
20
|
+
...(input.scope != null && { scope: serializeAws_restJson1Scopes(input.scope, context) }),
|
|
28
21
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
headers = {
|
|
38
|
-
"content-type": "application/json",
|
|
39
|
-
};
|
|
40
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/client/register";
|
|
41
|
-
body = JSON.stringify(__assign(__assign(__assign({}, (input.clientName != null && { clientName: input.clientName })), (input.clientType != null && { clientType: input.clientType })), (input.scopes != null && { scopes: serializeAws_restJson1Scopes(input.scopes, context) })));
|
|
42
|
-
return [2, new __HttpRequest({
|
|
43
|
-
protocol: protocol,
|
|
44
|
-
hostname: hostname,
|
|
45
|
-
port: port,
|
|
46
|
-
method: "POST",
|
|
47
|
-
headers: headers,
|
|
48
|
-
path: resolvedPath,
|
|
49
|
-
body: body,
|
|
50
|
-
})];
|
|
51
|
-
}
|
|
22
|
+
return new __HttpRequest({
|
|
23
|
+
protocol,
|
|
24
|
+
hostname,
|
|
25
|
+
port,
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers,
|
|
28
|
+
path: resolvedPath,
|
|
29
|
+
body,
|
|
52
30
|
});
|
|
53
|
-
}
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
body = JSON.stringify(__assign(__assign(__assign({}, (input.clientId != null && { clientId: input.clientId })), (input.clientSecret != null && { clientSecret: input.clientSecret })), (input.startUrl != null && { startUrl: input.startUrl })));
|
|
66
|
-
return [2, new __HttpRequest({
|
|
67
|
-
protocol: protocol,
|
|
68
|
-
hostname: hostname,
|
|
69
|
-
port: port,
|
|
70
|
-
method: "POST",
|
|
71
|
-
headers: headers,
|
|
72
|
-
path: resolvedPath,
|
|
73
|
-
body: body,
|
|
74
|
-
})];
|
|
75
|
-
}
|
|
31
|
+
};
|
|
32
|
+
export const serializeAws_restJson1RegisterClientCommand = async (input, context) => {
|
|
33
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
34
|
+
const headers = {
|
|
35
|
+
"content-type": "application/json",
|
|
36
|
+
};
|
|
37
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/client/register";
|
|
38
|
+
let body;
|
|
39
|
+
body = JSON.stringify({
|
|
40
|
+
...(input.clientName != null && { clientName: input.clientName }),
|
|
41
|
+
...(input.clientType != null && { clientType: input.clientType }),
|
|
42
|
+
...(input.scopes != null && { scopes: serializeAws_restJson1Scopes(input.scopes, context) }),
|
|
76
43
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
contents = map({
|
|
87
|
-
$metadata: deserializeMetadata(output),
|
|
88
|
-
});
|
|
89
|
-
_a = __expectNonNull;
|
|
90
|
-
_b = __expectObject;
|
|
91
|
-
return [4, parseBody(output.body, context)];
|
|
92
|
-
case 1:
|
|
93
|
-
data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
|
|
94
|
-
if (data.accessToken != null) {
|
|
95
|
-
contents.accessToken = __expectString(data.accessToken);
|
|
96
|
-
}
|
|
97
|
-
if (data.expiresIn != null) {
|
|
98
|
-
contents.expiresIn = __expectInt32(data.expiresIn);
|
|
99
|
-
}
|
|
100
|
-
if (data.idToken != null) {
|
|
101
|
-
contents.idToken = __expectString(data.idToken);
|
|
102
|
-
}
|
|
103
|
-
if (data.refreshToken != null) {
|
|
104
|
-
contents.refreshToken = __expectString(data.refreshToken);
|
|
105
|
-
}
|
|
106
|
-
if (data.tokenType != null) {
|
|
107
|
-
contents.tokenType = __expectString(data.tokenType);
|
|
108
|
-
}
|
|
109
|
-
return [2, contents];
|
|
110
|
-
}
|
|
44
|
+
return new __HttpRequest({
|
|
45
|
+
protocol,
|
|
46
|
+
hostname,
|
|
47
|
+
port,
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers,
|
|
50
|
+
path: resolvedPath,
|
|
51
|
+
body,
|
|
111
52
|
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
125
|
-
_b = errorCode;
|
|
126
|
-
switch (_b) {
|
|
127
|
-
case "AccessDeniedException": return [3, 2];
|
|
128
|
-
case "com.amazonaws.ssooidc#AccessDeniedException": return [3, 2];
|
|
129
|
-
case "AuthorizationPendingException": return [3, 4];
|
|
130
|
-
case "com.amazonaws.ssooidc#AuthorizationPendingException": return [3, 4];
|
|
131
|
-
case "ExpiredTokenException": return [3, 6];
|
|
132
|
-
case "com.amazonaws.ssooidc#ExpiredTokenException": return [3, 6];
|
|
133
|
-
case "InternalServerException": return [3, 8];
|
|
134
|
-
case "com.amazonaws.ssooidc#InternalServerException": return [3, 8];
|
|
135
|
-
case "InvalidClientException": return [3, 10];
|
|
136
|
-
case "com.amazonaws.ssooidc#InvalidClientException": return [3, 10];
|
|
137
|
-
case "InvalidGrantException": return [3, 12];
|
|
138
|
-
case "com.amazonaws.ssooidc#InvalidGrantException": return [3, 12];
|
|
139
|
-
case "InvalidRequestException": return [3, 14];
|
|
140
|
-
case "com.amazonaws.ssooidc#InvalidRequestException": return [3, 14];
|
|
141
|
-
case "InvalidScopeException": return [3, 16];
|
|
142
|
-
case "com.amazonaws.ssooidc#InvalidScopeException": return [3, 16];
|
|
143
|
-
case "SlowDownException": return [3, 18];
|
|
144
|
-
case "com.amazonaws.ssooidc#SlowDownException": return [3, 18];
|
|
145
|
-
case "UnauthorizedClientException": return [3, 20];
|
|
146
|
-
case "com.amazonaws.ssooidc#UnauthorizedClientException": return [3, 20];
|
|
147
|
-
case "UnsupportedGrantTypeException": return [3, 22];
|
|
148
|
-
case "com.amazonaws.ssooidc#UnsupportedGrantTypeException": return [3, 22];
|
|
149
|
-
}
|
|
150
|
-
return [3, 24];
|
|
151
|
-
case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
|
|
152
|
-
case 3: throw _d.sent();
|
|
153
|
-
case 4: return [4, deserializeAws_restJson1AuthorizationPendingExceptionResponse(parsedOutput, context)];
|
|
154
|
-
case 5: throw _d.sent();
|
|
155
|
-
case 6: return [4, deserializeAws_restJson1ExpiredTokenExceptionResponse(parsedOutput, context)];
|
|
156
|
-
case 7: throw _d.sent();
|
|
157
|
-
case 8: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
|
|
158
|
-
case 9: throw _d.sent();
|
|
159
|
-
case 10: return [4, deserializeAws_restJson1InvalidClientExceptionResponse(parsedOutput, context)];
|
|
160
|
-
case 11: throw _d.sent();
|
|
161
|
-
case 12: return [4, deserializeAws_restJson1InvalidGrantExceptionResponse(parsedOutput, context)];
|
|
162
|
-
case 13: throw _d.sent();
|
|
163
|
-
case 14: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
|
|
164
|
-
case 15: throw _d.sent();
|
|
165
|
-
case 16: return [4, deserializeAws_restJson1InvalidScopeExceptionResponse(parsedOutput, context)];
|
|
166
|
-
case 17: throw _d.sent();
|
|
167
|
-
case 18: return [4, deserializeAws_restJson1SlowDownExceptionResponse(parsedOutput, context)];
|
|
168
|
-
case 19: throw _d.sent();
|
|
169
|
-
case 20: return [4, deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context)];
|
|
170
|
-
case 21: throw _d.sent();
|
|
171
|
-
case 22: return [4, deserializeAws_restJson1UnsupportedGrantTypeExceptionResponse(parsedOutput, context)];
|
|
172
|
-
case 23: throw _d.sent();
|
|
173
|
-
case 24:
|
|
174
|
-
parsedBody = parsedOutput.body;
|
|
175
|
-
throwDefaultError({
|
|
176
|
-
output: output,
|
|
177
|
-
parsedBody: parsedBody,
|
|
178
|
-
exceptionCtor: __BaseException,
|
|
179
|
-
errorCode: errorCode,
|
|
180
|
-
});
|
|
181
|
-
_d.label = 25;
|
|
182
|
-
case 25: return [2];
|
|
183
|
-
}
|
|
53
|
+
};
|
|
54
|
+
export const serializeAws_restJson1StartDeviceAuthorizationCommand = async (input, context) => {
|
|
55
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
56
|
+
const headers = {
|
|
57
|
+
"content-type": "application/json",
|
|
58
|
+
};
|
|
59
|
+
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/device_authorization";
|
|
60
|
+
let body;
|
|
61
|
+
body = JSON.stringify({
|
|
62
|
+
...(input.clientId != null && { clientId: input.clientId }),
|
|
63
|
+
...(input.clientSecret != null && { clientSecret: input.clientSecret }),
|
|
64
|
+
...(input.startUrl != null && { startUrl: input.startUrl }),
|
|
184
65
|
});
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
contents = map({
|
|
195
|
-
$metadata: deserializeMetadata(output),
|
|
196
|
-
});
|
|
197
|
-
_a = __expectNonNull;
|
|
198
|
-
_b = __expectObject;
|
|
199
|
-
return [4, parseBody(output.body, context)];
|
|
200
|
-
case 1:
|
|
201
|
-
data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
|
|
202
|
-
if (data.authorizationEndpoint != null) {
|
|
203
|
-
contents.authorizationEndpoint = __expectString(data.authorizationEndpoint);
|
|
204
|
-
}
|
|
205
|
-
if (data.clientId != null) {
|
|
206
|
-
contents.clientId = __expectString(data.clientId);
|
|
207
|
-
}
|
|
208
|
-
if (data.clientIdIssuedAt != null) {
|
|
209
|
-
contents.clientIdIssuedAt = __expectLong(data.clientIdIssuedAt);
|
|
210
|
-
}
|
|
211
|
-
if (data.clientSecret != null) {
|
|
212
|
-
contents.clientSecret = __expectString(data.clientSecret);
|
|
213
|
-
}
|
|
214
|
-
if (data.clientSecretExpiresAt != null) {
|
|
215
|
-
contents.clientSecretExpiresAt = __expectLong(data.clientSecretExpiresAt);
|
|
216
|
-
}
|
|
217
|
-
if (data.tokenEndpoint != null) {
|
|
218
|
-
contents.tokenEndpoint = __expectString(data.tokenEndpoint);
|
|
219
|
-
}
|
|
220
|
-
return [2, contents];
|
|
221
|
-
}
|
|
66
|
+
return new __HttpRequest({
|
|
67
|
+
protocol,
|
|
68
|
+
hostname,
|
|
69
|
+
port,
|
|
70
|
+
method: "POST",
|
|
71
|
+
headers,
|
|
72
|
+
path: resolvedPath,
|
|
73
|
+
body,
|
|
222
74
|
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
_a = [__assign({}, output)];
|
|
231
|
-
_c = {};
|
|
232
|
-
return [4, parseErrorBody(output.body, context)];
|
|
233
|
-
case 1:
|
|
234
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
235
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
236
|
-
_b = errorCode;
|
|
237
|
-
switch (_b) {
|
|
238
|
-
case "InternalServerException": return [3, 2];
|
|
239
|
-
case "com.amazonaws.ssooidc#InternalServerException": return [3, 2];
|
|
240
|
-
case "InvalidClientMetadataException": return [3, 4];
|
|
241
|
-
case "com.amazonaws.ssooidc#InvalidClientMetadataException": return [3, 4];
|
|
242
|
-
case "InvalidRequestException": return [3, 6];
|
|
243
|
-
case "com.amazonaws.ssooidc#InvalidRequestException": return [3, 6];
|
|
244
|
-
case "InvalidScopeException": return [3, 8];
|
|
245
|
-
case "com.amazonaws.ssooidc#InvalidScopeException": return [3, 8];
|
|
246
|
-
}
|
|
247
|
-
return [3, 10];
|
|
248
|
-
case 2: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
|
|
249
|
-
case 3: throw _d.sent();
|
|
250
|
-
case 4: return [4, deserializeAws_restJson1InvalidClientMetadataExceptionResponse(parsedOutput, context)];
|
|
251
|
-
case 5: throw _d.sent();
|
|
252
|
-
case 6: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
|
|
253
|
-
case 7: throw _d.sent();
|
|
254
|
-
case 8: return [4, deserializeAws_restJson1InvalidScopeExceptionResponse(parsedOutput, context)];
|
|
255
|
-
case 9: throw _d.sent();
|
|
256
|
-
case 10:
|
|
257
|
-
parsedBody = parsedOutput.body;
|
|
258
|
-
throwDefaultError({
|
|
259
|
-
output: output,
|
|
260
|
-
parsedBody: parsedBody,
|
|
261
|
-
exceptionCtor: __BaseException,
|
|
262
|
-
errorCode: errorCode,
|
|
263
|
-
});
|
|
264
|
-
_d.label = 11;
|
|
265
|
-
case 11: return [2];
|
|
266
|
-
}
|
|
75
|
+
};
|
|
76
|
+
export const deserializeAws_restJson1CreateTokenCommand = async (output, context) => {
|
|
77
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
78
|
+
return deserializeAws_restJson1CreateTokenCommandError(output, context);
|
|
79
|
+
}
|
|
80
|
+
const contents = map({
|
|
81
|
+
$metadata: deserializeMetadata(output),
|
|
267
82
|
});
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
83
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
84
|
+
if (data.accessToken != null) {
|
|
85
|
+
contents.accessToken = __expectString(data.accessToken);
|
|
86
|
+
}
|
|
87
|
+
if (data.expiresIn != null) {
|
|
88
|
+
contents.expiresIn = __expectInt32(data.expiresIn);
|
|
89
|
+
}
|
|
90
|
+
if (data.idToken != null) {
|
|
91
|
+
contents.idToken = __expectString(data.idToken);
|
|
92
|
+
}
|
|
93
|
+
if (data.refreshToken != null) {
|
|
94
|
+
contents.refreshToken = __expectString(data.refreshToken);
|
|
95
|
+
}
|
|
96
|
+
if (data.tokenType != null) {
|
|
97
|
+
contents.tokenType = __expectString(data.tokenType);
|
|
98
|
+
}
|
|
99
|
+
return contents;
|
|
100
|
+
};
|
|
101
|
+
const deserializeAws_restJson1CreateTokenCommandError = async (output, context) => {
|
|
102
|
+
const parsedOutput = {
|
|
103
|
+
...output,
|
|
104
|
+
body: await parseErrorBody(output.body, context),
|
|
105
|
+
};
|
|
106
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
107
|
+
switch (errorCode) {
|
|
108
|
+
case "AccessDeniedException":
|
|
109
|
+
case "com.amazonaws.ssooidc#AccessDeniedException":
|
|
110
|
+
throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
|
|
111
|
+
case "AuthorizationPendingException":
|
|
112
|
+
case "com.amazonaws.ssooidc#AuthorizationPendingException":
|
|
113
|
+
throw await deserializeAws_restJson1AuthorizationPendingExceptionResponse(parsedOutput, context);
|
|
114
|
+
case "ExpiredTokenException":
|
|
115
|
+
case "com.amazonaws.ssooidc#ExpiredTokenException":
|
|
116
|
+
throw await deserializeAws_restJson1ExpiredTokenExceptionResponse(parsedOutput, context);
|
|
117
|
+
case "InternalServerException":
|
|
118
|
+
case "com.amazonaws.ssooidc#InternalServerException":
|
|
119
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
120
|
+
case "InvalidClientException":
|
|
121
|
+
case "com.amazonaws.ssooidc#InvalidClientException":
|
|
122
|
+
throw await deserializeAws_restJson1InvalidClientExceptionResponse(parsedOutput, context);
|
|
123
|
+
case "InvalidGrantException":
|
|
124
|
+
case "com.amazonaws.ssooidc#InvalidGrantException":
|
|
125
|
+
throw await deserializeAws_restJson1InvalidGrantExceptionResponse(parsedOutput, context);
|
|
126
|
+
case "InvalidRequestException":
|
|
127
|
+
case "com.amazonaws.ssooidc#InvalidRequestException":
|
|
128
|
+
throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
|
|
129
|
+
case "InvalidScopeException":
|
|
130
|
+
case "com.amazonaws.ssooidc#InvalidScopeException":
|
|
131
|
+
throw await deserializeAws_restJson1InvalidScopeExceptionResponse(parsedOutput, context);
|
|
132
|
+
case "SlowDownException":
|
|
133
|
+
case "com.amazonaws.ssooidc#SlowDownException":
|
|
134
|
+
throw await deserializeAws_restJson1SlowDownExceptionResponse(parsedOutput, context);
|
|
135
|
+
case "UnauthorizedClientException":
|
|
136
|
+
case "com.amazonaws.ssooidc#UnauthorizedClientException":
|
|
137
|
+
throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
|
|
138
|
+
case "UnsupportedGrantTypeException":
|
|
139
|
+
case "com.amazonaws.ssooidc#UnsupportedGrantTypeException":
|
|
140
|
+
throw await deserializeAws_restJson1UnsupportedGrantTypeExceptionResponse(parsedOutput, context);
|
|
141
|
+
default:
|
|
142
|
+
const parsedBody = parsedOutput.body;
|
|
143
|
+
throwDefaultError({
|
|
144
|
+
output,
|
|
145
|
+
parsedBody,
|
|
146
|
+
exceptionCtor: __BaseException,
|
|
147
|
+
errorCode,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
export const deserializeAws_restJson1RegisterClientCommand = async (output, context) => {
|
|
152
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
153
|
+
return deserializeAws_restJson1RegisterClientCommandError(output, context);
|
|
154
|
+
}
|
|
155
|
+
const contents = map({
|
|
156
|
+
$metadata: deserializeMetadata(output),
|
|
305
157
|
});
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
158
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
159
|
+
if (data.authorizationEndpoint != null) {
|
|
160
|
+
contents.authorizationEndpoint = __expectString(data.authorizationEndpoint);
|
|
161
|
+
}
|
|
162
|
+
if (data.clientId != null) {
|
|
163
|
+
contents.clientId = __expectString(data.clientId);
|
|
164
|
+
}
|
|
165
|
+
if (data.clientIdIssuedAt != null) {
|
|
166
|
+
contents.clientIdIssuedAt = __expectLong(data.clientIdIssuedAt);
|
|
167
|
+
}
|
|
168
|
+
if (data.clientSecret != null) {
|
|
169
|
+
contents.clientSecret = __expectString(data.clientSecret);
|
|
170
|
+
}
|
|
171
|
+
if (data.clientSecretExpiresAt != null) {
|
|
172
|
+
contents.clientSecretExpiresAt = __expectLong(data.clientSecretExpiresAt);
|
|
173
|
+
}
|
|
174
|
+
if (data.tokenEndpoint != null) {
|
|
175
|
+
contents.tokenEndpoint = __expectString(data.tokenEndpoint);
|
|
176
|
+
}
|
|
177
|
+
return contents;
|
|
178
|
+
};
|
|
179
|
+
const deserializeAws_restJson1RegisterClientCommandError = async (output, context) => {
|
|
180
|
+
const parsedOutput = {
|
|
181
|
+
...output,
|
|
182
|
+
body: await parseErrorBody(output.body, context),
|
|
183
|
+
};
|
|
184
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
185
|
+
switch (errorCode) {
|
|
186
|
+
case "InternalServerException":
|
|
187
|
+
case "com.amazonaws.ssooidc#InternalServerException":
|
|
188
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
189
|
+
case "InvalidClientMetadataException":
|
|
190
|
+
case "com.amazonaws.ssooidc#InvalidClientMetadataException":
|
|
191
|
+
throw await deserializeAws_restJson1InvalidClientMetadataExceptionResponse(parsedOutput, context);
|
|
192
|
+
case "InvalidRequestException":
|
|
193
|
+
case "com.amazonaws.ssooidc#InvalidRequestException":
|
|
194
|
+
throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
|
|
195
|
+
case "InvalidScopeException":
|
|
196
|
+
case "com.amazonaws.ssooidc#InvalidScopeException":
|
|
197
|
+
throw await deserializeAws_restJson1InvalidScopeExceptionResponse(parsedOutput, context);
|
|
198
|
+
default:
|
|
199
|
+
const parsedBody = parsedOutput.body;
|
|
200
|
+
throwDefaultError({
|
|
201
|
+
output,
|
|
202
|
+
parsedBody,
|
|
203
|
+
exceptionCtor: __BaseException,
|
|
204
|
+
errorCode,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
export const deserializeAws_restJson1StartDeviceAuthorizationCommand = async (output, context) => {
|
|
209
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
210
|
+
return deserializeAws_restJson1StartDeviceAuthorizationCommandError(output, context);
|
|
211
|
+
}
|
|
212
|
+
const contents = map({
|
|
213
|
+
$metadata: deserializeMetadata(output),
|
|
354
214
|
});
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
contents =
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
215
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
216
|
+
if (data.deviceCode != null) {
|
|
217
|
+
contents.deviceCode = __expectString(data.deviceCode);
|
|
218
|
+
}
|
|
219
|
+
if (data.expiresIn != null) {
|
|
220
|
+
contents.expiresIn = __expectInt32(data.expiresIn);
|
|
221
|
+
}
|
|
222
|
+
if (data.interval != null) {
|
|
223
|
+
contents.interval = __expectInt32(data.interval);
|
|
224
|
+
}
|
|
225
|
+
if (data.userCode != null) {
|
|
226
|
+
contents.userCode = __expectString(data.userCode);
|
|
227
|
+
}
|
|
228
|
+
if (data.verificationUri != null) {
|
|
229
|
+
contents.verificationUri = __expectString(data.verificationUri);
|
|
230
|
+
}
|
|
231
|
+
if (data.verificationUriComplete != null) {
|
|
232
|
+
contents.verificationUriComplete = __expectString(data.verificationUriComplete);
|
|
233
|
+
}
|
|
234
|
+
return contents;
|
|
235
|
+
};
|
|
236
|
+
const deserializeAws_restJson1StartDeviceAuthorizationCommandError = async (output, context) => {
|
|
237
|
+
const parsedOutput = {
|
|
238
|
+
...output,
|
|
239
|
+
body: await parseErrorBody(output.body, context),
|
|
240
|
+
};
|
|
241
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
242
|
+
switch (errorCode) {
|
|
243
|
+
case "InternalServerException":
|
|
244
|
+
case "com.amazonaws.ssooidc#InternalServerException":
|
|
245
|
+
throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
|
|
246
|
+
case "InvalidClientException":
|
|
247
|
+
case "com.amazonaws.ssooidc#InvalidClientException":
|
|
248
|
+
throw await deserializeAws_restJson1InvalidClientExceptionResponse(parsedOutput, context);
|
|
249
|
+
case "InvalidRequestException":
|
|
250
|
+
case "com.amazonaws.ssooidc#InvalidRequestException":
|
|
251
|
+
throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
|
|
252
|
+
case "SlowDownException":
|
|
253
|
+
case "com.amazonaws.ssooidc#SlowDownException":
|
|
254
|
+
throw await deserializeAws_restJson1SlowDownExceptionResponse(parsedOutput, context);
|
|
255
|
+
case "UnauthorizedClientException":
|
|
256
|
+
case "com.amazonaws.ssooidc#UnauthorizedClientException":
|
|
257
|
+
throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context);
|
|
258
|
+
default:
|
|
259
|
+
const parsedBody = parsedOutput.body;
|
|
260
|
+
throwDefaultError({
|
|
261
|
+
output,
|
|
262
|
+
parsedBody,
|
|
263
|
+
exceptionCtor: __BaseException,
|
|
264
|
+
errorCode,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
const map = __map;
|
|
269
|
+
const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
|
|
270
|
+
const contents = map({});
|
|
271
|
+
const data = parsedOutput.body;
|
|
272
|
+
if (data.error != null) {
|
|
273
|
+
contents.error = __expectString(data.error);
|
|
274
|
+
}
|
|
275
|
+
if (data.error_description != null) {
|
|
276
|
+
contents.error_description = __expectString(data.error_description);
|
|
277
|
+
}
|
|
278
|
+
const exception = new AccessDeniedException({
|
|
279
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
280
|
+
...contents,
|
|
370
281
|
});
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
282
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
283
|
+
};
|
|
284
|
+
const deserializeAws_restJson1AuthorizationPendingExceptionResponse = async (parsedOutput, context) => {
|
|
285
|
+
const contents = map({});
|
|
286
|
+
const data = parsedOutput.body;
|
|
287
|
+
if (data.error != null) {
|
|
288
|
+
contents.error = __expectString(data.error);
|
|
289
|
+
}
|
|
290
|
+
if (data.error_description != null) {
|
|
291
|
+
contents.error_description = __expectString(data.error_description);
|
|
292
|
+
}
|
|
293
|
+
const exception = new AuthorizationPendingException({
|
|
294
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
295
|
+
...contents,
|
|
385
296
|
});
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
297
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
298
|
+
};
|
|
299
|
+
const deserializeAws_restJson1ExpiredTokenExceptionResponse = async (parsedOutput, context) => {
|
|
300
|
+
const contents = map({});
|
|
301
|
+
const data = parsedOutput.body;
|
|
302
|
+
if (data.error != null) {
|
|
303
|
+
contents.error = __expectString(data.error);
|
|
304
|
+
}
|
|
305
|
+
if (data.error_description != null) {
|
|
306
|
+
contents.error_description = __expectString(data.error_description);
|
|
307
|
+
}
|
|
308
|
+
const exception = new ExpiredTokenException({
|
|
309
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
310
|
+
...contents,
|
|
400
311
|
});
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
312
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
313
|
+
};
|
|
314
|
+
const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
|
|
315
|
+
const contents = map({});
|
|
316
|
+
const data = parsedOutput.body;
|
|
317
|
+
if (data.error != null) {
|
|
318
|
+
contents.error = __expectString(data.error);
|
|
319
|
+
}
|
|
320
|
+
if (data.error_description != null) {
|
|
321
|
+
contents.error_description = __expectString(data.error_description);
|
|
322
|
+
}
|
|
323
|
+
const exception = new InternalServerException({
|
|
324
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
325
|
+
...contents,
|
|
415
326
|
});
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
327
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
328
|
+
};
|
|
329
|
+
const deserializeAws_restJson1InvalidClientExceptionResponse = async (parsedOutput, context) => {
|
|
330
|
+
const contents = map({});
|
|
331
|
+
const data = parsedOutput.body;
|
|
332
|
+
if (data.error != null) {
|
|
333
|
+
contents.error = __expectString(data.error);
|
|
334
|
+
}
|
|
335
|
+
if (data.error_description != null) {
|
|
336
|
+
contents.error_description = __expectString(data.error_description);
|
|
337
|
+
}
|
|
338
|
+
const exception = new InvalidClientException({
|
|
339
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
340
|
+
...contents,
|
|
430
341
|
});
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
342
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
343
|
+
};
|
|
344
|
+
const deserializeAws_restJson1InvalidClientMetadataExceptionResponse = async (parsedOutput, context) => {
|
|
345
|
+
const contents = map({});
|
|
346
|
+
const data = parsedOutput.body;
|
|
347
|
+
if (data.error != null) {
|
|
348
|
+
contents.error = __expectString(data.error);
|
|
349
|
+
}
|
|
350
|
+
if (data.error_description != null) {
|
|
351
|
+
contents.error_description = __expectString(data.error_description);
|
|
352
|
+
}
|
|
353
|
+
const exception = new InvalidClientMetadataException({
|
|
354
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
355
|
+
...contents,
|
|
445
356
|
});
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
357
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
358
|
+
};
|
|
359
|
+
const deserializeAws_restJson1InvalidGrantExceptionResponse = async (parsedOutput, context) => {
|
|
360
|
+
const contents = map({});
|
|
361
|
+
const data = parsedOutput.body;
|
|
362
|
+
if (data.error != null) {
|
|
363
|
+
contents.error = __expectString(data.error);
|
|
364
|
+
}
|
|
365
|
+
if (data.error_description != null) {
|
|
366
|
+
contents.error_description = __expectString(data.error_description);
|
|
367
|
+
}
|
|
368
|
+
const exception = new InvalidGrantException({
|
|
369
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
370
|
+
...contents,
|
|
460
371
|
});
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
372
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
373
|
+
};
|
|
374
|
+
const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
|
|
375
|
+
const contents = map({});
|
|
376
|
+
const data = parsedOutput.body;
|
|
377
|
+
if (data.error != null) {
|
|
378
|
+
contents.error = __expectString(data.error);
|
|
379
|
+
}
|
|
380
|
+
if (data.error_description != null) {
|
|
381
|
+
contents.error_description = __expectString(data.error_description);
|
|
382
|
+
}
|
|
383
|
+
const exception = new InvalidRequestException({
|
|
384
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
385
|
+
...contents,
|
|
475
386
|
});
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
387
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
388
|
+
};
|
|
389
|
+
const deserializeAws_restJson1InvalidScopeExceptionResponse = async (parsedOutput, context) => {
|
|
390
|
+
const contents = map({});
|
|
391
|
+
const data = parsedOutput.body;
|
|
392
|
+
if (data.error != null) {
|
|
393
|
+
contents.error = __expectString(data.error);
|
|
394
|
+
}
|
|
395
|
+
if (data.error_description != null) {
|
|
396
|
+
contents.error_description = __expectString(data.error_description);
|
|
397
|
+
}
|
|
398
|
+
const exception = new InvalidScopeException({
|
|
399
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
400
|
+
...contents,
|
|
490
401
|
});
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
402
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
403
|
+
};
|
|
404
|
+
const deserializeAws_restJson1SlowDownExceptionResponse = async (parsedOutput, context) => {
|
|
405
|
+
const contents = map({});
|
|
406
|
+
const data = parsedOutput.body;
|
|
407
|
+
if (data.error != null) {
|
|
408
|
+
contents.error = __expectString(data.error);
|
|
409
|
+
}
|
|
410
|
+
if (data.error_description != null) {
|
|
411
|
+
contents.error_description = __expectString(data.error_description);
|
|
412
|
+
}
|
|
413
|
+
const exception = new SlowDownException({
|
|
414
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
415
|
+
...contents,
|
|
505
416
|
});
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
417
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
418
|
+
};
|
|
419
|
+
const deserializeAws_restJson1UnauthorizedClientExceptionResponse = async (parsedOutput, context) => {
|
|
420
|
+
const contents = map({});
|
|
421
|
+
const data = parsedOutput.body;
|
|
422
|
+
if (data.error != null) {
|
|
423
|
+
contents.error = __expectString(data.error);
|
|
424
|
+
}
|
|
425
|
+
if (data.error_description != null) {
|
|
426
|
+
contents.error_description = __expectString(data.error_description);
|
|
427
|
+
}
|
|
428
|
+
const exception = new UnauthorizedClientException({
|
|
429
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
430
|
+
...contents,
|
|
520
431
|
});
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
432
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
433
|
+
};
|
|
434
|
+
const deserializeAws_restJson1UnsupportedGrantTypeExceptionResponse = async (parsedOutput, context) => {
|
|
435
|
+
const contents = map({});
|
|
436
|
+
const data = parsedOutput.body;
|
|
437
|
+
if (data.error != null) {
|
|
438
|
+
contents.error = __expectString(data.error);
|
|
439
|
+
}
|
|
440
|
+
if (data.error_description != null) {
|
|
441
|
+
contents.error_description = __expectString(data.error_description);
|
|
442
|
+
}
|
|
443
|
+
const exception = new UnsupportedGrantTypeException({
|
|
444
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
445
|
+
...contents,
|
|
535
446
|
});
|
|
536
|
-
|
|
537
|
-
|
|
447
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
448
|
+
};
|
|
449
|
+
const serializeAws_restJson1Scopes = (input, context) => {
|
|
538
450
|
return input
|
|
539
|
-
.filter(
|
|
540
|
-
.map(
|
|
451
|
+
.filter((e) => e != null)
|
|
452
|
+
.map((entry) => {
|
|
541
453
|
return entry;
|
|
542
454
|
});
|
|
543
455
|
};
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
});
|
|
552
|
-
};
|
|
553
|
-
var collectBody = function (streamBody, context) {
|
|
554
|
-
if (streamBody === void 0) { streamBody = new Uint8Array(); }
|
|
456
|
+
const deserializeMetadata = (output) => ({
|
|
457
|
+
httpStatusCode: output.statusCode,
|
|
458
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
459
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
460
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
461
|
+
});
|
|
462
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
555
463
|
if (streamBody instanceof Uint8Array) {
|
|
556
464
|
return Promise.resolve(streamBody);
|
|
557
465
|
}
|
|
558
466
|
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
559
467
|
};
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
});
|
|
468
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
469
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
470
|
+
value !== null &&
|
|
471
|
+
value !== "" &&
|
|
472
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
473
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
474
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
475
|
+
if (encoded.length) {
|
|
476
|
+
return JSON.parse(encoded);
|
|
477
|
+
}
|
|
478
|
+
return {};
|
|
479
|
+
});
|
|
480
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
481
|
+
const value = await parseBody(errorBody, context);
|
|
482
|
+
value.message = value.message ?? value.Message;
|
|
483
|
+
return value;
|
|
577
484
|
};
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
switch (_b.label) {
|
|
583
|
-
case 0: return [4, parseBody(errorBody, context)];
|
|
584
|
-
case 1:
|
|
585
|
-
value = _b.sent();
|
|
586
|
-
value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
|
|
587
|
-
return [2, value];
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
}); };
|
|
591
|
-
var loadRestJsonErrorCode = function (output, data) {
|
|
592
|
-
var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
|
|
593
|
-
var sanitizeErrorCode = function (rawValue) {
|
|
594
|
-
var cleanValue = rawValue;
|
|
485
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
486
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
487
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
488
|
+
let cleanValue = rawValue;
|
|
595
489
|
if (typeof cleanValue === "number") {
|
|
596
490
|
cleanValue = cleanValue.toString();
|
|
597
491
|
}
|
|
@@ -606,7 +500,7 @@ var loadRestJsonErrorCode = function (output, data) {
|
|
|
606
500
|
}
|
|
607
501
|
return cleanValue;
|
|
608
502
|
};
|
|
609
|
-
|
|
503
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
610
504
|
if (headerKey !== undefined) {
|
|
611
505
|
return sanitizeErrorCode(output.headers[headerKey]);
|
|
612
506
|
}
|