@aws-sdk/client-kinesis-video-webrtc-storage 3.234.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 (71) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +212 -0
  3. package/dist-cjs/KinesisVideoWebRTCStorage.js +37 -0
  4. package/dist-cjs/KinesisVideoWebRTCStorageClient.js +40 -0
  5. package/dist-cjs/commands/JoinStorageSessionAsViewerCommand.js +46 -0
  6. package/dist-cjs/commands/JoinStorageSessionCommand.js +46 -0
  7. package/dist-cjs/commands/index.js +5 -0
  8. package/dist-cjs/endpoint/EndpointParameters.js +12 -0
  9. package/dist-cjs/endpoint/endpointResolver.js +12 -0
  10. package/dist-cjs/endpoint/ruleset.js +303 -0
  11. package/dist-cjs/index.js +10 -0
  12. package/dist-cjs/models/KinesisVideoWebRTCStorageServiceException.js +11 -0
  13. package/dist-cjs/models/index.js +4 -0
  14. package/dist-cjs/models/models_0.js +64 -0
  15. package/dist-cjs/protocols/Aws_restJson1.js +237 -0
  16. package/dist-cjs/runtimeConfig.browser.js +42 -0
  17. package/dist-cjs/runtimeConfig.js +51 -0
  18. package/dist-cjs/runtimeConfig.native.js +15 -0
  19. package/dist-cjs/runtimeConfig.shared.js +18 -0
  20. package/dist-es/KinesisVideoWebRTCStorage.js +33 -0
  21. package/dist-es/KinesisVideoWebRTCStorageClient.js +36 -0
  22. package/dist-es/commands/JoinStorageSessionAsViewerCommand.js +42 -0
  23. package/dist-es/commands/JoinStorageSessionCommand.js +42 -0
  24. package/dist-es/commands/index.js +2 -0
  25. package/dist-es/endpoint/EndpointParameters.js +8 -0
  26. package/dist-es/endpoint/endpointResolver.js +8 -0
  27. package/dist-es/endpoint/ruleset.js +300 -0
  28. package/dist-es/index.js +5 -0
  29. package/dist-es/models/KinesisVideoWebRTCStorageServiceException.js +7 -0
  30. package/dist-es/models/index.js +1 -0
  31. package/dist-es/models/models_0.js +55 -0
  32. package/dist-es/protocols/Aws_restJson1.js +230 -0
  33. package/dist-es/runtimeConfig.browser.js +37 -0
  34. package/dist-es/runtimeConfig.js +46 -0
  35. package/dist-es/runtimeConfig.native.js +11 -0
  36. package/dist-es/runtimeConfig.shared.js +14 -0
  37. package/dist-types/KinesisVideoWebRTCStorage.d.ts +60 -0
  38. package/dist-types/KinesisVideoWebRTCStorageClient.d.ts +144 -0
  39. package/dist-types/commands/JoinStorageSessionAsViewerCommand.d.ts +54 -0
  40. package/dist-types/commands/JoinStorageSessionCommand.d.ts +58 -0
  41. package/dist-types/commands/index.d.ts +2 -0
  42. package/dist-types/endpoint/EndpointParameters.d.ts +19 -0
  43. package/dist-types/endpoint/endpointResolver.d.ts +5 -0
  44. package/dist-types/endpoint/ruleset.d.ts +2 -0
  45. package/dist-types/index.d.ts +5 -0
  46. package/dist-types/models/KinesisVideoWebRTCStorageServiceException.d.ts +10 -0
  47. package/dist-types/models/index.d.ts +1 -0
  48. package/dist-types/models/models_0.d.ts +105 -0
  49. package/dist-types/protocols/Aws_restJson1.d.ts +8 -0
  50. package/dist-types/runtimeConfig.browser.d.ts +42 -0
  51. package/dist-types/runtimeConfig.d.ts +42 -0
  52. package/dist-types/runtimeConfig.native.d.ts +41 -0
  53. package/dist-types/runtimeConfig.shared.d.ts +16 -0
  54. package/dist-types/ts3.4/KinesisVideoWebRTCStorage.d.ts +38 -0
  55. package/dist-types/ts3.4/KinesisVideoWebRTCStorageClient.d.ts +124 -0
  56. package/dist-types/ts3.4/commands/JoinStorageSessionAsViewerCommand.d.ts +37 -0
  57. package/dist-types/ts3.4/commands/JoinStorageSessionCommand.d.ts +33 -0
  58. package/dist-types/ts3.4/commands/index.d.ts +2 -0
  59. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +34 -0
  60. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  61. package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
  62. package/dist-types/ts3.4/index.d.ts +5 -0
  63. package/dist-types/ts3.4/models/KinesisVideoWebRTCStorageServiceException.d.ts +7 -0
  64. package/dist-types/ts3.4/models/index.d.ts +1 -0
  65. package/dist-types/ts3.4/models/models_0.d.ts +43 -0
  66. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +29 -0
  67. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +93 -0
  68. package/dist-types/ts3.4/runtimeConfig.d.ts +93 -0
  69. package/dist-types/ts3.4/runtimeConfig.native.d.ts +82 -0
  70. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +18 -0
  71. package/package.json +102 -0
