@aws-sdk/client-oam 3.218.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 (143) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +216 -0
  3. package/dist-cjs/OAM.js +232 -0
  4. package/dist-cjs/OAMClient.js +40 -0
  5. package/dist-cjs/commands/CreateLinkCommand.js +46 -0
  6. package/dist-cjs/commands/CreateSinkCommand.js +46 -0
  7. package/dist-cjs/commands/DeleteLinkCommand.js +46 -0
  8. package/dist-cjs/commands/DeleteSinkCommand.js +46 -0
  9. package/dist-cjs/commands/GetLinkCommand.js +46 -0
  10. package/dist-cjs/commands/GetSinkCommand.js +46 -0
  11. package/dist-cjs/commands/GetSinkPolicyCommand.js +46 -0
  12. package/dist-cjs/commands/ListAttachedLinksCommand.js +46 -0
  13. package/dist-cjs/commands/ListLinksCommand.js +46 -0
  14. package/dist-cjs/commands/ListSinksCommand.js +46 -0
  15. package/dist-cjs/commands/ListTagsForResourceCommand.js +46 -0
  16. package/dist-cjs/commands/PutSinkPolicyCommand.js +46 -0
  17. package/dist-cjs/commands/TagResourceCommand.js +46 -0
  18. package/dist-cjs/commands/UntagResourceCommand.js +46 -0
  19. package/dist-cjs/commands/UpdateLinkCommand.js +46 -0
  20. package/dist-cjs/commands/index.js +18 -0
  21. package/dist-cjs/endpoint/EndpointParameters.js +12 -0
  22. package/dist-cjs/endpoint/endpointResolver.js +12 -0
  23. package/dist-cjs/endpoint/ruleset.js +312 -0
  24. package/dist-cjs/index.js +11 -0
  25. package/dist-cjs/models/OAMServiceException.js +11 -0
  26. package/dist-cjs/models/index.js +4 -0
  27. package/dist-cjs/models/models_0.js +258 -0
  28. package/dist-cjs/pagination/Interfaces.js +2 -0
  29. package/dist-cjs/pagination/ListAttachedLinksPaginator.js +36 -0
  30. package/dist-cjs/pagination/ListLinksPaginator.js +36 -0
  31. package/dist-cjs/pagination/ListSinksPaginator.js +36 -0
  32. package/dist-cjs/pagination/index.js +7 -0
  33. package/dist-cjs/protocols/Aws_restJson1.js +1313 -0
  34. package/dist-cjs/runtimeConfig.browser.js +42 -0
  35. package/dist-cjs/runtimeConfig.js +50 -0
  36. package/dist-cjs/runtimeConfig.native.js +15 -0
  37. package/dist-cjs/runtimeConfig.shared.js +18 -0
  38. package/dist-es/OAM.js +228 -0
  39. package/dist-es/OAMClient.js +36 -0
  40. package/dist-es/commands/CreateLinkCommand.js +42 -0
  41. package/dist-es/commands/CreateSinkCommand.js +42 -0
  42. package/dist-es/commands/DeleteLinkCommand.js +42 -0
  43. package/dist-es/commands/DeleteSinkCommand.js +42 -0
  44. package/dist-es/commands/GetLinkCommand.js +42 -0
  45. package/dist-es/commands/GetSinkCommand.js +42 -0
  46. package/dist-es/commands/GetSinkPolicyCommand.js +42 -0
  47. package/dist-es/commands/ListAttachedLinksCommand.js +42 -0
  48. package/dist-es/commands/ListLinksCommand.js +42 -0
  49. package/dist-es/commands/ListSinksCommand.js +42 -0
  50. package/dist-es/commands/ListTagsForResourceCommand.js +42 -0
  51. package/dist-es/commands/PutSinkPolicyCommand.js +42 -0
  52. package/dist-es/commands/TagResourceCommand.js +42 -0
  53. package/dist-es/commands/UntagResourceCommand.js +42 -0
  54. package/dist-es/commands/UpdateLinkCommand.js +42 -0
  55. package/dist-es/commands/index.js +15 -0
  56. package/dist-es/endpoint/EndpointParameters.js +8 -0
  57. package/dist-es/endpoint/endpointResolver.js +8 -0
  58. package/dist-es/endpoint/ruleset.js +309 -0
  59. package/dist-es/index.js +6 -0
  60. package/dist-es/models/OAMServiceException.js +7 -0
  61. package/dist-es/models/index.js +1 -0
  62. package/dist-es/models/models_0.js +214 -0
  63. package/dist-es/pagination/Interfaces.js +1 -0
  64. package/dist-es/pagination/ListAttachedLinksPaginator.js +32 -0
  65. package/dist-es/pagination/ListLinksPaginator.js +32 -0
  66. package/dist-es/pagination/ListSinksPaginator.js +32 -0
  67. package/dist-es/pagination/index.js +4 -0
  68. package/dist-es/protocols/Aws_restJson1.js +1280 -0
  69. package/dist-es/runtimeConfig.browser.js +37 -0
  70. package/dist-es/runtimeConfig.js +45 -0
  71. package/dist-es/runtimeConfig.native.js +11 -0
  72. package/dist-es/runtimeConfig.shared.js +14 -0
  73. package/dist-types/OAM.d.ts +194 -0
  74. package/dist-types/OAMClient.d.ts +167 -0
  75. package/dist-types/commands/CreateLinkCommand.d.ts +46 -0
  76. package/dist-types/commands/CreateSinkCommand.d.ts +43 -0
  77. package/dist-types/commands/DeleteLinkCommand.d.ts +38 -0
  78. package/dist-types/commands/DeleteSinkCommand.d.ts +37 -0
  79. package/dist-types/commands/GetLinkCommand.d.ts +38 -0
  80. package/dist-types/commands/GetSinkCommand.d.ts +38 -0
  81. package/dist-types/commands/GetSinkPolicyCommand.d.ts +38 -0
  82. package/dist-types/commands/ListAttachedLinksCommand.d.ts +39 -0
  83. package/dist-types/commands/ListLinksCommand.d.ts +39 -0
  84. package/dist-types/commands/ListSinksCommand.d.ts +37 -0
  85. package/dist-types/commands/ListTagsForResourceCommand.d.ts +37 -0
  86. package/dist-types/commands/PutSinkPolicyCommand.d.ts +60 -0
  87. package/dist-types/commands/TagResourceCommand.d.ts +53 -0
  88. package/dist-types/commands/UntagResourceCommand.d.ts +43 -0
  89. package/dist-types/commands/UpdateLinkCommand.d.ts +40 -0
  90. package/dist-types/commands/index.d.ts +15 -0
  91. package/dist-types/endpoint/EndpointParameters.d.ts +19 -0
  92. package/dist-types/endpoint/endpointResolver.d.ts +5 -0
  93. package/dist-types/endpoint/ruleset.d.ts +2 -0
  94. package/dist-types/index.d.ts +6 -0
  95. package/dist-types/models/OAMServiceException.d.ts +10 -0
  96. package/dist-types/models/index.d.ts +1 -0
  97. package/dist-types/models/models_0.d.ts +724 -0
  98. package/dist-types/pagination/Interfaces.d.ts +6 -0
  99. package/dist-types/pagination/ListAttachedLinksPaginator.d.ts +4 -0
  100. package/dist-types/pagination/ListLinksPaginator.d.ts +4 -0
  101. package/dist-types/pagination/ListSinksPaginator.d.ts +4 -0
  102. package/dist-types/pagination/index.d.ts +4 -0
  103. package/dist-types/protocols/Aws_restJson1.d.ts +47 -0
  104. package/dist-types/runtimeConfig.browser.d.ts +42 -0
  105. package/dist-types/runtimeConfig.d.ts +42 -0
  106. package/dist-types/runtimeConfig.native.d.ts +41 -0
  107. package/dist-types/runtimeConfig.shared.d.ts +16 -0
  108. package/dist-types/ts3.4/OAM.d.ts +259 -0
  109. package/dist-types/ts3.4/OAMClient.d.ts +200 -0
  110. package/dist-types/ts3.4/commands/CreateLinkCommand.d.ts +34 -0
  111. package/dist-types/ts3.4/commands/CreateSinkCommand.d.ts +34 -0
  112. package/dist-types/ts3.4/commands/DeleteLinkCommand.d.ts +34 -0
  113. package/dist-types/ts3.4/commands/DeleteSinkCommand.d.ts +34 -0
  114. package/dist-types/ts3.4/commands/GetLinkCommand.d.ts +32 -0
  115. package/dist-types/ts3.4/commands/GetSinkCommand.d.ts +32 -0
  116. package/dist-types/ts3.4/commands/GetSinkPolicyCommand.d.ts +34 -0
  117. package/dist-types/ts3.4/commands/ListAttachedLinksCommand.d.ts +37 -0
  118. package/dist-types/ts3.4/commands/ListLinksCommand.d.ts +34 -0
  119. package/dist-types/ts3.4/commands/ListSinksCommand.d.ts +34 -0
  120. package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +38 -0
  121. package/dist-types/ts3.4/commands/PutSinkPolicyCommand.d.ts +34 -0
  122. package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +34 -0
  123. package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +34 -0
  124. package/dist-types/ts3.4/commands/UpdateLinkCommand.d.ts +34 -0
  125. package/dist-types/ts3.4/commands/index.d.ts +15 -0
  126. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +34 -0
  127. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  128. package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
  129. package/dist-types/ts3.4/index.d.ts +6 -0
  130. package/dist-types/ts3.4/models/OAMServiceException.d.ts +7 -0
  131. package/dist-types/ts3.4/models/index.d.ts +1 -0
  132. package/dist-types/ts3.4/models/models_0.d.ts +313 -0
  133. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  134. package/dist-types/ts3.4/pagination/ListAttachedLinksPaginator.d.ts +11 -0
  135. package/dist-types/ts3.4/pagination/ListLinksPaginator.d.ts +11 -0
  136. package/dist-types/ts3.4/pagination/ListSinksPaginator.d.ts +11 -0
  137. package/dist-types/ts3.4/pagination/index.d.ts +4 -0
  138. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +185 -0
  139. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +88 -0
  140. package/dist-types/ts3.4/runtimeConfig.d.ts +88 -0
  141. package/dist-types/ts3.4/runtimeConfig.native.d.ts +77 -0
  142. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +16 -0
  143. package/package.json +101 -0
