@aws-sdk/client-outposts 3.28.0 → 3.32.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 (47) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/Outposts.ts +27 -0
  3. package/OutpostsClient.ts +3 -0
  4. package/README.md +7 -7
  5. package/commands/CreateOrderCommand.ts +94 -0
  6. package/dist/cjs/Outposts.js +15 -0
  7. package/dist/cjs/Outposts.js.map +1 -1
  8. package/dist/cjs/OutpostsClient.js.map +1 -1
  9. package/dist/cjs/commands/CreateOrderCommand.js +61 -0
  10. package/dist/cjs/commands/CreateOrderCommand.js.map +1 -0
  11. package/dist/cjs/index.js +1 -0
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/models/models_0.js +77 -13
  14. package/dist/cjs/models/models_0.js.map +1 -1
  15. package/dist/cjs/package.json +31 -31
  16. package/dist/cjs/protocols/Aws_restJson1.js +174 -7
  17. package/dist/cjs/protocols/Aws_restJson1.js.map +1 -1
  18. package/dist/es/Outposts.js +15 -0
  19. package/dist/es/Outposts.js.map +1 -1
  20. package/dist/es/OutpostsClient.js.map +1 -1
  21. package/dist/es/commands/CreateOrderCommand.js +65 -0
  22. package/dist/es/commands/CreateOrderCommand.js.map +1 -0
  23. package/dist/es/endpoints.js +1 -2
  24. package/dist/es/endpoints.js.map +1 -1
  25. package/dist/es/index.js +1 -0
  26. package/dist/es/index.js.map +1 -1
  27. package/dist/es/models/models_0.js +66 -12
  28. package/dist/es/models/models_0.js.map +1 -1
  29. package/dist/es/package.json +31 -31
  30. package/dist/es/protocols/Aws_restJson1.js +215 -25
  31. package/dist/es/protocols/Aws_restJson1.js.map +1 -1
  32. package/dist/types/Outposts.d.ts +7 -0
  33. package/dist/types/OutpostsClient.d.ts +3 -2
  34. package/dist/types/commands/CreateOrderCommand.d.ts +35 -0
  35. package/dist/types/index.d.ts +1 -0
  36. package/dist/types/models/models_0.d.ts +207 -54
  37. package/dist/types/protocols/Aws_restJson1.d.ts +3 -0
  38. package/dist/types/ts3.4/Outposts.d.ts +7 -0
  39. package/dist/types/ts3.4/OutpostsClient.d.ts +3 -2
  40. package/dist/types/ts3.4/commands/CreateOrderCommand.d.ts +35 -0
  41. package/dist/types/ts3.4/index.d.ts +1 -0
  42. package/dist/types/ts3.4/models/models_0.d.ts +207 -54
  43. package/dist/types/ts3.4/protocols/Aws_restJson1.d.ts +3 -0
  44. package/index.ts +1 -0
  45. package/models/models_0.ts +239 -50
  46. package/package.json +31 -31
  47. package/protocols/Aws_restJson1.ts +203 -6
@@ -1,3 +1,4 @@
1
+ import { CreateOrderCommandInput, CreateOrderCommandOutput } from "../commands/CreateOrderCommand";
1
2
  import { CreateOutpostCommandInput, CreateOutpostCommandOutput } from "../commands/CreateOutpostCommand";
2
3
  import { DeleteOutpostCommandInput, DeleteOutpostCommandOutput } from "../commands/DeleteOutpostCommand";
3
4
  import { DeleteSiteCommandInput, DeleteSiteCommandOutput } from "../commands/DeleteSiteCommand";