@@ -0,0 +1,303 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ruleSet = void 0;
4
+ exports.ruleSet = {
5
+ version: "1.0",
6
+ parameters: {
7
+ Region: {
8
+ builtIn: "AWS::Region",
9
+ required: true,
10
+ documentation: "The AWS region used to dispatch the request.",
11
+ type: "String",
12
+ },
13
+ UseDualStack: {
14
+ builtIn: "AWS::UseDualStack",
15
+ required: true,
16
+ default: false,
17
+ documentation: "When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.",
18
+ type: "Boolean",
19
+ },
20
+ UseFIPS: {
21
+ builtIn: "AWS::UseFIPS",
22
+ required: true,
23
+ default: false,
24
+ documentation: "When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.",
25
+ type: "Boolean",
26
+ },
27
+ Endpoint: {
28
+ builtIn: "SDK::Endpoint",
29
+ required: false,
30
+ documentation: "Override the endpoint used to send this request",
31
+ type: "String",
32
+ },
33
+ },
34
+ rules: [
35
+ {
36
+ conditions: [
37
+ {
38
+ fn: "aws.partition",
39
+ argv: [
40
+ {
41
+ ref: "Region",
42
+ },
43
+ ],
44
+ assign: "PartitionResult",
45
+ },
46
+ ],
47
+ type: "tree",
48
+ rules: [
49
+ {
50
+ conditions: [
51
+ {
52
+ fn: "isSet",
53
+ argv: [
54
+ {
55
+ ref: "Endpoint",
56
+ },
57
+ ],
58
+ },
59
+ ],
60
+ type: "tree",
61
+ rules: [
62
+ {
63
+ conditions: [
64
+ {
65
+ fn: "booleanEquals",
66
+ argv: [
67
+ {
68
+ ref: "UseFIPS",
69
+ },
70
+ true,
71
+ ],
72
+ },
73
+ ],
74
+ error: "Invalid Configuration: FIPS and custom endpoint are not supported",
75
+ type: "error",
76
+ },
77
+ {
78
+ conditions: [],
79
+ type: "tree",
80
+ rules: [
81
+ {
82
+ conditions: [
83
+ {
84
+ fn: "booleanEquals",
85
+ argv: [
86
+ {
87
+ ref: "UseDualStack",
88
+ },
89
+ true,
90
+ ],
91
+ },
92
+ ],
93
+ error: "Invalid Configuration: Dualstack and custom endpoint are not supported",
94
+ type: "error",
95
+ },
96
+ {
97
+ conditions: [],
98
+ endpoint: {
99
+ url: {
100
+ ref: "Endpoint",
101
+ },
102
+ properties: {},
103
+ headers: {},
104
+ },
105
+ type: "endpoint",
106
+ },
107
+ ],
108
+ },
109
+ ],
110
+ },
111
+ {
112
+ conditions: [
113
+ {
114
+ fn: "booleanEquals",
115
+ argv: [
116
+ {
117
+ ref: "UseFIPS",
118
+ },
119
+ true,
120
+ ],
121
+ },
122
+ {
123
+ fn: "booleanEquals",
124
+ argv: [
125
+ {
126
+ ref: "UseDualStack",
127
+ },
128
+ true,
129
+ ],
130
+ },
131
+ ],
132
+ type: "tree",
133
+ rules: [
134
+ {
135
+ conditions: [
136
+ {
137
+ fn: "booleanEquals",
138
+ argv: [
139
+ true,
140
+ {
141
+ fn: "getAttr",
142
+ argv: [
143
+ {
144
+ ref: "PartitionResult",
145
+ },
146
+ "supportsFIPS",
147
+ ],
148
+ },
149
+ ],
150
+ },
151
+ {
152
+ fn: "booleanEquals",
153
+ argv: [
154
+ true,
155
+ {
156
+ fn: "getAttr",
157
+ argv: [
158
+ {
159
+ ref: "PartitionResult",
160
+ },
161
+ "supportsDualStack",
162
+ ],
163
+ },
164
+ ],
165
+ },
166
+ ],
167
+ type: "tree",
168
+ rules: [
169
+ {
170
+ conditions: [],
171
+ endpoint: {
172
+ url: "https://kinesisvideo-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",
173
+ properties: {},
174
+ headers: {},
175
+ },
176
+ type: "endpoint",
177
+ },
178
+ ],
179
+ },
180
+ {
181
+ conditions: [],
182
+ error: "FIPS and DualStack are enabled, but this partition does not support one or both",
183
+ type: "error",
184
+ },
185
+ ],
186
+ },
187
+ {
188
+ conditions: [
189
+ {
190
+ fn: "booleanEquals",
191
+ argv: [
192
+ {
193
+ ref: "UseFIPS",
194
+ },
195
+ true,
196
+ ],
197
+ },
198
+ ],
199
+ type: "tree",
200
+ rules: [
201
+ {
202
+ conditions: [
203
+ {
204
+ fn: "booleanEquals",
205
+ argv: [
206
+ true,
207
+ {
208
+ fn: "getAttr",
209
+ argv: [
210
+ {
211
+ ref: "PartitionResult",
212
+ },
213
+ "supportsFIPS",
214
+ ],
215
+ },
216
+ ],
217
+ },
218
+ ],
219
+ type: "tree",
220
+ rules: [
221
+ {
222
+ conditions: [],
223
+ endpoint: {
224
+ url: "https://kinesisvideo-fips.{Region}.{PartitionResult#dnsSuffix}",
225
+ properties: {},
226
+ headers: {},
227
+ },
228
+ type: "endpoint",
229
+ },
230
+ ],
231
+ },
232
+ {
233
+ conditions: [],
234
+ error: "FIPS is enabled but this partition does not support FIPS",
235
+ type: "error",
236
+ },
237
+ ],
238
+ },
239
+ {
240
+ conditions: [
241
+ {
242
+ fn: "booleanEquals",
243
+ argv: [
244
+ {
245
+ ref: "UseDualStack",
246
+ },
247
+ true,
248
+ ],
249
+ },
250
+ ],
251
+ type: "tree",
252
+ rules: [
253
+ {
254
+ conditions: [
255
+ {
256
+ fn: "booleanEquals",
257
+ argv: [
258
+ true,
259
+ {
260
+ fn: "getAttr",
261
+ argv: [
262
+ {
263
+ ref: "PartitionResult",
264
+ },
265
+ "supportsDualStack",
266
+ ],
267
+ },
268
+ ],
269
+ },
270
+ ],
271
+ type: "tree",
272
+ rules: [
273
+ {
274
+ conditions: [],
275
+ endpoint: {
276
+ url: "https://kinesisvideo.{Region}.{PartitionResult#dualStackDnsSuffix}",
277
+ properties: {},
278
+ headers: {},
279
+ },
280
+ type: "endpoint",
281
+ },
282
+ ],
283
+ },
284
+ {
285
+ conditions: [],
286
+ error: "DualStack is enabled but this partition does not support DualStack",
287
+ type: "error",
288
+ },
289
+ ],
290
+ },
291
+ {
292
+ conditions: [],
293
+ endpoint: {
294
+ url: "https://kinesisvideo.{Region}.{PartitionResult#dnsSuffix}",
295
+ properties: {},
296
+ headers: {},
297
+ },
298
+ type: "endpoint",
299
+ },
300
+ ],
301
+ },
302
+ ],
303
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KinesisVideoWebRTCStorageServiceException = void 0;
4
+ const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./KinesisVideoWebRTCStorage"), exports);
6
+ tslib_1.__exportStar(require("./KinesisVideoWebRTCStorageClient"), exports);
7
+ tslib_1.__exportStar(require("./commands"), exports);
8
+ tslib_1.__exportStar(require("./models"), exports);
9
+ var KinesisVideoWebRTCStorageServiceException_1 = require("./models/KinesisVideoWebRTCStorageServiceException");
10
+ Object.defineProperty(exports, "KinesisVideoWebRTCStorageServiceException", { enumerable: true, get: function () { return KinesisVideoWebRTCStorageServiceException_1.KinesisVideoWebRTCStorageServiceException; } });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KinesisVideoWebRTCStorageServiceException = void 0;
4
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
5
+ class KinesisVideoWebRTCStorageServiceException extends smithy_client_1.ServiceException {
6
+ constructor(options) {
7
+ super(options);
8
+ Object.setPrototypeOf(this, KinesisVideoWebRTCStorageServiceException.prototype);
9
+ }
10
+ }
11
+ exports.KinesisVideoWebRTCStorageServiceException = KinesisVideoWebRTCStorageServiceException;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./models_0"), exports);
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JoinStorageSessionAsViewerInputFilterSensitiveLog = exports.JoinStorageSessionInputFilterSensitiveLog = exports.ResourceNotFoundException = exports.InvalidArgumentException = exports.ClientLimitExceededException = exports.AccessDeniedException = void 0;
4
+ const KinesisVideoWebRTCStorageServiceException_1 = require("./KinesisVideoWebRTCStorageServiceException");
5
+ class AccessDeniedException extends KinesisVideoWebRTCStorageServiceException_1.KinesisVideoWebRTCStorageServiceException {
6
+ constructor(opts) {
7
+ super({
8
+ name: "AccessDeniedException",
9
+ $fault: "client",
10
+ ...opts,
11
+ });
12
+ this.name = "AccessDeniedException";
13
+ this.$fault = "client";
14
+ Object.setPrototypeOf(this, AccessDeniedException.prototype);
15
+ }
16
+ }
17
+ exports.AccessDeniedException = AccessDeniedException;
18
+ class ClientLimitExceededException extends KinesisVideoWebRTCStorageServiceException_1.KinesisVideoWebRTCStorageServiceException {
19
+ constructor(opts) {
20
+ super({
21
+ name: "ClientLimitExceededException",
22
+ $fault: "client",
23
+ ...opts,
24
+ });
25
+ this.name = "ClientLimitExceededException";
26
+ this.$fault = "client";
27
+ Object.setPrototypeOf(this, ClientLimitExceededException.prototype);
28
+ }
29
+ }
30
+ exports.ClientLimitExceededException = ClientLimitExceededException;
31
+ class InvalidArgumentException extends KinesisVideoWebRTCStorageServiceException_1.KinesisVideoWebRTCStorageServiceException {
32
+ constructor(opts) {
33
+ super({
34
+ name: "InvalidArgumentException",
35
+ $fault: "client",
36
+ ...opts,
37
+ });
38
+ this.name = "InvalidArgumentException";
39
+ this.$fault = "client";
40
+ Object.setPrototypeOf(this, InvalidArgumentException.prototype);
41
+ }
42
+ }
43
+ exports.InvalidArgumentException = InvalidArgumentException;
44
+ class ResourceNotFoundException extends KinesisVideoWebRTCStorageServiceException_1.KinesisVideoWebRTCStorageServiceException {
45
+ constructor(opts) {
46
+ super({
47
+ name: "ResourceNotFoundException",
48
+ $fault: "client",
49
+ ...opts,
50
+ });
51
+ this.name = "ResourceNotFoundException";
52
+ this.$fault = "client";
53
+ Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
54
+ }
55
+ }
56
+ exports.ResourceNotFoundException = ResourceNotFoundException;
57
+ const JoinStorageSessionInputFilterSensitiveLog = (obj) => ({
58
+ ...obj,
59
+ });
60
+ exports.JoinStorageSessionInputFilterSensitiveLog = JoinStorageSessionInputFilterSensitiveLog;
61
+ const JoinStorageSessionAsViewerInputFilterSensitiveLog = (obj) => ({
62
+ ...obj,
63
+ });
64
+ exports.JoinStorageSessionAsViewerInputFilterSensitiveLog = JoinStorageSessionAsViewerInputFilterSensitiveLog;
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeAws_restJson1JoinStorageSessionAsViewerCommand = exports.deserializeAws_restJson1JoinStorageSessionCommand = exports.serializeAws_restJson1JoinStorageSessionAsViewerCommand = exports.serializeAws_restJson1JoinStorageSessionCommand = void 0;
4
+ const protocol_http_1 = require("@aws-sdk/protocol-http");
5
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const KinesisVideoWebRTCStorageServiceException_1 = require("../models/KinesisVideoWebRTCStorageServiceException");
7
+ const models_0_1 = require("../models/models_0");
8
+ const serializeAws_restJson1JoinStorageSessionCommand = async (input, context) => {
9
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
+ const headers = {
11
+ "content-type": "application/json",
12
+ };
13
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/joinStorageSession";
14
+ let body;
15
+ body = JSON.stringify({
16
+ ...(input.channelArn != null && { channelArn: input.channelArn }),
17
+ });
18
+ return new protocol_http_1.HttpRequest({
19
+ protocol,
20
+ hostname,
21
+ port,
22
+ method: "POST",
23
+ headers,
24
+ path: resolvedPath,
25
+ body,
26
+ });
27
+ };
28
+ exports.serializeAws_restJson1JoinStorageSessionCommand = serializeAws_restJson1JoinStorageSessionCommand;
29
+ const serializeAws_restJson1JoinStorageSessionAsViewerCommand = async (input, context) => {
30
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
31
+ const headers = {
32
+ "content-type": "application/json",
33
+ };
34
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/joinStorageSessionAsViewer";
35
+ let body;
36
+ body = JSON.stringify({
37
+ ...(input.channelArn != null && { channelArn: input.channelArn }),
38
+ ...(input.clientId != null && { clientId: input.clientId }),
39
+ });
40
+ return new protocol_http_1.HttpRequest({
41
+ protocol,
42
+ hostname,
43
+ port,
44
+ method: "POST",
45
+ headers,
46
+ path: resolvedPath,
47
+ body,
48
+ });
49
+ };
50
+ exports.serializeAws_restJson1JoinStorageSessionAsViewerCommand = serializeAws_restJson1JoinStorageSessionAsViewerCommand;
51
+ const deserializeAws_restJson1JoinStorageSessionCommand = async (output, context) => {
52
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
53
+ return deserializeAws_restJson1JoinStorageSessionCommandError(output, context);
54
+ }
55
+ const contents = map({
56
+ $metadata: deserializeMetadata(output),
57
+ });
58
+ await collectBody(output.body, context);
59
+ return contents;
60
+ };
61
+ exports.deserializeAws_restJson1JoinStorageSessionCommand = deserializeAws_restJson1JoinStorageSessionCommand;
62
+ const deserializeAws_restJson1JoinStorageSessionCommandError = async (output, context) => {
63
+ const parsedOutput = {
64
+ ...output,
65
+ body: await parseErrorBody(output.body, context),
66
+ };
67
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
68
+ switch (errorCode) {
69
+ case "AccessDeniedException":
70
+ case "com.amazonaws.kinesisvideowebrtcstorage#AccessDeniedException":
71
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
72
+ case "ClientLimitExceededException":
73
+ case "com.amazonaws.kinesisvideowebrtcstorage#ClientLimitExceededException":
74
+ throw await deserializeAws_restJson1ClientLimitExceededExceptionResponse(parsedOutput, context);
75
+ case "InvalidArgumentException":
76
+ case "com.amazonaws.kinesisvideowebrtcstorage#InvalidArgumentException":
77
+ throw await deserializeAws_restJson1InvalidArgumentExceptionResponse(parsedOutput, context);
78
+ case "ResourceNotFoundException":
79
+ case "com.amazonaws.kinesisvideowebrtcstorage#ResourceNotFoundException":
80
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
81
+ default:
82
+ const parsedBody = parsedOutput.body;
83
+ (0, smithy_client_1.throwDefaultError)({
84
+ output,
85
+ parsedBody,
86
+ exceptionCtor: KinesisVideoWebRTCStorageServiceException_1.KinesisVideoWebRTCStorageServiceException,
87
+ errorCode,
88
+ });
89
+ }
90
+ };
91
+ const deserializeAws_restJson1JoinStorageSessionAsViewerCommand = async (output, context) => {
92
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
93
+ return deserializeAws_restJson1JoinStorageSessionAsViewerCommandError(output, context);
94
+ }
95
+ const contents = map({
96
+ $metadata: deserializeMetadata(output),
97
+ });
98
+ await collectBody(output.body, context);
99
+ return contents;
100
+ };
101
+ exports.deserializeAws_restJson1JoinStorageSessionAsViewerCommand = deserializeAws_restJson1JoinStorageSessionAsViewerCommand;
102
+ const deserializeAws_restJson1JoinStorageSessionAsViewerCommandError = async (output, context) => {
103
+ const parsedOutput = {
104
+ ...output,
105
+ body: await parseErrorBody(output.body, context),
106
+ };
107
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
108
+ switch (errorCode) {
109
+ case "AccessDeniedException":
110
+ case "com.amazonaws.kinesisvideowebrtcstorage#AccessDeniedException":
111
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
112
+ case "ClientLimitExceededException":
113
+ case "com.amazonaws.kinesisvideowebrtcstorage#ClientLimitExceededException":
114
+ throw await deserializeAws_restJson1ClientLimitExceededExceptionResponse(parsedOutput, context);
115
+ case "InvalidArgumentException":
116
+ case "com.amazonaws.kinesisvideowebrtcstorage#InvalidArgumentException":
117
+ throw await deserializeAws_restJson1InvalidArgumentExceptionResponse(parsedOutput, context);
118
+ case "ResourceNotFoundException":
119
+ case "com.amazonaws.kinesisvideowebrtcstorage#ResourceNotFoundException":
120
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
121
+ default:
122
+ const parsedBody = parsedOutput.body;
123
+ (0, smithy_client_1.throwDefaultError)({
124
+ output,
125
+ parsedBody,
126
+ exceptionCtor: KinesisVideoWebRTCStorageServiceException_1.KinesisVideoWebRTCStorageServiceException,
127
+ errorCode,
128
+ });
129
+ }
130
+ };
131
+ const map = smithy_client_1.map;
132
+ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
133
+ const contents = map({});
134
+ const data = parsedOutput.body;
135
+ if (data.message != null) {
136
+ contents.message = (0, smithy_client_1.expectString)(data.message);
137
+ }
138
+ const exception = new models_0_1.AccessDeniedException({
139
+ $metadata: deserializeMetadata(parsedOutput),
140
+ ...contents,
141
+ });
142
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
143
+ };
144
+ const deserializeAws_restJson1ClientLimitExceededExceptionResponse = async (parsedOutput, context) => {
145
+ const contents = map({});
146
+ const data = parsedOutput.body;
147
+ if (data.message != null) {
148
+ contents.message = (0, smithy_client_1.expectString)(data.message);
149
+ }
150
+ const exception = new models_0_1.ClientLimitExceededException({
151
+ $metadata: deserializeMetadata(parsedOutput),
152
+ ...contents,
153
+ });
154
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
155
+ };
156
+ const deserializeAws_restJson1InvalidArgumentExceptionResponse = async (parsedOutput, context) => {
157
+ const contents = map({});
158
+ const data = parsedOutput.body;
159
+ if (data.message != null) {
160
+ contents.message = (0, smithy_client_1.expectString)(data.message);
161
+ }
162
+ const exception = new models_0_1.InvalidArgumentException({
163
+ $metadata: deserializeMetadata(parsedOutput),
164
+ ...contents,
165
+ });
166
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
167
+ };
168
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
169
+ const contents = map({});
170
+ const data = parsedOutput.body;
171
+ if (data.message != null) {
172
+ contents.message = (0, smithy_client_1.expectString)(data.message);
173
+ }
174
+ const exception = new models_0_1.ResourceNotFoundException({
175
+ $metadata: deserializeMetadata(parsedOutput),
176
+ ...contents,
177
+ });
178
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
179
+ };
180
+ const deserializeMetadata = (output) => ({
181
+ httpStatusCode: output.statusCode,
182
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
183
+ extendedRequestId: output.headers["x-amz-id-2"],
184
+ cfId: output.headers["x-amz-cf-id"],
185
+ });
186
+ const collectBody = (streamBody = new Uint8Array(), context) => {
187
+ if (streamBody instanceof Uint8Array) {
188
+ return Promise.resolve(streamBody);
189
+ }
190
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
191
+ };
192
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
193
+ const isSerializableHeaderValue = (value) => value !== undefined &&
194
+ value !== null &&
195
+ value !== "" &&
196
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
197
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
198
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
199
+ if (encoded.length) {
200
+ return JSON.parse(encoded);
201
+ }
202
+ return {};
203
+ });
204
+ const parseErrorBody = async (errorBody, context) => {
205
+ const value = await parseBody(errorBody, context);
206
+ value.message = value.message ?? value.Message;
207
+ return value;
208
+ };
209
+ const loadRestJsonErrorCode = (output, data) => {
210
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
211
+ const sanitizeErrorCode = (rawValue) => {
212
+ let cleanValue = rawValue;
213
+ if (typeof cleanValue === "number") {
214
+ cleanValue = cleanValue.toString();
215
+ }
216
+ if (cleanValue.indexOf(",") >= 0) {
217
+ cleanValue = cleanValue.split(",")[0];
218
+ }
219
+ if (cleanValue.indexOf(":") >= 0) {
220
+ cleanValue = cleanValue.split(":")[0];
221
+ }
222
+ if (cleanValue.indexOf("#") >= 0) {
223
+ cleanValue = cleanValue.split("#")[1];
224
+ }
225
+ return cleanValue;
226
+ };
227
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
228
+ if (headerKey !== undefined) {
229
+ return sanitizeErrorCode(output.headers[headerKey]);
230
+ }
231
+ if (data.code !== undefined) {
232
+ return sanitizeErrorCode(data.code);
233
+ }
234
+ if (data["__type"] !== undefined) {
235
+ return sanitizeErrorCode(data["__type"]);
236
+ }
237
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const package_json_1 = tslib_1.__importDefault(require("../package.json"));
6
+ const sha256_browser_1 = require("@aws-crypto/sha256-browser");
7
+ const config_resolver_1 = require("@aws-sdk/config-resolver");
8
+ const fetch_http_handler_1 = require("@aws-sdk/fetch-http-handler");
9
+ const invalid_dependency_1 = require("@aws-sdk/invalid-dependency");
10
+ const util_body_length_browser_1 = require("@aws-sdk/util-body-length-browser");
11
+ const util_retry_1 = require("@aws-sdk/util-retry");
12
+ const util_user_agent_browser_1 = require("@aws-sdk/util-user-agent-browser");
13
+ const util_utf8_browser_1 = require("@aws-sdk/util-utf8-browser");
14
+ const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
15
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
16
+ const util_defaults_mode_browser_1 = require("@aws-sdk/util-defaults-mode-browser");
17
+ const getRuntimeConfig = (config) => {
18
+ const defaultsMode = (0, util_defaults_mode_browser_1.resolveDefaultsModeConfig)(config);
19
+ const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
20
+ const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
21
+ return {
22
+ ...clientSharedValues,
23
+ ...config,
24
+ runtime: "browser",
25
+ defaultsMode,
26
+ bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_browser_1.calculateBodyLength,
27
+ credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
28
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ??
29
+ (0, util_user_agent_browser_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
30
+ maxAttempts: config?.maxAttempts ?? util_retry_1.DEFAULT_MAX_ATTEMPTS,
31
+ region: config?.region ?? (0, invalid_dependency_1.invalidProvider)("Region is missing"),
32
+ requestHandler: config?.requestHandler ?? new fetch_http_handler_1.FetchHttpHandler(defaultConfigProvider),
33
+ retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE),
34
+ sha256: config?.sha256 ?? sha256_browser_1.Sha256,
35
+ streamCollector: config?.streamCollector ?? fetch_http_handler_1.streamCollector,
36
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_DUALSTACK_ENDPOINT)),
37
+ useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_FIPS_ENDPOINT)),
38
+ utf8Decoder: config?.utf8Decoder ?? util_utf8_browser_1.fromUtf8,
39
+ utf8Encoder: config?.utf8Encoder ?? util_utf8_browser_1.toUtf8,
40
+ };
41
+ };
42
+ exports.getRuntimeConfig = getRuntimeConfig;