@@ -0,0 +1,1313 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeAws_restJson1UpdateLinkCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1PutSinkPolicyCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListSinksCommand = exports.deserializeAws_restJson1ListLinksCommand = exports.deserializeAws_restJson1ListAttachedLinksCommand = exports.deserializeAws_restJson1GetSinkPolicyCommand = exports.deserializeAws_restJson1GetSinkCommand = exports.deserializeAws_restJson1GetLinkCommand = exports.deserializeAws_restJson1DeleteSinkCommand = exports.deserializeAws_restJson1DeleteLinkCommand = exports.deserializeAws_restJson1CreateSinkCommand = exports.deserializeAws_restJson1CreateLinkCommand = exports.serializeAws_restJson1UpdateLinkCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1PutSinkPolicyCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1ListSinksCommand = exports.serializeAws_restJson1ListLinksCommand = exports.serializeAws_restJson1ListAttachedLinksCommand = exports.serializeAws_restJson1GetSinkPolicyCommand = exports.serializeAws_restJson1GetSinkCommand = exports.serializeAws_restJson1GetLinkCommand = exports.serializeAws_restJson1DeleteSinkCommand = exports.serializeAws_restJson1DeleteLinkCommand = exports.serializeAws_restJson1CreateSinkCommand = exports.serializeAws_restJson1CreateLinkCommand = void 0;
4
+ const protocol_http_1 = require("@aws-sdk/protocol-http");
5
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const models_0_1 = require("../models/models_0");
7
+ const OAMServiceException_1 = require("../models/OAMServiceException");
8
+ const serializeAws_restJson1CreateLinkCommand = 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 || ""}` + "/CreateLink";
14
+ let body;
15
+ body = JSON.stringify({
16
+ ...(input.LabelTemplate != null && { LabelTemplate: input.LabelTemplate }),
17
+ ...(input.ResourceTypes != null && {
18
+ ResourceTypes: serializeAws_restJson1ResourceTypesInput(input.ResourceTypes, context),
19
+ }),
20
+ ...(input.SinkIdentifier != null && { SinkIdentifier: input.SinkIdentifier }),
21
+ ...(input.Tags != null && { Tags: serializeAws_restJson1TagMapInput(input.Tags, context) }),
22
+ });
23
+ return new protocol_http_1.HttpRequest({
24
+ protocol,
25
+ hostname,
26
+ port,
27
+ method: "POST",
28
+ headers,
29
+ path: resolvedPath,
30
+ body,
31
+ });
32
+ };
33
+ exports.serializeAws_restJson1CreateLinkCommand = serializeAws_restJson1CreateLinkCommand;
34
+ const serializeAws_restJson1CreateSinkCommand = async (input, context) => {
35
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
36
+ const headers = {
37
+ "content-type": "application/json",
38
+ };
39
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateSink";
40
+ let body;
41
+ body = JSON.stringify({
42
+ ...(input.Name != null && { Name: input.Name }),
43
+ ...(input.Tags != null && { Tags: serializeAws_restJson1TagMapInput(input.Tags, context) }),
44
+ });
45
+ return new protocol_http_1.HttpRequest({
46
+ protocol,
47
+ hostname,
48
+ port,
49
+ method: "POST",
50
+ headers,
51
+ path: resolvedPath,
52
+ body,
53
+ });
54
+ };
55
+ exports.serializeAws_restJson1CreateSinkCommand = serializeAws_restJson1CreateSinkCommand;
56
+ const serializeAws_restJson1DeleteLinkCommand = async (input, context) => {
57
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
58
+ const headers = {
59
+ "content-type": "application/json",
60
+ };
61
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteLink";
62
+ let body;
63
+ body = JSON.stringify({
64
+ ...(input.Identifier != null && { Identifier: input.Identifier }),
65
+ });
66
+ return new protocol_http_1.HttpRequest({
67
+ protocol,
68
+ hostname,
69
+ port,
70
+ method: "POST",
71
+ headers,
72
+ path: resolvedPath,
73
+ body,
74
+ });
75
+ };
76
+ exports.serializeAws_restJson1DeleteLinkCommand = serializeAws_restJson1DeleteLinkCommand;
77
+ const serializeAws_restJson1DeleteSinkCommand = async (input, context) => {
78
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
79
+ const headers = {
80
+ "content-type": "application/json",
81
+ };
82
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteSink";
83
+ let body;
84
+ body = JSON.stringify({
85
+ ...(input.Identifier != null && { Identifier: input.Identifier }),
86
+ });
87
+ return new protocol_http_1.HttpRequest({
88
+ protocol,
89
+ hostname,
90
+ port,
91
+ method: "POST",
92
+ headers,
93
+ path: resolvedPath,
94
+ body,
95
+ });
96
+ };
97
+ exports.serializeAws_restJson1DeleteSinkCommand = serializeAws_restJson1DeleteSinkCommand;
98
+ const serializeAws_restJson1GetLinkCommand = async (input, context) => {
99
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
100
+ const headers = {
101
+ "content-type": "application/json",
102
+ };
103
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetLink";
104
+ let body;
105
+ body = JSON.stringify({
106
+ ...(input.Identifier != null && { Identifier: input.Identifier }),
107
+ });
108
+ return new protocol_http_1.HttpRequest({
109
+ protocol,
110
+ hostname,
111
+ port,
112
+ method: "POST",
113
+ headers,
114
+ path: resolvedPath,
115
+ body,
116
+ });
117
+ };
118
+ exports.serializeAws_restJson1GetLinkCommand = serializeAws_restJson1GetLinkCommand;
119
+ const serializeAws_restJson1GetSinkCommand = async (input, context) => {
120
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
121
+ const headers = {
122
+ "content-type": "application/json",
123
+ };
124
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetSink";
125
+ let body;
126
+ body = JSON.stringify({
127
+ ...(input.Identifier != null && { Identifier: input.Identifier }),
128
+ });
129
+ return new protocol_http_1.HttpRequest({
130
+ protocol,
131
+ hostname,
132
+ port,
133
+ method: "POST",
134
+ headers,
135
+ path: resolvedPath,
136
+ body,
137
+ });
138
+ };
139
+ exports.serializeAws_restJson1GetSinkCommand = serializeAws_restJson1GetSinkCommand;
140
+ const serializeAws_restJson1GetSinkPolicyCommand = async (input, context) => {
141
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
142
+ const headers = {
143
+ "content-type": "application/json",
144
+ };
145
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetSinkPolicy";
146
+ let body;
147
+ body = JSON.stringify({
148
+ ...(input.SinkIdentifier != null && { SinkIdentifier: input.SinkIdentifier }),
149
+ });
150
+ return new protocol_http_1.HttpRequest({
151
+ protocol,
152
+ hostname,
153
+ port,
154
+ method: "POST",
155
+ headers,
156
+ path: resolvedPath,
157
+ body,
158
+ });
159
+ };
160
+ exports.serializeAws_restJson1GetSinkPolicyCommand = serializeAws_restJson1GetSinkPolicyCommand;
161
+ const serializeAws_restJson1ListAttachedLinksCommand = async (input, context) => {
162
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
163
+ const headers = {
164
+ "content-type": "application/json",
165
+ };
166
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListAttachedLinks";
167
+ let body;
168
+ body = JSON.stringify({
169
+ ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
170
+ ...(input.NextToken != null && { NextToken: input.NextToken }),
171
+ ...(input.SinkIdentifier != null && { SinkIdentifier: input.SinkIdentifier }),
172
+ });
173
+ return new protocol_http_1.HttpRequest({
174
+ protocol,
175
+ hostname,
176
+ port,
177
+ method: "POST",
178
+ headers,
179
+ path: resolvedPath,
180
+ body,
181
+ });
182
+ };
183
+ exports.serializeAws_restJson1ListAttachedLinksCommand = serializeAws_restJson1ListAttachedLinksCommand;
184
+ const serializeAws_restJson1ListLinksCommand = 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 || ""}` + "/ListLinks";
190
+ let body;
191
+ body = JSON.stringify({
192
+ ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
193
+ ...(input.NextToken != null && { NextToken: input.NextToken }),
194
+ });
195
+ return new protocol_http_1.HttpRequest({
196
+ protocol,
197
+ hostname,
198
+ port,
199
+ method: "POST",
200
+ headers,
201
+ path: resolvedPath,
202
+ body,
203
+ });
204
+ };
205
+ exports.serializeAws_restJson1ListLinksCommand = serializeAws_restJson1ListLinksCommand;
206
+ const serializeAws_restJson1ListSinksCommand = 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 || ""}` + "/ListSinks";
212
+ let body;
213
+ body = JSON.stringify({
214
+ ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
215
+ ...(input.NextToken != null && { NextToken: input.NextToken }),
216
+ });
217
+ return new protocol_http_1.HttpRequest({
218
+ protocol,
219
+ hostname,
220
+ port,
221
+ method: "POST",
222
+ headers,
223
+ path: resolvedPath,
224
+ body,
225
+ });
226
+ };
227
+ exports.serializeAws_restJson1ListSinksCommand = serializeAws_restJson1ListSinksCommand;
228
+ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context) => {
229
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
230
+ const headers = {};
231
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
232
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
233
+ let body;
234
+ return new protocol_http_1.HttpRequest({
235
+ protocol,
236
+ hostname,
237
+ port,
238
+ method: "GET",
239
+ headers,
240
+ path: resolvedPath,
241
+ body,
242
+ });
243
+ };
244
+ exports.serializeAws_restJson1ListTagsForResourceCommand = serializeAws_restJson1ListTagsForResourceCommand;
245
+ const serializeAws_restJson1PutSinkPolicyCommand = async (input, context) => {
246
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
247
+ const headers = {
248
+ "content-type": "application/json",
249
+ };
250
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PutSinkPolicy";
251
+ let body;
252
+ body = JSON.stringify({
253
+ ...(input.Policy != null && { Policy: input.Policy }),
254
+ ...(input.SinkIdentifier != null && { SinkIdentifier: input.SinkIdentifier }),
255
+ });
256
+ return new protocol_http_1.HttpRequest({
257
+ protocol,
258
+ hostname,
259
+ port,
260
+ method: "POST",
261
+ headers,
262
+ path: resolvedPath,
263
+ body,
264
+ });
265
+ };
266
+ exports.serializeAws_restJson1PutSinkPolicyCommand = serializeAws_restJson1PutSinkPolicyCommand;
267
+ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
268
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
269
+ const headers = {
270
+ "content-type": "application/json",
271
+ };
272
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
273
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
274
+ let body;
275
+ body = JSON.stringify({
276
+ ...(input.Tags != null && { Tags: serializeAws_restJson1TagMapInput(input.Tags, context) }),
277
+ });
278
+ return new protocol_http_1.HttpRequest({
279
+ protocol,
280
+ hostname,
281
+ port,
282
+ method: "PUT",
283
+ headers,
284
+ path: resolvedPath,
285
+ body,
286
+ });
287
+ };
288
+ exports.serializeAws_restJson1TagResourceCommand = serializeAws_restJson1TagResourceCommand;
289
+ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
290
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
291
+ const headers = {};
292
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
293
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
294
+ const query = map({
295
+ tagKeys: [
296
+ (0, smithy_client_1.expectNonNull)(input.TagKeys, `TagKeys`) != null,
297
+ () => (input.TagKeys || []).map((_entry) => _entry),
298
+ ],
299
+ });
300
+ let body;
301
+ return new protocol_http_1.HttpRequest({
302
+ protocol,
303
+ hostname,
304
+ port,
305
+ method: "DELETE",
306
+ headers,
307
+ path: resolvedPath,
308
+ query,
309
+ body,
310
+ });
311
+ };
312
+ exports.serializeAws_restJson1UntagResourceCommand = serializeAws_restJson1UntagResourceCommand;
313
+ const serializeAws_restJson1UpdateLinkCommand = async (input, context) => {
314
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
315
+ const headers = {
316
+ "content-type": "application/json",
317
+ };
318
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateLink";
319
+ let body;
320
+ body = JSON.stringify({
321
+ ...(input.Identifier != null && { Identifier: input.Identifier }),
322
+ ...(input.ResourceTypes != null && {
323
+ ResourceTypes: serializeAws_restJson1ResourceTypesInput(input.ResourceTypes, context),
324
+ }),
325
+ });
326
+ return new protocol_http_1.HttpRequest({
327
+ protocol,
328
+ hostname,
329
+ port,
330
+ method: "POST",
331
+ headers,
332
+ path: resolvedPath,
333
+ body,
334
+ });
335
+ };
336
+ exports.serializeAws_restJson1UpdateLinkCommand = serializeAws_restJson1UpdateLinkCommand;
337
+ const deserializeAws_restJson1CreateLinkCommand = async (output, context) => {
338
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
339
+ return deserializeAws_restJson1CreateLinkCommandError(output, context);
340
+ }
341
+ const contents = map({
342
+ $metadata: deserializeMetadata(output),
343
+ });
344
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
345
+ if (data.Arn != null) {
346
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
347
+ }
348
+ if (data.Id != null) {
349
+ contents.Id = (0, smithy_client_1.expectString)(data.Id);
350
+ }
351
+ if (data.Label != null) {
352
+ contents.Label = (0, smithy_client_1.expectString)(data.Label);
353
+ }
354
+ if (data.LabelTemplate != null) {
355
+ contents.LabelTemplate = (0, smithy_client_1.expectString)(data.LabelTemplate);
356
+ }
357
+ if (data.ResourceTypes != null) {
358
+ contents.ResourceTypes = deserializeAws_restJson1ResourceTypesOutput(data.ResourceTypes, context);
359
+ }
360
+ if (data.SinkArn != null) {
361
+ contents.SinkArn = (0, smithy_client_1.expectString)(data.SinkArn);
362
+ }
363
+ if (data.Tags != null) {
364
+ contents.Tags = deserializeAws_restJson1TagMapOutput(data.Tags, context);
365
+ }
366
+ return contents;
367
+ };
368
+ exports.deserializeAws_restJson1CreateLinkCommand = deserializeAws_restJson1CreateLinkCommand;
369
+ const deserializeAws_restJson1CreateLinkCommandError = async (output, context) => {
370
+ const parsedOutput = {
371
+ ...output,
372
+ body: await parseErrorBody(output.body, context),
373
+ };
374
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
375
+ switch (errorCode) {
376
+ case "ConflictException":
377
+ case "com.amazonaws.oam#ConflictException":
378
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
379
+ case "InternalServiceFault":
380
+ case "com.amazonaws.oam#InternalServiceFault":
381
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
382
+ case "InvalidParameterException":
383
+ case "com.amazonaws.oam#InvalidParameterException":
384
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
385
+ case "MissingRequiredParameterException":
386
+ case "com.amazonaws.oam#MissingRequiredParameterException":
387
+ throw await deserializeAws_restJson1MissingRequiredParameterExceptionResponse(parsedOutput, context);
388
+ case "ServiceQuotaExceededException":
389
+ case "com.amazonaws.oam#ServiceQuotaExceededException":
390
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
391
+ default:
392
+ const parsedBody = parsedOutput.body;
393
+ (0, smithy_client_1.throwDefaultError)({
394
+ output,
395
+ parsedBody,
396
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
397
+ errorCode,
398
+ });
399
+ }
400
+ };
401
+ const deserializeAws_restJson1CreateSinkCommand = async (output, context) => {
402
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
403
+ return deserializeAws_restJson1CreateSinkCommandError(output, context);
404
+ }
405
+ const contents = map({
406
+ $metadata: deserializeMetadata(output),
407
+ });
408
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
409
+ if (data.Arn != null) {
410
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
411
+ }
412
+ if (data.Id != null) {
413
+ contents.Id = (0, smithy_client_1.expectString)(data.Id);
414
+ }
415
+ if (data.Name != null) {
416
+ contents.Name = (0, smithy_client_1.expectString)(data.Name);
417
+ }
418
+ if (data.Tags != null) {
419
+ contents.Tags = deserializeAws_restJson1TagMapOutput(data.Tags, context);
420
+ }
421
+ return contents;
422
+ };
423
+ exports.deserializeAws_restJson1CreateSinkCommand = deserializeAws_restJson1CreateSinkCommand;
424
+ const deserializeAws_restJson1CreateSinkCommandError = async (output, context) => {
425
+ const parsedOutput = {
426
+ ...output,
427
+ body: await parseErrorBody(output.body, context),
428
+ };
429
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
430
+ switch (errorCode) {
431
+ case "ConflictException":
432
+ case "com.amazonaws.oam#ConflictException":
433
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
434
+ case "InternalServiceFault":
435
+ case "com.amazonaws.oam#InternalServiceFault":
436
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
437
+ case "InvalidParameterException":
438
+ case "com.amazonaws.oam#InvalidParameterException":
439
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
440
+ case "MissingRequiredParameterException":
441
+ case "com.amazonaws.oam#MissingRequiredParameterException":
442
+ throw await deserializeAws_restJson1MissingRequiredParameterExceptionResponse(parsedOutput, context);
443
+ case "ServiceQuotaExceededException":
444
+ case "com.amazonaws.oam#ServiceQuotaExceededException":
445
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
446
+ default:
447
+ const parsedBody = parsedOutput.body;
448
+ (0, smithy_client_1.throwDefaultError)({
449
+ output,
450
+ parsedBody,
451
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
452
+ errorCode,
453
+ });
454
+ }
455
+ };
456
+ const deserializeAws_restJson1DeleteLinkCommand = async (output, context) => {
457
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
458
+ return deserializeAws_restJson1DeleteLinkCommandError(output, context);
459
+ }
460
+ const contents = map({
461
+ $metadata: deserializeMetadata(output),
462
+ });
463
+ await collectBody(output.body, context);
464
+ return contents;
465
+ };
466
+ exports.deserializeAws_restJson1DeleteLinkCommand = deserializeAws_restJson1DeleteLinkCommand;
467
+ const deserializeAws_restJson1DeleteLinkCommandError = async (output, context) => {
468
+ const parsedOutput = {
469
+ ...output,
470
+ body: await parseErrorBody(output.body, context),
471
+ };
472
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
473
+ switch (errorCode) {
474
+ case "InternalServiceFault":
475
+ case "com.amazonaws.oam#InternalServiceFault":
476
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
477
+ case "InvalidParameterException":
478
+ case "com.amazonaws.oam#InvalidParameterException":
479
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
480
+ case "MissingRequiredParameterException":
481
+ case "com.amazonaws.oam#MissingRequiredParameterException":
482
+ throw await deserializeAws_restJson1MissingRequiredParameterExceptionResponse(parsedOutput, context);
483
+ case "ResourceNotFoundException":
484
+ case "com.amazonaws.oam#ResourceNotFoundException":
485
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
486
+ default:
487
+ const parsedBody = parsedOutput.body;
488
+ (0, smithy_client_1.throwDefaultError)({
489
+ output,
490
+ parsedBody,
491
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
492
+ errorCode,
493
+ });
494
+ }
495
+ };
496
+ const deserializeAws_restJson1DeleteSinkCommand = async (output, context) => {
497
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
498
+ return deserializeAws_restJson1DeleteSinkCommandError(output, context);
499
+ }
500
+ const contents = map({
501
+ $metadata: deserializeMetadata(output),
502
+ });
503
+ await collectBody(output.body, context);
504
+ return contents;
505
+ };
506
+ exports.deserializeAws_restJson1DeleteSinkCommand = deserializeAws_restJson1DeleteSinkCommand;
507
+ const deserializeAws_restJson1DeleteSinkCommandError = async (output, context) => {
508
+ const parsedOutput = {
509
+ ...output,
510
+ body: await parseErrorBody(output.body, context),
511
+ };
512
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
513
+ switch (errorCode) {
514
+ case "ConflictException":
515
+ case "com.amazonaws.oam#ConflictException":
516
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
517
+ case "InternalServiceFault":
518
+ case "com.amazonaws.oam#InternalServiceFault":
519
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
520
+ case "InvalidParameterException":
521
+ case "com.amazonaws.oam#InvalidParameterException":
522
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
523
+ case "MissingRequiredParameterException":
524
+ case "com.amazonaws.oam#MissingRequiredParameterException":
525
+ throw await deserializeAws_restJson1MissingRequiredParameterExceptionResponse(parsedOutput, context);
526
+ case "ResourceNotFoundException":
527
+ case "com.amazonaws.oam#ResourceNotFoundException":
528
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
529
+ default:
530
+ const parsedBody = parsedOutput.body;
531
+ (0, smithy_client_1.throwDefaultError)({
532
+ output,
533
+ parsedBody,
534
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
535
+ errorCode,
536
+ });
537
+ }
538
+ };
539
+ const deserializeAws_restJson1GetLinkCommand = async (output, context) => {
540
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
541
+ return deserializeAws_restJson1GetLinkCommandError(output, context);
542
+ }
543
+ const contents = map({
544
+ $metadata: deserializeMetadata(output),
545
+ });
546
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
547
+ if (data.Arn != null) {
548
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
549
+ }
550
+ if (data.Id != null) {
551
+ contents.Id = (0, smithy_client_1.expectString)(data.Id);
552
+ }
553
+ if (data.Label != null) {
554
+ contents.Label = (0, smithy_client_1.expectString)(data.Label);
555
+ }
556
+ if (data.LabelTemplate != null) {
557
+ contents.LabelTemplate = (0, smithy_client_1.expectString)(data.LabelTemplate);
558
+ }
559
+ if (data.ResourceTypes != null) {
560
+ contents.ResourceTypes = deserializeAws_restJson1ResourceTypesOutput(data.ResourceTypes, context);
561
+ }
562
+ if (data.SinkArn != null) {
563
+ contents.SinkArn = (0, smithy_client_1.expectString)(data.SinkArn);
564
+ }
565
+ if (data.Tags != null) {
566
+ contents.Tags = deserializeAws_restJson1TagMapOutput(data.Tags, context);
567
+ }
568
+ return contents;
569
+ };
570
+ exports.deserializeAws_restJson1GetLinkCommand = deserializeAws_restJson1GetLinkCommand;
571
+ const deserializeAws_restJson1GetLinkCommandError = async (output, context) => {
572
+ const parsedOutput = {
573
+ ...output,
574
+ body: await parseErrorBody(output.body, context),
575
+ };
576
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
577
+ switch (errorCode) {
578
+ case "InternalServiceFault":
579
+ case "com.amazonaws.oam#InternalServiceFault":
580
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
581
+ case "InvalidParameterException":
582
+ case "com.amazonaws.oam#InvalidParameterException":
583
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
584
+ case "MissingRequiredParameterException":
585
+ case "com.amazonaws.oam#MissingRequiredParameterException":
586
+ throw await deserializeAws_restJson1MissingRequiredParameterExceptionResponse(parsedOutput, context);
587
+ case "ResourceNotFoundException":
588
+ case "com.amazonaws.oam#ResourceNotFoundException":
589
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
590
+ default:
591
+ const parsedBody = parsedOutput.body;
592
+ (0, smithy_client_1.throwDefaultError)({
593
+ output,
594
+ parsedBody,
595
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
596
+ errorCode,
597
+ });
598
+ }
599
+ };
600
+ const deserializeAws_restJson1GetSinkCommand = async (output, context) => {
601
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
602
+ return deserializeAws_restJson1GetSinkCommandError(output, context);
603
+ }
604
+ const contents = map({
605
+ $metadata: deserializeMetadata(output),
606
+ });
607
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
608
+ if (data.Arn != null) {
609
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
610
+ }
611
+ if (data.Id != null) {
612
+ contents.Id = (0, smithy_client_1.expectString)(data.Id);
613
+ }
614
+ if (data.Name != null) {
615
+ contents.Name = (0, smithy_client_1.expectString)(data.Name);
616
+ }
617
+ if (data.Tags != null) {
618
+ contents.Tags = deserializeAws_restJson1TagMapOutput(data.Tags, context);
619
+ }
620
+ return contents;
621
+ };
622
+ exports.deserializeAws_restJson1GetSinkCommand = deserializeAws_restJson1GetSinkCommand;
623
+ const deserializeAws_restJson1GetSinkCommandError = async (output, context) => {
624
+ const parsedOutput = {
625
+ ...output,
626
+ body: await parseErrorBody(output.body, context),
627
+ };
628
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
629
+ switch (errorCode) {
630
+ case "InternalServiceFault":
631
+ case "com.amazonaws.oam#InternalServiceFault":
632
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
633
+ case "InvalidParameterException":
634
+ case "com.amazonaws.oam#InvalidParameterException":
635
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
636
+ case "MissingRequiredParameterException":
637
+ case "com.amazonaws.oam#MissingRequiredParameterException":
638
+ throw await deserializeAws_restJson1MissingRequiredParameterExceptionResponse(parsedOutput, context);
639
+ case "ResourceNotFoundException":
640
+ case "com.amazonaws.oam#ResourceNotFoundException":
641
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
642
+ default:
643
+ const parsedBody = parsedOutput.body;
644
+ (0, smithy_client_1.throwDefaultError)({
645
+ output,
646
+ parsedBody,
647
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
648
+ errorCode,
649
+ });
650
+ }
651
+ };
652
+ const deserializeAws_restJson1GetSinkPolicyCommand = async (output, context) => {
653
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
654
+ return deserializeAws_restJson1GetSinkPolicyCommandError(output, context);
655
+ }
656
+ const contents = map({
657
+ $metadata: deserializeMetadata(output),
658
+ });
659
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
660
+ if (data.Policy != null) {
661
+ contents.Policy = (0, smithy_client_1.expectString)(data.Policy);
662
+ }
663
+ if (data.SinkArn != null) {
664
+ contents.SinkArn = (0, smithy_client_1.expectString)(data.SinkArn);
665
+ }
666
+ if (data.SinkId != null) {
667
+ contents.SinkId = (0, smithy_client_1.expectString)(data.SinkId);
668
+ }
669
+ return contents;
670
+ };
671
+ exports.deserializeAws_restJson1GetSinkPolicyCommand = deserializeAws_restJson1GetSinkPolicyCommand;
672
+ const deserializeAws_restJson1GetSinkPolicyCommandError = async (output, context) => {
673
+ const parsedOutput = {
674
+ ...output,
675
+ body: await parseErrorBody(output.body, context),
676
+ };
677
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
678
+ switch (errorCode) {
679
+ case "InternalServiceFault":
680
+ case "com.amazonaws.oam#InternalServiceFault":
681
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
682
+ case "InvalidParameterException":
683
+ case "com.amazonaws.oam#InvalidParameterException":
684
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
685
+ case "MissingRequiredParameterException":
686
+ case "com.amazonaws.oam#MissingRequiredParameterException":
687
+ throw await deserializeAws_restJson1MissingRequiredParameterExceptionResponse(parsedOutput, context);
688
+ case "ResourceNotFoundException":
689
+ case "com.amazonaws.oam#ResourceNotFoundException":
690
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
691
+ default:
692
+ const parsedBody = parsedOutput.body;
693
+ (0, smithy_client_1.throwDefaultError)({
694
+ output,
695
+ parsedBody,
696
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
697
+ errorCode,
698
+ });
699
+ }
700
+ };
701
+ const deserializeAws_restJson1ListAttachedLinksCommand = async (output, context) => {
702
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
703
+ return deserializeAws_restJson1ListAttachedLinksCommandError(output, context);
704
+ }
705
+ const contents = map({
706
+ $metadata: deserializeMetadata(output),
707
+ });
708
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
709
+ if (data.Items != null) {
710
+ contents.Items = deserializeAws_restJson1ListAttachedLinksItems(data.Items, context);
711
+ }
712
+ if (data.NextToken != null) {
713
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
714
+ }
715
+ return contents;
716
+ };
717
+ exports.deserializeAws_restJson1ListAttachedLinksCommand = deserializeAws_restJson1ListAttachedLinksCommand;
718
+ const deserializeAws_restJson1ListAttachedLinksCommandError = async (output, context) => {
719
+ const parsedOutput = {
720
+ ...output,
721
+ body: await parseErrorBody(output.body, context),
722
+ };
723
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
724
+ switch (errorCode) {
725
+ case "InternalServiceFault":
726
+ case "com.amazonaws.oam#InternalServiceFault":
727
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
728
+ case "InvalidParameterException":
729
+ case "com.amazonaws.oam#InvalidParameterException":
730
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
731
+ case "MissingRequiredParameterException":
732
+ case "com.amazonaws.oam#MissingRequiredParameterException":
733
+ throw await deserializeAws_restJson1MissingRequiredParameterExceptionResponse(parsedOutput, context);
734
+ case "ResourceNotFoundException":
735
+ case "com.amazonaws.oam#ResourceNotFoundException":
736
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
737
+ default:
738
+ const parsedBody = parsedOutput.body;
739
+ (0, smithy_client_1.throwDefaultError)({
740
+ output,
741
+ parsedBody,
742
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
743
+ errorCode,
744
+ });
745
+ }
746
+ };
747
+ const deserializeAws_restJson1ListLinksCommand = async (output, context) => {
748
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
749
+ return deserializeAws_restJson1ListLinksCommandError(output, context);
750
+ }
751
+ const contents = map({
752
+ $metadata: deserializeMetadata(output),
753
+ });
754
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
755
+ if (data.Items != null) {
756
+ contents.Items = deserializeAws_restJson1ListLinksItems(data.Items, context);
757
+ }
758
+ if (data.NextToken != null) {
759
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
760
+ }
761
+ return contents;
762
+ };
763
+ exports.deserializeAws_restJson1ListLinksCommand = deserializeAws_restJson1ListLinksCommand;
764
+ const deserializeAws_restJson1ListLinksCommandError = async (output, context) => {
765
+ const parsedOutput = {
766
+ ...output,
767
+ body: await parseErrorBody(output.body, context),
768
+ };
769
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
770
+ switch (errorCode) {
771
+ case "InternalServiceFault":
772
+ case "com.amazonaws.oam#InternalServiceFault":
773
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
774
+ case "InvalidParameterException":
775
+ case "com.amazonaws.oam#InvalidParameterException":
776
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
777
+ case "ResourceNotFoundException":
778
+ case "com.amazonaws.oam#ResourceNotFoundException":
779
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
780
+ default:
781
+ const parsedBody = parsedOutput.body;
782
+ (0, smithy_client_1.throwDefaultError)({
783
+ output,
784
+ parsedBody,
785
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
786
+ errorCode,
787
+ });
788
+ }
789
+ };
790
+ const deserializeAws_restJson1ListSinksCommand = async (output, context) => {
791
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
792
+ return deserializeAws_restJson1ListSinksCommandError(output, context);
793
+ }
794
+ const contents = map({
795
+ $metadata: deserializeMetadata(output),
796
+ });
797
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
798
+ if (data.Items != null) {
799
+ contents.Items = deserializeAws_restJson1ListSinksItems(data.Items, context);
800
+ }
801
+ if (data.NextToken != null) {
802
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
803
+ }
804
+ return contents;
805
+ };
806
+ exports.deserializeAws_restJson1ListSinksCommand = deserializeAws_restJson1ListSinksCommand;
807
+ const deserializeAws_restJson1ListSinksCommandError = async (output, context) => {
808
+ const parsedOutput = {
809
+ ...output,
810
+ body: await parseErrorBody(output.body, context),
811
+ };
812
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
813
+ switch (errorCode) {
814
+ case "InternalServiceFault":
815
+ case "com.amazonaws.oam#InternalServiceFault":
816
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
817
+ case "InvalidParameterException":
818
+ case "com.amazonaws.oam#InvalidParameterException":
819
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
820
+ case "ResourceNotFoundException":
821
+ case "com.amazonaws.oam#ResourceNotFoundException":
822
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
823
+ default:
824
+ const parsedBody = parsedOutput.body;
825
+ (0, smithy_client_1.throwDefaultError)({
826
+ output,
827
+ parsedBody,
828
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
829
+ errorCode,
830
+ });
831
+ }
832
+ };
833
+ const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
834
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
835
+ return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
836
+ }
837
+ const contents = map({
838
+ $metadata: deserializeMetadata(output),
839
+ });
840
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
841
+ if (data.Tags != null) {
842
+ contents.Tags = deserializeAws_restJson1TagMapOutput(data.Tags, context);
843
+ }
844
+ return contents;
845
+ };
846
+ exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
847
+ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
848
+ const parsedOutput = {
849
+ ...output,
850
+ body: await parseErrorBody(output.body, context),
851
+ };
852
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
853
+ switch (errorCode) {
854
+ case "ResourceNotFoundException":
855
+ case "com.amazonaws.oam#ResourceNotFoundException":
856
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
857
+ case "ValidationException":
858
+ case "com.amazonaws.oam#ValidationException":
859
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
860
+ default:
861
+ const parsedBody = parsedOutput.body;
862
+ (0, smithy_client_1.throwDefaultError)({
863
+ output,
864
+ parsedBody,
865
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
866
+ errorCode,
867
+ });
868
+ }
869
+ };
870
+ const deserializeAws_restJson1PutSinkPolicyCommand = async (output, context) => {
871
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
872
+ return deserializeAws_restJson1PutSinkPolicyCommandError(output, context);
873
+ }
874
+ const contents = map({
875
+ $metadata: deserializeMetadata(output),
876
+ });
877
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
878
+ if (data.Policy != null) {
879
+ contents.Policy = (0, smithy_client_1.expectString)(data.Policy);
880
+ }
881
+ if (data.SinkArn != null) {
882
+ contents.SinkArn = (0, smithy_client_1.expectString)(data.SinkArn);
883
+ }
884
+ if (data.SinkId != null) {
885
+ contents.SinkId = (0, smithy_client_1.expectString)(data.SinkId);
886
+ }
887
+ return contents;
888
+ };
889
+ exports.deserializeAws_restJson1PutSinkPolicyCommand = deserializeAws_restJson1PutSinkPolicyCommand;
890
+ const deserializeAws_restJson1PutSinkPolicyCommandError = async (output, context) => {
891
+ const parsedOutput = {
892
+ ...output,
893
+ body: await parseErrorBody(output.body, context),
894
+ };
895
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
896
+ switch (errorCode) {
897
+ case "InternalServiceFault":
898
+ case "com.amazonaws.oam#InternalServiceFault":
899
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
900
+ case "InvalidParameterException":
901
+ case "com.amazonaws.oam#InvalidParameterException":
902
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
903
+ case "MissingRequiredParameterException":
904
+ case "com.amazonaws.oam#MissingRequiredParameterException":
905
+ throw await deserializeAws_restJson1MissingRequiredParameterExceptionResponse(parsedOutput, context);
906
+ case "ResourceNotFoundException":
907
+ case "com.amazonaws.oam#ResourceNotFoundException":
908
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
909
+ default:
910
+ const parsedBody = parsedOutput.body;
911
+ (0, smithy_client_1.throwDefaultError)({
912
+ output,
913
+ parsedBody,
914
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
915
+ errorCode,
916
+ });
917
+ }
918
+ };
919
+ const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
920
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
921
+ return deserializeAws_restJson1TagResourceCommandError(output, context);
922
+ }
923
+ const contents = map({
924
+ $metadata: deserializeMetadata(output),
925
+ });
926
+ await collectBody(output.body, context);
927
+ return contents;
928
+ };
929
+ exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
930
+ const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
931
+ const parsedOutput = {
932
+ ...output,
933
+ body: await parseErrorBody(output.body, context),
934
+ };
935
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
936
+ switch (errorCode) {
937
+ case "ResourceNotFoundException":
938
+ case "com.amazonaws.oam#ResourceNotFoundException":
939
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
940
+ case "TooManyTagsException":
941
+ case "com.amazonaws.oam#TooManyTagsException":
942
+ throw await deserializeAws_restJson1TooManyTagsExceptionResponse(parsedOutput, context);
943
+ case "ValidationException":
944
+ case "com.amazonaws.oam#ValidationException":
945
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
946
+ default:
947
+ const parsedBody = parsedOutput.body;
948
+ (0, smithy_client_1.throwDefaultError)({
949
+ output,
950
+ parsedBody,
951
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
952
+ errorCode,
953
+ });
954
+ }
955
+ };
956
+ const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
957
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
958
+ return deserializeAws_restJson1UntagResourceCommandError(output, context);
959
+ }
960
+ const contents = map({
961
+ $metadata: deserializeMetadata(output),
962
+ });
963
+ await collectBody(output.body, context);
964
+ return contents;
965
+ };
966
+ exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
967
+ const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
968
+ const parsedOutput = {
969
+ ...output,
970
+ body: await parseErrorBody(output.body, context),
971
+ };
972
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
973
+ switch (errorCode) {
974
+ case "ResourceNotFoundException":
975
+ case "com.amazonaws.oam#ResourceNotFoundException":
976
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
977
+ case "ValidationException":
978
+ case "com.amazonaws.oam#ValidationException":
979
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
980
+ default:
981
+ const parsedBody = parsedOutput.body;
982
+ (0, smithy_client_1.throwDefaultError)({
983
+ output,
984
+ parsedBody,
985
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
986
+ errorCode,
987
+ });
988
+ }
989
+ };
990
+ const deserializeAws_restJson1UpdateLinkCommand = async (output, context) => {
991
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
992
+ return deserializeAws_restJson1UpdateLinkCommandError(output, context);
993
+ }
994
+ const contents = map({
995
+ $metadata: deserializeMetadata(output),
996
+ });
997
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
998
+ if (data.Arn != null) {
999
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1000
+ }
1001
+ if (data.Id != null) {
1002
+ contents.Id = (0, smithy_client_1.expectString)(data.Id);
1003
+ }
1004
+ if (data.Label != null) {
1005
+ contents.Label = (0, smithy_client_1.expectString)(data.Label);
1006
+ }
1007
+ if (data.LabelTemplate != null) {
1008
+ contents.LabelTemplate = (0, smithy_client_1.expectString)(data.LabelTemplate);
1009
+ }
1010
+ if (data.ResourceTypes != null) {
1011
+ contents.ResourceTypes = deserializeAws_restJson1ResourceTypesOutput(data.ResourceTypes, context);
1012
+ }
1013
+ if (data.SinkArn != null) {
1014
+ contents.SinkArn = (0, smithy_client_1.expectString)(data.SinkArn);
1015
+ }
1016
+ if (data.Tags != null) {
1017
+ contents.Tags = deserializeAws_restJson1TagMapOutput(data.Tags, context);
1018
+ }
1019
+ return contents;
1020
+ };
1021
+ exports.deserializeAws_restJson1UpdateLinkCommand = deserializeAws_restJson1UpdateLinkCommand;
1022
+ const deserializeAws_restJson1UpdateLinkCommandError = async (output, context) => {
1023
+ const parsedOutput = {
1024
+ ...output,
1025
+ body: await parseErrorBody(output.body, context),
1026
+ };
1027
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1028
+ switch (errorCode) {
1029
+ case "InternalServiceFault":
1030
+ case "com.amazonaws.oam#InternalServiceFault":
1031
+ throw await deserializeAws_restJson1InternalServiceFaultResponse(parsedOutput, context);
1032
+ case "InvalidParameterException":
1033
+ case "com.amazonaws.oam#InvalidParameterException":
1034
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1035
+ case "MissingRequiredParameterException":
1036
+ case "com.amazonaws.oam#MissingRequiredParameterException":
1037
+ throw await deserializeAws_restJson1MissingRequiredParameterExceptionResponse(parsedOutput, context);
1038
+ case "ResourceNotFoundException":
1039
+ case "com.amazonaws.oam#ResourceNotFoundException":
1040
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1041
+ default:
1042
+ const parsedBody = parsedOutput.body;
1043
+ (0, smithy_client_1.throwDefaultError)({
1044
+ output,
1045
+ parsedBody,
1046
+ exceptionCtor: OAMServiceException_1.OAMServiceException,
1047
+ errorCode,
1048
+ });
1049
+ }
1050
+ };
1051
+ const map = smithy_client_1.map;
1052
+ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1053
+ const contents = map({
1054
+ amznErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1055
+ });
1056
+ const data = parsedOutput.body;
1057
+ if (data.Message != null) {
1058
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
1059
+ }
1060
+ const exception = new models_0_1.ConflictException({
1061
+ $metadata: deserializeMetadata(parsedOutput),
1062
+ ...contents,
1063
+ });
1064
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1065
+ };
1066
+ const deserializeAws_restJson1InternalServiceFaultResponse = async (parsedOutput, context) => {
1067
+ const contents = map({
1068
+ amznErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1069
+ });
1070
+ const data = parsedOutput.body;
1071
+ if (data.Message != null) {
1072
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
1073
+ }
1074
+ const exception = new models_0_1.InternalServiceFault({
1075
+ $metadata: deserializeMetadata(parsedOutput),
1076
+ ...contents,
1077
+ });
1078
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1079
+ };
1080
+ const deserializeAws_restJson1InvalidParameterExceptionResponse = async (parsedOutput, context) => {
1081
+ const contents = map({
1082
+ amznErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1083
+ });
1084
+ const data = parsedOutput.body;
1085
+ if (data.message != null) {
1086
+ contents.message = (0, smithy_client_1.expectString)(data.message);
1087
+ }
1088
+ const exception = new models_0_1.InvalidParameterException({
1089
+ $metadata: deserializeMetadata(parsedOutput),
1090
+ ...contents,
1091
+ });
1092
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1093
+ };
1094
+ const deserializeAws_restJson1MissingRequiredParameterExceptionResponse = async (parsedOutput, context) => {
1095
+ const contents = map({
1096
+ amznErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1097
+ });
1098
+ const data = parsedOutput.body;
1099
+ if (data.message != null) {
1100
+ contents.message = (0, smithy_client_1.expectString)(data.message);
1101
+ }
1102
+ const exception = new models_0_1.MissingRequiredParameterException({
1103
+ $metadata: deserializeMetadata(parsedOutput),
1104
+ ...contents,
1105
+ });
1106
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1107
+ };
1108
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1109
+ const contents = map({
1110
+ amznErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1111
+ });
1112
+ const data = parsedOutput.body;
1113
+ if (data.Message != null) {
1114
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
1115
+ }
1116
+ const exception = new models_0_1.ResourceNotFoundException({
1117
+ $metadata: deserializeMetadata(parsedOutput),
1118
+ ...contents,
1119
+ });
1120
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1121
+ };
1122
+ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1123
+ const contents = map({
1124
+ amznErrorType: [, parsedOutput.headers["x-amzn-errortype"]],
1125
+ });
1126
+ const data = parsedOutput.body;
1127
+ if (data.Message != null) {
1128
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
1129
+ }
1130
+ const exception = new models_0_1.ServiceQuotaExceededException({
1131
+ $metadata: deserializeMetadata(parsedOutput),
1132
+ ...contents,
1133
+ });
1134
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1135
+ };
1136
+ const deserializeAws_restJson1TooManyTagsExceptionResponse = async (parsedOutput, context) => {
1137
+ const contents = map({});
1138
+ const data = parsedOutput.body;
1139
+ if (data.Message != null) {
1140
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
1141
+ }
1142
+ const exception = new models_0_1.TooManyTagsException({
1143
+ $metadata: deserializeMetadata(parsedOutput),
1144
+ ...contents,
1145
+ });
1146
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1147
+ };
1148
+ const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1149
+ const contents = map({});
1150
+ const data = parsedOutput.body;
1151
+ if (data.Message != null) {
1152
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
1153
+ }
1154
+ const exception = new models_0_1.ValidationException({
1155
+ $metadata: deserializeMetadata(parsedOutput),
1156
+ ...contents,
1157
+ });
1158
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1159
+ };
1160
+ const serializeAws_restJson1ResourceTypesInput = (input, context) => {
1161
+ return input
1162
+ .filter((e) => e != null)
1163
+ .map((entry) => {
1164
+ return entry;
1165
+ });
1166
+ };
1167
+ const serializeAws_restJson1TagMapInput = (input, context) => {
1168
+ return Object.entries(input).reduce((acc, [key, value]) => {
1169
+ if (value === null) {
1170
+ return acc;
1171
+ }
1172
+ acc[key] = value;
1173
+ return acc;
1174
+ }, {});
1175
+ };
1176
+ const deserializeAws_restJson1ListAttachedLinksItem = (output, context) => {
1177
+ return {
1178
+ Label: (0, smithy_client_1.expectString)(output.Label),
1179
+ LinkArn: (0, smithy_client_1.expectString)(output.LinkArn),
1180
+ ResourceTypes: output.ResourceTypes != null
1181
+ ? deserializeAws_restJson1ResourceTypesOutput(output.ResourceTypes, context)
1182
+ : undefined,
1183
+ };
1184
+ };
1185
+ const deserializeAws_restJson1ListAttachedLinksItems = (output, context) => {
1186
+ const retVal = (output || [])
1187
+ .filter((e) => e != null)
1188
+ .map((entry) => {
1189
+ if (entry === null) {
1190
+ return null;
1191
+ }
1192
+ return deserializeAws_restJson1ListAttachedLinksItem(entry, context);
1193
+ });
1194
+ return retVal;
1195
+ };
1196
+ const deserializeAws_restJson1ListLinksItem = (output, context) => {
1197
+ return {
1198
+ Arn: (0, smithy_client_1.expectString)(output.Arn),
1199
+ Id: (0, smithy_client_1.expectString)(output.Id),
1200
+ Label: (0, smithy_client_1.expectString)(output.Label),
1201
+ ResourceTypes: output.ResourceTypes != null
1202
+ ? deserializeAws_restJson1ResourceTypesOutput(output.ResourceTypes, context)
1203
+ : undefined,
1204
+ SinkArn: (0, smithy_client_1.expectString)(output.SinkArn),
1205
+ };
1206
+ };
1207
+ const deserializeAws_restJson1ListLinksItems = (output, context) => {
1208
+ const retVal = (output || [])
1209
+ .filter((e) => e != null)
1210
+ .map((entry) => {
1211
+ if (entry === null) {
1212
+ return null;
1213
+ }
1214
+ return deserializeAws_restJson1ListLinksItem(entry, context);
1215
+ });
1216
+ return retVal;
1217
+ };
1218
+ const deserializeAws_restJson1ListSinksItem = (output, context) => {
1219
+ return {
1220
+ Arn: (0, smithy_client_1.expectString)(output.Arn),
1221
+ Id: (0, smithy_client_1.expectString)(output.Id),
1222
+ Name: (0, smithy_client_1.expectString)(output.Name),
1223
+ };
1224
+ };
1225
+ const deserializeAws_restJson1ListSinksItems = (output, context) => {
1226
+ const retVal = (output || [])
1227
+ .filter((e) => e != null)
1228
+ .map((entry) => {
1229
+ if (entry === null) {
1230
+ return null;
1231
+ }
1232
+ return deserializeAws_restJson1ListSinksItem(entry, context);
1233
+ });
1234
+ return retVal;
1235
+ };
1236
+ const deserializeAws_restJson1ResourceTypesOutput = (output, context) => {
1237
+ const retVal = (output || [])
1238
+ .filter((e) => e != null)
1239
+ .map((entry) => {
1240
+ if (entry === null) {
1241
+ return null;
1242
+ }
1243
+ return (0, smithy_client_1.expectString)(entry);
1244
+ });
1245
+ return retVal;
1246
+ };
1247
+ const deserializeAws_restJson1TagMapOutput = (output, context) => {
1248
+ return Object.entries(output).reduce((acc, [key, value]) => {
1249
+ if (value === null) {
1250
+ return acc;
1251
+ }
1252
+ acc[key] = (0, smithy_client_1.expectString)(value);
1253
+ return acc;
1254
+ }, {});
1255
+ };
1256
+ const deserializeMetadata = (output) => ({
1257
+ httpStatusCode: output.statusCode,
1258
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
1259
+ extendedRequestId: output.headers["x-amz-id-2"],
1260
+ cfId: output.headers["x-amz-cf-id"],
1261
+ });
1262
+ const collectBody = (streamBody = new Uint8Array(), context) => {
1263
+ if (streamBody instanceof Uint8Array) {
1264
+ return Promise.resolve(streamBody);
1265
+ }
1266
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1267
+ };
1268
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1269
+ const isSerializableHeaderValue = (value) => value !== undefined &&
1270
+ value !== null &&
1271
+ value !== "" &&
1272
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1273
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1274
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1275
+ if (encoded.length) {
1276
+ return JSON.parse(encoded);
1277
+ }
1278
+ return {};
1279
+ });
1280
+ const parseErrorBody = async (errorBody, context) => {
1281
+ const value = await parseBody(errorBody, context);
1282
+ value.message = value.message ?? value.Message;
1283
+ return value;
1284
+ };
1285
+ const loadRestJsonErrorCode = (output, data) => {
1286
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1287
+ const sanitizeErrorCode = (rawValue) => {
1288
+ let cleanValue = rawValue;
1289
+ if (typeof cleanValue === "number") {
1290
+ cleanValue = cleanValue.toString();
1291
+ }
1292
+ if (cleanValue.indexOf(",") >= 0) {
1293
+ cleanValue = cleanValue.split(",")[0];
1294
+ }
1295
+ if (cleanValue.indexOf(":") >= 0) {
1296
+ cleanValue = cleanValue.split(":")[0];
1297
+ }
1298
+ if (cleanValue.indexOf("#") >= 0) {
1299
+ cleanValue = cleanValue.split("#")[1];
1300
+ }
1301
+ return cleanValue;
1302
+ };
1303
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
1304
+ if (headerKey !== undefined) {
1305
+ return sanitizeErrorCode(output.headers[headerKey]);
1306
+ }
1307
+ if (data.code !== undefined) {
1308
+ return sanitizeErrorCode(data.code);
1309
+ }
1310
+ if (data["__type"] !== undefined) {
1311
+ return sanitizeErrorCode(data["__type"]);
1312
+ }
1313
+ };