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