/clients/client-api-gateway/protocols/Aws_restJson1.ts

https://github.com/aws/aws-sdk-js-v3 · TypeScript · 18708 lines · 18236 code · 467 blank · 5 comment · 7969 complexity · ad9dc544741b25018143ae03da46eb9b MD5 · raw file

Large files are truncated click here to view the full file

  1. import { CreateApiKeyCommandInput, CreateApiKeyCommandOutput } from "../commands/CreateApiKeyCommand";
  2. import { CreateAuthorizerCommandInput, CreateAuthorizerCommandOutput } from "../commands/CreateAuthorizerCommand";
  3. import {
  4. CreateBasePathMappingCommandInput,
  5. CreateBasePathMappingCommandOutput,
  6. } from "../commands/CreateBasePathMappingCommand";
  7. import { CreateDeploymentCommandInput, CreateDeploymentCommandOutput } from "../commands/CreateDeploymentCommand";
  8. import {
  9. CreateDocumentationPartCommandInput,
  10. CreateDocumentationPartCommandOutput,
  11. } from "../commands/CreateDocumentationPartCommand";
  12. import {
  13. CreateDocumentationVersionCommandInput,
  14. CreateDocumentationVersionCommandOutput,
  15. } from "../commands/CreateDocumentationVersionCommand";
  16. import { CreateDomainNameCommandInput, CreateDomainNameCommandOutput } from "../commands/CreateDomainNameCommand";
  17. import { CreateModelCommandInput, CreateModelCommandOutput } from "../commands/CreateModelCommand";
  18. import {
  19. CreateRequestValidatorCommandInput,
  20. CreateRequestValidatorCommandOutput,
  21. } from "../commands/CreateRequestValidatorCommand";
  22. import { CreateResourceCommandInput, CreateResourceCommandOutput } from "../commands/CreateResourceCommand";
  23. import { CreateRestApiCommandInput, CreateRestApiCommandOutput } from "../commands/CreateRestApiCommand";
  24. import { CreateStageCommandInput, CreateStageCommandOutput } from "../commands/CreateStageCommand";
  25. import { CreateUsagePlanCommandInput, CreateUsagePlanCommandOutput } from "../commands/CreateUsagePlanCommand";
  26. import { CreateUsagePlanKeyCommandInput, CreateUsagePlanKeyCommandOutput } from "../commands/CreateUsagePlanKeyCommand";
  27. import { CreateVpcLinkCommandInput, CreateVpcLinkCommandOutput } from "../commands/CreateVpcLinkCommand";
  28. import { DeleteApiKeyCommandInput, DeleteApiKeyCommandOutput } from "../commands/DeleteApiKeyCommand";
  29. import { DeleteAuthorizerCommandInput, DeleteAuthorizerCommandOutput } from "../commands/DeleteAuthorizerCommand";
  30. import {
  31. DeleteBasePathMappingCommandInput,
  32. DeleteBasePathMappingCommandOutput,
  33. } from "../commands/DeleteBasePathMappingCommand";
  34. import {
  35. DeleteClientCertificateCommandInput,
  36. DeleteClientCertificateCommandOutput,
  37. } from "../commands/DeleteClientCertificateCommand";
  38. import { DeleteDeploymentCommandInput, DeleteDeploymentCommandOutput } from "../commands/DeleteDeploymentCommand";
  39. import {
  40. DeleteDocumentationPartCommandInput,
  41. DeleteDocumentationPartCommandOutput,
  42. } from "../commands/DeleteDocumentationPartCommand";
  43. import {
  44. DeleteDocumentationVersionCommandInput,
  45. DeleteDocumentationVersionCommandOutput,
  46. } from "../commands/DeleteDocumentationVersionCommand";
  47. import { DeleteDomainNameCommandInput, DeleteDomainNameCommandOutput } from "../commands/DeleteDomainNameCommand";
  48. import {
  49. DeleteGatewayResponseCommandInput,
  50. DeleteGatewayResponseCommandOutput,
  51. } from "../commands/DeleteGatewayResponseCommand";
  52. import { DeleteIntegrationCommandInput, DeleteIntegrationCommandOutput } from "../commands/DeleteIntegrationCommand";
  53. import {
  54. DeleteIntegrationResponseCommandInput,
  55. DeleteIntegrationResponseCommandOutput,
  56. } from "../commands/DeleteIntegrationResponseCommand";
  57. import { DeleteMethodCommandInput, DeleteMethodCommandOutput } from "../commands/DeleteMethodCommand";
  58. import {
  59. DeleteMethodResponseCommandInput,
  60. DeleteMethodResponseCommandOutput,
  61. } from "../commands/DeleteMethodResponseCommand";
  62. import { DeleteModelCommandInput, DeleteModelCommandOutput } from "../commands/DeleteModelCommand";
  63. import {
  64. DeleteRequestValidatorCommandInput,
  65. DeleteRequestValidatorCommandOutput,
  66. } from "../commands/DeleteRequestValidatorCommand";
  67. import { DeleteResourceCommandInput, DeleteResourceCommandOutput } from "../commands/DeleteResourceCommand";
  68. import { DeleteRestApiCommandInput, DeleteRestApiCommandOutput } from "../commands/DeleteRestApiCommand";
  69. import { DeleteStageCommandInput, DeleteStageCommandOutput } from "../commands/DeleteStageCommand";
  70. import { DeleteUsagePlanCommandInput, DeleteUsagePlanCommandOutput } from "../commands/DeleteUsagePlanCommand";
  71. import { DeleteUsagePlanKeyCommandInput, DeleteUsagePlanKeyCommandOutput } from "../commands/DeleteUsagePlanKeyCommand";
  72. import { DeleteVpcLinkCommandInput, DeleteVpcLinkCommandOutput } from "../commands/DeleteVpcLinkCommand";
  73. import {
  74. FlushStageAuthorizersCacheCommandInput,
  75. FlushStageAuthorizersCacheCommandOutput,
  76. } from "../commands/FlushStageAuthorizersCacheCommand";
  77. import { FlushStageCacheCommandInput, FlushStageCacheCommandOutput } from "../commands/FlushStageCacheCommand";
  78. import {
  79. GenerateClientCertificateCommandInput,
  80. GenerateClientCertificateCommandOutput,
  81. } from "../commands/GenerateClientCertificateCommand";
  82. import { GetAccountCommandInput, GetAccountCommandOutput } from "../commands/GetAccountCommand";
  83. import { GetApiKeyCommandInput, GetApiKeyCommandOutput } from "../commands/GetApiKeyCommand";
  84. import { GetApiKeysCommandInput, GetApiKeysCommandOutput } from "../commands/GetApiKeysCommand";
  85. import { GetAuthorizerCommandInput, GetAuthorizerCommandOutput } from "../commands/GetAuthorizerCommand";
  86. import { GetAuthorizersCommandInput, GetAuthorizersCommandOutput } from "../commands/GetAuthorizersCommand";
  87. import { GetBasePathMappingCommandInput, GetBasePathMappingCommandOutput } from "../commands/GetBasePathMappingCommand";
  88. import {
  89. GetBasePathMappingsCommandInput,
  90. GetBasePathMappingsCommandOutput,
  91. } from "../commands/GetBasePathMappingsCommand";
  92. import {
  93. GetClientCertificateCommandInput,
  94. GetClientCertificateCommandOutput,
  95. } from "../commands/GetClientCertificateCommand";
  96. import {
  97. GetClientCertificatesCommandInput,
  98. GetClientCertificatesCommandOutput,
  99. } from "../commands/GetClientCertificatesCommand";
  100. import { GetDeploymentCommandInput, GetDeploymentCommandOutput } from "../commands/GetDeploymentCommand";
  101. import { GetDeploymentsCommandInput, GetDeploymentsCommandOutput } from "../commands/GetDeploymentsCommand";
  102. import {
  103. GetDocumentationPartCommandInput,
  104. GetDocumentationPartCommandOutput,
  105. } from "../commands/GetDocumentationPartCommand";
  106. import {
  107. GetDocumentationPartsCommandInput,
  108. GetDocumentationPartsCommandOutput,
  109. } from "../commands/GetDocumentationPartsCommand";
  110. import {
  111. GetDocumentationVersionCommandInput,
  112. GetDocumentationVersionCommandOutput,
  113. } from "../commands/GetDocumentationVersionCommand";
  114. import {
  115. GetDocumentationVersionsCommandInput,
  116. GetDocumentationVersionsCommandOutput,
  117. } from "../commands/GetDocumentationVersionsCommand";
  118. import { GetDomainNameCommandInput, GetDomainNameCommandOutput } from "../commands/GetDomainNameCommand";
  119. import { GetDomainNamesCommandInput, GetDomainNamesCommandOutput } from "../commands/GetDomainNamesCommand";
  120. import { GetExportCommandInput, GetExportCommandOutput } from "../commands/GetExportCommand";
  121. import { GetGatewayResponseCommandInput, GetGatewayResponseCommandOutput } from "../commands/GetGatewayResponseCommand";
  122. import {
  123. GetGatewayResponsesCommandInput,
  124. GetGatewayResponsesCommandOutput,
  125. } from "../commands/GetGatewayResponsesCommand";
  126. import { GetIntegrationCommandInput, GetIntegrationCommandOutput } from "../commands/GetIntegrationCommand";
  127. import {
  128. GetIntegrationResponseCommandInput,
  129. GetIntegrationResponseCommandOutput,
  130. } from "../commands/GetIntegrationResponseCommand";
  131. import { GetMethodCommandInput, GetMethodCommandOutput } from "../commands/GetMethodCommand";
  132. import { GetMethodResponseCommandInput, GetMethodResponseCommandOutput } from "../commands/GetMethodResponseCommand";
  133. import { GetModelCommandInput, GetModelCommandOutput } from "../commands/GetModelCommand";
  134. import { GetModelTemplateCommandInput, GetModelTemplateCommandOutput } from "../commands/GetModelTemplateCommand";
  135. import { GetModelsCommandInput, GetModelsCommandOutput } from "../commands/GetModelsCommand";
  136. import {
  137. GetRequestValidatorCommandInput,
  138. GetRequestValidatorCommandOutput,
  139. } from "../commands/GetRequestValidatorCommand";
  140. import {
  141. GetRequestValidatorsCommandInput,
  142. GetRequestValidatorsCommandOutput,
  143. } from "../commands/GetRequestValidatorsCommand";
  144. import { GetResourceCommandInput, GetResourceCommandOutput } from "../commands/GetResourceCommand";
  145. import { GetResourcesCommandInput, GetResourcesCommandOutput } from "../commands/GetResourcesCommand";
  146. import { GetRestApiCommandInput, GetRestApiCommandOutput } from "../commands/GetRestApiCommand";
  147. import { GetRestApisCommandInput, GetRestApisCommandOutput } from "../commands/GetRestApisCommand";
  148. import { GetSdkCommandInput, GetSdkCommandOutput } from "../commands/GetSdkCommand";
  149. import { GetSdkTypeCommandInput, GetSdkTypeCommandOutput } from "../commands/GetSdkTypeCommand";
  150. import { GetSdkTypesCommandInput, GetSdkTypesCommandOutput } from "../commands/GetSdkTypesCommand";
  151. import { GetStageCommandInput, GetStageCommandOutput } from "../commands/GetStageCommand";
  152. import { GetStagesCommandInput, GetStagesCommandOutput } from "../commands/GetStagesCommand";
  153. import { GetTagsCommandInput, GetTagsCommandOutput } from "../commands/GetTagsCommand";
  154. import { GetUsageCommandInput, GetUsageCommandOutput } from "../commands/GetUsageCommand";
  155. import { GetUsagePlanCommandInput, GetUsagePlanCommandOutput } from "../commands/GetUsagePlanCommand";
  156. import { GetUsagePlanKeyCommandInput, GetUsagePlanKeyCommandOutput } from "../commands/GetUsagePlanKeyCommand";
  157. import { GetUsagePlanKeysCommandInput, GetUsagePlanKeysCommandOutput } from "../commands/GetUsagePlanKeysCommand";
  158. import { GetUsagePlansCommandInput, GetUsagePlansCommandOutput } from "../commands/GetUsagePlansCommand";
  159. import { GetVpcLinkCommandInput, GetVpcLinkCommandOutput } from "../commands/GetVpcLinkCommand";
  160. import { GetVpcLinksCommandInput, GetVpcLinksCommandOutput } from "../commands/GetVpcLinksCommand";
  161. import { ImportApiKeysCommandInput, ImportApiKeysCommandOutput } from "../commands/ImportApiKeysCommand";
  162. import {
  163. ImportDocumentationPartsCommandInput,
  164. ImportDocumentationPartsCommandOutput,
  165. } from "../commands/ImportDocumentationPartsCommand";
  166. import { ImportRestApiCommandInput, ImportRestApiCommandOutput } from "../commands/ImportRestApiCommand";
  167. import { PutGatewayResponseCommandInput, PutGatewayResponseCommandOutput } from "../commands/PutGatewayResponseCommand";
  168. import { PutIntegrationCommandInput, PutIntegrationCommandOutput } from "../commands/PutIntegrationCommand";
  169. import {
  170. PutIntegrationResponseCommandInput,
  171. PutIntegrationResponseCommandOutput,
  172. } from "../commands/PutIntegrationResponseCommand";
  173. import { PutMethodCommandInput, PutMethodCommandOutput } from "../commands/PutMethodCommand";
  174. import { PutMethodResponseCommandInput, PutMethodResponseCommandOutput } from "../commands/PutMethodResponseCommand";
  175. import { PutRestApiCommandInput, PutRestApiCommandOutput } from "../commands/PutRestApiCommand";
  176. import { TagResourceCommandInput, TagResourceCommandOutput } from "../commands/TagResourceCommand";
  177. import {
  178. TestInvokeAuthorizerCommandInput,
  179. TestInvokeAuthorizerCommandOutput,
  180. } from "../commands/TestInvokeAuthorizerCommand";
  181. import { TestInvokeMethodCommandInput, TestInvokeMethodCommandOutput } from "../commands/TestInvokeMethodCommand";
  182. import { UntagResourceCommandInput, UntagResourceCommandOutput } from "../commands/UntagResourceCommand";
  183. import { UpdateAccountCommandInput, UpdateAccountCommandOutput } from "../commands/UpdateAccountCommand";
  184. import { UpdateApiKeyCommandInput, UpdateApiKeyCommandOutput } from "../commands/UpdateApiKeyCommand";
  185. import { UpdateAuthorizerCommandInput, UpdateAuthorizerCommandOutput } from "../commands/UpdateAuthorizerCommand";
  186. import {
  187. UpdateBasePathMappingCommandInput,
  188. UpdateBasePathMappingCommandOutput,
  189. } from "../commands/UpdateBasePathMappingCommand";
  190. import {
  191. UpdateClientCertificateCommandInput,
  192. UpdateClientCertificateCommandOutput,
  193. } from "../commands/UpdateClientCertificateCommand";
  194. import { UpdateDeploymentCommandInput, UpdateDeploymentCommandOutput } from "../commands/UpdateDeploymentCommand";
  195. import {
  196. UpdateDocumentationPartCommandInput,
  197. UpdateDocumentationPartCommandOutput,
  198. } from "../commands/UpdateDocumentationPartCommand";
  199. import {
  200. UpdateDocumentationVersionCommandInput,
  201. UpdateDocumentationVersionCommandOutput,
  202. } from "../commands/UpdateDocumentationVersionCommand";
  203. import { UpdateDomainNameCommandInput, UpdateDomainNameCommandOutput } from "../commands/UpdateDomainNameCommand";
  204. import {
  205. UpdateGatewayResponseCommandInput,
  206. UpdateGatewayResponseCommandOutput,
  207. } from "../commands/UpdateGatewayResponseCommand";
  208. import { UpdateIntegrationCommandInput, UpdateIntegrationCommandOutput } from "../commands/UpdateIntegrationCommand";
  209. import {
  210. UpdateIntegrationResponseCommandInput,
  211. UpdateIntegrationResponseCommandOutput,
  212. } from "../commands/UpdateIntegrationResponseCommand";
  213. import { UpdateMethodCommandInput, UpdateMethodCommandOutput } from "../commands/UpdateMethodCommand";
  214. import {
  215. UpdateMethodResponseCommandInput,
  216. UpdateMethodResponseCommandOutput,
  217. } from "../commands/UpdateMethodResponseCommand";
  218. import { UpdateModelCommandInput, UpdateModelCommandOutput } from "../commands/UpdateModelCommand";
  219. import {
  220. UpdateRequestValidatorCommandInput,
  221. UpdateRequestValidatorCommandOutput,
  222. } from "../commands/UpdateRequestValidatorCommand";
  223. import { UpdateResourceCommandInput, UpdateResourceCommandOutput } from "../commands/UpdateResourceCommand";
  224. import { UpdateRestApiCommandInput, UpdateRestApiCommandOutput } from "../commands/UpdateRestApiCommand";
  225. import { UpdateStageCommandInput, UpdateStageCommandOutput } from "../commands/UpdateStageCommand";
  226. import { UpdateUsageCommandInput, UpdateUsageCommandOutput } from "../commands/UpdateUsageCommand";
  227. import { UpdateUsagePlanCommandInput, UpdateUsagePlanCommandOutput } from "../commands/UpdateUsagePlanCommand";
  228. import { UpdateVpcLinkCommandInput, UpdateVpcLinkCommandOutput } from "../commands/UpdateVpcLinkCommand";
  229. import {
  230. AccessLogSettings,
  231. ApiKey,
  232. ApiStage,
  233. Authorizer,
  234. BadRequestException,
  235. BasePathMapping,
  236. CanarySettings,
  237. ClientCertificate,
  238. ConflictException,
  239. Deployment,
  240. DeploymentCanarySettings,
  241. DocumentationPart,
  242. DocumentationPartLocation,
  243. DocumentationVersion,
  244. DomainName,
  245. EndpointConfiguration,
  246. EndpointType,
  247. GatewayResponse,
  248. Integration,
  249. IntegrationResponse,
  250. LimitExceededException,
  251. Method,
  252. MethodResponse,
  253. MethodSetting,
  254. MethodSnapshot,
  255. Model,
  256. NotFoundException,
  257. PatchOperation,
  258. QuotaSettings,
  259. RequestValidator,
  260. Resource,
  261. RestApi,
  262. SdkConfigurationProperty,
  263. SdkType,
  264. ServiceUnavailableException,
  265. Stage,
  266. StageKey,
  267. ThrottleSettings,
  268. TlsConfig,
  269. TooManyRequestsException,
  270. UnauthorizedException,
  271. UsagePlan,
  272. UsagePlanKey,
  273. VpcLink,
  274. } from "../models/models_0";
  275. import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
  276. import {
  277. SmithyException as __SmithyException,
  278. extendedEncodeURIComponent as __extendedEncodeURIComponent,
  279. } from "@aws-sdk/smithy-client";
  280. import {
  281. Endpoint as __Endpoint,
  282. MetadataBearer as __MetadataBearer,
  283. ResponseMetadata as __ResponseMetadata,
  284. SerdeContext as __SerdeContext,
  285. } from "@aws-sdk/types";
  286. export const serializeAws_restJson1CreateApiKeyCommand = async (
  287. input: CreateApiKeyCommandInput,
  288. context: __SerdeContext
  289. ): Promise<__HttpRequest> => {
  290. const headers: any = {
  291. "Content-Type": "application/json",
  292. };
  293. let resolvedPath = "/apikeys";
  294. let body: any;
  295. body = JSON.stringify({
  296. ...(input.customerId !== undefined && { customerId: input.customerId }),
  297. ...(input.description !== undefined && { description: input.description }),
  298. ...(input.enabled !== undefined && { enabled: input.enabled }),
  299. ...(input.generateDistinctId !== undefined && { generateDistinctId: input.generateDistinctId }),
  300. ...(input.name !== undefined && { name: input.name }),
  301. ...(input.stageKeys !== undefined && {
  302. stageKeys: serializeAws_restJson1ListOfStageKeys(input.stageKeys, context),
  303. }),
  304. ...(input.tags !== undefined && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }),
  305. ...(input.template !== undefined && { template: input.template }),
  306. ...(input.templateSkipList !== undefined && {
  307. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  308. }),
  309. ...(input.title !== undefined && { title: input.title }),
  310. ...(input.value !== undefined && { value: input.value }),
  311. });
  312. const { hostname, protocol = "https", port } = await context.endpoint();
  313. return new __HttpRequest({
  314. protocol,
  315. hostname,
  316. port,
  317. method: "POST",
  318. headers,
  319. path: resolvedPath,
  320. body,
  321. });
  322. };
  323. export const serializeAws_restJson1CreateAuthorizerCommand = async (
  324. input: CreateAuthorizerCommandInput,
  325. context: __SerdeContext
  326. ): Promise<__HttpRequest> => {
  327. const headers: any = {
  328. "Content-Type": "application/json",
  329. };
  330. let resolvedPath = "/restapis/{restApiId}/authorizers";
  331. if (input.restApiId !== undefined) {
  332. const labelValue: string = input.restApiId;
  333. if (labelValue.length <= 0) {
  334. throw new Error("Empty value provided for input HTTP label: restApiId.");
  335. }
  336. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  337. } else {
  338. throw new Error("No value provided for input HTTP label: restApiId.");
  339. }
  340. let body: any;
  341. body = JSON.stringify({
  342. ...(input.authType !== undefined && { authType: input.authType }),
  343. ...(input.authorizerCredentials !== undefined && { authorizerCredentials: input.authorizerCredentials }),
  344. ...(input.authorizerResultTtlInSeconds !== undefined && {
  345. authorizerResultTtlInSeconds: input.authorizerResultTtlInSeconds,
  346. }),
  347. ...(input.authorizerUri !== undefined && { authorizerUri: input.authorizerUri }),
  348. ...(input.identitySource !== undefined && { identitySource: input.identitySource }),
  349. ...(input.identityValidationExpression !== undefined && {
  350. identityValidationExpression: input.identityValidationExpression,
  351. }),
  352. ...(input.name !== undefined && { name: input.name }),
  353. ...(input.providerARNs !== undefined && {
  354. providerARNs: serializeAws_restJson1ListOfARNs(input.providerARNs, context),
  355. }),
  356. ...(input.template !== undefined && { template: input.template }),
  357. ...(input.templateSkipList !== undefined && {
  358. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  359. }),
  360. ...(input.title !== undefined && { title: input.title }),
  361. ...(input.type !== undefined && { type: input.type }),
  362. });
  363. const { hostname, protocol = "https", port } = await context.endpoint();
  364. return new __HttpRequest({
  365. protocol,
  366. hostname,
  367. port,
  368. method: "POST",
  369. headers,
  370. path: resolvedPath,
  371. body,
  372. });
  373. };
  374. export const serializeAws_restJson1CreateBasePathMappingCommand = async (
  375. input: CreateBasePathMappingCommandInput,
  376. context: __SerdeContext
  377. ): Promise<__HttpRequest> => {
  378. const headers: any = {
  379. "Content-Type": "application/json",
  380. };
  381. let resolvedPath = "/domainnames/{domainName}/basepathmappings";
  382. if (input.domainName !== undefined) {
  383. const labelValue: string = input.domainName;
  384. if (labelValue.length <= 0) {
  385. throw new Error("Empty value provided for input HTTP label: domainName.");
  386. }
  387. resolvedPath = resolvedPath.replace("{domainName}", __extendedEncodeURIComponent(labelValue));
  388. } else {
  389. throw new Error("No value provided for input HTTP label: domainName.");
  390. }
  391. let body: any;
  392. body = JSON.stringify({
  393. ...(input.basePath !== undefined && { basePath: input.basePath }),
  394. ...(input.name !== undefined && { name: input.name }),
  395. ...(input.restApiId !== undefined && { restApiId: input.restApiId }),
  396. ...(input.stage !== undefined && { stage: input.stage }),
  397. ...(input.template !== undefined && { template: input.template }),
  398. ...(input.templateSkipList !== undefined && {
  399. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  400. }),
  401. ...(input.title !== undefined && { title: input.title }),
  402. });
  403. const { hostname, protocol = "https", port } = await context.endpoint();
  404. return new __HttpRequest({
  405. protocol,
  406. hostname,
  407. port,
  408. method: "POST",
  409. headers,
  410. path: resolvedPath,
  411. body,
  412. });
  413. };
  414. export const serializeAws_restJson1CreateDeploymentCommand = async (
  415. input: CreateDeploymentCommandInput,
  416. context: __SerdeContext
  417. ): Promise<__HttpRequest> => {
  418. const headers: any = {
  419. "Content-Type": "application/json",
  420. };
  421. let resolvedPath = "/restapis/{restApiId}/deployments";
  422. if (input.restApiId !== undefined) {
  423. const labelValue: string = input.restApiId;
  424. if (labelValue.length <= 0) {
  425. throw new Error("Empty value provided for input HTTP label: restApiId.");
  426. }
  427. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  428. } else {
  429. throw new Error("No value provided for input HTTP label: restApiId.");
  430. }
  431. let body: any;
  432. body = JSON.stringify({
  433. ...(input.cacheClusterEnabled !== undefined && { cacheClusterEnabled: input.cacheClusterEnabled }),
  434. ...(input.cacheClusterSize !== undefined && { cacheClusterSize: input.cacheClusterSize }),
  435. ...(input.canarySettings !== undefined && {
  436. canarySettings: serializeAws_restJson1DeploymentCanarySettings(input.canarySettings, context),
  437. }),
  438. ...(input.description !== undefined && { description: input.description }),
  439. ...(input.name !== undefined && { name: input.name }),
  440. ...(input.stageDescription !== undefined && { stageDescription: input.stageDescription }),
  441. ...(input.stageName !== undefined && { stageName: input.stageName }),
  442. ...(input.template !== undefined && { template: input.template }),
  443. ...(input.templateSkipList !== undefined && {
  444. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  445. }),
  446. ...(input.title !== undefined && { title: input.title }),
  447. ...(input.tracingEnabled !== undefined && { tracingEnabled: input.tracingEnabled }),
  448. ...(input.variables !== undefined && {
  449. variables: serializeAws_restJson1MapOfStringToString(input.variables, context),
  450. }),
  451. });
  452. const { hostname, protocol = "https", port } = await context.endpoint();
  453. return new __HttpRequest({
  454. protocol,
  455. hostname,
  456. port,
  457. method: "POST",
  458. headers,
  459. path: resolvedPath,
  460. body,
  461. });
  462. };
  463. export const serializeAws_restJson1CreateDocumentationPartCommand = async (
  464. input: CreateDocumentationPartCommandInput,
  465. context: __SerdeContext
  466. ): Promise<__HttpRequest> => {
  467. const headers: any = {
  468. "Content-Type": "application/json",
  469. };
  470. let resolvedPath = "/restapis/{restApiId}/documentation/parts";
  471. if (input.restApiId !== undefined) {
  472. const labelValue: string = input.restApiId;
  473. if (labelValue.length <= 0) {
  474. throw new Error("Empty value provided for input HTTP label: restApiId.");
  475. }
  476. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  477. } else {
  478. throw new Error("No value provided for input HTTP label: restApiId.");
  479. }
  480. let body: any;
  481. body = JSON.stringify({
  482. ...(input.location !== undefined && {
  483. location: serializeAws_restJson1DocumentationPartLocation(input.location, context),
  484. }),
  485. ...(input.name !== undefined && { name: input.name }),
  486. ...(input.properties !== undefined && { properties: input.properties }),
  487. ...(input.template !== undefined && { template: input.template }),
  488. ...(input.templateSkipList !== undefined && {
  489. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  490. }),
  491. ...(input.title !== undefined && { title: input.title }),
  492. });
  493. const { hostname, protocol = "https", port } = await context.endpoint();
  494. return new __HttpRequest({
  495. protocol,
  496. hostname,
  497. port,
  498. method: "POST",
  499. headers,
  500. path: resolvedPath,
  501. body,
  502. });
  503. };
  504. export const serializeAws_restJson1CreateDocumentationVersionCommand = async (
  505. input: CreateDocumentationVersionCommandInput,
  506. context: __SerdeContext
  507. ): Promise<__HttpRequest> => {
  508. const headers: any = {
  509. "Content-Type": "application/json",
  510. };
  511. let resolvedPath = "/restapis/{restApiId}/documentation/versions";
  512. if (input.restApiId !== undefined) {
  513. const labelValue: string = input.restApiId;
  514. if (labelValue.length <= 0) {
  515. throw new Error("Empty value provided for input HTTP label: restApiId.");
  516. }
  517. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  518. } else {
  519. throw new Error("No value provided for input HTTP label: restApiId.");
  520. }
  521. let body: any;
  522. body = JSON.stringify({
  523. ...(input.description !== undefined && { description: input.description }),
  524. ...(input.documentationVersion !== undefined && { documentationVersion: input.documentationVersion }),
  525. ...(input.name !== undefined && { name: input.name }),
  526. ...(input.stageName !== undefined && { stageName: input.stageName }),
  527. ...(input.template !== undefined && { template: input.template }),
  528. ...(input.templateSkipList !== undefined && {
  529. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  530. }),
  531. ...(input.title !== undefined && { title: input.title }),
  532. });
  533. const { hostname, protocol = "https", port } = await context.endpoint();
  534. return new __HttpRequest({
  535. protocol,
  536. hostname,
  537. port,
  538. method: "POST",
  539. headers,
  540. path: resolvedPath,
  541. body,
  542. });
  543. };
  544. export const serializeAws_restJson1CreateDomainNameCommand = async (
  545. input: CreateDomainNameCommandInput,
  546. context: __SerdeContext
  547. ): Promise<__HttpRequest> => {
  548. const headers: any = {
  549. "Content-Type": "application/json",
  550. };
  551. let resolvedPath = "/domainnames";
  552. let body: any;
  553. body = JSON.stringify({
  554. ...(input.certificateArn !== undefined && { certificateArn: input.certificateArn }),
  555. ...(input.certificateBody !== undefined && { certificateBody: input.certificateBody }),
  556. ...(input.certificateChain !== undefined && { certificateChain: input.certificateChain }),
  557. ...(input.certificateName !== undefined && { certificateName: input.certificateName }),
  558. ...(input.certificatePrivateKey !== undefined && { certificatePrivateKey: input.certificatePrivateKey }),
  559. ...(input.domainName !== undefined && { domainName: input.domainName }),
  560. ...(input.endpointConfiguration !== undefined && {
  561. endpointConfiguration: serializeAws_restJson1EndpointConfiguration(input.endpointConfiguration, context),
  562. }),
  563. ...(input.name !== undefined && { name: input.name }),
  564. ...(input.regionalCertificateArn !== undefined && { regionalCertificateArn: input.regionalCertificateArn }),
  565. ...(input.regionalCertificateName !== undefined && { regionalCertificateName: input.regionalCertificateName }),
  566. ...(input.securityPolicy !== undefined && { securityPolicy: input.securityPolicy }),
  567. ...(input.tags !== undefined && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }),
  568. ...(input.template !== undefined && { template: input.template }),
  569. ...(input.templateSkipList !== undefined && {
  570. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  571. }),
  572. ...(input.title !== undefined && { title: input.title }),
  573. });
  574. const { hostname, protocol = "https", port } = await context.endpoint();
  575. return new __HttpRequest({
  576. protocol,
  577. hostname,
  578. port,
  579. method: "POST",
  580. headers,
  581. path: resolvedPath,
  582. body,
  583. });
  584. };
  585. export const serializeAws_restJson1CreateModelCommand = async (
  586. input: CreateModelCommandInput,
  587. context: __SerdeContext
  588. ): Promise<__HttpRequest> => {
  589. const headers: any = {
  590. "Content-Type": "application/json",
  591. };
  592. let resolvedPath = "/restapis/{restApiId}/models";
  593. if (input.restApiId !== undefined) {
  594. const labelValue: string = input.restApiId;
  595. if (labelValue.length <= 0) {
  596. throw new Error("Empty value provided for input HTTP label: restApiId.");
  597. }
  598. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  599. } else {
  600. throw new Error("No value provided for input HTTP label: restApiId.");
  601. }
  602. let body: any;
  603. body = JSON.stringify({
  604. ...(input.contentType !== undefined && { contentType: input.contentType }),
  605. ...(input.description !== undefined && { description: input.description }),
  606. ...(input.name !== undefined && { name: input.name }),
  607. ...(input.schema !== undefined && { schema: input.schema }),
  608. ...(input.template !== undefined && { template: input.template }),
  609. ...(input.templateSkipList !== undefined && {
  610. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  611. }),
  612. ...(input.title !== undefined && { title: input.title }),
  613. });
  614. const { hostname, protocol = "https", port } = await context.endpoint();
  615. return new __HttpRequest({
  616. protocol,
  617. hostname,
  618. port,
  619. method: "POST",
  620. headers,
  621. path: resolvedPath,
  622. body,
  623. });
  624. };
  625. export const serializeAws_restJson1CreateRequestValidatorCommand = async (
  626. input: CreateRequestValidatorCommandInput,
  627. context: __SerdeContext
  628. ): Promise<__HttpRequest> => {
  629. const headers: any = {
  630. "Content-Type": "application/json",
  631. };
  632. let resolvedPath = "/restapis/{restApiId}/requestvalidators";
  633. if (input.restApiId !== undefined) {
  634. const labelValue: string = input.restApiId;
  635. if (labelValue.length <= 0) {
  636. throw new Error("Empty value provided for input HTTP label: restApiId.");
  637. }
  638. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  639. } else {
  640. throw new Error("No value provided for input HTTP label: restApiId.");
  641. }
  642. let body: any;
  643. body = JSON.stringify({
  644. ...(input.name !== undefined && { name: input.name }),
  645. ...(input.template !== undefined && { template: input.template }),
  646. ...(input.templateSkipList !== undefined && {
  647. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  648. }),
  649. ...(input.title !== undefined && { title: input.title }),
  650. ...(input.validateRequestBody !== undefined && { validateRequestBody: input.validateRequestBody }),
  651. ...(input.validateRequestParameters !== undefined && {
  652. validateRequestParameters: input.validateRequestParameters,
  653. }),
  654. });
  655. const { hostname, protocol = "https", port } = await context.endpoint();
  656. return new __HttpRequest({
  657. protocol,
  658. hostname,
  659. port,
  660. method: "POST",
  661. headers,
  662. path: resolvedPath,
  663. body,
  664. });
  665. };
  666. export const serializeAws_restJson1CreateResourceCommand = async (
  667. input: CreateResourceCommandInput,
  668. context: __SerdeContext
  669. ): Promise<__HttpRequest> => {
  670. const headers: any = {
  671. "Content-Type": "application/json",
  672. };
  673. let resolvedPath = "/restapis/{restApiId}/resources/{parentId}";
  674. if (input.parentId !== undefined) {
  675. const labelValue: string = input.parentId;
  676. if (labelValue.length <= 0) {
  677. throw new Error("Empty value provided for input HTTP label: parentId.");
  678. }
  679. resolvedPath = resolvedPath.replace("{parentId}", __extendedEncodeURIComponent(labelValue));
  680. } else {
  681. throw new Error("No value provided for input HTTP label: parentId.");
  682. }
  683. if (input.restApiId !== undefined) {
  684. const labelValue: string = input.restApiId;
  685. if (labelValue.length <= 0) {
  686. throw new Error("Empty value provided for input HTTP label: restApiId.");
  687. }
  688. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  689. } else {
  690. throw new Error("No value provided for input HTTP label: restApiId.");
  691. }
  692. let body: any;
  693. body = JSON.stringify({
  694. ...(input.name !== undefined && { name: input.name }),
  695. ...(input.pathPart !== undefined && { pathPart: input.pathPart }),
  696. ...(input.template !== undefined && { template: input.template }),
  697. ...(input.templateSkipList !== undefined && {
  698. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  699. }),
  700. ...(input.title !== undefined && { title: input.title }),
  701. });
  702. const { hostname, protocol = "https", port } = await context.endpoint();
  703. return new __HttpRequest({
  704. protocol,
  705. hostname,
  706. port,
  707. method: "POST",
  708. headers,
  709. path: resolvedPath,
  710. body,
  711. });
  712. };
  713. export const serializeAws_restJson1CreateRestApiCommand = async (
  714. input: CreateRestApiCommandInput,
  715. context: __SerdeContext
  716. ): Promise<__HttpRequest> => {
  717. const headers: any = {
  718. "Content-Type": "application/json",
  719. };
  720. let resolvedPath = "/restapis";
  721. let body: any;
  722. body = JSON.stringify({
  723. ...(input.apiKeySource !== undefined && { apiKeySource: input.apiKeySource }),
  724. ...(input.binaryMediaTypes !== undefined && {
  725. binaryMediaTypes: serializeAws_restJson1ListOfString(input.binaryMediaTypes, context),
  726. }),
  727. ...(input.cloneFrom !== undefined && { cloneFrom: input.cloneFrom }),
  728. ...(input.description !== undefined && { description: input.description }),
  729. ...(input.endpointConfiguration !== undefined && {
  730. endpointConfiguration: serializeAws_restJson1EndpointConfiguration(input.endpointConfiguration, context),
  731. }),
  732. ...(input.minimumCompressionSize !== undefined && { minimumCompressionSize: input.minimumCompressionSize }),
  733. ...(input.name !== undefined && { name: input.name }),
  734. ...(input.policy !== undefined && { policy: input.policy }),
  735. ...(input.tags !== undefined && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }),
  736. ...(input.template !== undefined && { template: input.template }),
  737. ...(input.templateSkipList !== undefined && {
  738. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  739. }),
  740. ...(input.title !== undefined && { title: input.title }),
  741. ...(input.version !== undefined && { version: input.version }),
  742. });
  743. const { hostname, protocol = "https", port } = await context.endpoint();
  744. return new __HttpRequest({
  745. protocol,
  746. hostname,
  747. port,
  748. method: "POST",
  749. headers,
  750. path: resolvedPath,
  751. body,
  752. });
  753. };
  754. export const serializeAws_restJson1CreateStageCommand = async (
  755. input: CreateStageCommandInput,
  756. context: __SerdeContext
  757. ): Promise<__HttpRequest> => {
  758. const headers: any = {
  759. "Content-Type": "application/json",
  760. };
  761. let resolvedPath = "/restapis/{restApiId}/stages";
  762. if (input.restApiId !== undefined) {
  763. const labelValue: string = input.restApiId;
  764. if (labelValue.length <= 0) {
  765. throw new Error("Empty value provided for input HTTP label: restApiId.");
  766. }
  767. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  768. } else {
  769. throw new Error("No value provided for input HTTP label: restApiId.");
  770. }
  771. let body: any;
  772. body = JSON.stringify({
  773. ...(input.cacheClusterEnabled !== undefined && { cacheClusterEnabled: input.cacheClusterEnabled }),
  774. ...(input.cacheClusterSize !== undefined && { cacheClusterSize: input.cacheClusterSize }),
  775. ...(input.canarySettings !== undefined && {
  776. canarySettings: serializeAws_restJson1CanarySettings(input.canarySettings, context),
  777. }),
  778. ...(input.deploymentId !== undefined && { deploymentId: input.deploymentId }),
  779. ...(input.description !== undefined && { description: input.description }),
  780. ...(input.documentationVersion !== undefined && { documentationVersion: input.documentationVersion }),
  781. ...(input.name !== undefined && { name: input.name }),
  782. ...(input.stageName !== undefined && { stageName: input.stageName }),
  783. ...(input.tags !== undefined && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }),
  784. ...(input.template !== undefined && { template: input.template }),
  785. ...(input.templateSkipList !== undefined && {
  786. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  787. }),
  788. ...(input.title !== undefined && { title: input.title }),
  789. ...(input.tracingEnabled !== undefined && { tracingEnabled: input.tracingEnabled }),
  790. ...(input.variables !== undefined && {
  791. variables: serializeAws_restJson1MapOfStringToString(input.variables, context),
  792. }),
  793. });
  794. const { hostname, protocol = "https", port } = await context.endpoint();
  795. return new __HttpRequest({
  796. protocol,
  797. hostname,
  798. port,
  799. method: "POST",
  800. headers,
  801. path: resolvedPath,
  802. body,
  803. });
  804. };
  805. export const serializeAws_restJson1CreateUsagePlanCommand = async (
  806. input: CreateUsagePlanCommandInput,
  807. context: __SerdeContext
  808. ): Promise<__HttpRequest> => {
  809. const headers: any = {
  810. "Content-Type": "application/json",
  811. };
  812. let resolvedPath = "/usageplans";
  813. let body: any;
  814. body = JSON.stringify({
  815. ...(input.apiStages !== undefined && { apiStages: serializeAws_restJson1ListOfApiStage(input.apiStages, context) }),
  816. ...(input.description !== undefined && { description: input.description }),
  817. ...(input.name !== undefined && { name: input.name }),
  818. ...(input.quota !== undefined && { quota: serializeAws_restJson1QuotaSettings(input.quota, context) }),
  819. ...(input.tags !== undefined && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }),
  820. ...(input.template !== undefined && { template: input.template }),
  821. ...(input.templateSkipList !== undefined && {
  822. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  823. }),
  824. ...(input.throttle !== undefined && { throttle: serializeAws_restJson1ThrottleSettings(input.throttle, context) }),
  825. ...(input.title !== undefined && { title: input.title }),
  826. });
  827. const { hostname, protocol = "https", port } = await context.endpoint();
  828. return new __HttpRequest({
  829. protocol,
  830. hostname,
  831. port,
  832. method: "POST",
  833. headers,
  834. path: resolvedPath,
  835. body,
  836. });
  837. };
  838. export const serializeAws_restJson1CreateUsagePlanKeyCommand = async (
  839. input: CreateUsagePlanKeyCommandInput,
  840. context: __SerdeContext
  841. ): Promise<__HttpRequest> => {
  842. const headers: any = {
  843. "Content-Type": "application/json",
  844. };
  845. let resolvedPath = "/usageplans/{usagePlanId}/keys";
  846. if (input.usagePlanId !== undefined) {
  847. const labelValue: string = input.usagePlanId;
  848. if (labelValue.length <= 0) {
  849. throw new Error("Empty value provided for input HTTP label: usagePlanId.");
  850. }
  851. resolvedPath = resolvedPath.replace("{usagePlanId}", __extendedEncodeURIComponent(labelValue));
  852. } else {
  853. throw new Error("No value provided for input HTTP label: usagePlanId.");
  854. }
  855. let body: any;
  856. body = JSON.stringify({
  857. ...(input.keyId !== undefined && { keyId: input.keyId }),
  858. ...(input.keyType !== undefined && { keyType: input.keyType }),
  859. ...(input.name !== undefined && { name: input.name }),
  860. ...(input.template !== undefined && { template: input.template }),
  861. ...(input.templateSkipList !== undefined && {
  862. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  863. }),
  864. ...(input.title !== undefined && { title: input.title }),
  865. });
  866. const { hostname, protocol = "https", port } = await context.endpoint();
  867. return new __HttpRequest({
  868. protocol,
  869. hostname,
  870. port,
  871. method: "POST",
  872. headers,
  873. path: resolvedPath,
  874. body,
  875. });
  876. };
  877. export const serializeAws_restJson1CreateVpcLinkCommand = async (
  878. input: CreateVpcLinkCommandInput,
  879. context: __SerdeContext
  880. ): Promise<__HttpRequest> => {
  881. const headers: any = {
  882. "Content-Type": "application/json",
  883. };
  884. let resolvedPath = "/vpclinks";
  885. let body: any;
  886. body = JSON.stringify({
  887. ...(input.description !== undefined && { description: input.description }),
  888. ...(input.name !== undefined && { name: input.name }),
  889. ...(input.tags !== undefined && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }),
  890. ...(input.targetArns !== undefined && {
  891. targetArns: serializeAws_restJson1ListOfString(input.targetArns, context),
  892. }),
  893. ...(input.template !== undefined && { template: input.template }),
  894. ...(input.templateSkipList !== undefined && {
  895. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  896. }),
  897. ...(input.title !== undefined && { title: input.title }),
  898. });
  899. const { hostname, protocol = "https", port } = await context.endpoint();
  900. return new __HttpRequest({
  901. protocol,
  902. hostname,
  903. port,
  904. method: "POST",
  905. headers,
  906. path: resolvedPath,
  907. body,
  908. });
  909. };
  910. export const serializeAws_restJson1DeleteApiKeyCommand = async (
  911. input: DeleteApiKeyCommandInput,
  912. context: __SerdeContext
  913. ): Promise<__HttpRequest> => {
  914. const headers: any = {
  915. "Content-Type": "application/json",
  916. };
  917. let resolvedPath = "/apikeys/{apiKey}";
  918. if (input.apiKey !== undefined) {
  919. const labelValue: string = input.apiKey;
  920. if (labelValue.length <= 0) {
  921. throw new Error("Empty value provided for input HTTP label: apiKey.");
  922. }
  923. resolvedPath = resolvedPath.replace("{apiKey}", __extendedEncodeURIComponent(labelValue));
  924. } else {
  925. throw new Error("No value provided for input HTTP label: apiKey.");
  926. }
  927. let body: any;
  928. body = JSON.stringify({
  929. ...(input.name !== undefined && { name: input.name }),
  930. ...(input.template !== undefined && { template: input.template }),
  931. ...(input.templateSkipList !== undefined && {
  932. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  933. }),
  934. ...(input.title !== undefined && { title: input.title }),
  935. });
  936. const { hostname, protocol = "https", port } = await context.endpoint();
  937. return new __HttpRequest({
  938. protocol,
  939. hostname,
  940. port,
  941. method: "DELETE",
  942. headers,
  943. path: resolvedPath,
  944. body,
  945. });
  946. };
  947. export const serializeAws_restJson1DeleteAuthorizerCommand = async (
  948. input: DeleteAuthorizerCommandInput,
  949. context: __SerdeContext
  950. ): Promise<__HttpRequest> => {
  951. const headers: any = {
  952. "Content-Type": "application/json",
  953. };
  954. let resolvedPath = "/restapis/{restApiId}/authorizers/{authorizerId}";
  955. if (input.authorizerId !== undefined) {
  956. const labelValue: string = input.authorizerId;
  957. if (labelValue.length <= 0) {
  958. throw new Error("Empty value provided for input HTTP label: authorizerId.");
  959. }
  960. resolvedPath = resolvedPath.replace("{authorizerId}", __extendedEncodeURIComponent(labelValue));
  961. } else {
  962. throw new Error("No value provided for input HTTP label: authorizerId.");
  963. }
  964. if (input.restApiId !== undefined) {
  965. const labelValue: string = input.restApiId;
  966. if (labelValue.length <= 0) {
  967. throw new Error("Empty value provided for input HTTP label: restApiId.");
  968. }
  969. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  970. } else {
  971. throw new Error("No value provided for input HTTP label: restApiId.");
  972. }
  973. let body: any;
  974. body = JSON.stringify({
  975. ...(input.name !== undefined && { name: input.name }),
  976. ...(input.template !== undefined && { template: input.template }),
  977. ...(input.templateSkipList !== undefined && {
  978. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  979. }),
  980. ...(input.title !== undefined && { title: input.title }),
  981. });
  982. const { hostname, protocol = "https", port } = await context.endpoint();
  983. return new __HttpRequest({
  984. protocol,
  985. hostname,
  986. port,
  987. method: "DELETE",
  988. headers,
  989. path: resolvedPath,
  990. body,
  991. });
  992. };
  993. export const serializeAws_restJson1DeleteBasePathMappingCommand = async (
  994. input: DeleteBasePathMappingCommandInput,
  995. context: __SerdeContext
  996. ): Promise<__HttpRequest> => {
  997. const headers: any = {
  998. "Content-Type": "application/json",
  999. };
  1000. let resolvedPath = "/domainnames/{domainName}/basepathmappings/{basePath}";
  1001. if (input.domainName !== undefined) {
  1002. const labelValue: string = input.domainName;
  1003. if (labelValue.length <= 0) {
  1004. throw new Error("Empty value provided for input HTTP label: domainName.");
  1005. }
  1006. resolvedPath = resolvedPath.replace("{domainName}", __extendedEncodeURIComponent(labelValue));
  1007. } else {
  1008. throw new Error("No value provided for input HTTP label: domainName.");
  1009. }
  1010. if (input.basePath !== undefined) {
  1011. const labelValue: string = input.basePath;
  1012. if (labelValue.length <= 0) {
  1013. throw new Error("Empty value provided for input HTTP label: basePath.");
  1014. }
  1015. resolvedPath = resolvedPath.replace("{basePath}", __extendedEncodeURIComponent(labelValue));
  1016. } else {
  1017. throw new Error("No value provided for input HTTP label: basePath.");
  1018. }
  1019. let body: any;
  1020. body = JSON.stringify({
  1021. ...(input.name !== undefined && { name: input.name }),
  1022. ...(input.template !== undefined && { template: input.template }),
  1023. ...(input.templateSkipList !== undefined && {
  1024. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  1025. }),
  1026. ...(input.title !== undefined && { title: input.title }),
  1027. });
  1028. const { hostname, protocol = "https", port } = await context.endpoint();
  1029. return new __HttpRequest({
  1030. protocol,
  1031. hostname,
  1032. port,
  1033. method: "DELETE",
  1034. headers,
  1035. path: resolvedPath,
  1036. body,
  1037. });
  1038. };
  1039. export const serializeAws_restJson1DeleteClientCertificateCommand = async (
  1040. input: DeleteClientCertificateCommandInput,
  1041. context: __SerdeContext
  1042. ): Promise<__HttpRequest> => {
  1043. const headers: any = {
  1044. "Content-Type": "application/json",
  1045. };
  1046. let resolvedPath = "/clientcertificates/{clientCertificateId}";
  1047. if (input.clientCertificateId !== undefined) {
  1048. const labelValue: string = input.clientCertificateId;
  1049. if (labelValue.length <= 0) {
  1050. throw new Error("Empty value provided for input HTTP label: clientCertificateId.");
  1051. }
  1052. resolvedPath = resolvedPath.replace("{clientCertificateId}", __extendedEncodeURIComponent(labelValue));
  1053. } else {
  1054. throw new Error("No value provided for input HTTP label: clientCertificateId.");
  1055. }
  1056. let body: any;
  1057. body = JSON.stringify({
  1058. ...(input.name !== undefined && { name: input.name }),
  1059. ...(input.template !== undefined && { template: input.template }),
  1060. ...(input.templateSkipList !== undefined && {
  1061. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  1062. }),
  1063. ...(input.title !== undefined && { title: input.title }),
  1064. });
  1065. const { hostname, protocol = "https", port } = await context.endpoint();
  1066. return new __HttpRequest({
  1067. protocol,
  1068. hostname,
  1069. port,
  1070. method: "DELETE",
  1071. headers,
  1072. path: resolvedPath,
  1073. body,
  1074. });
  1075. };
  1076. export const serializeAws_restJson1DeleteDeploymentCommand = async (
  1077. input: DeleteDeploymentCommandInput,
  1078. context: __SerdeContext
  1079. ): Promise<__HttpRequest> => {
  1080. const headers: any = {
  1081. "Content-Type": "application/json",
  1082. };
  1083. let resolvedPath = "/restapis/{restApiId}/deployments/{deploymentId}";
  1084. if (input.deploymentId !== undefined) {
  1085. const labelValue: string = input.deploymentId;
  1086. if (labelValue.length <= 0) {
  1087. throw new Error("Empty value provided for input HTTP label: deploymentId.");
  1088. }
  1089. resolvedPath = resolvedPath.replace("{deploymentId}", __extendedEncodeURIComponent(labelValue));
  1090. } else {
  1091. throw new Error("No value provided for input HTTP label: deploymentId.");
  1092. }
  1093. if (input.restApiId !== undefined) {
  1094. const labelValue: string = input.restApiId;
  1095. if (labelValue.length <= 0) {
  1096. throw new Error("Empty value provided for input HTTP label: restApiId.");
  1097. }
  1098. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  1099. } else {
  1100. throw new Error("No value provided for input HTTP label: restApiId.");
  1101. }
  1102. let body: any;
  1103. body = JSON.stringify({
  1104. ...(input.name !== undefined && { name: input.name }),
  1105. ...(input.template !== undefined && { template: input.template }),
  1106. ...(input.templateSkipList !== undefined && {
  1107. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  1108. }),
  1109. ...(input.title !== undefined && { title: input.title }),
  1110. });
  1111. const { hostname, protocol = "https", port } = await context.endpoint();
  1112. return new __HttpRequest({
  1113. protocol,
  1114. hostname,
  1115. port,
  1116. method: "DELETE",
  1117. headers,
  1118. path: resolvedPath,
  1119. body,
  1120. });
  1121. };
  1122. export const serializeAws_restJson1DeleteDocumentationPartCommand = async (
  1123. input: DeleteDocumentationPartCommandInput,
  1124. context: __SerdeContext
  1125. ): Promise<__HttpRequest> => {
  1126. const headers: any = {
  1127. "Content-Type": "application/json",
  1128. };
  1129. let resolvedPath = "/restapis/{restApiId}/documentation/parts/{documentationPartId}";
  1130. if (input.restApiId !== undefined) {
  1131. const labelValue: string = input.restApiId;
  1132. if (labelValue.length <= 0) {
  1133. throw new Error("Empty value provided for input HTTP label: restApiId.");
  1134. }
  1135. resolvedPath = resolvedPath.replace("{restApiId}", __extendedEncodeURIComponent(labelValue));
  1136. } else {
  1137. throw new Error("No value provided for input HTTP label: restApiId.");
  1138. }
  1139. if (input.documentationPartId !== undefined) {
  1140. const labelValue: string = input.documentationPartId;
  1141. if (labelValue.length <= 0) {
  1142. throw new Error("Empty value provided for input HTTP label: documentationPartId.");
  1143. }
  1144. resolvedPath = resolvedPath.replace("{documentationPartId}", __extendedEncodeURIComponent(labelValue));
  1145. } else {
  1146. throw new Error("No value provided for input HTTP label: documentationPartId.");
  1147. }
  1148. let body: any;
  1149. body = JSON.stringify({
  1150. ...(input.name !== undefined && { name: input.name }),
  1151. ...(input.template !== undefined && { template: input.template }),
  1152. ...(input.templateSkipList !== undefined && {
  1153. templateSkipList: serializeAws_restJson1ListOfString(input.templateSkipList, context),
  1154. }),
  1155. ...(input.title !== undefined && { title: input.title }),
  1156. });
  1157. const { hostname, pr