@@ -19,7 +20,10 @@ import {
19
20
  ConflictException,
20
21
  InstanceTypeItem,
21
22
  InternalServerException,
23
+ LineItem,
24
+ LineItemRequest,
22
25
  NotFoundException,
26
+ Order,
23
27
  Outpost,
24
28
  ServiceQuotaExceededException,
25
29
  Site,
@@ -27,8 +31,13 @@ import {
27
31
  } from "../models/models_0";
28
32
  import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
29
33
  import {
34
+ expectInt32 as __expectInt32,
35
+ expectNonNull as __expectNonNull,
36
+ expectNumber as __expectNumber,
37
+ expectObject as __expectObject,
30
38
  expectString as __expectString,
31
39
  extendedEncodeURIComponent as __extendedEncodeURIComponent,
40
+ parseEpochTimestamp as __parseEpochTimestamp,
32
41
  } from "@aws-sdk/smithy-client";
33
42
  import {
34
43
  Endpoint as __Endpoint,
@@ -38,6 +47,37 @@ import {
38
47
  SmithyException as __SmithyException,
39
48
  } from "@aws-sdk/types";
40
49
 
50
+ export const serializeAws_restJson1CreateOrderCommand = async (
51
+ input: CreateOrderCommandInput,
52
+ context: __SerdeContext
53
+ ): Promise<__HttpRequest> => {
54
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
55
+ const headers: any = {
56
+ "content-type": "application/json",
57
+ };
58
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/orders";
59
+ let body: any;
60
+ body = JSON.stringify({
61
+ ...(input.LineItems !== undefined &&
62
+ input.LineItems !== null && {
63
+ LineItems: serializeAws_restJson1LineItemRequestListDefinition(input.LineItems, context),
64
+ }),
65
+ ...(input.OutpostIdentifier !== undefined &&
66
+ input.OutpostIdentifier !== null && { OutpostIdentifier: input.OutpostIdentifier }),
67
+ ...(input.PaymentOption !== undefined && input.PaymentOption !== null && { PaymentOption: input.PaymentOption }),
68
+ ...(input.PaymentTerm !== undefined && input.PaymentTerm !== null && { PaymentTerm: input.PaymentTerm }),
69
+ });
70
+ return new __HttpRequest({
71
+ protocol,
72
+ hostname,
73
+ port,
74
+ method: "POST",
75
+ headers,
76
+ path: resolvedPath,
77
+ body,
78
+ });
79
+ };
80
+
41
81
  export const serializeAws_restJson1CreateOutpostCommand = async (
42
82
  input: CreateOutpostCommandInput,
43
83
  context: __SerdeContext
@@ -337,6 +377,101 @@ export const serializeAws_restJson1UntagResourceCommand = async (
337
377
  });
338
378
  };
339
379
 
380
+ export const deserializeAws_restJson1CreateOrderCommand = async (
381
+ output: __HttpResponse,
382
+ context: __SerdeContext
383
+ ): Promise<CreateOrderCommandOutput> => {
384
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
385
+ return deserializeAws_restJson1CreateOrderCommandError(output, context);
386
+ }
387
+ const contents: CreateOrderCommandOutput = {
388
+ $metadata: deserializeMetadata(output),
389
+ Order: undefined,
390
+ };
391
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
392
+ if (data.Order !== undefined && data.Order !== null) {
393
+ contents.Order = deserializeAws_restJson1Order(data.Order, context);
394
+ }
395
+ return Promise.resolve(contents);
396
+ };
397
+
398
+ const deserializeAws_restJson1CreateOrderCommandError = async (
399
+ output: __HttpResponse,
400
+ context: __SerdeContext
401
+ ): Promise<CreateOrderCommandOutput> => {
402
+ const parsedOutput: any = {
403
+ ...output,
404
+ body: await parseBody(output.body, context),
405
+ };
406
+ let response: __SmithyException & __MetadataBearer & { [key: string]: any };
407
+ let errorCode: string = "UnknownError";
408
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
409
+ switch (errorCode) {
410
+ case "AccessDeniedException":
411
+ case "com.amazonaws.outposts#AccessDeniedException":
412
+ response = {
413
+ ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
414
+ name: errorCode,
415
+ $metadata: deserializeMetadata(output),
416
+ };
417
+ break;
418
+ case "ConflictException":
419
+ case "com.amazonaws.outposts#ConflictException":
420
+ response = {
421
+ ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
422
+ name: errorCode,
423
+ $metadata: deserializeMetadata(output),
424
+ };
425
+ break;
426
+ case "InternalServerException":
427
+ case "com.amazonaws.outposts#InternalServerException":
428
+ response = {
429
+ ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
430
+ name: errorCode,
431
+ $metadata: deserializeMetadata(output),
432
+ };
433
+ break;
434
+ case "NotFoundException":
435
+ case "com.amazonaws.outposts#NotFoundException":
436
+ response = {
437
+ ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
438
+ name: errorCode,
439
+ $metadata: deserializeMetadata(output),
440
+ };
441
+ break;
442
+ case "ServiceQuotaExceededException":
443
+ case "com.amazonaws.outposts#ServiceQuotaExceededException":
444
+ response = {
445
+ ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
446
+ name: errorCode,
447
+ $metadata: deserializeMetadata(output),
448
+ };
449
+ break;
450
+ case "ValidationException":
451
+ case "com.amazonaws.outposts#ValidationException":
452
+ response = {
453
+ ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
454
+ name: errorCode,
455
+ $metadata: deserializeMetadata(output),
456
+ };
457
+ break;
458
+ default:
459
+ const parsedBody = parsedOutput.body;
460
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
461
+ response = {
462
+ ...parsedBody,
463
+ name: `${errorCode}`,
464
+ message: parsedBody.message || parsedBody.Message || errorCode,
465
+ $fault: "client",
466
+ $metadata: deserializeMetadata(output),
467
+ } as any;
468
+ }
469
+ const message = response.message || response.Message || errorCode;
470
+ response.message = message;
471
+ delete response.Message;
472
+ return Promise.reject(Object.assign(new Error(message), response));
473
+ };
474
+
340
475
  export const deserializeAws_restJson1CreateOutpostCommand = async (
341
476
  output: __HttpResponse,
342
477
  context: __SerdeContext
@@ -348,7 +483,7 @@ export const deserializeAws_restJson1CreateOutpostCommand = async (
348
483
  $metadata: deserializeMetadata(output),
349
484
  Outpost: undefined,
350
485
  };
351
- const data: any = await parseBody(output.body, context);
486
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
352
487
  if (data.Outpost !== undefined && data.Outpost !== null) {
353
488
  contents.Outpost = deserializeAws_restJson1Outpost(data.Outpost, context);
354
489
  }
@@ -609,7 +744,7 @@ export const deserializeAws_restJson1GetOutpostCommand = async (
609
744
  $metadata: deserializeMetadata(output),
610
745
  Outpost: undefined,
611
746
  };
612
- const data: any = await parseBody(output.body, context);
747
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
613
748
  if (data.Outpost !== undefined && data.Outpost !== null) {
614
749
  contents.Outpost = deserializeAws_restJson1Outpost(data.Outpost, context);
615
750
  }
@@ -691,7 +826,7 @@ export const deserializeAws_restJson1GetOutpostInstanceTypesCommand = async (
691
826
  OutpostArn: undefined,
692
827
  OutpostId: undefined,
693
828
  };
694
- const data: any = await parseBody(output.body, context);
829
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
695
830
  if (data.InstanceTypes !== undefined && data.InstanceTypes !== null) {
696
831
  contents.InstanceTypes = deserializeAws_restJson1InstanceTypeListDefinition(data.InstanceTypes, context);
697
832
  }
@@ -780,7 +915,7 @@ export const deserializeAws_restJson1ListOutpostsCommand = async (
780
915
  NextToken: undefined,
781
916
  Outposts: undefined,
782
917
  };
783
- const data: any = await parseBody(output.body, context);
918
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
784
919
  if (data.NextToken !== undefined && data.NextToken !== null) {
785
920
  contents.NextToken = __expectString(data.NextToken);
786
921
  }
@@ -855,7 +990,7 @@ export const deserializeAws_restJson1ListSitesCommand = async (
855
990
  NextToken: undefined,
856
991
  Sites: undefined,
857
992
  };
858
- const data: any = await parseBody(output.body, context);
993
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
859
994
  if (data.NextToken !== undefined && data.NextToken !== null) {
860
995
  contents.NextToken = __expectString(data.NextToken);
861
996
  }
@@ -929,7 +1064,7 @@ export const deserializeAws_restJson1ListTagsForResourceCommand = async (
929
1064
  $metadata: deserializeMetadata(output),
930
1065
  Tags: undefined,
931
1066
  };
932
- const data: any = await parseBody(output.body, context);
1067
+ const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
933
1068
  if (data.Tags !== undefined && data.Tags !== null) {
934
1069
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
935
1070
  }
@@ -1233,6 +1368,27 @@ const deserializeAws_restJson1ValidationExceptionResponse = async (
1233
1368
  return contents;
1234
1369
  };
1235
1370
 
1371
+ const serializeAws_restJson1LineItemRequest = (input: LineItemRequest, context: __SerdeContext): any => {
1372
+ return {
1373
+ ...(input.CatalogItemId !== undefined && input.CatalogItemId !== null && { CatalogItemId: input.CatalogItemId }),
1374
+ ...(input.Quantity !== undefined && input.Quantity !== null && { Quantity: input.Quantity }),
1375
+ };
1376
+ };
1377
+
1378
+ const serializeAws_restJson1LineItemRequestListDefinition = (
1379
+ input: LineItemRequest[],
1380
+ context: __SerdeContext
1381
+ ): any => {
1382
+ return input
1383
+ .filter((e: any) => e != null)
1384
+ .map((entry) => {
1385
+ if (entry === null) {
1386
+ return null as any;
1387
+ }
1388
+ return serializeAws_restJson1LineItemRequest(entry, context);
1389
+ });
1390
+ };
1391
+
1236
1392
  const serializeAws_restJson1TagMap = (input: { [key: string]: string }, context: __SerdeContext): any => {
1237
1393
  return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => {
1238
1394
  if (value === null) {
@@ -1265,6 +1421,47 @@ const deserializeAws_restJson1InstanceTypeListDefinition = (
1265
1421
  });
1266
1422
  };
1267
1423
 
1424
+ const deserializeAws_restJson1LineItem = (output: any, context: __SerdeContext): LineItem => {
1425
+ return {
1426
+ CatalogItemId: __expectString(output.CatalogItemId),
1427
+ LineItemId: __expectString(output.LineItemId),
1428
+ Quantity: __expectInt32(output.Quantity),
1429
+ Status: __expectString(output.Status),
1430
+ } as any;
1431
+ };
1432
+
1433
+ const deserializeAws_restJson1LineItemListDefinition = (output: any, context: __SerdeContext): LineItem[] => {
1434
+ return (output || [])
1435
+ .filter((e: any) => e != null)
1436
+ .map((entry: any) => {
1437
+ if (entry === null) {
1438
+ return null as any;
1439
+ }
1440
+ return deserializeAws_restJson1LineItem(entry, context);
1441
+ });
1442
+ };
1443
+
1444
+ const deserializeAws_restJson1Order = (output: any, context: __SerdeContext): Order => {
1445
+ return {
1446
+ LineItems:
1447
+ output.LineItems !== undefined && output.LineItems !== null
1448
+ ? deserializeAws_restJson1LineItemListDefinition(output.LineItems, context)
1449
+ : undefined,
1450
+ OrderFulfilledDate:
1451
+ output.OrderFulfilledDate !== undefined && output.OrderFulfilledDate !== null
1452
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.OrderFulfilledDate)))
1453
+ : undefined,
1454
+ OrderId: __expectString(output.OrderId),
1455
+ OrderSubmissionDate:
1456
+ output.OrderSubmissionDate !== undefined && output.OrderSubmissionDate !== null
1457
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.OrderSubmissionDate)))
1458
+ : undefined,
1459
+ OutpostId: __expectString(output.OutpostId),
1460
+ PaymentOption: __expectString(output.PaymentOption),
1461
+ Status: __expectString(output.Status),
1462
+ } as any;
1463
+ };
1464
+
1268
1465
  const deserializeAws_restJson1Outpost = (output: any, context: __SerdeContext): Outpost => {
1269
1466
  return {
1270
1467
  AvailabilityZone: __expectString(output.AvailabilityZone),