From 63a041ff93445987d0e6dc19935ad75717ab3828 Mon Sep 17 00:00:00 2001 From: JordonPhillips Date: Fri, 2 Jul 2021 18:30:53 +0200 Subject: [PATCH] chore: update generated code --- .../protocols/Aws_restJson1.ts | 124 +- clients/client-amp/protocols/Aws_restJson1.ts | 23 +- .../client-amplify/protocols/Aws_restJson1.ts | 174 +-- .../protocols/Aws_restJson1.ts | 134 ++- .../protocols/Aws_restJson1.ts | 611 ++++++---- .../protocols/Aws_restJson1.ts | 15 +- .../protocols/Aws_restJson1.ts | 363 +++--- .../protocols/Aws_restJson1.ts | 204 ++-- .../protocols/Aws_restJson1.ts | 169 ++- .../client-appflow/protocols/Aws_restJson1.ts | 78 +- .../protocols/Aws_restJson1.ts | 41 +- .../protocols/Aws_restJson1.ts | 27 +- .../client-appsync/protocols/Aws_restJson1.ts | 198 +-- .../protocols/Aws_restJson1.ts | 243 ++-- .../client-backup/protocols/Aws_restJson1.ts | 250 ++-- .../client-batch/protocols/Aws_restJson1.ts | 83 +- .../client-braket/protocols/Aws_restJson1.ts | 38 +- .../client-chime/protocols/Aws_restJson1.ts | 940 +++++++++------ .../protocols/Aws_restJson1.ts | 389 ++++-- .../protocols/Aws_restXml.ts | 429 ++++--- .../protocols/Aws_restJson1.ts | 13 +- .../protocols/Aws_restJson1.ts | 152 +-- .../protocols/Aws_restJson1.ts | 64 +- .../protocols/Aws_restJson1.ts | 124 +- .../protocols/Aws_restJson1.ts | 53 +- .../protocols/Aws_restJson1.ts | 91 +- .../protocols/Aws_restJson1.ts | 6 +- .../client-connect/protocols/Aws_restJson1.ts | 536 +++++---- .../protocols/Aws_restJson1.ts | 34 +- .../protocols/Aws_restJson1.ts | 145 ++- .../protocols/Aws_restJson1.ts | 164 +-- .../protocols/Aws_restJson1.ts | 107 +- .../protocols/Aws_restJson1.ts | 61 +- .../protocols/Aws_restJson1.ts | 89 +- clients/client-dlm/protocols/Aws_restJson1.ts | 32 +- clients/client-ebs/protocols/Aws_restJson1.ts | 32 +- clients/client-efs/protocols/Aws_restJson1.ts | 142 ++- clients/client-eks/protocols/Aws_restJson1.ts | 165 ++- .../protocols/Aws_restJson1.ts | 26 +- .../protocols/Aws_restJson1.ts | 75 +- .../protocols/Aws_restJson1.ts | 208 ++-- .../protocols/Aws_restJson1.ts | 76 +- .../protocols/Aws_restJson1.ts | 14 +- .../protocols/Aws_restJson1.ts | 35 +- clients/client-fis/protocols/Aws_restJson1.ts | 59 +- .../client-glacier/protocols/Aws_restJson1.ts | 183 ++- .../protocols/Aws_restJson1.ts | 502 +++++--- .../protocols/Aws_restJson1.ts | 121 +- .../protocols/Aws_restJson1.ts | 110 +- .../protocols/Aws_restJson1.ts | 291 +++-- .../protocols/Aws_restJson1.ts | 69 +- .../protocols/Aws_restJson1.ts | 210 ++-- .../protocols/Aws_restJson1.ts | 59 +- .../protocols/Aws_restJson1.ts | 78 +- .../protocols/Aws_restJson1.ts | 25 +- .../protocols/Aws_restJson1.ts | 47 +- .../protocols/Aws_restJson1.ts | 117 +- .../protocols/Aws_restJson1.ts | 19 +- .../protocols/Aws_restJson1.ts | 258 ++-- clients/client-iot/protocols/Aws_restJson1.ts | 1061 ++++++++++------- .../protocols/Aws_restJson1.ts | 150 +-- .../protocols/Aws_restJson1.ts | 63 +- .../protocols/Aws_restJson1.ts | 35 +- .../protocols/Aws_restJson1.ts | 258 ++-- clients/client-ivs/protocols/Aws_restJson1.ts | 108 +- .../client-kafka/protocols/Aws_restJson1.ts | 141 ++- .../protocols/Aws_restJson1.ts | 22 +- .../protocols/Aws_restJson1.ts | 4 +- .../protocols/Aws_restJson1.ts | 10 +- .../protocols/Aws_restJson1.ts | 78 +- .../client-lambda/protocols/Aws_restJson1.ts | 324 +++-- .../protocols/Aws_restJson1.ts | 179 +-- .../protocols/Aws_restJson1.ts | 278 +++-- .../protocols/Aws_restJson1.ts | 30 +- .../protocols/Aws_restJson1.ts | 36 +- .../protocols/Aws_restJson1.ts | 236 ++-- .../protocols/Aws_restJson1.ts | 103 +- .../protocols/Aws_restJson1.ts | 103 +- .../client-macie2/protocols/Aws_restJson1.ts | 237 ++-- .../protocols/Aws_restJson1.ts | 111 +- .../protocols/Aws_restJson1.ts | 24 +- .../protocols/Aws_restJson1.ts | 143 ++- .../protocols/Aws_restJson1.ts | 110 +- .../protocols/Aws_restJson1.ts | 270 +++-- .../protocols/Aws_restJson1.ts | 73 +- .../protocols/Aws_restJson1.ts | 80 +- .../protocols/Aws_restJson1.ts | 20 +- .../protocols/Aws_restJson1.ts | 152 ++- clients/client-mgn/protocols/Aws_restJson1.ts | 110 +- .../client-mobile/protocols/Aws_restJson1.ts | 36 +- clients/client-mq/protocols/Aws_restJson1.ts | 101 +- .../client-mwaa/protocols/Aws_restJson1.ts | 45 +- .../protocols/Aws_restJson1.ts | 191 +-- .../client-nimble/protocols/Aws_restJson1.ts | 255 ++-- .../protocols/Aws_restJson1.ts | 41 +- .../protocols/Aws_restJson1.ts | 12 +- .../protocols/Aws_restJson1.ts | 8 +- .../protocols/Aws_restJson1.ts | 221 ++-- .../protocols/Aws_restJson1.ts | 39 +- .../protocols/Aws_restJson1.ts | 589 +++++---- .../client-polly/protocols/Aws_restJson1.ts | 37 +- .../client-qldb/protocols/Aws_restJson1.ts | 93 +- .../protocols/Aws_restJson1.ts | 639 ++++++---- clients/client-ram/protocols/Aws_restJson1.ts | 107 +- .../protocols/Aws_restJson1.ts | 24 +- .../protocols/Aws_restJson1.ts | 64 +- .../protocols/Aws_restJson1.ts | 243 ++-- .../client-route-53/protocols/Aws_restXml.ts | 334 ++++-- .../protocols/Aws_restXml.ts | 255 ++-- clients/client-s3/protocols/Aws_restXml.ts | 368 +++--- .../protocols/Aws_restJson1.ts | 15 +- .../protocols/Aws_restJson1.ts | 22 +- .../protocols/Aws_restJson1.ts | 8 +- .../protocols/Aws_restJson1.ts | 19 +- .../protocols/Aws_restJson1.ts | 5 +- .../protocols/Aws_restJson1.ts | 39 +- .../client-schemas/protocols/Aws_restJson1.ts | 157 ++- .../protocols/Aws_restJson1.ts | 217 ++-- .../protocols/Aws_restJson1.ts | 71 +- .../protocols/Aws_restJson1.ts | 98 +- .../client-sesv2/protocols/Aws_restJson1.ts | 430 ++++--- .../client-signer/protocols/Aws_restJson1.ts | 80 +- .../protocols/Aws_restJson1.ts | 117 +- .../protocols/Aws_restJson1.ts | 12 +- clients/client-sso/protocols/Aws_restJson1.ts | 16 +- .../protocols/Aws_restJson1.ts | 52 +- .../protocols/Aws_restJson1.ts | 9 +- .../protocols/Aws_restJson1.ts | 155 ++- .../protocols/Aws_restJson1.ts | 209 ++-- .../protocols/Aws_restJson1.ts | 147 ++- .../protocols/Aws_restJson1.ts | 8 +- .../client-xray/protocols/Aws_restJson1.ts | 110 +- .../aws-ec2/tests/functional/ec2query.spec.ts | 2 + .../tests/functional/awsjson1_0.spec.ts | 2 + .../tests/functional/awsjson1_1.spec.ts | 2 + .../tests/functional/awsquery.spec.ts | 2 + .../aws-restjson/protocols/Aws_restJson1.ts | 196 +-- .../tests/functional/restjson1.spec.ts | 2 + .../aws-restxml/protocols/Aws_restXml.ts | 235 ++-- .../tests/functional/restxml.spec.ts | 3 + 140 files changed, 11686 insertions(+), 8130 deletions(-) diff --git a/clients/client-accessanalyzer/protocols/Aws_restJson1.ts b/clients/client-accessanalyzer/protocols/Aws_restJson1.ts index a6687f5692283..dea45e353b2fb 100644 --- a/clients/client-accessanalyzer/protocols/Aws_restJson1.ts +++ b/clients/client-accessanalyzer/protocols/Aws_restJson1.ts @@ -129,17 +129,17 @@ export const serializeAws_restJson1ApplyArchiveRuleCommand = async ( input: ApplyArchiveRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/archive-rule"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/archive-rule"; let body: any; body = JSON.stringify({ ...(input.analyzerArn !== undefined && input.analyzerArn !== null && { analyzerArn: input.analyzerArn }), clientToken: input.clientToken ?? generateIdempotencyToken(), ...(input.ruleName !== undefined && input.ruleName !== null && { ruleName: input.ruleName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -155,8 +155,10 @@ export const serializeAws_restJson1CancelPolicyGenerationCommand = async ( input: CancelPolicyGenerationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policy/generation/{jobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy/generation/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -167,7 +169,6 @@ export const serializeAws_restJson1CancelPolicyGenerationCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -183,10 +184,11 @@ export const serializeAws_restJson1CreateAccessPreviewCommand = async ( input: CreateAccessPreviewCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/access-preview"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-preview"; let body: any; body = JSON.stringify({ ...(input.analyzerArn !== undefined && input.analyzerArn !== null && { analyzerArn: input.analyzerArn }), @@ -196,7 +198,6 @@ export const serializeAws_restJson1CreateAccessPreviewCommand = async ( configurations: serializeAws_restJson1ConfigurationsMap(input.configurations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -212,10 +213,11 @@ export const serializeAws_restJson1CreateAnalyzerCommand = async ( input: CreateAnalyzerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/analyzer"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer"; let body: any; body = JSON.stringify({ ...(input.analyzerName !== undefined && input.analyzerName !== null && { analyzerName: input.analyzerName }), @@ -228,7 +230,6 @@ export const serializeAws_restJson1CreateAnalyzerCommand = async ( input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -244,10 +245,12 @@ export const serializeAws_restJson1CreateArchiveRuleCommand = async ( input: CreateArchiveRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/analyzer/{analyzerName}/archive-rule"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer/{analyzerName}/archive-rule"; if (input.analyzerName !== undefined) { const labelValue: string = input.analyzerName; if (labelValue.length <= 0) { @@ -264,7 +267,6 @@ export const serializeAws_restJson1CreateArchiveRuleCommand = async ( input.filter !== null && { filter: serializeAws_restJson1FilterCriteriaMap(input.filter, context) }), ...(input.ruleName !== undefined && input.ruleName !== null && { ruleName: input.ruleName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -280,8 +282,9 @@ export const serializeAws_restJson1DeleteAnalyzerCommand = async ( input: DeleteAnalyzerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/analyzer/{analyzerName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer/{analyzerName}"; if (input.analyzerName !== undefined) { const labelValue: string = input.analyzerName; if (labelValue.length <= 0) { @@ -295,7 +298,6 @@ export const serializeAws_restJson1DeleteAnalyzerCommand = async ( ...(input.clientToken !== undefined && { clientToken: input.clientToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -312,8 +314,11 @@ export const serializeAws_restJson1DeleteArchiveRuleCommand = async ( input: DeleteArchiveRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/analyzer/{analyzerName}/archive-rule/{ruleName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/analyzer/{analyzerName}/archive-rule/{ruleName}"; if (input.analyzerName !== undefined) { const labelValue: string = input.analyzerName; if (labelValue.length <= 0) { @@ -336,7 +341,6 @@ export const serializeAws_restJson1DeleteArchiveRuleCommand = async ( ...(input.clientToken !== undefined && { clientToken: input.clientToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -353,8 +357,10 @@ export const serializeAws_restJson1GetAccessPreviewCommand = async ( input: GetAccessPreviewCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/access-preview/{accessPreviewId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-preview/{accessPreviewId}"; if (input.accessPreviewId !== undefined) { const labelValue: string = input.accessPreviewId; if (labelValue.length <= 0) { @@ -368,7 +374,6 @@ export const serializeAws_restJson1GetAccessPreviewCommand = async ( ...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -385,14 +390,14 @@ export const serializeAws_restJson1GetAnalyzedResourceCommand = async ( input: GetAnalyzedResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/analyzed-resource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analyzed-resource"; const query: any = { ...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn }), ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -409,8 +414,9 @@ export const serializeAws_restJson1GetAnalyzerCommand = async ( input: GetAnalyzerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/analyzer/{analyzerName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer/{analyzerName}"; if (input.analyzerName !== undefined) { const labelValue: string = input.analyzerName; if (labelValue.length <= 0) { @@ -421,7 +427,6 @@ export const serializeAws_restJson1GetAnalyzerCommand = async ( throw new Error("No value provided for input HTTP label: analyzerName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -437,8 +442,11 @@ export const serializeAws_restJson1GetArchiveRuleCommand = async ( input: GetArchiveRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/analyzer/{analyzerName}/archive-rule/{ruleName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/analyzer/{analyzerName}/archive-rule/{ruleName}"; if (input.analyzerName !== undefined) { const labelValue: string = input.analyzerName; if (labelValue.length <= 0) { @@ -458,7 +466,6 @@ export const serializeAws_restJson1GetArchiveRuleCommand = async ( throw new Error("No value provided for input HTTP label: ruleName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -474,8 +481,9 @@ export const serializeAws_restJson1GetFindingCommand = async ( input: GetFindingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/finding/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/finding/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -489,7 +497,6 @@ export const serializeAws_restJson1GetFindingCommand = async ( ...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -506,8 +513,10 @@ export const serializeAws_restJson1GetGeneratedPolicyCommand = async ( input: GetGeneratedPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policy/generation/{jobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy/generation/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -526,7 +535,6 @@ export const serializeAws_restJson1GetGeneratedPolicyCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -543,10 +551,12 @@ export const serializeAws_restJson1ListAccessPreviewFindingsCommand = async ( input: ListAccessPreviewFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/access-preview/{accessPreviewId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-preview/{accessPreviewId}"; if (input.accessPreviewId !== undefined) { const labelValue: string = input.accessPreviewId; if (labelValue.length <= 0) { @@ -564,7 +574,6 @@ export const serializeAws_restJson1ListAccessPreviewFindingsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -580,15 +589,15 @@ export const serializeAws_restJson1ListAccessPreviewsCommand = async ( input: ListAccessPreviewsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/access-preview"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-preview"; const query: any = { ...(input.analyzerArn !== undefined && { analyzerArn: input.analyzerArn }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -605,10 +614,11 @@ export const serializeAws_restJson1ListAnalyzedResourcesCommand = async ( input: ListAnalyzedResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/analyzed-resource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analyzed-resource"; let body: any; body = JSON.stringify({ ...(input.analyzerArn !== undefined && input.analyzerArn !== null && { analyzerArn: input.analyzerArn }), @@ -616,7 +626,6 @@ export const serializeAws_restJson1ListAnalyzedResourcesCommand = async ( ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), ...(input.resourceType !== undefined && input.resourceType !== null && { resourceType: input.resourceType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -632,15 +641,15 @@ export const serializeAws_restJson1ListAnalyzersCommand = async ( input: ListAnalyzersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/analyzer"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.type !== undefined && { type: input.type }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -657,8 +666,10 @@ export const serializeAws_restJson1ListArchiveRulesCommand = async ( input: ListArchiveRulesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/analyzer/{analyzerName}/archive-rule"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analyzer/{analyzerName}/archive-rule"; if (input.analyzerName !== undefined) { const labelValue: string = input.analyzerName; if (labelValue.length <= 0) { @@ -673,7 +684,6 @@ export const serializeAws_restJson1ListArchiveRulesCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -690,10 +700,11 @@ export const serializeAws_restJson1ListFindingsCommand = async ( input: ListFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/finding"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/finding"; let body: any; body = JSON.stringify({ ...(input.analyzerArn !== undefined && input.analyzerArn !== null && { analyzerArn: input.analyzerArn }), @@ -704,7 +715,6 @@ export const serializeAws_restJson1ListFindingsCommand = async ( ...(input.sort !== undefined && input.sort !== null && { sort: serializeAws_restJson1SortCriteria(input.sort, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -720,15 +730,15 @@ export const serializeAws_restJson1ListPolicyGenerationsCommand = async ( input: ListPolicyGenerationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policy/generation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy/generation"; const query: any = { ...(input.principalArn !== undefined && { principalArn: input.principalArn }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -745,8 +755,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -757,7 +768,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -773,10 +783,11 @@ export const serializeAws_restJson1StartPolicyGenerationCommand = async ( input: StartPolicyGenerationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/policy/generation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy/generation"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -789,7 +800,6 @@ export const serializeAws_restJson1StartPolicyGenerationCommand = async ( policyGenerationDetails: serializeAws_restJson1PolicyGenerationDetails(input.policyGenerationDetails, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -805,16 +815,16 @@ export const serializeAws_restJson1StartResourceScanCommand = async ( input: StartResourceScanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/resource/scan"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resource/scan"; let body: any; body = JSON.stringify({ ...(input.analyzerArn !== undefined && input.analyzerArn !== null && { analyzerArn: input.analyzerArn }), ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -830,10 +840,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -848,7 +859,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -864,8 +874,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -879,7 +890,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -896,10 +906,13 @@ export const serializeAws_restJson1UpdateArchiveRuleCommand = async ( input: UpdateArchiveRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/analyzer/{analyzerName}/archive-rule/{ruleName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/analyzer/{analyzerName}/archive-rule/{ruleName}"; if (input.analyzerName !== undefined) { const labelValue: string = input.analyzerName; if (labelValue.length <= 0) { @@ -924,7 +937,6 @@ export const serializeAws_restJson1UpdateArchiveRuleCommand = async ( ...(input.filter !== undefined && input.filter !== null && { filter: serializeAws_restJson1FilterCriteriaMap(input.filter, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -940,10 +952,11 @@ export const serializeAws_restJson1UpdateFindingsCommand = async ( input: UpdateFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/finding"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/finding"; let body: any; body = JSON.stringify({ ...(input.analyzerArn !== undefined && input.analyzerArn !== null && { analyzerArn: input.analyzerArn }), @@ -953,7 +966,6 @@ export const serializeAws_restJson1UpdateFindingsCommand = async ( ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -969,10 +981,11 @@ export const serializeAws_restJson1ValidatePolicyCommand = async ( input: ValidatePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/policy/validation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy/validation"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), @@ -984,7 +997,6 @@ export const serializeAws_restJson1ValidatePolicyCommand = async ( input.policyDocument !== null && { policyDocument: input.policyDocument }), ...(input.policyType !== undefined && input.policyType !== null && { policyType: input.policyType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-amp/protocols/Aws_restJson1.ts b/clients/client-amp/protocols/Aws_restJson1.ts index dd428ed4d0d2e..d3474ec66c841 100644 --- a/clients/client-amp/protocols/Aws_restJson1.ts +++ b/clients/client-amp/protocols/Aws_restJson1.ts @@ -37,16 +37,16 @@ export const serializeAws_restJson1CreateWorkspaceCommand = async ( input: CreateWorkspaceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workspaces"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces"; let body: any; body = JSON.stringify({ ...(input.alias !== undefined && input.alias !== null && { alias: input.alias }), clientToken: input.clientToken ?? generateIdempotencyToken(), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -62,8 +62,10 @@ export const serializeAws_restJson1DeleteWorkspaceCommand = async ( input: DeleteWorkspaceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workspaces/{workspaceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}"; if (input.workspaceId !== undefined) { const labelValue: string = input.workspaceId; if (labelValue.length <= 0) { @@ -77,7 +79,6 @@ export const serializeAws_restJson1DeleteWorkspaceCommand = async ( ...(input.clientToken !== undefined && { clientToken: input.clientToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -94,8 +95,10 @@ export const serializeAws_restJson1DescribeWorkspaceCommand = async ( input: DescribeWorkspaceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workspaces/{workspaceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}"; if (input.workspaceId !== undefined) { const labelValue: string = input.workspaceId; if (labelValue.length <= 0) { @@ -106,7 +109,6 @@ export const serializeAws_restJson1DescribeWorkspaceCommand = async ( throw new Error("No value provided for input HTTP label: workspaceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -122,15 +124,15 @@ export const serializeAws_restJson1ListWorkspacesCommand = async ( input: ListWorkspacesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workspaces"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.alias !== undefined && { alias: input.alias }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -147,10 +149,12 @@ export const serializeAws_restJson1UpdateWorkspaceAliasCommand = async ( input: UpdateWorkspaceAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workspaces/{workspaceId}/alias"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/alias"; if (input.workspaceId !== undefined) { const labelValue: string = input.workspaceId; if (labelValue.length <= 0) { @@ -165,7 +169,6 @@ export const serializeAws_restJson1UpdateWorkspaceAliasCommand = async ( ...(input.alias !== undefined && input.alias !== null && { alias: input.alias }), clientToken: input.clientToken ?? generateIdempotencyToken(), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-amplify/protocols/Aws_restJson1.ts b/clients/client-amplify/protocols/Aws_restJson1.ts index 327c849bc7a8e..81abca873b0b8 100644 --- a/clients/client-amplify/protocols/Aws_restJson1.ts +++ b/clients/client-amplify/protocols/Aws_restJson1.ts @@ -106,10 +106,11 @@ export const serializeAws_restJson1CreateAppCommand = async ( input: CreateAppCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps"; let body: any; body = JSON.stringify({ ...(input.accessToken !== undefined && input.accessToken !== null && { accessToken: input.accessToken }), @@ -154,7 +155,6 @@ export const serializeAws_restJson1CreateAppCommand = async ( ...(input.repository !== undefined && input.repository !== null && { repository: input.repository }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -170,10 +170,12 @@ export const serializeAws_restJson1CreateBackendEnvironmentCommand = async ( input: CreateBackendEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}/backendenvironments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/backendenvironments"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -191,7 +193,6 @@ export const serializeAws_restJson1CreateBackendEnvironmentCommand = async ( input.environmentName !== null && { environmentName: input.environmentName }), ...(input.stackName !== undefined && input.stackName !== null && { stackName: input.stackName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -207,10 +208,11 @@ export const serializeAws_restJson1CreateBranchCommand = async ( input: CreateBranchCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}/branches"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -251,7 +253,6 @@ export const serializeAws_restJson1CreateBranchCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), ...(input.ttl !== undefined && input.ttl !== null && { ttl: input.ttl }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -267,10 +268,13 @@ export const serializeAws_restJson1CreateDeploymentCommand = async ( input: CreateDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}/branches/{branchName}/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/apps/{appId}/branches/{branchName}/deployments"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -294,7 +298,6 @@ export const serializeAws_restJson1CreateDeploymentCommand = async ( ...(input.fileMap !== undefined && input.fileMap !== null && { fileMap: serializeAws_restJson1FileMap(input.fileMap, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -310,10 +313,11 @@ export const serializeAws_restJson1CreateDomainAssociationCommand = async ( input: CreateDomainAssociationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}/domains"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/domains"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -342,7 +346,6 @@ export const serializeAws_restJson1CreateDomainAssociationCommand = async ( subDomainSettings: serializeAws_restJson1SubDomainSettings(input.subDomainSettings, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -358,10 +361,11 @@ export const serializeAws_restJson1CreateWebhookCommand = async ( input: CreateWebhookCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}/webhooks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/webhooks"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -376,7 +380,6 @@ export const serializeAws_restJson1CreateWebhookCommand = async ( ...(input.branchName !== undefined && input.branchName !== null && { branchName: input.branchName }), ...(input.description !== undefined && input.description !== null && { description: input.description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -392,8 +395,9 @@ export const serializeAws_restJson1DeleteAppCommand = async ( input: DeleteAppCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -404,7 +408,6 @@ export const serializeAws_restJson1DeleteAppCommand = async ( throw new Error("No value provided for input HTTP label: appId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -420,8 +423,11 @@ export const serializeAws_restJson1DeleteBackendEnvironmentCommand = async ( input: DeleteBackendEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/backendenvironments/{environmentName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/apps/{appId}/backendenvironments/{environmentName}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -441,7 +447,6 @@ export const serializeAws_restJson1DeleteBackendEnvironmentCommand = async ( throw new Error("No value provided for input HTTP label: environmentName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -457,8 +462,10 @@ export const serializeAws_restJson1DeleteBranchCommand = async ( input: DeleteBranchCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/branches/{branchName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches/{branchName}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -478,7 +485,6 @@ export const serializeAws_restJson1DeleteBranchCommand = async ( throw new Error("No value provided for input HTTP label: branchName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -494,8 +500,10 @@ export const serializeAws_restJson1DeleteDomainAssociationCommand = async ( input: DeleteDomainAssociationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/domains/{domainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/domains/{domainName}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -515,7 +523,6 @@ export const serializeAws_restJson1DeleteDomainAssociationCommand = async ( throw new Error("No value provided for input HTTP label: domainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -531,8 +538,11 @@ export const serializeAws_restJson1DeleteJobCommand = async ( input: DeleteJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/branches/{branchName}/jobs/{jobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/apps/{appId}/branches/{branchName}/jobs/{jobId}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -561,7 +571,6 @@ export const serializeAws_restJson1DeleteJobCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -577,8 +586,9 @@ export const serializeAws_restJson1DeleteWebhookCommand = async ( input: DeleteWebhookCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/webhooks/{webhookId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/webhooks/{webhookId}"; if (input.webhookId !== undefined) { const labelValue: string = input.webhookId; if (labelValue.length <= 0) { @@ -589,7 +599,6 @@ export const serializeAws_restJson1DeleteWebhookCommand = async ( throw new Error("No value provided for input HTTP label: webhookId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -605,10 +614,11 @@ export const serializeAws_restJson1GenerateAccessLogsCommand = async ( input: GenerateAccessLogsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}/accesslogs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/accesslogs"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -626,7 +636,6 @@ export const serializeAws_restJson1GenerateAccessLogsCommand = async ( ...(input.startTime !== undefined && input.startTime !== null && { startTime: Math.round(input.startTime.getTime() / 1000) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -642,8 +651,9 @@ export const serializeAws_restJson1GetAppCommand = async ( input: GetAppCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -654,7 +664,6 @@ export const serializeAws_restJson1GetAppCommand = async ( throw new Error("No value provided for input HTTP label: appId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -670,8 +679,9 @@ export const serializeAws_restJson1GetArtifactUrlCommand = async ( input: GetArtifactUrlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/artifacts/{artifactId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/artifacts/{artifactId}"; if (input.artifactId !== undefined) { const labelValue: string = input.artifactId; if (labelValue.length <= 0) { @@ -682,7 +692,6 @@ export const serializeAws_restJson1GetArtifactUrlCommand = async ( throw new Error("No value provided for input HTTP label: artifactId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -698,8 +707,11 @@ export const serializeAws_restJson1GetBackendEnvironmentCommand = async ( input: GetBackendEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/backendenvironments/{environmentName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/apps/{appId}/backendenvironments/{environmentName}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -719,7 +731,6 @@ export const serializeAws_restJson1GetBackendEnvironmentCommand = async ( throw new Error("No value provided for input HTTP label: environmentName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -735,8 +746,10 @@ export const serializeAws_restJson1GetBranchCommand = async ( input: GetBranchCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/branches/{branchName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches/{branchName}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -756,7 +769,6 @@ export const serializeAws_restJson1GetBranchCommand = async ( throw new Error("No value provided for input HTTP label: branchName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -772,8 +784,10 @@ export const serializeAws_restJson1GetDomainAssociationCommand = async ( input: GetDomainAssociationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/domains/{domainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/domains/{domainName}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -793,7 +807,6 @@ export const serializeAws_restJson1GetDomainAssociationCommand = async ( throw new Error("No value provided for input HTTP label: domainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -809,8 +822,11 @@ export const serializeAws_restJson1GetJobCommand = async ( input: GetJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/branches/{branchName}/jobs/{jobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/apps/{appId}/branches/{branchName}/jobs/{jobId}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -839,7 +855,6 @@ export const serializeAws_restJson1GetJobCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -855,8 +870,9 @@ export const serializeAws_restJson1GetWebhookCommand = async ( input: GetWebhookCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/webhooks/{webhookId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/webhooks/{webhookId}"; if (input.webhookId !== undefined) { const labelValue: string = input.webhookId; if (labelValue.length <= 0) { @@ -867,7 +883,6 @@ export const serializeAws_restJson1GetWebhookCommand = async ( throw new Error("No value provided for input HTTP label: webhookId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -883,14 +898,14 @@ export const serializeAws_restJson1ListAppsCommand = async ( input: ListAppsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -907,8 +922,11 @@ export const serializeAws_restJson1ListArtifactsCommand = async ( input: ListArtifactsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/branches/{branchName}/jobs/{jobId}/artifacts"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/apps/{appId}/branches/{branchName}/jobs/{jobId}/artifacts"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -941,7 +959,6 @@ export const serializeAws_restJson1ListArtifactsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -958,8 +975,10 @@ export const serializeAws_restJson1ListBackendEnvironmentsCommand = async ( input: ListBackendEnvironmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/backendenvironments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/backendenvironments"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -975,7 +994,6 @@ export const serializeAws_restJson1ListBackendEnvironmentsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -992,8 +1010,9 @@ export const serializeAws_restJson1ListBranchesCommand = async ( input: ListBranchesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/branches"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -1008,7 +1027,6 @@ export const serializeAws_restJson1ListBranchesCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1025,8 +1043,9 @@ export const serializeAws_restJson1ListDomainAssociationsCommand = async ( input: ListDomainAssociationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/domains"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/domains"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -1041,7 +1060,6 @@ export const serializeAws_restJson1ListDomainAssociationsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1058,8 +1076,10 @@ export const serializeAws_restJson1ListJobsCommand = async ( input: ListJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/branches/{branchName}/jobs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches/{branchName}/jobs"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -1083,7 +1103,6 @@ export const serializeAws_restJson1ListJobsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1100,8 +1119,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1112,7 +1132,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1128,8 +1147,9 @@ export const serializeAws_restJson1ListWebhooksCommand = async ( input: ListWebhooksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/webhooks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/webhooks"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -1144,7 +1164,6 @@ export const serializeAws_restJson1ListWebhooksCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1161,10 +1180,13 @@ export const serializeAws_restJson1StartDeploymentCommand = async ( input: StartDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}/branches/{branchName}/deployments/start"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/apps/{appId}/branches/{branchName}/deployments/start"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -1188,7 +1210,6 @@ export const serializeAws_restJson1StartDeploymentCommand = async ( ...(input.jobId !== undefined && input.jobId !== null && { jobId: input.jobId }), ...(input.sourceUrl !== undefined && input.sourceUrl !== null && { sourceUrl: input.sourceUrl }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1204,10 +1225,12 @@ export const serializeAws_restJson1StartJobCommand = async ( input: StartJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}/branches/{branchName}/jobs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches/{branchName}/jobs"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -1236,7 +1259,6 @@ export const serializeAws_restJson1StartJobCommand = async ( ...(input.jobReason !== undefined && input.jobReason !== null && { jobReason: input.jobReason }), ...(input.jobType !== undefined && input.jobType !== null && { jobType: input.jobType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1252,8 +1274,11 @@ export const serializeAws_restJson1StopJobCommand = async ( input: StopJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apps/{appId}/branches/{branchName}/jobs/{jobId}/stop"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/apps/{appId}/branches/{branchName}/jobs/{jobId}/stop"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -1282,7 +1307,6 @@ export const serializeAws_restJson1StopJobCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1298,10 +1322,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1315,7 +1340,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1331,8 +1355,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1346,7 +1371,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1363,10 +1387,11 @@ export const serializeAws_restJson1UpdateAppCommand = async ( input: UpdateAppCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -1419,7 +1444,6 @@ export const serializeAws_restJson1UpdateAppCommand = async ( ...(input.platform !== undefined && input.platform !== null && { platform: input.platform }), ...(input.repository !== undefined && input.repository !== null && { repository: input.repository }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1435,10 +1459,12 @@ export const serializeAws_restJson1UpdateBranchCommand = async ( input: UpdateBranchCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}/branches/{branchName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/branches/{branchName}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -1486,7 +1512,6 @@ export const serializeAws_restJson1UpdateBranchCommand = async ( ...(input.stage !== undefined && input.stage !== null && { stage: input.stage }), ...(input.ttl !== undefined && input.ttl !== null && { ttl: input.ttl }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1502,10 +1527,12 @@ export const serializeAws_restJson1UpdateDomainAssociationCommand = async ( input: UpdateDomainAssociationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apps/{appId}/domains/{domainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apps/{appId}/domains/{domainName}"; if (input.appId !== undefined) { const labelValue: string = input.appId; if (labelValue.length <= 0) { @@ -1542,7 +1569,6 @@ export const serializeAws_restJson1UpdateDomainAssociationCommand = async ( subDomainSettings: serializeAws_restJson1SubDomainSettings(input.subDomainSettings, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1558,10 +1584,11 @@ export const serializeAws_restJson1UpdateWebhookCommand = async ( input: UpdateWebhookCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/webhooks/{webhookId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/webhooks/{webhookId}"; if (input.webhookId !== undefined) { const labelValue: string = input.webhookId; if (labelValue.length <= 0) { @@ -1576,7 +1603,6 @@ export const serializeAws_restJson1UpdateWebhookCommand = async ( ...(input.branchName !== undefined && input.branchName !== null && { branchName: input.branchName }), ...(input.description !== undefined && input.description !== null && { description: input.description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-amplifybackend/protocols/Aws_restJson1.ts b/clients/client-amplifybackend/protocols/Aws_restJson1.ts index 15b5622f0f1a3..eb48a34d9ca38 100644 --- a/clients/client-amplifybackend/protocols/Aws_restJson1.ts +++ b/clients/client-amplifybackend/protocols/Aws_restJson1.ts @@ -94,10 +94,13 @@ export const serializeAws_restJson1CloneBackendCommand = async ( input: CloneBackendCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/environments/{BackendEnvironmentName}/clone"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/environments/{BackendEnvironmentName}/clone"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -121,7 +124,6 @@ export const serializeAws_restJson1CloneBackendCommand = async ( ...(input.TargetEnvironmentName !== undefined && input.TargetEnvironmentName !== null && { targetEnvironmentName: input.TargetEnvironmentName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -137,10 +139,11 @@ export const serializeAws_restJson1CreateBackendCommand = async ( input: CreateBackendCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backend"; let body: any; body = JSON.stringify({ ...(input.AppId !== undefined && input.AppId !== null && { appId: input.AppId }), @@ -153,7 +156,6 @@ export const serializeAws_restJson1CreateBackendCommand = async ( }), ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -169,10 +171,11 @@ export const serializeAws_restJson1CreateBackendAPICommand = async ( input: CreateBackendAPICommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/api"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/api"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -192,7 +195,6 @@ export const serializeAws_restJson1CreateBackendAPICommand = async ( }), ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -208,10 +210,11 @@ export const serializeAws_restJson1CreateBackendAuthCommand = async ( input: CreateBackendAuthCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/auth"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/auth"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -231,7 +234,6 @@ export const serializeAws_restJson1CreateBackendAuthCommand = async ( }), ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -247,10 +249,11 @@ export const serializeAws_restJson1CreateBackendConfigCommand = async ( input: CreateBackendConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/config"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/config"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -265,7 +268,6 @@ export const serializeAws_restJson1CreateBackendConfigCommand = async ( ...(input.BackendManagerAppId !== undefined && input.BackendManagerAppId !== null && { backendManagerAppId: input.BackendManagerAppId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -281,8 +283,10 @@ export const serializeAws_restJson1CreateTokenCommand = async ( input: CreateTokenCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backend/{AppId}/challenge"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/challenge"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -293,7 +297,6 @@ export const serializeAws_restJson1CreateTokenCommand = async ( throw new Error("No value provided for input HTTP label: AppId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -309,8 +312,11 @@ export const serializeAws_restJson1DeleteBackendCommand = async ( input: DeleteBackendCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backend/{AppId}/environments/{BackendEnvironmentName}/remove"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/environments/{BackendEnvironmentName}/remove"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -330,7 +336,6 @@ export const serializeAws_restJson1DeleteBackendCommand = async ( throw new Error("No value provided for input HTTP label: BackendEnvironmentName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -346,10 +351,13 @@ export const serializeAws_restJson1DeleteBackendAPICommand = async ( input: DeleteBackendAPICommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/api/{BackendEnvironmentName}/remove"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/api/{BackendEnvironmentName}/remove"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -376,7 +384,6 @@ export const serializeAws_restJson1DeleteBackendAPICommand = async ( }), ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -392,10 +399,13 @@ export const serializeAws_restJson1DeleteBackendAuthCommand = async ( input: DeleteBackendAuthCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/auth/{BackendEnvironmentName}/remove"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/auth/{BackendEnvironmentName}/remove"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -418,7 +428,6 @@ export const serializeAws_restJson1DeleteBackendAuthCommand = async ( body = JSON.stringify({ ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -434,8 +443,11 @@ export const serializeAws_restJson1DeleteTokenCommand = async ( input: DeleteTokenCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backend/{AppId}/challenge/{SessionId}/remove"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/challenge/{SessionId}/remove"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -455,7 +467,6 @@ export const serializeAws_restJson1DeleteTokenCommand = async ( throw new Error("No value provided for input HTTP label: SessionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -471,10 +482,13 @@ export const serializeAws_restJson1GenerateBackendAPIModelsCommand = async ( input: GenerateBackendAPIModelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/api/{BackendEnvironmentName}/generateModels"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/api/{BackendEnvironmentName}/generateModels"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -497,7 +511,6 @@ export const serializeAws_restJson1GenerateBackendAPIModelsCommand = async ( body = JSON.stringify({ ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -513,10 +526,11 @@ export const serializeAws_restJson1GetBackendCommand = async ( input: GetBackendCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/details"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/details"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -531,7 +545,6 @@ export const serializeAws_restJson1GetBackendCommand = async ( ...(input.BackendEnvironmentName !== undefined && input.BackendEnvironmentName !== null && { backendEnvironmentName: input.BackendEnvironmentName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -547,10 +560,13 @@ export const serializeAws_restJson1GetBackendAPICommand = async ( input: GetBackendAPICommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/api/{BackendEnvironmentName}/details"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/api/{BackendEnvironmentName}/details"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -577,7 +593,6 @@ export const serializeAws_restJson1GetBackendAPICommand = async ( }), ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -593,10 +608,13 @@ export const serializeAws_restJson1GetBackendAPIModelsCommand = async ( input: GetBackendAPIModelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/api/{BackendEnvironmentName}/getModels"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/api/{BackendEnvironmentName}/getModels"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -619,7 +637,6 @@ export const serializeAws_restJson1GetBackendAPIModelsCommand = async ( body = JSON.stringify({ ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -635,10 +652,13 @@ export const serializeAws_restJson1GetBackendAuthCommand = async ( input: GetBackendAuthCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/auth/{BackendEnvironmentName}/details"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/auth/{BackendEnvironmentName}/details"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -661,7 +681,6 @@ export const serializeAws_restJson1GetBackendAuthCommand = async ( body = JSON.stringify({ ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -677,8 +696,11 @@ export const serializeAws_restJson1GetBackendJobCommand = async ( input: GetBackendJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backend/{AppId}/job/{BackendEnvironmentName}/{JobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/job/{BackendEnvironmentName}/{JobId}"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -707,7 +729,6 @@ export const serializeAws_restJson1GetBackendJobCommand = async ( throw new Error("No value provided for input HTTP label: JobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -723,8 +744,10 @@ export const serializeAws_restJson1GetTokenCommand = async ( input: GetTokenCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backend/{AppId}/challenge/{SessionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/challenge/{SessionId}"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -744,7 +767,6 @@ export const serializeAws_restJson1GetTokenCommand = async ( throw new Error("No value provided for input HTTP label: SessionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -760,10 +782,13 @@ export const serializeAws_restJson1ImportBackendAuthCommand = async ( input: ImportBackendAuthCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/auth/{BackendEnvironmentName}/import"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/auth/{BackendEnvironmentName}/import"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -791,7 +816,6 @@ export const serializeAws_restJson1ImportBackendAuthCommand = async ( ...(input.UserPoolId !== undefined && input.UserPoolId !== null && { userPoolId: input.UserPoolId }), ...(input.WebClientId !== undefined && input.WebClientId !== null && { webClientId: input.WebClientId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -807,10 +831,13 @@ export const serializeAws_restJson1ListBackendJobsCommand = async ( input: ListBackendJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/job/{BackendEnvironmentName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/job/{BackendEnvironmentName}"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -837,7 +864,6 @@ export const serializeAws_restJson1ListBackendJobsCommand = async ( ...(input.Operation !== undefined && input.Operation !== null && { operation: input.Operation }), ...(input.Status !== undefined && input.Status !== null && { status: input.Status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -853,10 +879,11 @@ export const serializeAws_restJson1RemoveAllBackendsCommand = async ( input: RemoveAllBackendsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/remove"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/remove"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -871,7 +898,6 @@ export const serializeAws_restJson1RemoveAllBackendsCommand = async ( ...(input.CleanAmplifyApp !== undefined && input.CleanAmplifyApp !== null && { cleanAmplifyApp: input.CleanAmplifyApp }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -887,8 +913,10 @@ export const serializeAws_restJson1RemoveBackendConfigCommand = async ( input: RemoveBackendConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backend/{AppId}/config/remove"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/config/remove"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -899,7 +927,6 @@ export const serializeAws_restJson1RemoveBackendConfigCommand = async ( throw new Error("No value provided for input HTTP label: AppId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -915,10 +942,13 @@ export const serializeAws_restJson1UpdateBackendAPICommand = async ( input: UpdateBackendAPICommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/api/{BackendEnvironmentName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/api/{BackendEnvironmentName}"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -945,7 +975,6 @@ export const serializeAws_restJson1UpdateBackendAPICommand = async ( }), ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -961,10 +990,13 @@ export const serializeAws_restJson1UpdateBackendAuthCommand = async ( input: UpdateBackendAuthCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/auth/{BackendEnvironmentName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/auth/{BackendEnvironmentName}"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -991,7 +1023,6 @@ export const serializeAws_restJson1UpdateBackendAuthCommand = async ( }), ...(input.ResourceName !== undefined && input.ResourceName !== null && { resourceName: input.ResourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1007,10 +1038,12 @@ export const serializeAws_restJson1UpdateBackendConfigCommand = async ( input: UpdateBackendConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/config/update"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backend/{AppId}/config/update"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -1027,7 +1060,6 @@ export const serializeAws_restJson1UpdateBackendConfigCommand = async ( loginAuthConfig: serializeAws_restJson1LoginAuthConfigReqObj(input.LoginAuthConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1043,10 +1075,13 @@ export const serializeAws_restJson1UpdateBackendJobCommand = async ( input: UpdateBackendJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backend/{AppId}/job/{BackendEnvironmentName}/{JobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backend/{AppId}/job/{BackendEnvironmentName}/{JobId}"; if (input.AppId !== undefined) { const labelValue: string = input.AppId; if (labelValue.length <= 0) { @@ -1079,7 +1114,6 @@ export const serializeAws_restJson1UpdateBackendJobCommand = async ( ...(input.Operation !== undefined && input.Operation !== null && { operation: input.Operation }), ...(input.Status !== undefined && input.Status !== null && { status: input.Status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-api-gateway/protocols/Aws_restJson1.ts b/clients/client-api-gateway/protocols/Aws_restJson1.ts index ef953dd3bbcb5..90be87805da29 100644 --- a/clients/client-api-gateway/protocols/Aws_restJson1.ts +++ b/clients/client-api-gateway/protocols/Aws_restJson1.ts @@ -295,10 +295,11 @@ export const serializeAws_restJson1CreateApiKeyCommand = async ( input: CreateApiKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apikeys"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apikeys"; let body: any; body = JSON.stringify({ ...(input.customerId !== undefined && input.customerId !== null && { customerId: input.customerId }), @@ -313,7 +314,6 @@ export const serializeAws_restJson1CreateApiKeyCommand = async ( input.tags !== null && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }), ...(input.value !== undefined && input.value !== null && { value: input.value }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -329,10 +329,12 @@ export const serializeAws_restJson1CreateAuthorizerCommand = async ( input: CreateAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/authorizers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/authorizers"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -363,7 +365,6 @@ export const serializeAws_restJson1CreateAuthorizerCommand = async ( input.providerARNs !== null && { providerARNs: serializeAws_restJson1ListOfARNs(input.providerARNs, context) }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -379,10 +380,13 @@ export const serializeAws_restJson1CreateBasePathMappingCommand = async ( input: CreateBasePathMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domainnames/{domainName}/basepathmappings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domainnames/{domainName}/basepathmappings"; if (input.domainName !== undefined) { const labelValue: string = input.domainName; if (labelValue.length <= 0) { @@ -398,7 +402,6 @@ export const serializeAws_restJson1CreateBasePathMappingCommand = async ( ...(input.restApiId !== undefined && input.restApiId !== null && { restApiId: input.restApiId }), ...(input.stage !== undefined && input.stage !== null && { stage: input.stage }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -414,10 +417,12 @@ export const serializeAws_restJson1CreateDeploymentCommand = async ( input: CreateDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/deployments"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -446,7 +451,6 @@ export const serializeAws_restJson1CreateDeploymentCommand = async ( ...(input.variables !== undefined && input.variables !== null && { variables: serializeAws_restJson1MapOfStringToString(input.variables, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -462,10 +466,12 @@ export const serializeAws_restJson1CreateDocumentationPartCommand = async ( input: CreateDocumentationPartCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/documentation/parts"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/documentation/parts"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -483,7 +489,6 @@ export const serializeAws_restJson1CreateDocumentationPartCommand = async ( }), ...(input.properties !== undefined && input.properties !== null && { properties: input.properties }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -499,10 +504,13 @@ export const serializeAws_restJson1CreateDocumentationVersionCommand = async ( input: CreateDocumentationVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/documentation/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/documentation/versions"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -519,7 +527,6 @@ export const serializeAws_restJson1CreateDocumentationVersionCommand = async ( input.documentationVersion !== null && { documentationVersion: input.documentationVersion }), ...(input.stageName !== undefined && input.stageName !== null && { stageName: input.stageName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -535,10 +542,11 @@ export const serializeAws_restJson1CreateDomainNameCommand = async ( input: CreateDomainNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domainnames"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domainnames"; let body: any; body = JSON.stringify({ ...(input.certificateArn !== undefined && @@ -572,7 +580,6 @@ export const serializeAws_restJson1CreateDomainNameCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -588,10 +595,12 @@ export const serializeAws_restJson1CreateModelCommand = async ( input: CreateModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/models"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/models"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -608,7 +617,6 @@ export const serializeAws_restJson1CreateModelCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.schema !== undefined && input.schema !== null && { schema: input.schema }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -624,10 +632,12 @@ export const serializeAws_restJson1CreateRequestValidatorCommand = async ( input: CreateRequestValidatorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/requestvalidators"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/requestvalidators"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -645,7 +655,6 @@ export const serializeAws_restJson1CreateRequestValidatorCommand = async ( ...(input.validateRequestParameters !== undefined && input.validateRequestParameters !== null && { validateRequestParameters: input.validateRequestParameters }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -661,10 +670,13 @@ export const serializeAws_restJson1CreateResourceCommand = async ( input: CreateResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/resources/{parentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{parentId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -687,7 +699,6 @@ export const serializeAws_restJson1CreateResourceCommand = async ( body = JSON.stringify({ ...(input.pathPart !== undefined && input.pathPart !== null && { pathPart: input.pathPart }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -703,10 +714,11 @@ export const serializeAws_restJson1CreateRestApiCommand = async ( input: CreateRestApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis"; let body: any; body = JSON.stringify({ ...(input.apiKeySource !== undefined && input.apiKeySource !== null && { apiKeySource: input.apiKeySource }), @@ -730,7 +742,6 @@ export const serializeAws_restJson1CreateRestApiCommand = async ( input.tags !== null && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }), ...(input.version !== undefined && input.version !== null && { version: input.version }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -746,10 +757,12 @@ export const serializeAws_restJson1CreateStageCommand = async ( input: CreateStageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/stages"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/stages"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -781,7 +794,6 @@ export const serializeAws_restJson1CreateStageCommand = async ( ...(input.variables !== undefined && input.variables !== null && { variables: serializeAws_restJson1MapOfStringToString(input.variables, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -797,10 +809,11 @@ export const serializeAws_restJson1CreateUsagePlanCommand = async ( input: CreateUsagePlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/usageplans"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usageplans"; let body: any; body = JSON.stringify({ ...(input.apiStages !== undefined && @@ -814,7 +827,6 @@ export const serializeAws_restJson1CreateUsagePlanCommand = async ( ...(input.throttle !== undefined && input.throttle !== null && { throttle: serializeAws_restJson1ThrottleSettings(input.throttle, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -830,10 +842,12 @@ export const serializeAws_restJson1CreateUsagePlanKeyCommand = async ( input: CreateUsagePlanKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/usageplans/{usagePlanId}/keys"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usageplans/{usagePlanId}/keys"; if (input.usagePlanId !== undefined) { const labelValue: string = input.usagePlanId; if (labelValue.length <= 0) { @@ -848,7 +862,6 @@ export const serializeAws_restJson1CreateUsagePlanKeyCommand = async ( ...(input.keyId !== undefined && input.keyId !== null && { keyId: input.keyId }), ...(input.keyType !== undefined && input.keyType !== null && { keyType: input.keyType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -864,10 +877,11 @@ export const serializeAws_restJson1CreateVpcLinkCommand = async ( input: CreateVpcLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/vpclinks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/vpclinks"; let body: any; body = JSON.stringify({ ...(input.description !== undefined && input.description !== null && { description: input.description }), @@ -877,7 +891,6 @@ export const serializeAws_restJson1CreateVpcLinkCommand = async ( ...(input.targetArns !== undefined && input.targetArns !== null && { targetArns: serializeAws_restJson1ListOfString(input.targetArns, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -893,8 +906,9 @@ export const serializeAws_restJson1DeleteApiKeyCommand = async ( input: DeleteApiKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apikeys/{apiKey}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apikeys/{apiKey}"; if (input.apiKey !== undefined) { const labelValue: string = input.apiKey; if (labelValue.length <= 0) { @@ -905,7 +919,6 @@ export const serializeAws_restJson1DeleteApiKeyCommand = async ( throw new Error("No value provided for input HTTP label: apiKey."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -921,8 +934,11 @@ export const serializeAws_restJson1DeleteAuthorizerCommand = async ( input: DeleteAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/authorizers/{authorizerId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/authorizers/{authorizerId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -942,7 +958,6 @@ export const serializeAws_restJson1DeleteAuthorizerCommand = async ( throw new Error("No value provided for input HTTP label: authorizerId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -958,8 +973,11 @@ export const serializeAws_restJson1DeleteBasePathMappingCommand = async ( input: DeleteBasePathMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domainnames/{domainName}/basepathmappings/{basePath}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domainnames/{domainName}/basepathmappings/{basePath}"; if (input.domainName !== undefined) { const labelValue: string = input.domainName; if (labelValue.length <= 0) { @@ -979,7 +997,6 @@ export const serializeAws_restJson1DeleteBasePathMappingCommand = async ( throw new Error("No value provided for input HTTP label: basePath."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -995,8 +1012,10 @@ export const serializeAws_restJson1DeleteClientCertificateCommand = async ( input: DeleteClientCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clientcertificates/{clientCertificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clientcertificates/{clientCertificateId}"; if (input.clientCertificateId !== undefined) { const labelValue: string = input.clientCertificateId; if (labelValue.length <= 0) { @@ -1007,7 +1026,6 @@ export const serializeAws_restJson1DeleteClientCertificateCommand = async ( throw new Error("No value provided for input HTTP label: clientCertificateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1023,8 +1041,11 @@ export const serializeAws_restJson1DeleteDeploymentCommand = async ( input: DeleteDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/deployments/{deploymentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/deployments/{deploymentId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1044,7 +1065,6 @@ export const serializeAws_restJson1DeleteDeploymentCommand = async ( throw new Error("No value provided for input HTTP label: deploymentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1060,8 +1080,11 @@ export const serializeAws_restJson1DeleteDocumentationPartCommand = async ( input: DeleteDocumentationPartCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/documentation/parts/{documentationPartId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/documentation/parts/{documentationPartId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1081,7 +1104,6 @@ export const serializeAws_restJson1DeleteDocumentationPartCommand = async ( throw new Error("No value provided for input HTTP label: documentationPartId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1097,8 +1119,11 @@ export const serializeAws_restJson1DeleteDocumentationVersionCommand = async ( input: DeleteDocumentationVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/documentation/versions/{documentationVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/documentation/versions/{documentationVersion}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1118,7 +1143,6 @@ export const serializeAws_restJson1DeleteDocumentationVersionCommand = async ( throw new Error("No value provided for input HTTP label: documentationVersion."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1134,8 +1158,10 @@ export const serializeAws_restJson1DeleteDomainNameCommand = async ( input: DeleteDomainNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domainnames/{domainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domainnames/{domainName}"; if (input.domainName !== undefined) { const labelValue: string = input.domainName; if (labelValue.length <= 0) { @@ -1146,7 +1172,6 @@ export const serializeAws_restJson1DeleteDomainNameCommand = async ( throw new Error("No value provided for input HTTP label: domainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1162,8 +1187,11 @@ export const serializeAws_restJson1DeleteGatewayResponseCommand = async ( input: DeleteGatewayResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/gatewayresponses/{responseType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/gatewayresponses/{responseType}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1183,7 +1211,6 @@ export const serializeAws_restJson1DeleteGatewayResponseCommand = async ( throw new Error("No value provided for input HTTP label: responseType."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1199,8 +1226,11 @@ export const serializeAws_restJson1DeleteIntegrationCommand = async ( input: DeleteIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1229,7 +1259,6 @@ export const serializeAws_restJson1DeleteIntegrationCommand = async ( throw new Error("No value provided for input HTTP label: httpMethod."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1245,8 +1274,10 @@ export const serializeAws_restJson1DeleteIntegrationResponseCommand = async ( input: DeleteIntegrationResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration/responses/{statusCode}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; @@ -1285,7 +1316,6 @@ export const serializeAws_restJson1DeleteIntegrationResponseCommand = async ( throw new Error("No value provided for input HTTP label: statusCode."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1301,8 +1331,11 @@ export const serializeAws_restJson1DeleteMethodCommand = async ( input: DeleteMethodCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1331,7 +1364,6 @@ export const serializeAws_restJson1DeleteMethodCommand = async ( throw new Error("No value provided for input HTTP label: httpMethod."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1347,8 +1379,11 @@ export const serializeAws_restJson1DeleteMethodResponseCommand = async ( input: DeleteMethodResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1386,7 +1421,6 @@ export const serializeAws_restJson1DeleteMethodResponseCommand = async ( throw new Error("No value provided for input HTTP label: statusCode."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1402,8 +1436,10 @@ export const serializeAws_restJson1DeleteModelCommand = async ( input: DeleteModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/models/{modelName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/models/{modelName}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1423,7 +1459,6 @@ export const serializeAws_restJson1DeleteModelCommand = async ( throw new Error("No value provided for input HTTP label: modelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1439,8 +1474,11 @@ export const serializeAws_restJson1DeleteRequestValidatorCommand = async ( input: DeleteRequestValidatorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/requestvalidators/{requestValidatorId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/requestvalidators/{requestValidatorId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1460,7 +1498,6 @@ export const serializeAws_restJson1DeleteRequestValidatorCommand = async ( throw new Error("No value provided for input HTTP label: requestValidatorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1476,8 +1513,11 @@ export const serializeAws_restJson1DeleteResourceCommand = async ( input: DeleteResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1497,7 +1537,6 @@ export const serializeAws_restJson1DeleteResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1513,8 +1552,9 @@ export const serializeAws_restJson1DeleteRestApiCommand = async ( input: DeleteRestApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1525,7 +1565,6 @@ export const serializeAws_restJson1DeleteRestApiCommand = async ( throw new Error("No value provided for input HTTP label: restApiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1541,8 +1580,10 @@ export const serializeAws_restJson1DeleteStageCommand = async ( input: DeleteStageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/stages/{stageName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/stages/{stageName}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1562,7 +1603,6 @@ export const serializeAws_restJson1DeleteStageCommand = async ( throw new Error("No value provided for input HTTP label: stageName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1578,8 +1618,10 @@ export const serializeAws_restJson1DeleteUsagePlanCommand = async ( input: DeleteUsagePlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/usageplans/{usagePlanId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usageplans/{usagePlanId}"; if (input.usagePlanId !== undefined) { const labelValue: string = input.usagePlanId; if (labelValue.length <= 0) { @@ -1590,7 +1632,6 @@ export const serializeAws_restJson1DeleteUsagePlanCommand = async ( throw new Error("No value provided for input HTTP label: usagePlanId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1606,8 +1647,10 @@ export const serializeAws_restJson1DeleteUsagePlanKeyCommand = async ( input: DeleteUsagePlanKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/usageplans/{usagePlanId}/keys/{keyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usageplans/{usagePlanId}/keys/{keyId}"; if (input.usagePlanId !== undefined) { const labelValue: string = input.usagePlanId; if (labelValue.length <= 0) { @@ -1627,7 +1670,6 @@ export const serializeAws_restJson1DeleteUsagePlanKeyCommand = async ( throw new Error("No value provided for input HTTP label: keyId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1643,8 +1685,9 @@ export const serializeAws_restJson1DeleteVpcLinkCommand = async ( input: DeleteVpcLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/vpclinks/{vpcLinkId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/vpclinks/{vpcLinkId}"; if (input.vpcLinkId !== undefined) { const labelValue: string = input.vpcLinkId; if (labelValue.length <= 0) { @@ -1655,7 +1698,6 @@ export const serializeAws_restJson1DeleteVpcLinkCommand = async ( throw new Error("No value provided for input HTTP label: vpcLinkId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1671,8 +1713,11 @@ export const serializeAws_restJson1FlushStageAuthorizersCacheCommand = async ( input: FlushStageAuthorizersCacheCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/stages/{stageName}/cache/authorizers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/stages/{stageName}/cache/authorizers"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1692,7 +1737,6 @@ export const serializeAws_restJson1FlushStageAuthorizersCacheCommand = async ( throw new Error("No value provided for input HTTP label: stageName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1708,8 +1752,11 @@ export const serializeAws_restJson1FlushStageCacheCommand = async ( input: FlushStageCacheCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/stages/{stageName}/cache/data"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/stages/{stageName}/cache/data"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1729,7 +1776,6 @@ export const serializeAws_restJson1FlushStageCacheCommand = async ( throw new Error("No value provided for input HTTP label: stageName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1745,17 +1791,17 @@ export const serializeAws_restJson1GenerateClientCertificateCommand = async ( input: GenerateClientCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clientcertificates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clientcertificates"; let body: any; body = JSON.stringify({ ...(input.description !== undefined && input.description !== null && { description: input.description }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1771,13 +1817,13 @@ export const serializeAws_restJson1GetAccountCommand = async ( input: GetAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/account"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/account"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1793,8 +1839,9 @@ export const serializeAws_restJson1GetApiKeyCommand = async ( input: GetApiKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apikeys/{apiKey}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apikeys/{apiKey}"; if (input.apiKey !== undefined) { const labelValue: string = input.apiKey; if (labelValue.length <= 0) { @@ -1808,7 +1855,6 @@ export const serializeAws_restJson1GetApiKeyCommand = async ( ...(input.includeValue !== undefined && { includeValue: input.includeValue.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1825,8 +1871,9 @@ export const serializeAws_restJson1GetApiKeysCommand = async ( input: GetApiKeysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/apikeys"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apikeys"; const query: any = { ...(input.position !== undefined && { position: input.position }), ...(input.limit !== undefined && { limit: input.limit.toString() }), @@ -1835,7 +1882,6 @@ export const serializeAws_restJson1GetApiKeysCommand = async ( ...(input.includeValues !== undefined && { includeValues: input.includeValues.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1852,8 +1898,11 @@ export const serializeAws_restJson1GetAuthorizerCommand = async ( input: GetAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/authorizers/{authorizerId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/authorizers/{authorizerId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1873,7 +1922,6 @@ export const serializeAws_restJson1GetAuthorizerCommand = async ( throw new Error("No value provided for input HTTP label: authorizerId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1889,8 +1937,10 @@ export const serializeAws_restJson1GetAuthorizersCommand = async ( input: GetAuthorizersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/authorizers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/authorizers"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -1905,7 +1955,6 @@ export const serializeAws_restJson1GetAuthorizersCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1922,8 +1971,11 @@ export const serializeAws_restJson1GetBasePathMappingCommand = async ( input: GetBasePathMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domainnames/{domainName}/basepathmappings/{basePath}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domainnames/{domainName}/basepathmappings/{basePath}"; if (input.domainName !== undefined) { const labelValue: string = input.domainName; if (labelValue.length <= 0) { @@ -1943,7 +1995,6 @@ export const serializeAws_restJson1GetBasePathMappingCommand = async ( throw new Error("No value provided for input HTTP label: basePath."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1959,8 +2010,11 @@ export const serializeAws_restJson1GetBasePathMappingsCommand = async ( input: GetBasePathMappingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domainnames/{domainName}/basepathmappings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domainnames/{domainName}/basepathmappings"; if (input.domainName !== undefined) { const labelValue: string = input.domainName; if (labelValue.length <= 0) { @@ -1975,7 +2029,6 @@ export const serializeAws_restJson1GetBasePathMappingsCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1992,8 +2045,10 @@ export const serializeAws_restJson1GetClientCertificateCommand = async ( input: GetClientCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clientcertificates/{clientCertificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clientcertificates/{clientCertificateId}"; if (input.clientCertificateId !== undefined) { const labelValue: string = input.clientCertificateId; if (labelValue.length <= 0) { @@ -2004,7 +2059,6 @@ export const serializeAws_restJson1GetClientCertificateCommand = async ( throw new Error("No value provided for input HTTP label: clientCertificateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2020,14 +2074,14 @@ export const serializeAws_restJson1GetClientCertificatesCommand = async ( input: GetClientCertificatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clientcertificates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clientcertificates"; const query: any = { ...(input.position !== undefined && { position: input.position }), ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2044,8 +2098,11 @@ export const serializeAws_restJson1GetDeploymentCommand = async ( input: GetDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/deployments/{deploymentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/deployments/{deploymentId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2068,7 +2125,6 @@ export const serializeAws_restJson1GetDeploymentCommand = async ( ...(input.embed !== undefined && { embed: (input.embed || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2085,8 +2141,10 @@ export const serializeAws_restJson1GetDeploymentsCommand = async ( input: GetDeploymentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/deployments"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2101,7 +2159,6 @@ export const serializeAws_restJson1GetDeploymentsCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2118,8 +2175,11 @@ export const serializeAws_restJson1GetDocumentationPartCommand = async ( input: GetDocumentationPartCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/documentation/parts/{documentationPartId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/documentation/parts/{documentationPartId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2139,7 +2199,6 @@ export const serializeAws_restJson1GetDocumentationPartCommand = async ( throw new Error("No value provided for input HTTP label: documentationPartId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2155,8 +2214,10 @@ export const serializeAws_restJson1GetDocumentationPartsCommand = async ( input: GetDocumentationPartsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/documentation/parts"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/documentation/parts"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2175,7 +2236,6 @@ export const serializeAws_restJson1GetDocumentationPartsCommand = async ( ...(input.locationStatus !== undefined && { locationStatus: input.locationStatus }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2192,8 +2252,11 @@ export const serializeAws_restJson1GetDocumentationVersionCommand = async ( input: GetDocumentationVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/documentation/versions/{documentationVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/documentation/versions/{documentationVersion}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2213,7 +2276,6 @@ export const serializeAws_restJson1GetDocumentationVersionCommand = async ( throw new Error("No value provided for input HTTP label: documentationVersion."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2229,8 +2291,11 @@ export const serializeAws_restJson1GetDocumentationVersionsCommand = async ( input: GetDocumentationVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/documentation/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/documentation/versions"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2245,7 +2310,6 @@ export const serializeAws_restJson1GetDocumentationVersionsCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2262,8 +2326,10 @@ export const serializeAws_restJson1GetDomainNameCommand = async ( input: GetDomainNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domainnames/{domainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domainnames/{domainName}"; if (input.domainName !== undefined) { const labelValue: string = input.domainName; if (labelValue.length <= 0) { @@ -2274,7 +2340,6 @@ export const serializeAws_restJson1GetDomainNameCommand = async ( throw new Error("No value provided for input HTTP label: domainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2290,14 +2355,14 @@ export const serializeAws_restJson1GetDomainNamesCommand = async ( input: GetDomainNamesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domainnames"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domainnames"; const query: any = { ...(input.position !== undefined && { position: input.position }), ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2314,10 +2379,13 @@ export const serializeAws_restJson1GetExportCommand = async ( input: GetExportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.accepts) && { accept: input.accepts! }), }; - let resolvedPath = "/restapis/{restApiId}/stages/{stageName}/exports/{exportType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/stages/{stageName}/exports/{exportType}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2349,7 +2417,6 @@ export const serializeAws_restJson1GetExportCommand = async ( ...(input.parameters !== undefined && input.parameters), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2366,8 +2433,11 @@ export const serializeAws_restJson1GetGatewayResponseCommand = async ( input: GetGatewayResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/gatewayresponses/{responseType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/gatewayresponses/{responseType}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2387,7 +2457,6 @@ export const serializeAws_restJson1GetGatewayResponseCommand = async ( throw new Error("No value provided for input HTTP label: responseType."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2403,8 +2472,10 @@ export const serializeAws_restJson1GetGatewayResponsesCommand = async ( input: GetGatewayResponsesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/gatewayresponses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/gatewayresponses"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2419,7 +2490,6 @@ export const serializeAws_restJson1GetGatewayResponsesCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2436,8 +2506,11 @@ export const serializeAws_restJson1GetIntegrationCommand = async ( input: GetIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2466,7 +2539,6 @@ export const serializeAws_restJson1GetIntegrationCommand = async ( throw new Error("No value provided for input HTTP label: httpMethod."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2482,8 +2554,10 @@ export const serializeAws_restJson1GetIntegrationResponseCommand = async ( input: GetIntegrationResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration/responses/{statusCode}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; @@ -2522,7 +2596,6 @@ export const serializeAws_restJson1GetIntegrationResponseCommand = async ( throw new Error("No value provided for input HTTP label: statusCode."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2538,8 +2611,11 @@ export const serializeAws_restJson1GetMethodCommand = async ( input: GetMethodCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2568,7 +2644,6 @@ export const serializeAws_restJson1GetMethodCommand = async ( throw new Error("No value provided for input HTTP label: httpMethod."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2584,8 +2659,11 @@ export const serializeAws_restJson1GetMethodResponseCommand = async ( input: GetMethodResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2623,7 +2701,6 @@ export const serializeAws_restJson1GetMethodResponseCommand = async ( throw new Error("No value provided for input HTTP label: statusCode."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2639,8 +2716,10 @@ export const serializeAws_restJson1GetModelCommand = async ( input: GetModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/models/{modelName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/models/{modelName}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2663,7 +2742,6 @@ export const serializeAws_restJson1GetModelCommand = async ( ...(input.flatten !== undefined && { flatten: input.flatten.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2680,8 +2758,10 @@ export const serializeAws_restJson1GetModelsCommand = async ( input: GetModelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/models"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/models"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2696,7 +2776,6 @@ export const serializeAws_restJson1GetModelsCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2713,8 +2792,11 @@ export const serializeAws_restJson1GetModelTemplateCommand = async ( input: GetModelTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/models/{modelName}/default_template"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/models/{modelName}/default_template"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2734,7 +2816,6 @@ export const serializeAws_restJson1GetModelTemplateCommand = async ( throw new Error("No value provided for input HTTP label: modelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2750,8 +2831,11 @@ export const serializeAws_restJson1GetRequestValidatorCommand = async ( input: GetRequestValidatorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/requestvalidators/{requestValidatorId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/requestvalidators/{requestValidatorId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2771,7 +2855,6 @@ export const serializeAws_restJson1GetRequestValidatorCommand = async ( throw new Error("No value provided for input HTTP label: requestValidatorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2787,8 +2870,10 @@ export const serializeAws_restJson1GetRequestValidatorsCommand = async ( input: GetRequestValidatorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/requestvalidators"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/requestvalidators"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2803,7 +2888,6 @@ export const serializeAws_restJson1GetRequestValidatorsCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2820,8 +2904,11 @@ export const serializeAws_restJson1GetResourceCommand = async ( input: GetResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2844,7 +2931,6 @@ export const serializeAws_restJson1GetResourceCommand = async ( ...(input.embed !== undefined && { embed: (input.embed || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2861,8 +2947,10 @@ export const serializeAws_restJson1GetResourcesCommand = async ( input: GetResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/resources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/resources"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2878,7 +2966,6 @@ export const serializeAws_restJson1GetResourcesCommand = async ( ...(input.embed !== undefined && { embed: (input.embed || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2895,8 +2982,9 @@ export const serializeAws_restJson1GetRestApiCommand = async ( input: GetRestApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2907,7 +2995,6 @@ export const serializeAws_restJson1GetRestApiCommand = async ( throw new Error("No value provided for input HTTP label: restApiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2923,14 +3010,14 @@ export const serializeAws_restJson1GetRestApisCommand = async ( input: GetRestApisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis"; const query: any = { ...(input.position !== undefined && { position: input.position }), ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2947,8 +3034,11 @@ export const serializeAws_restJson1GetSdkCommand = async ( input: GetSdkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/stages/{stageName}/sdks/{sdkType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/stages/{stageName}/sdks/{sdkType}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -2980,7 +3070,6 @@ export const serializeAws_restJson1GetSdkCommand = async ( ...(input.parameters !== undefined && input.parameters), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2997,8 +3086,9 @@ export const serializeAws_restJson1GetSdkTypeCommand = async ( input: GetSdkTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sdktypes/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sdktypes/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -3009,7 +3099,6 @@ export const serializeAws_restJson1GetSdkTypeCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3025,14 +3114,14 @@ export const serializeAws_restJson1GetSdkTypesCommand = async ( input: GetSdkTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sdktypes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sdktypes"; const query: any = { ...(input.position !== undefined && { position: input.position }), ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3049,8 +3138,10 @@ export const serializeAws_restJson1GetStageCommand = async ( input: GetStageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/stages/{stageName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/stages/{stageName}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -3070,7 +3161,6 @@ export const serializeAws_restJson1GetStageCommand = async ( throw new Error("No value provided for input HTTP label: stageName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3086,8 +3176,10 @@ export const serializeAws_restJson1GetStagesCommand = async ( input: GetStagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restapis/{restApiId}/stages"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/stages"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -3101,7 +3193,6 @@ export const serializeAws_restJson1GetStagesCommand = async ( ...(input.deploymentId !== undefined && { deploymentId: input.deploymentId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3118,8 +3209,9 @@ export const serializeAws_restJson1GetTagsCommand = async ( input: GetTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -3134,7 +3226,6 @@ export const serializeAws_restJson1GetTagsCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3151,8 +3242,10 @@ export const serializeAws_restJson1GetUsageCommand = async ( input: GetUsageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/usageplans/{usagePlanId}/usage"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usageplans/{usagePlanId}/usage"; if (input.usagePlanId !== undefined) { const labelValue: string = input.usagePlanId; if (labelValue.length <= 0) { @@ -3170,7 +3263,6 @@ export const serializeAws_restJson1GetUsageCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3187,8 +3279,10 @@ export const serializeAws_restJson1GetUsagePlanCommand = async ( input: GetUsagePlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/usageplans/{usagePlanId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usageplans/{usagePlanId}"; if (input.usagePlanId !== undefined) { const labelValue: string = input.usagePlanId; if (labelValue.length <= 0) { @@ -3199,7 +3293,6 @@ export const serializeAws_restJson1GetUsagePlanCommand = async ( throw new Error("No value provided for input HTTP label: usagePlanId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3215,8 +3308,10 @@ export const serializeAws_restJson1GetUsagePlanKeyCommand = async ( input: GetUsagePlanKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/usageplans/{usagePlanId}/keys/{keyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usageplans/{usagePlanId}/keys/{keyId}"; if (input.usagePlanId !== undefined) { const labelValue: string = input.usagePlanId; if (labelValue.length <= 0) { @@ -3236,7 +3331,6 @@ export const serializeAws_restJson1GetUsagePlanKeyCommand = async ( throw new Error("No value provided for input HTTP label: keyId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3252,8 +3346,10 @@ export const serializeAws_restJson1GetUsagePlanKeysCommand = async ( input: GetUsagePlanKeysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/usageplans/{usagePlanId}/keys"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usageplans/{usagePlanId}/keys"; if (input.usagePlanId !== undefined) { const labelValue: string = input.usagePlanId; if (labelValue.length <= 0) { @@ -3269,7 +3365,6 @@ export const serializeAws_restJson1GetUsagePlanKeysCommand = async ( ...(input.nameQuery !== undefined && { name: input.nameQuery }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3286,15 +3381,15 @@ export const serializeAws_restJson1GetUsagePlansCommand = async ( input: GetUsagePlansCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/usageplans"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usageplans"; const query: any = { ...(input.position !== undefined && { position: input.position }), ...(input.keyId !== undefined && { keyId: input.keyId }), ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3311,8 +3406,9 @@ export const serializeAws_restJson1GetVpcLinkCommand = async ( input: GetVpcLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/vpclinks/{vpcLinkId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/vpclinks/{vpcLinkId}"; if (input.vpcLinkId !== undefined) { const labelValue: string = input.vpcLinkId; if (labelValue.length <= 0) { @@ -3323,7 +3419,6 @@ export const serializeAws_restJson1GetVpcLinkCommand = async ( throw new Error("No value provided for input HTTP label: vpcLinkId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3339,14 +3434,14 @@ export const serializeAws_restJson1GetVpcLinksCommand = async ( input: GetVpcLinksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/vpclinks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/vpclinks"; const query: any = { ...(input.position !== undefined && { position: input.position }), ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3363,10 +3458,11 @@ export const serializeAws_restJson1ImportApiKeysCommand = async ( input: ImportApiKeysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", }; - let resolvedPath = "/apikeys"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apikeys"; const query: any = { mode: "import", ...(input.format !== undefined && { format: input.format }), @@ -3376,7 +3472,6 @@ export const serializeAws_restJson1ImportApiKeysCommand = async ( if (input.body !== undefined) { body = input.body; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3393,10 +3488,12 @@ export const serializeAws_restJson1ImportDocumentationPartsCommand = async ( input: ImportDocumentationPartsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", }; - let resolvedPath = "/restapis/{restApiId}/documentation/parts"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/documentation/parts"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -3414,7 +3511,6 @@ export const serializeAws_restJson1ImportDocumentationPartsCommand = async ( if (input.body !== undefined) { body = input.body; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3431,10 +3527,11 @@ export const serializeAws_restJson1ImportRestApiCommand = async ( input: ImportRestApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", }; - let resolvedPath = "/restapis"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis"; const query: any = { mode: "import", ...(input.parameters !== undefined && input.parameters), @@ -3444,7 +3541,6 @@ export const serializeAws_restJson1ImportRestApiCommand = async ( if (input.body !== undefined) { body = input.body; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3461,10 +3557,13 @@ export const serializeAws_restJson1PutGatewayResponseCommand = async ( input: PutGatewayResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/gatewayresponses/{responseType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/gatewayresponses/{responseType}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -3495,7 +3594,6 @@ export const serializeAws_restJson1PutGatewayResponseCommand = async ( }), ...(input.statusCode !== undefined && input.statusCode !== null && { statusCode: input.statusCode }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3511,10 +3609,13 @@ export const serializeAws_restJson1PutIntegrationCommand = async ( input: PutIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -3575,7 +3676,6 @@ export const serializeAws_restJson1PutIntegrationCommand = async ( ...(input.type !== undefined && input.type !== null && { type: input.type }), ...(input.uri !== undefined && input.uri !== null && { uri: input.uri }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3591,10 +3691,12 @@ export const serializeAws_restJson1PutIntegrationResponseCommand = async ( input: PutIntegrationResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration/responses/{statusCode}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; @@ -3647,7 +3749,6 @@ export const serializeAws_restJson1PutIntegrationResponseCommand = async ( ...(input.selectionPattern !== undefined && input.selectionPattern !== null && { selectionPattern: input.selectionPattern }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3663,10 +3764,13 @@ export const serializeAws_restJson1PutMethodCommand = async ( input: PutMethodCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -3717,7 +3821,6 @@ export const serializeAws_restJson1PutMethodCommand = async ( ...(input.requestValidatorId !== undefined && input.requestValidatorId !== null && { requestValidatorId: input.requestValidatorId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3733,10 +3836,13 @@ export const serializeAws_restJson1PutMethodResponseCommand = async ( input: PutMethodResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -3784,7 +3890,6 @@ export const serializeAws_restJson1PutMethodResponseCommand = async ( responseParameters: serializeAws_restJson1MapOfStringToBoolean(input.responseParameters, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3800,10 +3905,11 @@ export const serializeAws_restJson1PutRestApiCommand = async ( input: PutRestApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", }; - let resolvedPath = "/restapis/{restApiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -3822,7 +3928,6 @@ export const serializeAws_restJson1PutRestApiCommand = async ( if (input.body !== undefined) { body = input.body; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3839,10 +3944,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -3857,7 +3963,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1MapOfStringToString(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3873,10 +3978,13 @@ export const serializeAws_restJson1TestInvokeAuthorizerCommand = async ( input: TestInvokeAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/authorizers/{authorizerId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/authorizers/{authorizerId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -3915,7 +4023,6 @@ export const serializeAws_restJson1TestInvokeAuthorizerCommand = async ( stageVariables: serializeAws_restJson1MapOfStringToString(input.stageVariables, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3931,10 +4038,13 @@ export const serializeAws_restJson1TestInvokeMethodCommand = async ( input: TestInvokeMethodCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -3980,7 +4090,6 @@ export const serializeAws_restJson1TestInvokeMethodCommand = async ( stageVariables: serializeAws_restJson1MapOfStringToString(input.stageVariables, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3996,8 +4105,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -4011,7 +4121,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4028,10 +4137,11 @@ export const serializeAws_restJson1UpdateAccountCommand = async ( input: UpdateAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/account"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/account"; let body: any; body = JSON.stringify({ ...(input.patchOperations !== undefined && @@ -4039,7 +4149,6 @@ export const serializeAws_restJson1UpdateAccountCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4055,10 +4164,11 @@ export const serializeAws_restJson1UpdateApiKeyCommand = async ( input: UpdateApiKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/apikeys/{apiKey}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apikeys/{apiKey}"; if (input.apiKey !== undefined) { const labelValue: string = input.apiKey; if (labelValue.length <= 0) { @@ -4075,7 +4185,6 @@ export const serializeAws_restJson1UpdateApiKeyCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4091,10 +4200,13 @@ export const serializeAws_restJson1UpdateAuthorizerCommand = async ( input: UpdateAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/authorizers/{authorizerId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/authorizers/{authorizerId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4120,7 +4232,6 @@ export const serializeAws_restJson1UpdateAuthorizerCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4136,10 +4247,13 @@ export const serializeAws_restJson1UpdateBasePathMappingCommand = async ( input: UpdateBasePathMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domainnames/{domainName}/basepathmappings/{basePath}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domainnames/{domainName}/basepathmappings/{basePath}"; if (input.domainName !== undefined) { const labelValue: string = input.domainName; if (labelValue.length <= 0) { @@ -4165,7 +4279,6 @@ export const serializeAws_restJson1UpdateBasePathMappingCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4181,10 +4294,12 @@ export const serializeAws_restJson1UpdateClientCertificateCommand = async ( input: UpdateClientCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clientcertificates/{clientCertificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clientcertificates/{clientCertificateId}"; if (input.clientCertificateId !== undefined) { const labelValue: string = input.clientCertificateId; if (labelValue.length <= 0) { @@ -4201,7 +4316,6 @@ export const serializeAws_restJson1UpdateClientCertificateCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4217,10 +4331,13 @@ export const serializeAws_restJson1UpdateDeploymentCommand = async ( input: UpdateDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/deployments/{deploymentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/deployments/{deploymentId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4246,7 +4363,6 @@ export const serializeAws_restJson1UpdateDeploymentCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4262,10 +4378,13 @@ export const serializeAws_restJson1UpdateDocumentationPartCommand = async ( input: UpdateDocumentationPartCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/documentation/parts/{documentationPartId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/documentation/parts/{documentationPartId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4291,7 +4410,6 @@ export const serializeAws_restJson1UpdateDocumentationPartCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4307,10 +4425,13 @@ export const serializeAws_restJson1UpdateDocumentationVersionCommand = async ( input: UpdateDocumentationVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/documentation/versions/{documentationVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/documentation/versions/{documentationVersion}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4336,7 +4457,6 @@ export const serializeAws_restJson1UpdateDocumentationVersionCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4352,10 +4472,12 @@ export const serializeAws_restJson1UpdateDomainNameCommand = async ( input: UpdateDomainNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domainnames/{domainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domainnames/{domainName}"; if (input.domainName !== undefined) { const labelValue: string = input.domainName; if (labelValue.length <= 0) { @@ -4372,7 +4494,6 @@ export const serializeAws_restJson1UpdateDomainNameCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4388,10 +4509,13 @@ export const serializeAws_restJson1UpdateGatewayResponseCommand = async ( input: UpdateGatewayResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/gatewayresponses/{responseType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/gatewayresponses/{responseType}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4417,7 +4541,6 @@ export const serializeAws_restJson1UpdateGatewayResponseCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4433,10 +4556,13 @@ export const serializeAws_restJson1UpdateIntegrationCommand = async ( input: UpdateIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4471,7 +4597,6 @@ export const serializeAws_restJson1UpdateIntegrationCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4487,10 +4612,12 @@ export const serializeAws_restJson1UpdateIntegrationResponseCommand = async ( input: UpdateIntegrationResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/integration/responses/{statusCode}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; @@ -4535,7 +4662,6 @@ export const serializeAws_restJson1UpdateIntegrationResponseCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4551,10 +4677,13 @@ export const serializeAws_restJson1UpdateMethodCommand = async ( input: UpdateMethodCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4589,7 +4718,6 @@ export const serializeAws_restJson1UpdateMethodCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4605,10 +4733,13 @@ export const serializeAws_restJson1UpdateMethodResponseCommand = async ( input: UpdateMethodResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}/methods/{httpMethod}/responses/{statusCode}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4652,7 +4783,6 @@ export const serializeAws_restJson1UpdateMethodResponseCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4668,10 +4798,12 @@ export const serializeAws_restJson1UpdateModelCommand = async ( input: UpdateModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/models/{modelName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/models/{modelName}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4697,7 +4829,6 @@ export const serializeAws_restJson1UpdateModelCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4713,10 +4844,13 @@ export const serializeAws_restJson1UpdateRequestValidatorCommand = async ( input: UpdateRequestValidatorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/requestvalidators/{requestValidatorId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/requestvalidators/{requestValidatorId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4742,7 +4876,6 @@ export const serializeAws_restJson1UpdateRequestValidatorCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4758,10 +4891,13 @@ export const serializeAws_restJson1UpdateResourceCommand = async ( input: UpdateResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/resources/{resourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/restapis/{restApiId}/resources/{resourceId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4787,7 +4923,6 @@ export const serializeAws_restJson1UpdateResourceCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4803,10 +4938,11 @@ export const serializeAws_restJson1UpdateRestApiCommand = async ( input: UpdateRestApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4823,7 +4959,6 @@ export const serializeAws_restJson1UpdateRestApiCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4839,10 +4974,12 @@ export const serializeAws_restJson1UpdateStageCommand = async ( input: UpdateStageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restapis/{restApiId}/stages/{stageName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restapis/{restApiId}/stages/{stageName}"; if (input.restApiId !== undefined) { const labelValue: string = input.restApiId; if (labelValue.length <= 0) { @@ -4868,7 +5005,6 @@ export const serializeAws_restJson1UpdateStageCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4884,10 +5020,13 @@ export const serializeAws_restJson1UpdateUsageCommand = async ( input: UpdateUsageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/usageplans/{usagePlanId}/keys/{keyId}/usage"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/usageplans/{usagePlanId}/keys/{keyId}/usage"; if (input.usagePlanId !== undefined) { const labelValue: string = input.usagePlanId; if (labelValue.length <= 0) { @@ -4913,7 +5052,6 @@ export const serializeAws_restJson1UpdateUsageCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4929,10 +5067,12 @@ export const serializeAws_restJson1UpdateUsagePlanCommand = async ( input: UpdateUsagePlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/usageplans/{usagePlanId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usageplans/{usagePlanId}"; if (input.usagePlanId !== undefined) { const labelValue: string = input.usagePlanId; if (labelValue.length <= 0) { @@ -4949,7 +5089,6 @@ export const serializeAws_restJson1UpdateUsagePlanCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4965,10 +5104,11 @@ export const serializeAws_restJson1UpdateVpcLinkCommand = async ( input: UpdateVpcLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/vpclinks/{vpcLinkId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/vpclinks/{vpcLinkId}"; if (input.vpcLinkId !== undefined) { const labelValue: string = input.vpcLinkId; if (labelValue.length <= 0) { @@ -4985,7 +5125,6 @@ export const serializeAws_restJson1UpdateVpcLinkCommand = async ( patchOperations: serializeAws_restJson1ListOfPatchOperation(input.patchOperations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-apigatewaymanagementapi/protocols/Aws_restJson1.ts b/clients/client-apigatewaymanagementapi/protocols/Aws_restJson1.ts index 354450302f749..59078268a71ab 100644 --- a/clients/client-apigatewaymanagementapi/protocols/Aws_restJson1.ts +++ b/clients/client-apigatewaymanagementapi/protocols/Aws_restJson1.ts @@ -25,8 +25,10 @@ export const serializeAws_restJson1DeleteConnectionCommand = async ( input: DeleteConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/@connections/{ConnectionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/@connections/{ConnectionId}"; if (input.ConnectionId !== undefined) { const labelValue: string = input.ConnectionId; if (labelValue.length <= 0) { @@ -37,7 +39,6 @@ export const serializeAws_restJson1DeleteConnectionCommand = async ( throw new Error("No value provided for input HTTP label: ConnectionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -53,8 +54,10 @@ export const serializeAws_restJson1GetConnectionCommand = async ( input: GetConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/@connections/{ConnectionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/@connections/{ConnectionId}"; if (input.ConnectionId !== undefined) { const labelValue: string = input.ConnectionId; if (labelValue.length <= 0) { @@ -65,7 +68,6 @@ export const serializeAws_restJson1GetConnectionCommand = async ( throw new Error("No value provided for input HTTP label: ConnectionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -81,10 +83,12 @@ export const serializeAws_restJson1PostToConnectionCommand = async ( input: PostToConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", }; - let resolvedPath = "/@connections/{ConnectionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/@connections/{ConnectionId}"; if (input.ConnectionId !== undefined) { const labelValue: string = input.ConnectionId; if (labelValue.length <= 0) { @@ -98,7 +102,6 @@ export const serializeAws_restJson1PostToConnectionCommand = async ( if (input.Data !== undefined) { body = input.Data; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-apigatewayv2/protocols/Aws_restJson1.ts b/clients/client-apigatewayv2/protocols/Aws_restJson1.ts index 97f2ef5680535..a5aec069e31b9 100644 --- a/clients/client-apigatewayv2/protocols/Aws_restJson1.ts +++ b/clients/client-apigatewayv2/protocols/Aws_restJson1.ts @@ -159,10 +159,11 @@ export const serializeAws_restJson1CreateApiCommand = async ( input: CreateApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis"; let body: any; body = JSON.stringify({ ...(input.ApiKeySelectionExpression !== undefined && @@ -187,7 +188,6 @@ export const serializeAws_restJson1CreateApiCommand = async ( ...(input.Target !== undefined && input.Target !== null && { target: input.Target }), ...(input.Version !== undefined && input.Version !== null && { version: input.Version }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -203,10 +203,12 @@ export const serializeAws_restJson1CreateApiMappingCommand = async ( input: CreateApiMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/domainnames/{DomainName}/apimappings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/domainnames/{DomainName}/apimappings"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -222,7 +224,6 @@ export const serializeAws_restJson1CreateApiMappingCommand = async ( ...(input.ApiMappingKey !== undefined && input.ApiMappingKey !== null && { apiMappingKey: input.ApiMappingKey }), ...(input.Stage !== undefined && input.Stage !== null && { stage: input.Stage }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -238,10 +239,12 @@ export const serializeAws_restJson1CreateAuthorizerCommand = async ( input: CreateAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/authorizers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/authorizers"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -282,7 +285,6 @@ export const serializeAws_restJson1CreateAuthorizerCommand = async ( }), ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -298,10 +300,12 @@ export const serializeAws_restJson1CreateDeploymentCommand = async ( input: CreateDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/deployments"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -316,7 +320,6 @@ export const serializeAws_restJson1CreateDeploymentCommand = async ( ...(input.Description !== undefined && input.Description !== null && { description: input.Description }), ...(input.StageName !== undefined && input.StageName !== null && { stageName: input.StageName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -332,10 +335,11 @@ export const serializeAws_restJson1CreateDomainNameCommand = async ( input: CreateDomainNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/domainnames"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/domainnames"; let body: any; body = JSON.stringify({ ...(input.DomainName !== undefined && input.DomainName !== null && { domainName: input.DomainName }), @@ -355,7 +359,6 @@ export const serializeAws_restJson1CreateDomainNameCommand = async ( }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -371,10 +374,12 @@ export const serializeAws_restJson1CreateIntegrationCommand = async ( input: CreateIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/integrations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/integrations"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -425,7 +430,6 @@ export const serializeAws_restJson1CreateIntegrationCommand = async ( ...(input.TlsConfig !== undefined && input.TlsConfig !== null && { tlsConfig: serializeAws_restJson1TlsConfigInput(input.TlsConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -441,10 +445,13 @@ export const serializeAws_restJson1CreateIntegrationResponseCommand = async ( input: CreateIntegrationResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/integrations/{IntegrationId}/integrationresponses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/integrations/{IntegrationId}/integrationresponses"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -480,7 +487,6 @@ export const serializeAws_restJson1CreateIntegrationResponseCommand = async ( ...(input.TemplateSelectionExpression !== undefined && input.TemplateSelectionExpression !== null && { templateSelectionExpression: input.TemplateSelectionExpression }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -496,10 +502,11 @@ export const serializeAws_restJson1CreateModelCommand = async ( input: CreateModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/models"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/models"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -516,7 +523,6 @@ export const serializeAws_restJson1CreateModelCommand = async ( ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), ...(input.Schema !== undefined && input.Schema !== null && { schema: input.Schema }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -532,10 +538,11 @@ export const serializeAws_restJson1CreateRouteCommand = async ( input: CreateRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/routes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/routes"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -574,7 +581,6 @@ export const serializeAws_restJson1CreateRouteCommand = async ( }), ...(input.Target !== undefined && input.Target !== null && { target: input.Target }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -590,10 +596,13 @@ export const serializeAws_restJson1CreateRouteResponseCommand = async ( input: CreateRouteResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/routes/{RouteId}/routeresponses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/routes/{RouteId}/routeresponses"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -627,7 +636,6 @@ export const serializeAws_restJson1CreateRouteResponseCommand = async ( ...(input.RouteResponseKey !== undefined && input.RouteResponseKey !== null && { routeResponseKey: input.RouteResponseKey }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -643,10 +651,11 @@ export const serializeAws_restJson1CreateStageCommand = async ( input: CreateStageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/stages"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/stages"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -682,7 +691,6 @@ export const serializeAws_restJson1CreateStageCommand = async ( }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -698,10 +706,11 @@ export const serializeAws_restJson1CreateVpcLinkCommand = async ( input: CreateVpcLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/vpclinks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/vpclinks"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), @@ -713,7 +722,6 @@ export const serializeAws_restJson1CreateVpcLinkCommand = async ( input.SubnetIds !== null && { subnetIds: serializeAws_restJson1SubnetIdList(input.SubnetIds, context) }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -729,8 +737,11 @@ export const serializeAws_restJson1DeleteAccessLogSettingsCommand = async ( input: DeleteAccessLogSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/stages/{StageName}/accesslogsettings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/stages/{StageName}/accesslogsettings"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -750,7 +761,6 @@ export const serializeAws_restJson1DeleteAccessLogSettingsCommand = async ( throw new Error("No value provided for input HTTP label: StageName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -766,8 +776,9 @@ export const serializeAws_restJson1DeleteApiCommand = async ( input: DeleteApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -778,7 +789,6 @@ export const serializeAws_restJson1DeleteApiCommand = async ( throw new Error("No value provided for input HTTP label: ApiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -794,8 +804,11 @@ export const serializeAws_restJson1DeleteApiMappingCommand = async ( input: DeleteApiMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/domainnames/{DomainName}/apimappings/{ApiMappingId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/domainnames/{DomainName}/apimappings/{ApiMappingId}"; if (input.ApiMappingId !== undefined) { const labelValue: string = input.ApiMappingId; if (labelValue.length <= 0) { @@ -815,7 +828,6 @@ export const serializeAws_restJson1DeleteApiMappingCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -831,8 +843,11 @@ export const serializeAws_restJson1DeleteAuthorizerCommand = async ( input: DeleteAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/authorizers/{AuthorizerId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/authorizers/{AuthorizerId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -852,7 +867,6 @@ export const serializeAws_restJson1DeleteAuthorizerCommand = async ( throw new Error("No value provided for input HTTP label: AuthorizerId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -868,8 +882,9 @@ export const serializeAws_restJson1DeleteCorsConfigurationCommand = async ( input: DeleteCorsConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/cors"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/cors"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -880,7 +895,6 @@ export const serializeAws_restJson1DeleteCorsConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: ApiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -896,8 +910,11 @@ export const serializeAws_restJson1DeleteDeploymentCommand = async ( input: DeleteDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/deployments/{DeploymentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/deployments/{DeploymentId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -917,7 +934,6 @@ export const serializeAws_restJson1DeleteDeploymentCommand = async ( throw new Error("No value provided for input HTTP label: DeploymentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -933,8 +949,10 @@ export const serializeAws_restJson1DeleteDomainNameCommand = async ( input: DeleteDomainNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/domainnames/{DomainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/domainnames/{DomainName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -945,7 +963,6 @@ export const serializeAws_restJson1DeleteDomainNameCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -961,8 +978,11 @@ export const serializeAws_restJson1DeleteIntegrationCommand = async ( input: DeleteIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/integrations/{IntegrationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/integrations/{IntegrationId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -982,7 +1002,6 @@ export const serializeAws_restJson1DeleteIntegrationCommand = async ( throw new Error("No value provided for input HTTP label: IntegrationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -998,8 +1017,11 @@ export const serializeAws_restJson1DeleteIntegrationResponseCommand = async ( input: DeleteIntegrationResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/integrations/{IntegrationId}/integrationresponses/{IntegrationResponseId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/integrations/{IntegrationId}/integrationresponses/{IntegrationResponseId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1028,7 +1050,6 @@ export const serializeAws_restJson1DeleteIntegrationResponseCommand = async ( throw new Error("No value provided for input HTTP label: IntegrationResponseId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1044,8 +1065,10 @@ export const serializeAws_restJson1DeleteModelCommand = async ( input: DeleteModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/models/{ModelId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/models/{ModelId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1065,7 +1088,6 @@ export const serializeAws_restJson1DeleteModelCommand = async ( throw new Error("No value provided for input HTTP label: ModelId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1081,8 +1103,10 @@ export const serializeAws_restJson1DeleteRouteCommand = async ( input: DeleteRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/routes/{RouteId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/routes/{RouteId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1102,7 +1126,6 @@ export const serializeAws_restJson1DeleteRouteCommand = async ( throw new Error("No value provided for input HTTP label: RouteId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1118,8 +1141,11 @@ export const serializeAws_restJson1DeleteRouteRequestParameterCommand = async ( input: DeleteRouteRequestParameterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/routes/{RouteId}/requestparameters/{RequestParameterKey}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/routes/{RouteId}/requestparameters/{RequestParameterKey}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1148,7 +1174,6 @@ export const serializeAws_restJson1DeleteRouteRequestParameterCommand = async ( throw new Error("No value provided for input HTTP label: RouteId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1164,8 +1189,11 @@ export const serializeAws_restJson1DeleteRouteResponseCommand = async ( input: DeleteRouteResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/routes/{RouteId}/routeresponses/{RouteResponseId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/routes/{RouteId}/routeresponses/{RouteResponseId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1194,7 +1222,6 @@ export const serializeAws_restJson1DeleteRouteResponseCommand = async ( throw new Error("No value provided for input HTTP label: RouteResponseId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1210,8 +1237,11 @@ export const serializeAws_restJson1DeleteRouteSettingsCommand = async ( input: DeleteRouteSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/stages/{StageName}/routesettings/{RouteKey}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/stages/{StageName}/routesettings/{RouteKey}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1240,7 +1270,6 @@ export const serializeAws_restJson1DeleteRouteSettingsCommand = async ( throw new Error("No value provided for input HTTP label: StageName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1256,8 +1285,10 @@ export const serializeAws_restJson1DeleteStageCommand = async ( input: DeleteStageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/stages/{StageName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/stages/{StageName}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1277,7 +1308,6 @@ export const serializeAws_restJson1DeleteStageCommand = async ( throw new Error("No value provided for input HTTP label: StageName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1293,8 +1323,9 @@ export const serializeAws_restJson1DeleteVpcLinkCommand = async ( input: DeleteVpcLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/vpclinks/{VpcLinkId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/vpclinks/{VpcLinkId}"; if (input.VpcLinkId !== undefined) { const labelValue: string = input.VpcLinkId; if (labelValue.length <= 0) { @@ -1305,7 +1336,6 @@ export const serializeAws_restJson1DeleteVpcLinkCommand = async ( throw new Error("No value provided for input HTTP label: VpcLinkId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1321,8 +1351,10 @@ export const serializeAws_restJson1ExportApiCommand = async ( input: ExportApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/exports/{Specification}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/exports/{Specification}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1348,7 +1380,6 @@ export const serializeAws_restJson1ExportApiCommand = async ( ...(input.StageName !== undefined && { stageName: input.StageName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1365,8 +1396,9 @@ export const serializeAws_restJson1GetApiCommand = async ( input: GetApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1377,7 +1409,6 @@ export const serializeAws_restJson1GetApiCommand = async ( throw new Error("No value provided for input HTTP label: ApiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1393,8 +1424,11 @@ export const serializeAws_restJson1GetApiMappingCommand = async ( input: GetApiMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/domainnames/{DomainName}/apimappings/{ApiMappingId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/domainnames/{DomainName}/apimappings/{ApiMappingId}"; if (input.ApiMappingId !== undefined) { const labelValue: string = input.ApiMappingId; if (labelValue.length <= 0) { @@ -1414,7 +1448,6 @@ export const serializeAws_restJson1GetApiMappingCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1430,8 +1463,10 @@ export const serializeAws_restJson1GetApiMappingsCommand = async ( input: GetApiMappingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/domainnames/{DomainName}/apimappings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/domainnames/{DomainName}/apimappings"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -1446,7 +1481,6 @@ export const serializeAws_restJson1GetApiMappingsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1463,14 +1497,14 @@ export const serializeAws_restJson1GetApisCommand = async ( input: GetApisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1487,8 +1521,11 @@ export const serializeAws_restJson1GetAuthorizerCommand = async ( input: GetAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/authorizers/{AuthorizerId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/authorizers/{AuthorizerId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1508,7 +1545,6 @@ export const serializeAws_restJson1GetAuthorizerCommand = async ( throw new Error("No value provided for input HTTP label: AuthorizerId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1524,8 +1560,10 @@ export const serializeAws_restJson1GetAuthorizersCommand = async ( input: GetAuthorizersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/authorizers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/authorizers"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1540,7 +1578,6 @@ export const serializeAws_restJson1GetAuthorizersCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1557,8 +1594,11 @@ export const serializeAws_restJson1GetDeploymentCommand = async ( input: GetDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/deployments/{DeploymentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/deployments/{DeploymentId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1578,7 +1618,6 @@ export const serializeAws_restJson1GetDeploymentCommand = async ( throw new Error("No value provided for input HTTP label: DeploymentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1594,8 +1633,10 @@ export const serializeAws_restJson1GetDeploymentsCommand = async ( input: GetDeploymentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/deployments"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1610,7 +1651,6 @@ export const serializeAws_restJson1GetDeploymentsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1627,8 +1667,10 @@ export const serializeAws_restJson1GetDomainNameCommand = async ( input: GetDomainNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/domainnames/{DomainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/domainnames/{DomainName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -1639,7 +1681,6 @@ export const serializeAws_restJson1GetDomainNameCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1655,14 +1696,14 @@ export const serializeAws_restJson1GetDomainNamesCommand = async ( input: GetDomainNamesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/domainnames"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/domainnames"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1679,8 +1720,11 @@ export const serializeAws_restJson1GetIntegrationCommand = async ( input: GetIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/integrations/{IntegrationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/integrations/{IntegrationId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1700,7 +1744,6 @@ export const serializeAws_restJson1GetIntegrationCommand = async ( throw new Error("No value provided for input HTTP label: IntegrationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1716,8 +1759,11 @@ export const serializeAws_restJson1GetIntegrationResponseCommand = async ( input: GetIntegrationResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/integrations/{IntegrationId}/integrationresponses/{IntegrationResponseId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/integrations/{IntegrationId}/integrationresponses/{IntegrationResponseId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1746,7 +1792,6 @@ export const serializeAws_restJson1GetIntegrationResponseCommand = async ( throw new Error("No value provided for input HTTP label: IntegrationResponseId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1762,8 +1807,11 @@ export const serializeAws_restJson1GetIntegrationResponsesCommand = async ( input: GetIntegrationResponsesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/integrations/{IntegrationId}/integrationresponses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/integrations/{IntegrationId}/integrationresponses"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1787,7 +1835,6 @@ export const serializeAws_restJson1GetIntegrationResponsesCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1804,8 +1851,10 @@ export const serializeAws_restJson1GetIntegrationsCommand = async ( input: GetIntegrationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/integrations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/integrations"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1820,7 +1869,6 @@ export const serializeAws_restJson1GetIntegrationsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1837,8 +1885,10 @@ export const serializeAws_restJson1GetModelCommand = async ( input: GetModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/models/{ModelId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/models/{ModelId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1858,7 +1908,6 @@ export const serializeAws_restJson1GetModelCommand = async ( throw new Error("No value provided for input HTTP label: ModelId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1874,8 +1923,9 @@ export const serializeAws_restJson1GetModelsCommand = async ( input: GetModelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/models"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/models"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1890,7 +1940,6 @@ export const serializeAws_restJson1GetModelsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1907,8 +1956,11 @@ export const serializeAws_restJson1GetModelTemplateCommand = async ( input: GetModelTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/models/{ModelId}/template"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/models/{ModelId}/template"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1928,7 +1980,6 @@ export const serializeAws_restJson1GetModelTemplateCommand = async ( throw new Error("No value provided for input HTTP label: ModelId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1944,8 +1995,10 @@ export const serializeAws_restJson1GetRouteCommand = async ( input: GetRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/routes/{RouteId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/routes/{RouteId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -1965,7 +2018,6 @@ export const serializeAws_restJson1GetRouteCommand = async ( throw new Error("No value provided for input HTTP label: RouteId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1981,8 +2033,11 @@ export const serializeAws_restJson1GetRouteResponseCommand = async ( input: GetRouteResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/routes/{RouteId}/routeresponses/{RouteResponseId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/routes/{RouteId}/routeresponses/{RouteResponseId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2011,7 +2066,6 @@ export const serializeAws_restJson1GetRouteResponseCommand = async ( throw new Error("No value provided for input HTTP label: RouteResponseId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2027,8 +2081,11 @@ export const serializeAws_restJson1GetRouteResponsesCommand = async ( input: GetRouteResponsesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/routes/{RouteId}/routeresponses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/routes/{RouteId}/routeresponses"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2052,7 +2109,6 @@ export const serializeAws_restJson1GetRouteResponsesCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2069,8 +2125,9 @@ export const serializeAws_restJson1GetRoutesCommand = async ( input: GetRoutesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/routes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/routes"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2085,7 +2142,6 @@ export const serializeAws_restJson1GetRoutesCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2102,8 +2158,10 @@ export const serializeAws_restJson1GetStageCommand = async ( input: GetStageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/stages/{StageName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/stages/{StageName}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2123,7 +2181,6 @@ export const serializeAws_restJson1GetStageCommand = async ( throw new Error("No value provided for input HTTP label: StageName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2139,8 +2196,9 @@ export const serializeAws_restJson1GetStagesCommand = async ( input: GetStagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/stages"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/stages"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2155,7 +2213,6 @@ export const serializeAws_restJson1GetStagesCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2172,8 +2229,9 @@ export const serializeAws_restJson1GetTagsCommand = async ( input: GetTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -2184,7 +2242,6 @@ export const serializeAws_restJson1GetTagsCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2200,8 +2257,9 @@ export const serializeAws_restJson1GetVpcLinkCommand = async ( input: GetVpcLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/vpclinks/{VpcLinkId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/vpclinks/{VpcLinkId}"; if (input.VpcLinkId !== undefined) { const labelValue: string = input.VpcLinkId; if (labelValue.length <= 0) { @@ -2212,7 +2270,6 @@ export const serializeAws_restJson1GetVpcLinkCommand = async ( throw new Error("No value provided for input HTTP label: VpcLinkId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2228,14 +2285,14 @@ export const serializeAws_restJson1GetVpcLinksCommand = async ( input: GetVpcLinksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/vpclinks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/vpclinks"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2252,10 +2309,11 @@ export const serializeAws_restJson1ImportApiCommand = async ( input: ImportApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis"; const query: any = { ...(input.Basepath !== undefined && { basepath: input.Basepath }), ...(input.FailOnWarnings !== undefined && { failOnWarnings: input.FailOnWarnings.toString() }), @@ -2264,7 +2322,6 @@ export const serializeAws_restJson1ImportApiCommand = async ( body = JSON.stringify({ ...(input.Body !== undefined && input.Body !== null && { body: input.Body }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2281,10 +2338,11 @@ export const serializeAws_restJson1ReimportApiCommand = async ( input: ReimportApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2302,7 +2360,6 @@ export const serializeAws_restJson1ReimportApiCommand = async ( body = JSON.stringify({ ...(input.Body !== undefined && input.Body !== null && { body: input.Body }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2319,8 +2376,11 @@ export const serializeAws_restJson1ResetAuthorizersCacheCommand = async ( input: ResetAuthorizersCacheCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/apis/{ApiId}/stages/{StageName}/cache/authorizers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/stages/{StageName}/cache/authorizers"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2340,7 +2400,6 @@ export const serializeAws_restJson1ResetAuthorizersCacheCommand = async ( throw new Error("No value provided for input HTTP label: StageName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2356,10 +2415,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -2373,7 +2433,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2389,8 +2448,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -2404,7 +2464,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2421,10 +2480,11 @@ export const serializeAws_restJson1UpdateApiCommand = async ( input: UpdateApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2456,7 +2516,6 @@ export const serializeAws_restJson1UpdateApiCommand = async ( ...(input.Target !== undefined && input.Target !== null && { target: input.Target }), ...(input.Version !== undefined && input.Version !== null && { version: input.Version }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2472,10 +2531,13 @@ export const serializeAws_restJson1UpdateApiMappingCommand = async ( input: UpdateApiMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/domainnames/{DomainName}/apimappings/{ApiMappingId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/domainnames/{DomainName}/apimappings/{ApiMappingId}"; if (input.ApiMappingId !== undefined) { const labelValue: string = input.ApiMappingId; if (labelValue.length <= 0) { @@ -2500,7 +2562,6 @@ export const serializeAws_restJson1UpdateApiMappingCommand = async ( ...(input.ApiMappingKey !== undefined && input.ApiMappingKey !== null && { apiMappingKey: input.ApiMappingKey }), ...(input.Stage !== undefined && input.Stage !== null && { stage: input.Stage }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2516,10 +2577,13 @@ export const serializeAws_restJson1UpdateAuthorizerCommand = async ( input: UpdateAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/authorizers/{AuthorizerId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/authorizers/{AuthorizerId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2569,7 +2633,6 @@ export const serializeAws_restJson1UpdateAuthorizerCommand = async ( }), ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2585,10 +2648,13 @@ export const serializeAws_restJson1UpdateDeploymentCommand = async ( input: UpdateDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/deployments/{DeploymentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/deployments/{DeploymentId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2611,7 +2677,6 @@ export const serializeAws_restJson1UpdateDeploymentCommand = async ( body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2627,10 +2692,12 @@ export const serializeAws_restJson1UpdateDomainNameCommand = async ( input: UpdateDomainNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/domainnames/{DomainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/domainnames/{DomainName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -2657,7 +2724,6 @@ export const serializeAws_restJson1UpdateDomainNameCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2673,10 +2739,13 @@ export const serializeAws_restJson1UpdateIntegrationCommand = async ( input: UpdateIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/integrations/{IntegrationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/integrations/{IntegrationId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2736,7 +2805,6 @@ export const serializeAws_restJson1UpdateIntegrationCommand = async ( ...(input.TlsConfig !== undefined && input.TlsConfig !== null && { tlsConfig: serializeAws_restJson1TlsConfigInput(input.TlsConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2752,10 +2820,13 @@ export const serializeAws_restJson1UpdateIntegrationResponseCommand = async ( input: UpdateIntegrationResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/integrations/{IntegrationId}/integrationresponses/{IntegrationResponseId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/integrations/{IntegrationId}/integrationresponses/{IntegrationResponseId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2800,7 +2871,6 @@ export const serializeAws_restJson1UpdateIntegrationResponseCommand = async ( ...(input.TemplateSelectionExpression !== undefined && input.TemplateSelectionExpression !== null && { templateSelectionExpression: input.TemplateSelectionExpression }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2816,10 +2886,12 @@ export const serializeAws_restJson1UpdateModelCommand = async ( input: UpdateModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/models/{ModelId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/models/{ModelId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2845,7 +2917,6 @@ export const serializeAws_restJson1UpdateModelCommand = async ( ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), ...(input.Schema !== undefined && input.Schema !== null && { schema: input.Schema }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2861,10 +2932,12 @@ export const serializeAws_restJson1UpdateRouteCommand = async ( input: UpdateRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/routes/{RouteId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/routes/{RouteId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2912,7 +2985,6 @@ export const serializeAws_restJson1UpdateRouteCommand = async ( }), ...(input.Target !== undefined && input.Target !== null && { target: input.Target }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2928,10 +3000,13 @@ export const serializeAws_restJson1UpdateRouteResponseCommand = async ( input: UpdateRouteResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/routes/{RouteId}/routeresponses/{RouteResponseId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/apis/{ApiId}/routes/{RouteId}/routeresponses/{RouteResponseId}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -2974,7 +3049,6 @@ export const serializeAws_restJson1UpdateRouteResponseCommand = async ( ...(input.RouteResponseKey !== undefined && input.RouteResponseKey !== null && { routeResponseKey: input.RouteResponseKey }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2990,10 +3064,12 @@ export const serializeAws_restJson1UpdateStageCommand = async ( input: UpdateStageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/apis/{ApiId}/stages/{StageName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/apis/{ApiId}/stages/{StageName}"; if (input.ApiId !== undefined) { const labelValue: string = input.ApiId; if (labelValue.length <= 0) { @@ -3036,7 +3112,6 @@ export const serializeAws_restJson1UpdateStageCommand = async ( stageVariables: serializeAws_restJson1StageVariablesMap(input.StageVariables, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3052,10 +3127,11 @@ export const serializeAws_restJson1UpdateVpcLinkCommand = async ( input: UpdateVpcLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/vpclinks/{VpcLinkId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/vpclinks/{VpcLinkId}"; if (input.VpcLinkId !== undefined) { const labelValue: string = input.VpcLinkId; if (labelValue.length <= 0) { @@ -3069,7 +3145,6 @@ export const serializeAws_restJson1UpdateVpcLinkCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-app-mesh/protocols/Aws_restJson1.ts b/clients/client-app-mesh/protocols/Aws_restJson1.ts index 61c48078560b1..c18e65ef68198 100644 --- a/clients/client-app-mesh/protocols/Aws_restJson1.ts +++ b/clients/client-app-mesh/protocols/Aws_restJson1.ts @@ -259,10 +259,13 @@ export const serializeAws_restJson1CreateGatewayRouteCommand = async ( input: CreateGatewayRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualGateway/{virtualGatewayName}/gatewayRoutes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualGateway/{virtualGatewayName}/gatewayRoutes"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -294,7 +297,6 @@ export const serializeAws_restJson1CreateGatewayRouteCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -311,10 +313,11 @@ export const serializeAws_restJson1CreateMeshCommand = async ( input: CreateMeshCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/meshes"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -324,7 +327,6 @@ export const serializeAws_restJson1CreateMeshCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -340,10 +342,13 @@ export const serializeAws_restJson1CreateRouteCommand = async ( input: CreateRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -374,7 +379,6 @@ export const serializeAws_restJson1CreateRouteCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -391,10 +395,13 @@ export const serializeAws_restJson1CreateVirtualGatewayCommand = async ( input: CreateVirtualGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualGateways"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualGateways"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -417,7 +424,6 @@ export const serializeAws_restJson1CreateVirtualGatewayCommand = async ( ...(input.virtualGatewayName !== undefined && input.virtualGatewayName !== null && { virtualGatewayName: input.virtualGatewayName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -434,10 +440,12 @@ export const serializeAws_restJson1CreateVirtualNodeCommand = async ( input: CreateVirtualNodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualNodes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/meshes/{meshName}/virtualNodes"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -460,7 +468,6 @@ export const serializeAws_restJson1CreateVirtualNodeCommand = async ( ...(input.virtualNodeName !== undefined && input.virtualNodeName !== null && { virtualNodeName: input.virtualNodeName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -477,10 +484,13 @@ export const serializeAws_restJson1CreateVirtualRouterCommand = async ( input: CreateVirtualRouterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualRouters"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualRouters"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -503,7 +513,6 @@ export const serializeAws_restJson1CreateVirtualRouterCommand = async ( ...(input.virtualRouterName !== undefined && input.virtualRouterName !== null && { virtualRouterName: input.virtualRouterName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -520,10 +529,13 @@ export const serializeAws_restJson1CreateVirtualServiceCommand = async ( input: CreateVirtualServiceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualServices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualServices"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -546,7 +558,6 @@ export const serializeAws_restJson1CreateVirtualServiceCommand = async ( ...(input.virtualServiceName !== undefined && input.virtualServiceName !== null && { virtualServiceName: input.virtualServiceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -563,8 +574,10 @@ export const serializeAws_restJson1DeleteGatewayRouteCommand = async ( input: DeleteGatewayRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/meshes/{meshName}/virtualGateway/{virtualGatewayName}/gatewayRoutes/{gatewayRouteName}"; if (input.gatewayRouteName !== undefined) { const labelValue: string = input.gatewayRouteName; @@ -597,7 +610,6 @@ export const serializeAws_restJson1DeleteGatewayRouteCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -614,8 +626,10 @@ export const serializeAws_restJson1DeleteMeshCommand = async ( input: DeleteMeshCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/meshes/{meshName}"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -626,7 +640,6 @@ export const serializeAws_restJson1DeleteMeshCommand = async ( throw new Error("No value provided for input HTTP label: meshName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -642,8 +655,11 @@ export const serializeAws_restJson1DeleteRouteCommand = async ( input: DeleteRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes/{routeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes/{routeName}"; if (input.routeName !== undefined) { const labelValue: string = input.routeName; if (labelValue.length <= 0) { @@ -675,7 +691,6 @@ export const serializeAws_restJson1DeleteRouteCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -692,8 +707,11 @@ export const serializeAws_restJson1DeleteVirtualGatewayCommand = async ( input: DeleteVirtualGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualGateways/{virtualGatewayName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualGateways/{virtualGatewayName}"; if (input.virtualGatewayName !== undefined) { const labelValue: string = input.virtualGatewayName; if (labelValue.length <= 0) { @@ -716,7 +734,6 @@ export const serializeAws_restJson1DeleteVirtualGatewayCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -733,8 +750,11 @@ export const serializeAws_restJson1DeleteVirtualNodeCommand = async ( input: DeleteVirtualNodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualNodes/{virtualNodeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualNodes/{virtualNodeName}"; if (input.virtualNodeName !== undefined) { const labelValue: string = input.virtualNodeName; if (labelValue.length <= 0) { @@ -757,7 +777,6 @@ export const serializeAws_restJson1DeleteVirtualNodeCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -774,8 +793,11 @@ export const serializeAws_restJson1DeleteVirtualRouterCommand = async ( input: DeleteVirtualRouterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualRouters/{virtualRouterName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualRouters/{virtualRouterName}"; if (input.virtualRouterName !== undefined) { const labelValue: string = input.virtualRouterName; if (labelValue.length <= 0) { @@ -798,7 +820,6 @@ export const serializeAws_restJson1DeleteVirtualRouterCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -815,8 +836,11 @@ export const serializeAws_restJson1DeleteVirtualServiceCommand = async ( input: DeleteVirtualServiceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualServices/{virtualServiceName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualServices/{virtualServiceName}"; if (input.virtualServiceName !== undefined) { const labelValue: string = input.virtualServiceName; if (labelValue.length <= 0) { @@ -839,7 +863,6 @@ export const serializeAws_restJson1DeleteVirtualServiceCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -856,8 +879,10 @@ export const serializeAws_restJson1DescribeGatewayRouteCommand = async ( input: DescribeGatewayRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/meshes/{meshName}/virtualGateway/{virtualGatewayName}/gatewayRoutes/{gatewayRouteName}"; if (input.gatewayRouteName !== undefined) { const labelValue: string = input.gatewayRouteName; @@ -890,7 +915,6 @@ export const serializeAws_restJson1DescribeGatewayRouteCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -907,8 +931,10 @@ export const serializeAws_restJson1DescribeMeshCommand = async ( input: DescribeMeshCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/meshes/{meshName}"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -922,7 +948,6 @@ export const serializeAws_restJson1DescribeMeshCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -939,8 +964,11 @@ export const serializeAws_restJson1DescribeRouteCommand = async ( input: DescribeRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes/{routeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes/{routeName}"; if (input.routeName !== undefined) { const labelValue: string = input.routeName; if (labelValue.length <= 0) { @@ -972,7 +1000,6 @@ export const serializeAws_restJson1DescribeRouteCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -989,8 +1016,11 @@ export const serializeAws_restJson1DescribeVirtualGatewayCommand = async ( input: DescribeVirtualGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualGateways/{virtualGatewayName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualGateways/{virtualGatewayName}"; if (input.virtualGatewayName !== undefined) { const labelValue: string = input.virtualGatewayName; if (labelValue.length <= 0) { @@ -1013,7 +1043,6 @@ export const serializeAws_restJson1DescribeVirtualGatewayCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1030,8 +1059,11 @@ export const serializeAws_restJson1DescribeVirtualNodeCommand = async ( input: DescribeVirtualNodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualNodes/{virtualNodeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualNodes/{virtualNodeName}"; if (input.virtualNodeName !== undefined) { const labelValue: string = input.virtualNodeName; if (labelValue.length <= 0) { @@ -1054,7 +1086,6 @@ export const serializeAws_restJson1DescribeVirtualNodeCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1071,8 +1102,11 @@ export const serializeAws_restJson1DescribeVirtualRouterCommand = async ( input: DescribeVirtualRouterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualRouters/{virtualRouterName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualRouters/{virtualRouterName}"; if (input.virtualRouterName !== undefined) { const labelValue: string = input.virtualRouterName; if (labelValue.length <= 0) { @@ -1095,7 +1129,6 @@ export const serializeAws_restJson1DescribeVirtualRouterCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1112,8 +1145,11 @@ export const serializeAws_restJson1DescribeVirtualServiceCommand = async ( input: DescribeVirtualServiceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualServices/{virtualServiceName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualServices/{virtualServiceName}"; if (input.virtualServiceName !== undefined) { const labelValue: string = input.virtualServiceName; if (labelValue.length <= 0) { @@ -1136,7 +1172,6 @@ export const serializeAws_restJson1DescribeVirtualServiceCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1153,8 +1188,11 @@ export const serializeAws_restJson1ListGatewayRoutesCommand = async ( input: ListGatewayRoutesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualGateway/{virtualGatewayName}/gatewayRoutes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualGateway/{virtualGatewayName}/gatewayRoutes"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -1179,7 +1217,6 @@ export const serializeAws_restJson1ListGatewayRoutesCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1196,14 +1233,14 @@ export const serializeAws_restJson1ListMeshesCommand = async ( input: ListMeshesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/meshes"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1220,8 +1257,11 @@ export const serializeAws_restJson1ListRoutesCommand = async ( input: ListRoutesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -1246,7 +1286,6 @@ export const serializeAws_restJson1ListRoutesCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1263,15 +1302,15 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1288,8 +1327,11 @@ export const serializeAws_restJson1ListVirtualGatewaysCommand = async ( input: ListVirtualGatewaysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualGateways"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualGateways"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -1305,7 +1347,6 @@ export const serializeAws_restJson1ListVirtualGatewaysCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1322,8 +1363,10 @@ export const serializeAws_restJson1ListVirtualNodesCommand = async ( input: ListVirtualNodesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualNodes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/meshes/{meshName}/virtualNodes"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -1339,7 +1382,6 @@ export const serializeAws_restJson1ListVirtualNodesCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1356,8 +1398,11 @@ export const serializeAws_restJson1ListVirtualRoutersCommand = async ( input: ListVirtualRoutersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualRouters"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualRouters"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -1373,7 +1418,6 @@ export const serializeAws_restJson1ListVirtualRoutersCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1390,8 +1434,11 @@ export const serializeAws_restJson1ListVirtualServicesCommand = async ( input: ListVirtualServicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualServices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualServices"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -1407,7 +1454,6 @@ export const serializeAws_restJson1ListVirtualServicesCommand = async ( ...(input.meshOwner !== undefined && { meshOwner: input.meshOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1424,10 +1470,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/tag"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/tag"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; @@ -1436,7 +1483,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1453,10 +1499,11 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/untag"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/untag"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; @@ -1465,7 +1512,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && input.tagKeys !== null && { tagKeys: serializeAws_restJson1TagKeyList(input.tagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1482,10 +1528,12 @@ export const serializeAws_restJson1UpdateGatewayRouteCommand = async ( input: UpdateGatewayRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/meshes/{meshName}/virtualGateway/{virtualGatewayName}/gatewayRoutes/{gatewayRouteName}"; if (input.gatewayRouteName !== undefined) { const labelValue: string = input.gatewayRouteName; @@ -1523,7 +1571,6 @@ export const serializeAws_restJson1UpdateGatewayRouteCommand = async ( ...(input.spec !== undefined && input.spec !== null && { spec: serializeAws_restJson1GatewayRouteSpec(input.spec, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1540,10 +1587,12 @@ export const serializeAws_restJson1UpdateMeshCommand = async ( input: UpdateMeshCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/meshes/{meshName}"; if (input.meshName !== undefined) { const labelValue: string = input.meshName; if (labelValue.length <= 0) { @@ -1559,7 +1608,6 @@ export const serializeAws_restJson1UpdateMeshCommand = async ( ...(input.spec !== undefined && input.spec !== null && { spec: serializeAws_restJson1MeshSpec(input.spec, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1575,10 +1623,13 @@ export const serializeAws_restJson1UpdateRouteCommand = async ( input: UpdateRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes/{routeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes/{routeName}"; if (input.routeName !== undefined) { const labelValue: string = input.routeName; if (labelValue.length <= 0) { @@ -1615,7 +1666,6 @@ export const serializeAws_restJson1UpdateRouteCommand = async ( ...(input.spec !== undefined && input.spec !== null && { spec: serializeAws_restJson1RouteSpec(input.spec, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1632,10 +1682,13 @@ export const serializeAws_restJson1UpdateVirtualGatewayCommand = async ( input: UpdateVirtualGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualGateways/{virtualGatewayName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualGateways/{virtualGatewayName}"; if (input.virtualGatewayName !== undefined) { const labelValue: string = input.virtualGatewayName; if (labelValue.length <= 0) { @@ -1663,7 +1716,6 @@ export const serializeAws_restJson1UpdateVirtualGatewayCommand = async ( ...(input.spec !== undefined && input.spec !== null && { spec: serializeAws_restJson1VirtualGatewaySpec(input.spec, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1680,10 +1732,13 @@ export const serializeAws_restJson1UpdateVirtualNodeCommand = async ( input: UpdateVirtualNodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualNodes/{virtualNodeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualNodes/{virtualNodeName}"; if (input.virtualNodeName !== undefined) { const labelValue: string = input.virtualNodeName; if (labelValue.length <= 0) { @@ -1711,7 +1766,6 @@ export const serializeAws_restJson1UpdateVirtualNodeCommand = async ( ...(input.spec !== undefined && input.spec !== null && { spec: serializeAws_restJson1VirtualNodeSpec(input.spec, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1728,10 +1782,13 @@ export const serializeAws_restJson1UpdateVirtualRouterCommand = async ( input: UpdateVirtualRouterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualRouters/{virtualRouterName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualRouters/{virtualRouterName}"; if (input.virtualRouterName !== undefined) { const labelValue: string = input.virtualRouterName; if (labelValue.length <= 0) { @@ -1759,7 +1816,6 @@ export const serializeAws_restJson1UpdateVirtualRouterCommand = async ( ...(input.spec !== undefined && input.spec !== null && { spec: serializeAws_restJson1VirtualRouterSpec(input.spec, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1776,10 +1832,13 @@ export const serializeAws_restJson1UpdateVirtualServiceCommand = async ( input: UpdateVirtualServiceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v20190125/meshes/{meshName}/virtualServices/{virtualServiceName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20190125/meshes/{meshName}/virtualServices/{virtualServiceName}"; if (input.virtualServiceName !== undefined) { const labelValue: string = input.virtualServiceName; if (labelValue.length <= 0) { @@ -1807,7 +1866,6 @@ export const serializeAws_restJson1UpdateVirtualServiceCommand = async ( ...(input.spec !== undefined && input.spec !== null && { spec: serializeAws_restJson1VirtualServiceSpec(input.spec, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-appconfig/protocols/Aws_restJson1.ts b/clients/client-appconfig/protocols/Aws_restJson1.ts index bcd55645315d1..f7214d44fb7ca 100644 --- a/clients/client-appconfig/protocols/Aws_restJson1.ts +++ b/clients/client-appconfig/protocols/Aws_restJson1.ts @@ -117,17 +117,17 @@ export const serializeAws_restJson1CreateApplicationCommand = async ( input: CreateApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -143,10 +143,13 @@ export const serializeAws_restJson1CreateConfigurationProfileCommand = async ( input: CreateConfigurationProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}/configurationprofiles"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/configurationprofiles"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -167,7 +170,6 @@ export const serializeAws_restJson1CreateConfigurationProfileCommand = async ( ...(input.Validators !== undefined && input.Validators !== null && { Validators: serializeAws_restJson1ValidatorList(input.Validators, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -183,10 +185,11 @@ export const serializeAws_restJson1CreateDeploymentStrategyCommand = async ( input: CreateDeploymentStrategyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deploymentstrategies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deploymentstrategies"; let body: any; body = JSON.stringify({ ...(input.DeploymentDurationInMinutes !== undefined && @@ -201,7 +204,6 @@ export const serializeAws_restJson1CreateDeploymentStrategyCommand = async ( ...(input.ReplicateTo !== undefined && input.ReplicateTo !== null && { ReplicateTo: input.ReplicateTo }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -217,10 +219,13 @@ export const serializeAws_restJson1CreateEnvironmentCommand = async ( input: CreateEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}/environments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/environments"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -238,7 +243,6 @@ export const serializeAws_restJson1CreateEnvironmentCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -254,6 +258,7 @@ export const serializeAws_restJson1CreateHostedConfigurationVersionCommand = asy input: CreateHostedConfigurationVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.Description) && { description: input.Description! }), @@ -263,6 +268,7 @@ export const serializeAws_restJson1CreateHostedConfigurationVersionCommand = asy }), }; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}/hostedconfigurationversions"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; @@ -286,7 +292,6 @@ export const serializeAws_restJson1CreateHostedConfigurationVersionCommand = asy if (input.Content !== undefined) { body = input.Content; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -302,8 +307,10 @@ export const serializeAws_restJson1DeleteApplicationCommand = async ( input: DeleteApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -314,7 +321,6 @@ export const serializeAws_restJson1DeleteApplicationCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -330,8 +336,11 @@ export const serializeAws_restJson1DeleteConfigurationProfileCommand = async ( input: DeleteConfigurationProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -351,7 +360,6 @@ export const serializeAws_restJson1DeleteConfigurationProfileCommand = async ( throw new Error("No value provided for input HTTP label: ConfigurationProfileId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -367,8 +375,11 @@ export const serializeAws_restJson1DeleteDeploymentStrategyCommand = async ( input: DeleteDeploymentStrategyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/deployementstrategies/{DeploymentStrategyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/deployementstrategies/{DeploymentStrategyId}"; if (input.DeploymentStrategyId !== undefined) { const labelValue: string = input.DeploymentStrategyId; if (labelValue.length <= 0) { @@ -379,7 +390,6 @@ export const serializeAws_restJson1DeleteDeploymentStrategyCommand = async ( throw new Error("No value provided for input HTTP label: DeploymentStrategyId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -395,8 +405,11 @@ export const serializeAws_restJson1DeleteEnvironmentCommand = async ( input: DeleteEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/environments/{EnvironmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/environments/{EnvironmentId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -416,7 +429,6 @@ export const serializeAws_restJson1DeleteEnvironmentCommand = async ( throw new Error("No value provided for input HTTP label: EnvironmentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -432,8 +444,10 @@ export const serializeAws_restJson1DeleteHostedConfigurationVersionCommand = asy input: DeleteHostedConfigurationVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}/hostedconfigurationversions/{VersionNumber}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; @@ -463,7 +477,6 @@ export const serializeAws_restJson1DeleteHostedConfigurationVersionCommand = asy throw new Error("No value provided for input HTTP label: VersionNumber."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -479,8 +492,10 @@ export const serializeAws_restJson1GetApplicationCommand = async ( input: GetApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -491,7 +506,6 @@ export const serializeAws_restJson1GetApplicationCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -507,8 +521,11 @@ export const serializeAws_restJson1GetConfigurationCommand = async ( input: GetConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{Application}/environments/{Environment}/configurations/{Configuration}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{Application}/environments/{Environment}/configurations/{Configuration}"; if (input.Application !== undefined) { const labelValue: string = input.Application; if (labelValue.length <= 0) { @@ -543,7 +560,6 @@ export const serializeAws_restJson1GetConfigurationCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -560,8 +576,11 @@ export const serializeAws_restJson1GetConfigurationProfileCommand = async ( input: GetConfigurationProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -581,7 +600,6 @@ export const serializeAws_restJson1GetConfigurationProfileCommand = async ( throw new Error("No value provided for input HTTP label: ConfigurationProfileId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -597,8 +615,11 @@ export const serializeAws_restJson1GetDeploymentCommand = async ( input: GetDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/environments/{EnvironmentId}/deployments/{DeploymentNumber}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/environments/{EnvironmentId}/deployments/{DeploymentNumber}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -627,7 +648,6 @@ export const serializeAws_restJson1GetDeploymentCommand = async ( throw new Error("No value provided for input HTTP label: DeploymentNumber."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -643,8 +663,11 @@ export const serializeAws_restJson1GetDeploymentStrategyCommand = async ( input: GetDeploymentStrategyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/deploymentstrategies/{DeploymentStrategyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/deploymentstrategies/{DeploymentStrategyId}"; if (input.DeploymentStrategyId !== undefined) { const labelValue: string = input.DeploymentStrategyId; if (labelValue.length <= 0) { @@ -655,7 +678,6 @@ export const serializeAws_restJson1GetDeploymentStrategyCommand = async ( throw new Error("No value provided for input HTTP label: DeploymentStrategyId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -671,8 +693,11 @@ export const serializeAws_restJson1GetEnvironmentCommand = async ( input: GetEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/environments/{EnvironmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/environments/{EnvironmentId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -692,7 +717,6 @@ export const serializeAws_restJson1GetEnvironmentCommand = async ( throw new Error("No value provided for input HTTP label: EnvironmentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -708,8 +732,10 @@ export const serializeAws_restJson1GetHostedConfigurationVersionCommand = async input: GetHostedConfigurationVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}/hostedconfigurationversions/{VersionNumber}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; @@ -739,7 +765,6 @@ export const serializeAws_restJson1GetHostedConfigurationVersionCommand = async throw new Error("No value provided for input HTTP label: VersionNumber."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -755,14 +780,14 @@ export const serializeAws_restJson1ListApplicationsCommand = async ( input: ListApplicationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications"; const query: any = { ...(input.MaxResults !== undefined && { max_results: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { next_token: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -779,8 +804,11 @@ export const serializeAws_restJson1ListConfigurationProfilesCommand = async ( input: ListConfigurationProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/configurationprofiles"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/configurationprofiles"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -795,7 +823,6 @@ export const serializeAws_restJson1ListConfigurationProfilesCommand = async ( ...(input.NextToken !== undefined && { next_token: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -812,8 +839,11 @@ export const serializeAws_restJson1ListDeploymentsCommand = async ( input: ListDeploymentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/environments/{EnvironmentId}/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/environments/{EnvironmentId}/deployments"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -837,7 +867,6 @@ export const serializeAws_restJson1ListDeploymentsCommand = async ( ...(input.NextToken !== undefined && { next_token: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -854,14 +883,14 @@ export const serializeAws_restJson1ListDeploymentStrategiesCommand = async ( input: ListDeploymentStrategiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/deploymentstrategies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deploymentstrategies"; const query: any = { ...(input.MaxResults !== undefined && { max_results: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { next_token: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -878,8 +907,11 @@ export const serializeAws_restJson1ListEnvironmentsCommand = async ( input: ListEnvironmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/environments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/environments"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -894,7 +926,6 @@ export const serializeAws_restJson1ListEnvironmentsCommand = async ( ...(input.NextToken !== undefined && { next_token: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -911,8 +942,10 @@ export const serializeAws_restJson1ListHostedConfigurationVersionsCommand = asyn input: ListHostedConfigurationVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}/hostedconfigurationversions"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; @@ -937,7 +970,6 @@ export const serializeAws_restJson1ListHostedConfigurationVersionsCommand = asyn ...(input.NextToken !== undefined && { next_token: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -954,8 +986,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -966,7 +999,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -982,10 +1014,13 @@ export const serializeAws_restJson1StartDeploymentCommand = async ( input: StartDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}/environments/{EnvironmentId}/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/environments/{EnvironmentId}/deployments"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1015,7 +1050,6 @@ export const serializeAws_restJson1StartDeploymentCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1031,8 +1065,11 @@ export const serializeAws_restJson1StopDeploymentCommand = async ( input: StopDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/environments/{EnvironmentId}/deployments/{DeploymentNumber}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/environments/{EnvironmentId}/deployments/{DeploymentNumber}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1061,7 +1098,6 @@ export const serializeAws_restJson1StopDeploymentCommand = async ( throw new Error("No value provided for input HTTP label: DeploymentNumber."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1077,10 +1113,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1094,7 +1131,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1110,8 +1146,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1125,7 +1162,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1142,10 +1178,12 @@ export const serializeAws_restJson1UpdateApplicationCommand = async ( input: UpdateApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1160,7 +1198,6 @@ export const serializeAws_restJson1UpdateApplicationCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1176,10 +1213,13 @@ export const serializeAws_restJson1UpdateConfigurationProfileCommand = async ( input: UpdateConfigurationProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1207,7 +1247,6 @@ export const serializeAws_restJson1UpdateConfigurationProfileCommand = async ( ...(input.Validators !== undefined && input.Validators !== null && { Validators: serializeAws_restJson1ValidatorList(input.Validators, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1223,10 +1262,13 @@ export const serializeAws_restJson1UpdateDeploymentStrategyCommand = async ( input: UpdateDeploymentStrategyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deploymentstrategies/{DeploymentStrategyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/deploymentstrategies/{DeploymentStrategyId}"; if (input.DeploymentStrategyId !== undefined) { const labelValue: string = input.DeploymentStrategyId; if (labelValue.length <= 0) { @@ -1247,7 +1289,6 @@ export const serializeAws_restJson1UpdateDeploymentStrategyCommand = async ( input.GrowthFactor !== null && { GrowthFactor: __serializeFloat(input.GrowthFactor) }), ...(input.GrowthType !== undefined && input.GrowthType !== null && { GrowthType: input.GrowthType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1263,10 +1304,13 @@ export const serializeAws_restJson1UpdateEnvironmentCommand = async ( input: UpdateEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}/environments/{EnvironmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/environments/{EnvironmentId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1292,7 +1336,6 @@ export const serializeAws_restJson1UpdateEnvironmentCommand = async ( input.Monitors !== null && { Monitors: serializeAws_restJson1MonitorList(input.Monitors, context) }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1308,8 +1351,11 @@ export const serializeAws_restJson1ValidateConfigurationCommand = async ( input: ValidateConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}/validators"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/configurationprofiles/{ConfigurationProfileId}/validators"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1332,7 +1378,6 @@ export const serializeAws_restJson1ValidateConfigurationCommand = async ( ...(input.ConfigurationVersion !== undefined && { configuration_version: input.ConfigurationVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-appflow/protocols/Aws_restJson1.ts b/clients/client-appflow/protocols/Aws_restJson1.ts index 41897e282cbad..be8aa3b70cf85 100644 --- a/clients/client-appflow/protocols/Aws_restJson1.ts +++ b/clients/client-appflow/protocols/Aws_restJson1.ts @@ -184,10 +184,12 @@ export const serializeAws_restJson1CreateConnectorProfileCommand = async ( input: CreateConnectorProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/create-connector-profile"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/create-connector-profile"; let body: any; body = JSON.stringify({ ...(input.connectionMode !== undefined && @@ -201,7 +203,6 @@ export const serializeAws_restJson1CreateConnectorProfileCommand = async ( ...(input.connectorType !== undefined && input.connectorType !== null && { connectorType: input.connectorType }), ...(input.kmsArn !== undefined && input.kmsArn !== null && { kmsArn: input.kmsArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -217,10 +218,11 @@ export const serializeAws_restJson1CreateFlowCommand = async ( input: CreateFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/create-flow"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/create-flow"; let body: any; body = JSON.stringify({ ...(input.description !== undefined && input.description !== null && { description: input.description }), @@ -245,7 +247,6 @@ export const serializeAws_restJson1CreateFlowCommand = async ( triggerConfig: serializeAws_restJson1TriggerConfig(input.triggerConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -261,17 +262,18 @@ export const serializeAws_restJson1DeleteConnectorProfileCommand = async ( input: DeleteConnectorProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/delete-connector-profile"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/delete-connector-profile"; let body: any; body = JSON.stringify({ ...(input.connectorProfileName !== undefined && input.connectorProfileName !== null && { connectorProfileName: input.connectorProfileName }), ...(input.forceDelete !== undefined && input.forceDelete !== null && { forceDelete: input.forceDelete }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -287,16 +289,16 @@ export const serializeAws_restJson1DeleteFlowCommand = async ( input: DeleteFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/delete-flow"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/delete-flow"; let body: any; body = JSON.stringify({ ...(input.flowName !== undefined && input.flowName !== null && { flowName: input.flowName }), ...(input.forceDelete !== undefined && input.forceDelete !== null && { forceDelete: input.forceDelete }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -312,10 +314,12 @@ export const serializeAws_restJson1DescribeConnectorEntityCommand = async ( input: DescribeConnectorEntityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describe-connector-entity"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describe-connector-entity"; let body: any; body = JSON.stringify({ ...(input.connectorEntityName !== undefined && @@ -324,7 +328,6 @@ export const serializeAws_restJson1DescribeConnectorEntityCommand = async ( input.connectorProfileName !== null && { connectorProfileName: input.connectorProfileName }), ...(input.connectorType !== undefined && input.connectorType !== null && { connectorType: input.connectorType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -340,10 +343,12 @@ export const serializeAws_restJson1DescribeConnectorProfilesCommand = async ( input: DescribeConnectorProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describe-connector-profiles"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describe-connector-profiles"; let body: any; body = JSON.stringify({ ...(input.connectorProfileNames !== undefined && @@ -354,7 +359,6 @@ export const serializeAws_restJson1DescribeConnectorProfilesCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -370,10 +374,11 @@ export const serializeAws_restJson1DescribeConnectorsCommand = async ( input: DescribeConnectorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describe-connectors"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describe-connectors"; let body: any; body = JSON.stringify({ ...(input.connectorTypes !== undefined && @@ -382,7 +387,6 @@ export const serializeAws_restJson1DescribeConnectorsCommand = async ( }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -398,15 +402,15 @@ export const serializeAws_restJson1DescribeFlowCommand = async ( input: DescribeFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describe-flow"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describe-flow"; let body: any; body = JSON.stringify({ ...(input.flowName !== undefined && input.flowName !== null && { flowName: input.flowName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -422,17 +426,18 @@ export const serializeAws_restJson1DescribeFlowExecutionRecordsCommand = async ( input: DescribeFlowExecutionRecordsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describe-flow-execution-records"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describe-flow-execution-records"; let body: any; body = JSON.stringify({ ...(input.flowName !== undefined && input.flowName !== null && { flowName: input.flowName }), ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -448,10 +453,11 @@ export const serializeAws_restJson1ListConnectorEntitiesCommand = async ( input: ListConnectorEntitiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/list-connector-entities"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/list-connector-entities"; let body: any; body = JSON.stringify({ ...(input.connectorProfileName !== undefined && @@ -459,7 +465,6 @@ export const serializeAws_restJson1ListConnectorEntitiesCommand = async ( ...(input.connectorType !== undefined && input.connectorType !== null && { connectorType: input.connectorType }), ...(input.entitiesPath !== undefined && input.entitiesPath !== null && { entitiesPath: input.entitiesPath }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -475,16 +480,16 @@ export const serializeAws_restJson1ListFlowsCommand = async ( input: ListFlowsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/list-flows"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/list-flows"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -500,8 +505,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -512,7 +518,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -528,15 +533,15 @@ export const serializeAws_restJson1StartFlowCommand = async ( input: StartFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/start-flow"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/start-flow"; let body: any; body = JSON.stringify({ ...(input.flowName !== undefined && input.flowName !== null && { flowName: input.flowName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -552,15 +557,15 @@ export const serializeAws_restJson1StopFlowCommand = async ( input: StopFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/stop-flow"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/stop-flow"; let body: any; body = JSON.stringify({ ...(input.flowName !== undefined && input.flowName !== null && { flowName: input.flowName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -576,10 +581,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -593,7 +599,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -609,8 +614,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -624,7 +630,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -641,10 +646,12 @@ export const serializeAws_restJson1UpdateConnectorProfileCommand = async ( input: UpdateConnectorProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/update-connector-profile"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/update-connector-profile"; let body: any; body = JSON.stringify({ ...(input.connectionMode !== undefined && @@ -656,7 +663,6 @@ export const serializeAws_restJson1UpdateConnectorProfileCommand = async ( ...(input.connectorProfileName !== undefined && input.connectorProfileName !== null && { connectorProfileName: input.connectorProfileName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -672,10 +678,11 @@ export const serializeAws_restJson1UpdateFlowCommand = async ( input: UpdateFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/update-flow"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/update-flow"; let body: any; body = JSON.stringify({ ...(input.description !== undefined && input.description !== null && { description: input.description }), @@ -698,7 +705,6 @@ export const serializeAws_restJson1UpdateFlowCommand = async ( triggerConfig: serializeAws_restJson1TriggerConfig(input.triggerConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-appintegrations/protocols/Aws_restJson1.ts b/clients/client-appintegrations/protocols/Aws_restJson1.ts index 936db0767bd5c..9f587afec9c1c 100644 --- a/clients/client-appintegrations/protocols/Aws_restJson1.ts +++ b/clients/client-appintegrations/protocols/Aws_restJson1.ts @@ -58,10 +58,11 @@ export const serializeAws_restJson1CreateEventIntegrationCommand = async ( input: CreateEventIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/eventIntegrations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/eventIntegrations"; let body: any; body = JSON.stringify({ ClientToken: input.ClientToken ?? generateIdempotencyToken(), @@ -73,7 +74,6 @@ export const serializeAws_restJson1CreateEventIntegrationCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -89,8 +89,10 @@ export const serializeAws_restJson1DeleteEventIntegrationCommand = async ( input: DeleteEventIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/eventIntegrations/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/eventIntegrations/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -101,7 +103,6 @@ export const serializeAws_restJson1DeleteEventIntegrationCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -117,8 +118,10 @@ export const serializeAws_restJson1GetEventIntegrationCommand = async ( input: GetEventIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/eventIntegrations/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/eventIntegrations/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -129,7 +132,6 @@ export const serializeAws_restJson1GetEventIntegrationCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -145,8 +147,11 @@ export const serializeAws_restJson1ListEventIntegrationAssociationsCommand = asy input: ListEventIntegrationAssociationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/eventIntegrations/{EventIntegrationName}/associations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/eventIntegrations/{EventIntegrationName}/associations"; if (input.EventIntegrationName !== undefined) { const labelValue: string = input.EventIntegrationName; if (labelValue.length <= 0) { @@ -161,7 +166,6 @@ export const serializeAws_restJson1ListEventIntegrationAssociationsCommand = asy ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -178,14 +182,14 @@ export const serializeAws_restJson1ListEventIntegrationsCommand = async ( input: ListEventIntegrationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/eventIntegrations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/eventIntegrations"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -202,8 +206,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -214,7 +219,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -230,10 +234,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -247,7 +252,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -263,8 +267,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -278,7 +283,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -295,10 +299,12 @@ export const serializeAws_restJson1UpdateEventIntegrationCommand = async ( input: UpdateEventIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/eventIntegrations/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/eventIntegrations/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -312,7 +318,6 @@ export const serializeAws_restJson1UpdateEventIntegrationCommand = async ( body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-applicationcostprofiler/protocols/Aws_restJson1.ts b/clients/client-applicationcostprofiler/protocols/Aws_restJson1.ts index 3f9b1d7c2426e..ec0599d504b67 100644 --- a/clients/client-applicationcostprofiler/protocols/Aws_restJson1.ts +++ b/clients/client-applicationcostprofiler/protocols/Aws_restJson1.ts @@ -49,8 +49,10 @@ export const serializeAws_restJson1DeleteReportDefinitionCommand = async ( input: DeleteReportDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/reportDefinition/{reportId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition/{reportId}"; if (input.reportId !== undefined) { const labelValue: string = input.reportId; if (labelValue.length <= 0) { @@ -61,7 +63,6 @@ export const serializeAws_restJson1DeleteReportDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: reportId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -77,8 +78,10 @@ export const serializeAws_restJson1GetReportDefinitionCommand = async ( input: GetReportDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/reportDefinition/{reportId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition/{reportId}"; if (input.reportId !== undefined) { const labelValue: string = input.reportId; if (labelValue.length <= 0) { @@ -89,7 +92,6 @@ export const serializeAws_restJson1GetReportDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: reportId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -105,10 +107,11 @@ export const serializeAws_restJson1ImportApplicationUsageCommand = async ( input: ImportApplicationUsageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/importApplicationUsage"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/importApplicationUsage"; let body: any; body = JSON.stringify({ ...(input.sourceS3Location !== undefined && @@ -116,7 +119,6 @@ export const serializeAws_restJson1ImportApplicationUsageCommand = async ( sourceS3Location: serializeAws_restJson1SourceS3Location(input.sourceS3Location, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -132,14 +134,14 @@ export const serializeAws_restJson1ListReportDefinitionsCommand = async ( input: ListReportDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/reportDefinition"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -156,10 +158,11 @@ export const serializeAws_restJson1PutReportDefinitionCommand = async ( input: PutReportDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/reportDefinition"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition"; let body: any; body = JSON.stringify({ ...(input.destinationS3Location !== undefined && @@ -173,7 +176,6 @@ export const serializeAws_restJson1PutReportDefinitionCommand = async ( input.reportFrequency !== null && { reportFrequency: input.reportFrequency }), ...(input.reportId !== undefined && input.reportId !== null && { reportId: input.reportId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -189,10 +191,12 @@ export const serializeAws_restJson1UpdateReportDefinitionCommand = async ( input: UpdateReportDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/reportDefinition/{reportId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition/{reportId}"; if (input.reportId !== undefined) { const labelValue: string = input.reportId; if (labelValue.length <= 0) { @@ -214,7 +218,6 @@ export const serializeAws_restJson1UpdateReportDefinitionCommand = async ( ...(input.reportFrequency !== undefined && input.reportFrequency !== null && { reportFrequency: input.reportFrequency }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-appsync/protocols/Aws_restJson1.ts b/clients/client-appsync/protocols/Aws_restJson1.ts index 72539c914e2bf..0e40ce6ac5c28 100644 --- a/clients/client-appsync/protocols/Aws_restJson1.ts +++ b/clients/client-appsync/protocols/Aws_restJson1.ts @@ -111,10 +111,12 @@ export const serializeAws_restJson1CreateApiCacheCommand = async ( input: CreateApiCacheCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/ApiCaches"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -135,7 +137,6 @@ export const serializeAws_restJson1CreateApiCacheCommand = async ( ...(input.ttl !== undefined && input.ttl !== null && { ttl: input.ttl }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -151,10 +152,11 @@ export const serializeAws_restJson1CreateApiKeyCommand = async ( input: CreateApiKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/apikeys"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -169,7 +171,6 @@ export const serializeAws_restJson1CreateApiKeyCommand = async ( ...(input.description !== undefined && input.description !== null && { description: input.description }), ...(input.expires !== undefined && input.expires !== null && { expires: input.expires }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -185,10 +186,12 @@ export const serializeAws_restJson1CreateDataSourceCommand = async ( input: CreateDataSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/datasources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -229,7 +232,6 @@ export const serializeAws_restJson1CreateDataSourceCommand = async ( input.serviceRoleArn !== null && { serviceRoleArn: input.serviceRoleArn }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -245,10 +247,12 @@ export const serializeAws_restJson1CreateFunctionCommand = async ( input: CreateFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/functions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -273,7 +277,6 @@ export const serializeAws_restJson1CreateFunctionCommand = async ( ...(input.syncConfig !== undefined && input.syncConfig !== null && { syncConfig: serializeAws_restJson1SyncConfig(input.syncConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -289,10 +292,11 @@ export const serializeAws_restJson1CreateGraphqlApiCommand = async ( input: CreateGraphqlApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis"; let body: any; body = JSON.stringify({ ...(input.additionalAuthenticationProviders !== undefined && @@ -318,7 +322,6 @@ export const serializeAws_restJson1CreateGraphqlApiCommand = async ( }), ...(input.xrayEnabled !== undefined && input.xrayEnabled !== null && { xrayEnabled: input.xrayEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -334,10 +337,13 @@ export const serializeAws_restJson1CreateResolverCommand = async ( input: CreateResolverCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/types/{typeName}/resolvers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apis/{apiId}/types/{typeName}/resolvers"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -377,7 +383,6 @@ export const serializeAws_restJson1CreateResolverCommand = async ( ...(input.syncConfig !== undefined && input.syncConfig !== null && { syncConfig: serializeAws_restJson1SyncConfig(input.syncConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -393,10 +398,11 @@ export const serializeAws_restJson1CreateTypeCommand = async ( input: CreateTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/types"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -411,7 +417,6 @@ export const serializeAws_restJson1CreateTypeCommand = async ( ...(input.definition !== undefined && input.definition !== null && { definition: input.definition }), ...(input.format !== undefined && input.format !== null && { format: input.format }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -427,8 +432,10 @@ export const serializeAws_restJson1DeleteApiCacheCommand = async ( input: DeleteApiCacheCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/ApiCaches"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -439,7 +446,6 @@ export const serializeAws_restJson1DeleteApiCacheCommand = async ( throw new Error("No value provided for input HTTP label: apiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -455,8 +461,10 @@ export const serializeAws_restJson1DeleteApiKeyCommand = async ( input: DeleteApiKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/apikeys/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys/{id}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -476,7 +484,6 @@ export const serializeAws_restJson1DeleteApiKeyCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -492,8 +499,10 @@ export const serializeAws_restJson1DeleteDataSourceCommand = async ( input: DeleteDataSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/datasources/{name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources/{name}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -513,7 +522,6 @@ export const serializeAws_restJson1DeleteDataSourceCommand = async ( throw new Error("No value provided for input HTTP label: name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -529,8 +537,10 @@ export const serializeAws_restJson1DeleteFunctionCommand = async ( input: DeleteFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/functions/{functionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions/{functionId}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -550,7 +560,6 @@ export const serializeAws_restJson1DeleteFunctionCommand = async ( throw new Error("No value provided for input HTTP label: functionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -566,8 +575,9 @@ export const serializeAws_restJson1DeleteGraphqlApiCommand = async ( input: DeleteGraphqlApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -578,7 +588,6 @@ export const serializeAws_restJson1DeleteGraphqlApiCommand = async ( throw new Error("No value provided for input HTTP label: apiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -594,8 +603,11 @@ export const serializeAws_restJson1DeleteResolverCommand = async ( input: DeleteResolverCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -624,7 +636,6 @@ export const serializeAws_restJson1DeleteResolverCommand = async ( throw new Error("No value provided for input HTTP label: fieldName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -640,8 +651,10 @@ export const serializeAws_restJson1DeleteTypeCommand = async ( input: DeleteTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/types/{typeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types/{typeName}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -661,7 +674,6 @@ export const serializeAws_restJson1DeleteTypeCommand = async ( throw new Error("No value provided for input HTTP label: typeName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -677,8 +689,10 @@ export const serializeAws_restJson1FlushApiCacheCommand = async ( input: FlushApiCacheCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/FlushCache"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/FlushCache"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -689,7 +703,6 @@ export const serializeAws_restJson1FlushApiCacheCommand = async ( throw new Error("No value provided for input HTTP label: apiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -705,8 +718,10 @@ export const serializeAws_restJson1GetApiCacheCommand = async ( input: GetApiCacheCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/ApiCaches"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -717,7 +732,6 @@ export const serializeAws_restJson1GetApiCacheCommand = async ( throw new Error("No value provided for input HTTP label: apiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -733,8 +747,10 @@ export const serializeAws_restJson1GetDataSourceCommand = async ( input: GetDataSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/datasources/{name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources/{name}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -754,7 +770,6 @@ export const serializeAws_restJson1GetDataSourceCommand = async ( throw new Error("No value provided for input HTTP label: name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -770,8 +785,10 @@ export const serializeAws_restJson1GetFunctionCommand = async ( input: GetFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/functions/{functionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions/{functionId}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -791,7 +808,6 @@ export const serializeAws_restJson1GetFunctionCommand = async ( throw new Error("No value provided for input HTTP label: functionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -807,8 +823,9 @@ export const serializeAws_restJson1GetGraphqlApiCommand = async ( input: GetGraphqlApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -819,7 +836,6 @@ export const serializeAws_restJson1GetGraphqlApiCommand = async ( throw new Error("No value provided for input HTTP label: apiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -835,8 +851,9 @@ export const serializeAws_restJson1GetIntrospectionSchemaCommand = async ( input: GetIntrospectionSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/schema"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/schema"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -851,7 +868,6 @@ export const serializeAws_restJson1GetIntrospectionSchemaCommand = async ( ...(input.includeDirectives !== undefined && { includeDirectives: input.includeDirectives.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -868,8 +884,11 @@ export const serializeAws_restJson1GetResolverCommand = async ( input: GetResolverCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -898,7 +917,6 @@ export const serializeAws_restJson1GetResolverCommand = async ( throw new Error("No value provided for input HTTP label: fieldName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -914,8 +932,10 @@ export const serializeAws_restJson1GetSchemaCreationStatusCommand = async ( input: GetSchemaCreationStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/schemacreation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/schemacreation"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -926,7 +946,6 @@ export const serializeAws_restJson1GetSchemaCreationStatusCommand = async ( throw new Error("No value provided for input HTTP label: apiId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -942,8 +961,10 @@ export const serializeAws_restJson1GetTypeCommand = async ( input: GetTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/types/{typeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types/{typeName}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -966,7 +987,6 @@ export const serializeAws_restJson1GetTypeCommand = async ( ...(input.format !== undefined && { format: input.format }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -983,8 +1003,9 @@ export const serializeAws_restJson1ListApiKeysCommand = async ( input: ListApiKeysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/apikeys"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -999,7 +1020,6 @@ export const serializeAws_restJson1ListApiKeysCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1016,8 +1036,10 @@ export const serializeAws_restJson1ListDataSourcesCommand = async ( input: ListDataSourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/datasources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1032,7 +1054,6 @@ export const serializeAws_restJson1ListDataSourcesCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1049,8 +1070,10 @@ export const serializeAws_restJson1ListFunctionsCommand = async ( input: ListFunctionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/functions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1065,7 +1088,6 @@ export const serializeAws_restJson1ListFunctionsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1082,14 +1104,14 @@ export const serializeAws_restJson1ListGraphqlApisCommand = async ( input: ListGraphqlApisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1106,8 +1128,11 @@ export const serializeAws_restJson1ListResolversCommand = async ( input: ListResolversCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/types/{typeName}/resolvers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apis/{apiId}/types/{typeName}/resolvers"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1131,7 +1156,6 @@ export const serializeAws_restJson1ListResolversCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1148,8 +1172,11 @@ export const serializeAws_restJson1ListResolversByFunctionCommand = async ( input: ListResolversByFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/functions/{functionId}/resolvers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apis/{apiId}/functions/{functionId}/resolvers"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1173,7 +1200,6 @@ export const serializeAws_restJson1ListResolversByFunctionCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1190,8 +1216,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1202,7 +1229,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1218,8 +1244,9 @@ export const serializeAws_restJson1ListTypesCommand = async ( input: ListTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apis/{apiId}/types"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1235,7 +1262,6 @@ export const serializeAws_restJson1ListTypesCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1252,10 +1278,12 @@ export const serializeAws_restJson1StartSchemaCreationCommand = async ( input: StartSchemaCreationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/schemacreation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/schemacreation"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1270,7 +1298,6 @@ export const serializeAws_restJson1StartSchemaCreationCommand = async ( ...(input.definition !== undefined && input.definition !== null && { definition: context.base64Encoder(input.definition) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1286,10 +1313,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1303,7 +1331,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1319,8 +1346,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1334,7 +1362,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1351,10 +1378,12 @@ export const serializeAws_restJson1UpdateApiCacheCommand = async ( input: UpdateApiCacheCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/ApiCaches/update"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches/update"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1371,7 +1400,6 @@ export const serializeAws_restJson1UpdateApiCacheCommand = async ( ...(input.ttl !== undefined && input.ttl !== null && { ttl: input.ttl }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1387,10 +1415,12 @@ export const serializeAws_restJson1UpdateApiKeyCommand = async ( input: UpdateApiKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/apikeys/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys/{id}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1414,7 +1444,6 @@ export const serializeAws_restJson1UpdateApiKeyCommand = async ( ...(input.description !== undefined && input.description !== null && { description: input.description }), ...(input.expires !== undefined && input.expires !== null && { expires: input.expires }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1430,10 +1459,12 @@ export const serializeAws_restJson1UpdateDataSourceCommand = async ( input: UpdateDataSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/datasources/{name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources/{name}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1482,7 +1513,6 @@ export const serializeAws_restJson1UpdateDataSourceCommand = async ( input.serviceRoleArn !== null && { serviceRoleArn: input.serviceRoleArn }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1498,10 +1528,12 @@ export const serializeAws_restJson1UpdateFunctionCommand = async ( input: UpdateFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/functions/{functionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions/{functionId}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1535,7 +1567,6 @@ export const serializeAws_restJson1UpdateFunctionCommand = async ( ...(input.syncConfig !== undefined && input.syncConfig !== null && { syncConfig: serializeAws_restJson1SyncConfig(input.syncConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1551,10 +1582,11 @@ export const serializeAws_restJson1UpdateGraphqlApiCommand = async ( input: UpdateGraphqlApiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1588,7 +1620,6 @@ export const serializeAws_restJson1UpdateGraphqlApiCommand = async ( }), ...(input.xrayEnabled !== undefined && input.xrayEnabled !== null && { xrayEnabled: input.xrayEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1604,10 +1635,13 @@ export const serializeAws_restJson1UpdateResolverCommand = async ( input: UpdateResolverCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1655,7 +1689,6 @@ export const serializeAws_restJson1UpdateResolverCommand = async ( ...(input.syncConfig !== undefined && input.syncConfig !== null && { syncConfig: serializeAws_restJson1SyncConfig(input.syncConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1671,10 +1704,12 @@ export const serializeAws_restJson1UpdateTypeCommand = async ( input: UpdateTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apis/{apiId}/types/{typeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types/{typeName}"; if (input.apiId !== undefined) { const labelValue: string = input.apiId; if (labelValue.length <= 0) { @@ -1698,7 +1733,6 @@ export const serializeAws_restJson1UpdateTypeCommand = async ( ...(input.definition !== undefined && input.definition !== null && { definition: input.definition }), ...(input.format !== undefined && input.format !== null && { format: input.format }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-auditmanager/protocols/Aws_restJson1.ts b/clients/client-auditmanager/protocols/Aws_restJson1.ts index 723e3799fcf08..21b8d24f65d47 100644 --- a/clients/client-auditmanager/protocols/Aws_restJson1.ts +++ b/clients/client-auditmanager/protocols/Aws_restJson1.ts @@ -201,10 +201,13 @@ export const serializeAws_restJson1AssociateAssessmentReportEvidenceFolderComman input: AssociateAssessmentReportEvidenceFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/associateToAssessmentReport"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/associateToAssessmentReport"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -219,7 +222,6 @@ export const serializeAws_restJson1AssociateAssessmentReportEvidenceFolderComman ...(input.evidenceFolderId !== undefined && input.evidenceFolderId !== null && { evidenceFolderId: input.evidenceFolderId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -235,10 +237,13 @@ export const serializeAws_restJson1BatchAssociateAssessmentReportEvidenceCommand input: BatchAssociateAssessmentReportEvidenceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/batchAssociateToAssessmentReport"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/batchAssociateToAssessmentReport"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -255,7 +260,6 @@ export const serializeAws_restJson1BatchAssociateAssessmentReportEvidenceCommand ...(input.evidenceIds !== undefined && input.evidenceIds !== null && { evidenceIds: serializeAws_restJson1EvidenceIds(input.evidenceIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -271,10 +275,12 @@ export const serializeAws_restJson1BatchCreateDelegationByAssessmentCommand = as input: BatchCreateDelegationByAssessmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/delegations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments/{assessmentId}/delegations"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -294,7 +300,6 @@ export const serializeAws_restJson1BatchCreateDelegationByAssessmentCommand = as ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -310,10 +315,12 @@ export const serializeAws_restJson1BatchDeleteDelegationByAssessmentCommand = as input: BatchDeleteDelegationByAssessmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/delegations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments/{assessmentId}/delegations"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -330,7 +337,6 @@ export const serializeAws_restJson1BatchDeleteDelegationByAssessmentCommand = as delegationIds: serializeAws_restJson1DelegationIds(input.delegationIds, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -346,10 +352,13 @@ export const serializeAws_restJson1BatchDisassociateAssessmentReportEvidenceComm input: BatchDisassociateAssessmentReportEvidenceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/batchDisassociateFromAssessmentReport"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/batchDisassociateFromAssessmentReport"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -366,7 +375,6 @@ export const serializeAws_restJson1BatchDisassociateAssessmentReportEvidenceComm ...(input.evidenceIds !== undefined && input.evidenceIds !== null && { evidenceIds: serializeAws_restJson1EvidenceIds(input.evidenceIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -382,10 +390,13 @@ export const serializeAws_restJson1BatchImportEvidenceToAssessmentControlCommand input: BatchImportEvidenceToAssessmentControlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/controlSets/{controlSetId}/controls/{controlId}/evidence"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/controlSets/{controlSetId}/controls/{controlId}/evidence"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -420,7 +431,6 @@ export const serializeAws_restJson1BatchImportEvidenceToAssessmentControlCommand manualEvidence: serializeAws_restJson1ManualEvidenceList(input.manualEvidence, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -436,10 +446,11 @@ export const serializeAws_restJson1CreateAssessmentCommand = async ( input: CreateAssessmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments"; let body: any; body = JSON.stringify({ ...(input.assessmentReportsDestination !== undefined && @@ -458,7 +469,6 @@ export const serializeAws_restJson1CreateAssessmentCommand = async ( input.scope !== null && { scope: serializeAws_restJson1Scope(input.scope, context) }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -474,10 +484,11 @@ export const serializeAws_restJson1CreateAssessmentFrameworkCommand = async ( input: CreateAssessmentFrameworkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessmentFrameworks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessmentFrameworks"; let body: any; body = JSON.stringify({ ...(input.complianceType !== undefined && @@ -490,7 +501,6 @@ export const serializeAws_restJson1CreateAssessmentFrameworkCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -506,10 +516,12 @@ export const serializeAws_restJson1CreateAssessmentReportCommand = async ( input: CreateAssessmentReportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/reports"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments/{assessmentId}/reports"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -524,7 +536,6 @@ export const serializeAws_restJson1CreateAssessmentReportCommand = async ( ...(input.description !== undefined && input.description !== null && { description: input.description }), ...(input.name !== undefined && input.name !== null && { name: input.name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -540,10 +551,11 @@ export const serializeAws_restJson1CreateControlCommand = async ( input: CreateControlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/controls"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/controls"; let body: any; body = JSON.stringify({ ...(input.actionPlanInstructions !== undefined && @@ -560,7 +572,6 @@ export const serializeAws_restJson1CreateControlCommand = async ( ...(input.testingInformation !== undefined && input.testingInformation !== null && { testingInformation: input.testingInformation }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -576,8 +587,10 @@ export const serializeAws_restJson1DeleteAssessmentCommand = async ( input: DeleteAssessmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessments/{assessmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments/{assessmentId}"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -588,7 +601,6 @@ export const serializeAws_restJson1DeleteAssessmentCommand = async ( throw new Error("No value provided for input HTTP label: assessmentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -604,8 +616,10 @@ export const serializeAws_restJson1DeleteAssessmentFrameworkCommand = async ( input: DeleteAssessmentFrameworkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessmentFrameworks/{frameworkId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessmentFrameworks/{frameworkId}"; if (input.frameworkId !== undefined) { const labelValue: string = input.frameworkId; if (labelValue.length <= 0) { @@ -616,7 +630,6 @@ export const serializeAws_restJson1DeleteAssessmentFrameworkCommand = async ( throw new Error("No value provided for input HTTP label: frameworkId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -632,8 +645,11 @@ export const serializeAws_restJson1DeleteAssessmentReportCommand = async ( input: DeleteAssessmentReportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessments/{assessmentId}/reports/{assessmentReportId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/reports/{assessmentReportId}"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -653,7 +669,6 @@ export const serializeAws_restJson1DeleteAssessmentReportCommand = async ( throw new Error("No value provided for input HTTP label: assessmentReportId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -669,8 +684,9 @@ export const serializeAws_restJson1DeleteControlCommand = async ( input: DeleteControlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/controls/{controlId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/controls/{controlId}"; if (input.controlId !== undefined) { const labelValue: string = input.controlId; if (labelValue.length <= 0) { @@ -681,7 +697,6 @@ export const serializeAws_restJson1DeleteControlCommand = async ( throw new Error("No value provided for input HTTP label: controlId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -697,13 +712,14 @@ export const serializeAws_restJson1DeregisterAccountCommand = async ( input: DeregisterAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/account/deregisterAccount"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/account/deregisterAccount"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -719,16 +735,18 @@ export const serializeAws_restJson1DeregisterOrganizationAdminAccountCommand = a input: DeregisterOrganizationAdminAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/account/deregisterOrganizationAdminAccount"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/account/deregisterOrganizationAdminAccount"; let body: any; body = JSON.stringify({ ...(input.adminAccountId !== undefined && input.adminAccountId !== null && { adminAccountId: input.adminAccountId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -744,10 +762,13 @@ export const serializeAws_restJson1DisassociateAssessmentReportEvidenceFolderCom input: DisassociateAssessmentReportEvidenceFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/disassociateFromAssessmentReport"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/disassociateFromAssessmentReport"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -762,7 +783,6 @@ export const serializeAws_restJson1DisassociateAssessmentReportEvidenceFolderCom ...(input.evidenceFolderId !== undefined && input.evidenceFolderId !== null && { evidenceFolderId: input.evidenceFolderId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -778,13 +798,13 @@ export const serializeAws_restJson1GetAccountStatusCommand = async ( input: GetAccountStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/account/status"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/account/status"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -800,8 +820,10 @@ export const serializeAws_restJson1GetAssessmentCommand = async ( input: GetAssessmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessments/{assessmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments/{assessmentId}"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -812,7 +834,6 @@ export const serializeAws_restJson1GetAssessmentCommand = async ( throw new Error("No value provided for input HTTP label: assessmentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -828,8 +849,10 @@ export const serializeAws_restJson1GetAssessmentFrameworkCommand = async ( input: GetAssessmentFrameworkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessmentFrameworks/{frameworkId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessmentFrameworks/{frameworkId}"; if (input.frameworkId !== undefined) { const labelValue: string = input.frameworkId; if (labelValue.length <= 0) { @@ -840,7 +863,6 @@ export const serializeAws_restJson1GetAssessmentFrameworkCommand = async ( throw new Error("No value provided for input HTTP label: frameworkId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -856,8 +878,11 @@ export const serializeAws_restJson1GetAssessmentReportUrlCommand = async ( input: GetAssessmentReportUrlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessments/{assessmentId}/reports/{assessmentReportId}/url"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/reports/{assessmentReportId}/url"; if (input.assessmentReportId !== undefined) { const labelValue: string = input.assessmentReportId; if (labelValue.length <= 0) { @@ -877,7 +902,6 @@ export const serializeAws_restJson1GetAssessmentReportUrlCommand = async ( throw new Error("No value provided for input HTTP label: assessmentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -893,8 +917,10 @@ export const serializeAws_restJson1GetChangeLogsCommand = async ( input: GetChangeLogsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessments/{assessmentId}/changelogs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments/{assessmentId}/changelogs"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -911,7 +937,6 @@ export const serializeAws_restJson1GetChangeLogsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -928,8 +953,9 @@ export const serializeAws_restJson1GetControlCommand = async ( input: GetControlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/controls/{controlId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/controls/{controlId}"; if (input.controlId !== undefined) { const labelValue: string = input.controlId; if (labelValue.length <= 0) { @@ -940,7 +966,6 @@ export const serializeAws_restJson1GetControlCommand = async ( throw new Error("No value provided for input HTTP label: controlId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -956,14 +981,14 @@ export const serializeAws_restJson1GetDelegationsCommand = async ( input: GetDelegationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/delegations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/delegations"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -980,8 +1005,10 @@ export const serializeAws_restJson1GetEvidenceCommand = async ( input: GetEvidenceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments/{assessmentId}/controlSets/{controlSetId}/evidenceFolders/{evidenceFolderId}/evidence/{evidenceId}"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; @@ -1020,7 +1047,6 @@ export const serializeAws_restJson1GetEvidenceCommand = async ( throw new Error("No value provided for input HTTP label: evidenceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1036,8 +1062,10 @@ export const serializeAws_restJson1GetEvidenceByEvidenceFolderCommand = async ( input: GetEvidenceByEvidenceFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments/{assessmentId}/controlSets/{controlSetId}/evidenceFolders/{evidenceFolderId}/evidence"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; @@ -1071,7 +1099,6 @@ export const serializeAws_restJson1GetEvidenceByEvidenceFolderCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1088,8 +1115,11 @@ export const serializeAws_restJson1GetEvidenceFolderCommand = async ( input: GetEvidenceFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessments/{assessmentId}/controlSets/{controlSetId}/evidenceFolders/{evidenceFolderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/controlSets/{controlSetId}/evidenceFolders/{evidenceFolderId}"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -1118,7 +1148,6 @@ export const serializeAws_restJson1GetEvidenceFolderCommand = async ( throw new Error("No value provided for input HTTP label: evidenceFolderId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1134,8 +1163,11 @@ export const serializeAws_restJson1GetEvidenceFoldersByAssessmentCommand = async input: GetEvidenceFoldersByAssessmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessments/{assessmentId}/evidenceFolders"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/evidenceFolders"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -1150,7 +1182,6 @@ export const serializeAws_restJson1GetEvidenceFoldersByAssessmentCommand = async ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1167,8 +1198,11 @@ export const serializeAws_restJson1GetEvidenceFoldersByAssessmentControlCommand input: GetEvidenceFoldersByAssessmentControlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessments/{assessmentId}/evidenceFolders-by-assessment-control/{controlSetId}/{controlId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/evidenceFolders-by-assessment-control/{controlSetId}/{controlId}"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -1201,7 +1235,6 @@ export const serializeAws_restJson1GetEvidenceFoldersByAssessmentControlCommand ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1218,13 +1251,14 @@ export const serializeAws_restJson1GetOrganizationAdminAccountCommand = async ( input: GetOrganizationAdminAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/account/organizationAdminAccount"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/account/organizationAdminAccount"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1240,13 +1274,13 @@ export const serializeAws_restJson1GetServicesInScopeCommand = async ( input: GetServicesInScopeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/services"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/services"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1262,8 +1296,9 @@ export const serializeAws_restJson1GetSettingsCommand = async ( input: GetSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/settings/{attribute}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/settings/{attribute}"; if (input.attribute !== undefined) { const labelValue: string = input.attribute; if (labelValue.length <= 0) { @@ -1274,7 +1309,6 @@ export const serializeAws_restJson1GetSettingsCommand = async ( throw new Error("No value provided for input HTTP label: attribute."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1290,15 +1324,15 @@ export const serializeAws_restJson1ListAssessmentFrameworksCommand = async ( input: ListAssessmentFrameworksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessmentFrameworks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessmentFrameworks"; const query: any = { ...(input.frameworkType !== undefined && { frameworkType: input.frameworkType }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1315,14 +1349,14 @@ export const serializeAws_restJson1ListAssessmentReportsCommand = async ( input: ListAssessmentReportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessmentReports"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessmentReports"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1339,14 +1373,14 @@ export const serializeAws_restJson1ListAssessmentsCommand = async ( input: ListAssessmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assessments"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1363,15 +1397,15 @@ export const serializeAws_restJson1ListControlsCommand = async ( input: ListControlsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/controls"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/controls"; const query: any = { ...(input.controlType !== undefined && { controlType: input.controlType }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1388,15 +1422,15 @@ export const serializeAws_restJson1ListKeywordsForDataSourceCommand = async ( input: ListKeywordsForDataSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dataSourceKeywords"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dataSourceKeywords"; const query: any = { ...(input.source !== undefined && { source: input.source }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1413,14 +1447,14 @@ export const serializeAws_restJson1ListNotificationsCommand = async ( input: ListNotificationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/notifications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/notifications"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1437,8 +1471,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1449,7 +1484,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1465,17 +1499,17 @@ export const serializeAws_restJson1RegisterAccountCommand = async ( input: RegisterAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/account/registerAccount"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/account/registerAccount"; let body: any; body = JSON.stringify({ ...(input.delegatedAdminAccount !== undefined && input.delegatedAdminAccount !== null && { delegatedAdminAccount: input.delegatedAdminAccount }), ...(input.kmsKey !== undefined && input.kmsKey !== null && { kmsKey: input.kmsKey }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1491,16 +1525,17 @@ export const serializeAws_restJson1RegisterOrganizationAdminAccountCommand = asy input: RegisterOrganizationAdminAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/account/registerOrganizationAdminAccount"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/account/registerOrganizationAdminAccount"; let body: any; body = JSON.stringify({ ...(input.adminAccountId !== undefined && input.adminAccountId !== null && { adminAccountId: input.adminAccountId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1516,10 +1551,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1533,7 +1569,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1549,8 +1584,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1564,7 +1600,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1581,10 +1616,12 @@ export const serializeAws_restJson1UpdateAssessmentCommand = async ( input: UpdateAssessmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments/{assessmentId}"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -1612,7 +1649,6 @@ export const serializeAws_restJson1UpdateAssessmentCommand = async ( ...(input.scope !== undefined && input.scope !== null && { scope: serializeAws_restJson1Scope(input.scope, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1628,10 +1664,13 @@ export const serializeAws_restJson1UpdateAssessmentControlCommand = async ( input: UpdateAssessmentControlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/controlSets/{controlSetId}/controls/{controlId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/controlSets/{controlSetId}/controls/{controlId}"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -1664,7 +1703,6 @@ export const serializeAws_restJson1UpdateAssessmentControlCommand = async ( ...(input.commentBody !== undefined && input.commentBody !== null && { commentBody: input.commentBody }), ...(input.controlStatus !== undefined && input.controlStatus !== null && { controlStatus: input.controlStatus }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1680,10 +1718,13 @@ export const serializeAws_restJson1UpdateAssessmentControlSetStatusCommand = asy input: UpdateAssessmentControlSetStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/controlSets/{controlSetId}/status"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/assessments/{assessmentId}/controlSets/{controlSetId}/status"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -1707,7 +1748,6 @@ export const serializeAws_restJson1UpdateAssessmentControlSetStatusCommand = asy ...(input.comment !== undefined && input.comment !== null && { comment: input.comment }), ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1723,10 +1763,12 @@ export const serializeAws_restJson1UpdateAssessmentFrameworkCommand = async ( input: UpdateAssessmentFrameworkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessmentFrameworks/{frameworkId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessmentFrameworks/{frameworkId}"; if (input.frameworkId !== undefined) { const labelValue: string = input.frameworkId; if (labelValue.length <= 0) { @@ -1747,7 +1789,6 @@ export const serializeAws_restJson1UpdateAssessmentFrameworkCommand = async ( ...(input.description !== undefined && input.description !== null && { description: input.description }), ...(input.name !== undefined && input.name !== null && { name: input.name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1763,10 +1804,12 @@ export const serializeAws_restJson1UpdateAssessmentStatusCommand = async ( input: UpdateAssessmentStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessments/{assessmentId}/status"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessments/{assessmentId}/status"; if (input.assessmentId !== undefined) { const labelValue: string = input.assessmentId; if (labelValue.length <= 0) { @@ -1780,7 +1823,6 @@ export const serializeAws_restJson1UpdateAssessmentStatusCommand = async ( body = JSON.stringify({ ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1796,10 +1838,11 @@ export const serializeAws_restJson1UpdateControlCommand = async ( input: UpdateControlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/controls/{controlId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/controls/{controlId}"; if (input.controlId !== undefined) { const labelValue: string = input.controlId; if (labelValue.length <= 0) { @@ -1824,7 +1867,6 @@ export const serializeAws_restJson1UpdateControlCommand = async ( ...(input.testingInformation !== undefined && input.testingInformation !== null && { testingInformation: input.testingInformation }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1840,10 +1882,11 @@ export const serializeAws_restJson1UpdateSettingsCommand = async ( input: UpdateSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/settings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/settings"; let body: any; body = JSON.stringify({ ...(input.defaultAssessmentReportsDestination !== undefined && @@ -1860,7 +1903,6 @@ export const serializeAws_restJson1UpdateSettingsCommand = async ( ...(input.kmsKey !== undefined && input.kmsKey !== null && { kmsKey: input.kmsKey }), ...(input.snsTopic !== undefined && input.snsTopic !== null && { snsTopic: input.snsTopic }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1876,16 +1918,17 @@ export const serializeAws_restJson1ValidateAssessmentReportIntegrityCommand = as input: ValidateAssessmentReportIntegrityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assessmentReports/integrity"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessmentReports/integrity"; let body: any; body = JSON.stringify({ ...(input.s3RelativePath !== undefined && input.s3RelativePath !== null && { s3RelativePath: input.s3RelativePath }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-backup/protocols/Aws_restJson1.ts b/clients/client-backup/protocols/Aws_restJson1.ts index 0c4dcf66a5da0..59471cb8c3301 100644 --- a/clients/client-backup/protocols/Aws_restJson1.ts +++ b/clients/client-backup/protocols/Aws_restJson1.ts @@ -188,10 +188,11 @@ export const serializeAws_restJson1CreateBackupPlanCommand = async ( input: CreateBackupPlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backup/plans"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/plans"; let body: any; body = JSON.stringify({ ...(input.BackupPlan !== undefined && @@ -201,7 +202,6 @@ export const serializeAws_restJson1CreateBackupPlanCommand = async ( ...(input.CreatorRequestId !== undefined && input.CreatorRequestId !== null && { CreatorRequestId: input.CreatorRequestId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -217,10 +217,12 @@ export const serializeAws_restJson1CreateBackupSelectionCommand = async ( input: CreateBackupSelectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backup/plans/{BackupPlanId}/selections"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/plans/{BackupPlanId}/selections"; if (input.BackupPlanId !== undefined) { const labelValue: string = input.BackupPlanId; if (labelValue.length <= 0) { @@ -239,7 +241,6 @@ export const serializeAws_restJson1CreateBackupSelectionCommand = async ( ...(input.CreatorRequestId !== undefined && input.CreatorRequestId !== null && { CreatorRequestId: input.CreatorRequestId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -255,10 +256,12 @@ export const serializeAws_restJson1CreateBackupVaultCommand = async ( input: CreateBackupVaultCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backup-vaults/{BackupVaultName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup-vaults/{BackupVaultName}"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -279,7 +282,6 @@ export const serializeAws_restJson1CreateBackupVaultCommand = async ( ...(input.EncryptionKeyArn !== undefined && input.EncryptionKeyArn !== null && { EncryptionKeyArn: input.EncryptionKeyArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -295,8 +297,10 @@ export const serializeAws_restJson1DeleteBackupPlanCommand = async ( input: DeleteBackupPlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup/plans/{BackupPlanId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/plans/{BackupPlanId}"; if (input.BackupPlanId !== undefined) { const labelValue: string = input.BackupPlanId; if (labelValue.length <= 0) { @@ -307,7 +311,6 @@ export const serializeAws_restJson1DeleteBackupPlanCommand = async ( throw new Error("No value provided for input HTTP label: BackupPlanId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -323,8 +326,11 @@ export const serializeAws_restJson1DeleteBackupSelectionCommand = async ( input: DeleteBackupSelectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup/plans/{BackupPlanId}/selections/{SelectionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup/plans/{BackupPlanId}/selections/{SelectionId}"; if (input.BackupPlanId !== undefined) { const labelValue: string = input.BackupPlanId; if (labelValue.length <= 0) { @@ -344,7 +350,6 @@ export const serializeAws_restJson1DeleteBackupSelectionCommand = async ( throw new Error("No value provided for input HTTP label: SelectionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -360,8 +365,10 @@ export const serializeAws_restJson1DeleteBackupVaultCommand = async ( input: DeleteBackupVaultCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup-vaults/{BackupVaultName}"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -372,7 +379,6 @@ export const serializeAws_restJson1DeleteBackupVaultCommand = async ( throw new Error("No value provided for input HTTP label: BackupVaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -388,8 +394,11 @@ export const serializeAws_restJson1DeleteBackupVaultAccessPolicyCommand = async input: DeleteBackupVaultAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}/access-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/access-policy"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -400,7 +409,6 @@ export const serializeAws_restJson1DeleteBackupVaultAccessPolicyCommand = async throw new Error("No value provided for input HTTP label: BackupVaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -416,8 +424,11 @@ export const serializeAws_restJson1DeleteBackupVaultNotificationsCommand = async input: DeleteBackupVaultNotificationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}/notification-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/notification-configuration"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -428,7 +439,6 @@ export const serializeAws_restJson1DeleteBackupVaultNotificationsCommand = async throw new Error("No value provided for input HTTP label: BackupVaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -444,8 +454,11 @@ export const serializeAws_restJson1DeleteRecoveryPointCommand = async ( input: DeleteRecoveryPointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -465,7 +478,6 @@ export const serializeAws_restJson1DeleteRecoveryPointCommand = async ( throw new Error("No value provided for input HTTP label: RecoveryPointArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -481,8 +493,10 @@ export const serializeAws_restJson1DescribeBackupJobCommand = async ( input: DescribeBackupJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-jobs/{BackupJobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup-jobs/{BackupJobId}"; if (input.BackupJobId !== undefined) { const labelValue: string = input.BackupJobId; if (labelValue.length <= 0) { @@ -493,7 +507,6 @@ export const serializeAws_restJson1DescribeBackupJobCommand = async ( throw new Error("No value provided for input HTTP label: BackupJobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -509,8 +522,10 @@ export const serializeAws_restJson1DescribeBackupVaultCommand = async ( input: DescribeBackupVaultCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup-vaults/{BackupVaultName}"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -521,7 +536,6 @@ export const serializeAws_restJson1DescribeBackupVaultCommand = async ( throw new Error("No value provided for input HTTP label: BackupVaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -537,8 +551,9 @@ export const serializeAws_restJson1DescribeCopyJobCommand = async ( input: DescribeCopyJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/copy-jobs/{CopyJobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/copy-jobs/{CopyJobId}"; if (input.CopyJobId !== undefined) { const labelValue: string = input.CopyJobId; if (labelValue.length <= 0) { @@ -549,7 +564,6 @@ export const serializeAws_restJson1DescribeCopyJobCommand = async ( throw new Error("No value provided for input HTTP label: CopyJobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -565,13 +579,13 @@ export const serializeAws_restJson1DescribeGlobalSettingsCommand = async ( input: DescribeGlobalSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-settings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-settings"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -587,8 +601,9 @@ export const serializeAws_restJson1DescribeProtectedResourceCommand = async ( input: DescribeProtectedResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/resources/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resources/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -599,7 +614,6 @@ export const serializeAws_restJson1DescribeProtectedResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -615,8 +629,11 @@ export const serializeAws_restJson1DescribeRecoveryPointCommand = async ( input: DescribeRecoveryPointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -636,7 +653,6 @@ export const serializeAws_restJson1DescribeRecoveryPointCommand = async ( throw new Error("No value provided for input HTTP label: RecoveryPointArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -652,13 +668,13 @@ export const serializeAws_restJson1DescribeRegionSettingsCommand = async ( input: DescribeRegionSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/account-settings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/account-settings"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -674,8 +690,10 @@ export const serializeAws_restJson1DescribeRestoreJobCommand = async ( input: DescribeRestoreJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restore-jobs/{RestoreJobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restore-jobs/{RestoreJobId}"; if (input.RestoreJobId !== undefined) { const labelValue: string = input.RestoreJobId; if (labelValue.length <= 0) { @@ -686,7 +704,6 @@ export const serializeAws_restJson1DescribeRestoreJobCommand = async ( throw new Error("No value provided for input HTTP label: RestoreJobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -702,8 +719,11 @@ export const serializeAws_restJson1DisassociateRecoveryPointCommand = async ( input: DisassociateRecoveryPointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}/disassociate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}/disassociate"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -723,7 +743,6 @@ export const serializeAws_restJson1DisassociateRecoveryPointCommand = async ( throw new Error("No value provided for input HTTP label: RecoveryPointArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -739,8 +758,10 @@ export const serializeAws_restJson1ExportBackupPlanTemplateCommand = async ( input: ExportBackupPlanTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup/plans/{BackupPlanId}/toTemplate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/plans/{BackupPlanId}/toTemplate"; if (input.BackupPlanId !== undefined) { const labelValue: string = input.BackupPlanId; if (labelValue.length <= 0) { @@ -751,7 +772,6 @@ export const serializeAws_restJson1ExportBackupPlanTemplateCommand = async ( throw new Error("No value provided for input HTTP label: BackupPlanId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -767,8 +787,10 @@ export const serializeAws_restJson1GetBackupPlanCommand = async ( input: GetBackupPlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup/plans/{BackupPlanId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/plans/{BackupPlanId}"; if (input.BackupPlanId !== undefined) { const labelValue: string = input.BackupPlanId; if (labelValue.length <= 0) { @@ -782,7 +804,6 @@ export const serializeAws_restJson1GetBackupPlanCommand = async ( ...(input.VersionId !== undefined && { versionId: input.VersionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -799,16 +820,17 @@ export const serializeAws_restJson1GetBackupPlanFromJSONCommand = async ( input: GetBackupPlanFromJSONCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backup/template/json/toPlan"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/template/json/toPlan"; let body: any; body = JSON.stringify({ ...(input.BackupPlanTemplateJson !== undefined && input.BackupPlanTemplateJson !== null && { BackupPlanTemplateJson: input.BackupPlanTemplateJson }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -824,8 +846,11 @@ export const serializeAws_restJson1GetBackupPlanFromTemplateCommand = async ( input: GetBackupPlanFromTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup/template/plans/{BackupPlanTemplateId}/toPlan"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup/template/plans/{BackupPlanTemplateId}/toPlan"; if (input.BackupPlanTemplateId !== undefined) { const labelValue: string = input.BackupPlanTemplateId; if (labelValue.length <= 0) { @@ -836,7 +861,6 @@ export const serializeAws_restJson1GetBackupPlanFromTemplateCommand = async ( throw new Error("No value provided for input HTTP label: BackupPlanTemplateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -852,8 +876,11 @@ export const serializeAws_restJson1GetBackupSelectionCommand = async ( input: GetBackupSelectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup/plans/{BackupPlanId}/selections/{SelectionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup/plans/{BackupPlanId}/selections/{SelectionId}"; if (input.BackupPlanId !== undefined) { const labelValue: string = input.BackupPlanId; if (labelValue.length <= 0) { @@ -873,7 +900,6 @@ export const serializeAws_restJson1GetBackupSelectionCommand = async ( throw new Error("No value provided for input HTTP label: SelectionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -889,8 +915,11 @@ export const serializeAws_restJson1GetBackupVaultAccessPolicyCommand = async ( input: GetBackupVaultAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}/access-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/access-policy"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -901,7 +930,6 @@ export const serializeAws_restJson1GetBackupVaultAccessPolicyCommand = async ( throw new Error("No value provided for input HTTP label: BackupVaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -917,8 +945,11 @@ export const serializeAws_restJson1GetBackupVaultNotificationsCommand = async ( input: GetBackupVaultNotificationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}/notification-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/notification-configuration"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -929,7 +960,6 @@ export const serializeAws_restJson1GetBackupVaultNotificationsCommand = async ( throw new Error("No value provided for input HTTP label: BackupVaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -945,8 +975,11 @@ export const serializeAws_restJson1GetRecoveryPointRestoreMetadataCommand = asyn input: GetRecoveryPointRestoreMetadataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}/restore-metadata"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}/restore-metadata"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -966,7 +999,6 @@ export const serializeAws_restJson1GetRecoveryPointRestoreMetadataCommand = asyn throw new Error("No value provided for input HTTP label: RecoveryPointArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -982,13 +1014,14 @@ export const serializeAws_restJson1GetSupportedResourceTypesCommand = async ( input: GetSupportedResourceTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/supported-resource-types"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/supported-resource-types"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1004,8 +1037,9 @@ export const serializeAws_restJson1ListBackupJobsCommand = async ( input: ListBackupJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup-jobs"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), @@ -1022,7 +1056,6 @@ export const serializeAws_restJson1ListBackupJobsCommand = async ( ...(input.ByAccountId !== undefined && { accountId: input.ByAccountId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1039,15 +1072,15 @@ export const serializeAws_restJson1ListBackupPlansCommand = async ( input: ListBackupPlansCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup/plans"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/plans"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.IncludeDeleted !== undefined && { includeDeleted: input.IncludeDeleted.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1064,14 +1097,14 @@ export const serializeAws_restJson1ListBackupPlanTemplatesCommand = async ( input: ListBackupPlanTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup/template/plans"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/template/plans"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1088,8 +1121,10 @@ export const serializeAws_restJson1ListBackupPlanVersionsCommand = async ( input: ListBackupPlanVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup/plans/{BackupPlanId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/plans/{BackupPlanId}/versions"; if (input.BackupPlanId !== undefined) { const labelValue: string = input.BackupPlanId; if (labelValue.length <= 0) { @@ -1104,7 +1139,6 @@ export const serializeAws_restJson1ListBackupPlanVersionsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1121,8 +1155,10 @@ export const serializeAws_restJson1ListBackupSelectionsCommand = async ( input: ListBackupSelectionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup/plans/{BackupPlanId}/selections"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/plans/{BackupPlanId}/selections"; if (input.BackupPlanId !== undefined) { const labelValue: string = input.BackupPlanId; if (labelValue.length <= 0) { @@ -1137,7 +1173,6 @@ export const serializeAws_restJson1ListBackupSelectionsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1154,14 +1189,14 @@ export const serializeAws_restJson1ListBackupVaultsCommand = async ( input: ListBackupVaultsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup-vaults"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1178,8 +1213,9 @@ export const serializeAws_restJson1ListCopyJobsCommand = async ( input: ListCopyJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/copy-jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/copy-jobs"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), @@ -1196,7 +1232,6 @@ export const serializeAws_restJson1ListCopyJobsCommand = async ( ...(input.ByAccountId !== undefined && { accountId: input.ByAccountId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1213,14 +1248,14 @@ export const serializeAws_restJson1ListProtectedResourcesCommand = async ( input: ListProtectedResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/resources"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resources"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1237,8 +1272,11 @@ export const serializeAws_restJson1ListRecoveryPointsByBackupVaultCommand = asyn input: ListRecoveryPointsByBackupVaultCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-vaults/{BackupVaultName}/recovery-points"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/recovery-points"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -1262,7 +1300,6 @@ export const serializeAws_restJson1ListRecoveryPointsByBackupVaultCommand = asyn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1279,8 +1316,10 @@ export const serializeAws_restJson1ListRecoveryPointsByResourceCommand = async ( input: ListRecoveryPointsByResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/resources/{ResourceArn}/recovery-points"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resources/{ResourceArn}/recovery-points"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1295,7 +1334,6 @@ export const serializeAws_restJson1ListRecoveryPointsByResourceCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1312,8 +1350,9 @@ export const serializeAws_restJson1ListRestoreJobsCommand = async ( input: ListRestoreJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/restore-jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restore-jobs"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), @@ -1327,7 +1366,6 @@ export const serializeAws_restJson1ListRestoreJobsCommand = async ( ...(input.ByStatus !== undefined && { status: input.ByStatus }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1344,8 +1382,9 @@ export const serializeAws_restJson1ListTagsCommand = async ( input: ListTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1360,7 +1399,6 @@ export const serializeAws_restJson1ListTagsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1377,10 +1415,13 @@ export const serializeAws_restJson1PutBackupVaultAccessPolicyCommand = async ( input: PutBackupVaultAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backup-vaults/{BackupVaultName}/access-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/access-policy"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -1394,7 +1435,6 @@ export const serializeAws_restJson1PutBackupVaultAccessPolicyCommand = async ( body = JSON.stringify({ ...(input.Policy !== undefined && input.Policy !== null && { Policy: input.Policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1410,10 +1450,13 @@ export const serializeAws_restJson1PutBackupVaultNotificationsCommand = async ( input: PutBackupVaultNotificationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backup-vaults/{BackupVaultName}/notification-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/notification-configuration"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -1431,7 +1474,6 @@ export const serializeAws_restJson1PutBackupVaultNotificationsCommand = async ( }), ...(input.SNSTopicArn !== undefined && input.SNSTopicArn !== null && { SNSTopicArn: input.SNSTopicArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1447,10 +1489,11 @@ export const serializeAws_restJson1StartBackupJobCommand = async ( input: StartBackupJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backup-jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup-jobs"; let body: any; body = JSON.stringify({ ...(input.BackupOptions !== undefined && @@ -1474,7 +1517,6 @@ export const serializeAws_restJson1StartBackupJobCommand = async ( ...(input.StartWindowMinutes !== undefined && input.StartWindowMinutes !== null && { StartWindowMinutes: input.StartWindowMinutes }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1490,10 +1532,11 @@ export const serializeAws_restJson1StartCopyJobCommand = async ( input: StartCopyJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/copy-jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/copy-jobs"; let body: any; body = JSON.stringify({ ...(input.DestinationBackupVaultArn !== undefined && @@ -1508,7 +1551,6 @@ export const serializeAws_restJson1StartCopyJobCommand = async ( ...(input.SourceBackupVaultName !== undefined && input.SourceBackupVaultName !== null && { SourceBackupVaultName: input.SourceBackupVaultName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1524,10 +1566,11 @@ export const serializeAws_restJson1StartRestoreJobCommand = async ( input: StartRestoreJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restore-jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restore-jobs"; let body: any; body = JSON.stringify({ ...(input.IamRoleArn !== undefined && input.IamRoleArn !== null && { IamRoleArn: input.IamRoleArn }), @@ -1539,7 +1582,6 @@ export const serializeAws_restJson1StartRestoreJobCommand = async ( input.RecoveryPointArn !== null && { RecoveryPointArn: input.RecoveryPointArn }), ...(input.ResourceType !== undefined && input.ResourceType !== null && { ResourceType: input.ResourceType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1555,8 +1597,10 @@ export const serializeAws_restJson1StopBackupJobCommand = async ( input: StopBackupJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/backup-jobs/{BackupJobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup-jobs/{BackupJobId}"; if (input.BackupJobId !== undefined) { const labelValue: string = input.BackupJobId; if (labelValue.length <= 0) { @@ -1567,7 +1611,6 @@ export const serializeAws_restJson1StopBackupJobCommand = async ( throw new Error("No value provided for input HTTP label: BackupJobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1583,10 +1626,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1600,7 +1644,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1616,10 +1659,11 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/untag/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/untag/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1634,7 +1678,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeyList !== undefined && input.TagKeyList !== null && { TagKeyList: serializeAws_restJson1TagKeyList(input.TagKeyList, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1650,10 +1693,12 @@ export const serializeAws_restJson1UpdateBackupPlanCommand = async ( input: UpdateBackupPlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backup/plans/{BackupPlanId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/backup/plans/{BackupPlanId}"; if (input.BackupPlanId !== undefined) { const labelValue: string = input.BackupPlanId; if (labelValue.length <= 0) { @@ -1668,7 +1713,6 @@ export const serializeAws_restJson1UpdateBackupPlanCommand = async ( ...(input.BackupPlan !== undefined && input.BackupPlan !== null && { BackupPlan: serializeAws_restJson1BackupPlanInput(input.BackupPlan, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1684,10 +1728,11 @@ export const serializeAws_restJson1UpdateGlobalSettingsCommand = async ( input: UpdateGlobalSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-settings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-settings"; let body: any; body = JSON.stringify({ ...(input.GlobalSettings !== undefined && @@ -1695,7 +1740,6 @@ export const serializeAws_restJson1UpdateGlobalSettingsCommand = async ( GlobalSettings: serializeAws_restJson1GlobalSettings(input.GlobalSettings, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1711,10 +1755,13 @@ export const serializeAws_restJson1UpdateRecoveryPointLifecycleCommand = async ( input: UpdateRecoveryPointLifecycleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/backup-vaults/{BackupVaultName}/recovery-points/{RecoveryPointArn}"; if (input.BackupVaultName !== undefined) { const labelValue: string = input.BackupVaultName; if (labelValue.length <= 0) { @@ -1738,7 +1785,6 @@ export const serializeAws_restJson1UpdateRecoveryPointLifecycleCommand = async ( ...(input.Lifecycle !== undefined && input.Lifecycle !== null && { Lifecycle: serializeAws_restJson1Lifecycle(input.Lifecycle, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1754,10 +1800,11 @@ export const serializeAws_restJson1UpdateRegionSettingsCommand = async ( input: UpdateRegionSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/account-settings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/account-settings"; let body: any; body = JSON.stringify({ ...(input.ResourceTypeOptInPreference !== undefined && @@ -1768,7 +1815,6 @@ export const serializeAws_restJson1UpdateRegionSettingsCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-batch/protocols/Aws_restJson1.ts b/clients/client-batch/protocols/Aws_restJson1.ts index 9c609d941f1cf..0c62f5166c9bb 100644 --- a/clients/client-batch/protocols/Aws_restJson1.ts +++ b/clients/client-batch/protocols/Aws_restJson1.ts @@ -111,16 +111,16 @@ export const serializeAws_restJson1CancelJobCommand = async ( input: CancelJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/canceljob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/canceljob"; let body: any; body = JSON.stringify({ ...(input.jobId !== undefined && input.jobId !== null && { jobId: input.jobId }), ...(input.reason !== undefined && input.reason !== null && { reason: input.reason }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -136,10 +136,12 @@ export const serializeAws_restJson1CreateComputeEnvironmentCommand = async ( input: CreateComputeEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/createcomputeenvironment"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/createcomputeenvironment"; let body: any; body = JSON.stringify({ ...(input.computeEnvironmentName !== undefined && @@ -154,7 +156,6 @@ export const serializeAws_restJson1CreateComputeEnvironmentCommand = async ( input.tags !== null && { tags: serializeAws_restJson1TagrisTagsMap(input.tags, context) }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -170,10 +171,11 @@ export const serializeAws_restJson1CreateJobQueueCommand = async ( input: CreateJobQueueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/createjobqueue"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/createjobqueue"; let body: any; body = JSON.stringify({ ...(input.computeEnvironmentOrder !== undefined && @@ -186,7 +188,6 @@ export const serializeAws_restJson1CreateJobQueueCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagrisTagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -202,16 +203,17 @@ export const serializeAws_restJson1DeleteComputeEnvironmentCommand = async ( input: DeleteComputeEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/deletecomputeenvironment"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/deletecomputeenvironment"; let body: any; body = JSON.stringify({ ...(input.computeEnvironment !== undefined && input.computeEnvironment !== null && { computeEnvironment: input.computeEnvironment }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -227,15 +229,15 @@ export const serializeAws_restJson1DeleteJobQueueCommand = async ( input: DeleteJobQueueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/deletejobqueue"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/deletejobqueue"; let body: any; body = JSON.stringify({ ...(input.jobQueue !== undefined && input.jobQueue !== null && { jobQueue: input.jobQueue }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -251,15 +253,16 @@ export const serializeAws_restJson1DeregisterJobDefinitionCommand = async ( input: DeregisterJobDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/deregisterjobdefinition"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/deregisterjobdefinition"; let body: any; body = JSON.stringify({ ...(input.jobDefinition !== undefined && input.jobDefinition !== null && { jobDefinition: input.jobDefinition }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -275,10 +278,12 @@ export const serializeAws_restJson1DescribeComputeEnvironmentsCommand = async ( input: DescribeComputeEnvironmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/describecomputeenvironments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/describecomputeenvironments"; let body: any; body = JSON.stringify({ ...(input.computeEnvironments !== undefined && @@ -288,7 +293,6 @@ export const serializeAws_restJson1DescribeComputeEnvironmentsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -304,10 +308,12 @@ export const serializeAws_restJson1DescribeJobDefinitionsCommand = async ( input: DescribeJobDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/describejobdefinitions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/describejobdefinitions"; let body: any; body = JSON.stringify({ ...(input.jobDefinitionName !== undefined && @@ -320,7 +326,6 @@ export const serializeAws_restJson1DescribeJobDefinitionsCommand = async ( ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -336,10 +341,11 @@ export const serializeAws_restJson1DescribeJobQueuesCommand = async ( input: DescribeJobQueuesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/describejobqueues"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/describejobqueues"; let body: any; body = JSON.stringify({ ...(input.jobQueues !== undefined && @@ -347,7 +353,6 @@ export const serializeAws_restJson1DescribeJobQueuesCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -363,16 +368,16 @@ export const serializeAws_restJson1DescribeJobsCommand = async ( input: DescribeJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/describejobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/describejobs"; let body: any; body = JSON.stringify({ ...(input.jobs !== undefined && input.jobs !== null && { jobs: serializeAws_restJson1StringList(input.jobs, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -388,10 +393,11 @@ export const serializeAws_restJson1ListJobsCommand = async ( input: ListJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/listjobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/listjobs"; let body: any; body = JSON.stringify({ ...(input.arrayJobId !== undefined && input.arrayJobId !== null && { arrayJobId: input.arrayJobId }), @@ -402,7 +408,6 @@ export const serializeAws_restJson1ListJobsCommand = async ( input.multiNodeJobId !== null && { multiNodeJobId: input.multiNodeJobId }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -418,8 +423,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -430,7 +436,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -446,10 +451,12 @@ export const serializeAws_restJson1RegisterJobDefinitionCommand = async ( input: RegisterJobDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/registerjobdefinition"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/registerjobdefinition"; let body: any; body = JSON.stringify({ ...(input.containerProperties !== undefined && @@ -479,7 +486,6 @@ export const serializeAws_restJson1RegisterJobDefinitionCommand = async ( input.timeout !== null && { timeout: serializeAws_restJson1JobTimeout(input.timeout, context) }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -495,10 +501,11 @@ export const serializeAws_restJson1SubmitJobCommand = async ( input: SubmitJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/submitjob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/submitjob"; let body: any; body = JSON.stringify({ ...(input.arrayProperties !== undefined && @@ -530,7 +537,6 @@ export const serializeAws_restJson1SubmitJobCommand = async ( ...(input.timeout !== undefined && input.timeout !== null && { timeout: serializeAws_restJson1JobTimeout(input.timeout, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -546,10 +552,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -564,7 +571,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagrisTagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -580,16 +586,16 @@ export const serializeAws_restJson1TerminateJobCommand = async ( input: TerminateJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/terminatejob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/terminatejob"; let body: any; body = JSON.stringify({ ...(input.jobId !== undefined && input.jobId !== null && { jobId: input.jobId }), ...(input.reason !== undefined && input.reason !== null && { reason: input.reason }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -605,8 +611,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -620,7 +627,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -637,10 +643,12 @@ export const serializeAws_restJson1UpdateComputeEnvironmentCommand = async ( input: UpdateComputeEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/updatecomputeenvironment"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/updatecomputeenvironment"; let body: any; body = JSON.stringify({ ...(input.computeEnvironment !== undefined && @@ -652,7 +660,6 @@ export const serializeAws_restJson1UpdateComputeEnvironmentCommand = async ( ...(input.serviceRole !== undefined && input.serviceRole !== null && { serviceRole: input.serviceRole }), ...(input.state !== undefined && input.state !== null && { state: input.state }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -668,10 +675,11 @@ export const serializeAws_restJson1UpdateJobQueueCommand = async ( input: UpdateJobQueueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/updatejobqueue"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/updatejobqueue"; let body: any; body = JSON.stringify({ ...(input.computeEnvironmentOrder !== undefined && @@ -682,7 +690,6 @@ export const serializeAws_restJson1UpdateJobQueueCommand = async ( ...(input.priority !== undefined && input.priority !== null && { priority: input.priority }), ...(input.state !== undefined && input.state !== null && { state: input.state }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-braket/protocols/Aws_restJson1.ts b/clients/client-braket/protocols/Aws_restJson1.ts index fc03abd96d99b..aad3ddc641b1f 100644 --- a/clients/client-braket/protocols/Aws_restJson1.ts +++ b/clients/client-braket/protocols/Aws_restJson1.ts @@ -45,10 +45,12 @@ export const serializeAws_restJson1CancelQuantumTaskCommand = async ( input: CancelQuantumTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/quantum-task/{quantumTaskArn}/cancel"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/quantum-task/{quantumTaskArn}/cancel"; if (input.quantumTaskArn !== undefined) { const labelValue: string = input.quantumTaskArn; if (labelValue.length <= 0) { @@ -62,7 +64,6 @@ export const serializeAws_restJson1CancelQuantumTaskCommand = async ( body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -78,10 +79,11 @@ export const serializeAws_restJson1CreateQuantumTaskCommand = async ( input: CreateQuantumTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/quantum-task"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/quantum-task"; let body: any; body = JSON.stringify({ ...(input.action !== undefined && input.action !== null && { action: __LazyJsonString.fromObject(input.action) }), @@ -97,7 +99,6 @@ export const serializeAws_restJson1CreateQuantumTaskCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -113,8 +114,9 @@ export const serializeAws_restJson1GetDeviceCommand = async ( input: GetDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/device/{deviceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/device/{deviceArn}"; if (input.deviceArn !== undefined) { const labelValue: string = input.deviceArn; if (labelValue.length <= 0) { @@ -125,7 +127,6 @@ export const serializeAws_restJson1GetDeviceCommand = async ( throw new Error("No value provided for input HTTP label: deviceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -141,8 +142,10 @@ export const serializeAws_restJson1GetQuantumTaskCommand = async ( input: GetQuantumTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/quantum-task/{quantumTaskArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/quantum-task/{quantumTaskArn}"; if (input.quantumTaskArn !== undefined) { const labelValue: string = input.quantumTaskArn; if (labelValue.length <= 0) { @@ -153,7 +156,6 @@ export const serializeAws_restJson1GetQuantumTaskCommand = async ( throw new Error("No value provided for input HTTP label: quantumTaskArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -169,8 +171,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -181,7 +184,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -197,10 +199,11 @@ export const serializeAws_restJson1SearchDevicesCommand = async ( input: SearchDevicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/devices"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/devices"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -208,7 +211,6 @@ export const serializeAws_restJson1SearchDevicesCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -224,10 +226,11 @@ export const serializeAws_restJson1SearchQuantumTasksCommand = async ( input: SearchQuantumTasksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/quantum-tasks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/quantum-tasks"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -237,7 +240,6 @@ export const serializeAws_restJson1SearchQuantumTasksCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -253,10 +255,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -271,7 +274,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -287,8 +289,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -302,7 +305,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-chime/protocols/Aws_restJson1.ts b/clients/client-chime/protocols/Aws_restJson1.ts index 00af06013500b..26efe8ee197d8 100644 --- a/clients/client-chime/protocols/Aws_restJson1.ts +++ b/clients/client-chime/protocols/Aws_restJson1.ts @@ -634,10 +634,12 @@ export const serializeAws_restJson1AssociatePhoneNumbersWithVoiceConnectorComman input: AssociatePhoneNumbersWithVoiceConnectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/voice-connectors/{VoiceConnectorId}"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -659,7 +661,6 @@ export const serializeAws_restJson1AssociatePhoneNumbersWithVoiceConnectorComman ...(input.ForceAssociate !== undefined && input.ForceAssociate !== null && { ForceAssociate: input.ForceAssociate }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -676,10 +677,13 @@ export const serializeAws_restJson1AssociatePhoneNumbersWithVoiceConnectorGroupC input: AssociatePhoneNumbersWithVoiceConnectorGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connector-groups/{VoiceConnectorGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connector-groups/{VoiceConnectorGroupId}"; if (input.VoiceConnectorGroupId !== undefined) { const labelValue: string = input.VoiceConnectorGroupId; if (labelValue.length <= 0) { @@ -701,7 +705,6 @@ export const serializeAws_restJson1AssociatePhoneNumbersWithVoiceConnectorGroupC ...(input.ForceAssociate !== undefined && input.ForceAssociate !== null && { ForceAssociate: input.ForceAssociate }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -718,10 +721,12 @@ export const serializeAws_restJson1AssociatePhoneNumberWithUserCommand = async ( input: AssociatePhoneNumberWithUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/users/{UserId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users/{UserId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -748,7 +753,6 @@ export const serializeAws_restJson1AssociatePhoneNumberWithUserCommand = async ( ...(input.E164PhoneNumber !== undefined && input.E164PhoneNumber !== null && { E164PhoneNumber: input.E164PhoneNumber }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -765,10 +769,11 @@ export const serializeAws_restJson1AssociateSigninDelegateGroupsWithAccountComma input: AssociateSigninDelegateGroupsWithAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -788,7 +793,6 @@ export const serializeAws_restJson1AssociateSigninDelegateGroupsWithAccountComma SigninDelegateGroups: serializeAws_restJson1SigninDelegateGroupList(input.SigninDelegateGroups, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -805,10 +809,12 @@ export const serializeAws_restJson1BatchCreateAttendeeCommand = async ( input: BatchCreateAttendeeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/meetings/{MeetingId}/attendees"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings/{MeetingId}/attendees"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -828,7 +834,6 @@ export const serializeAws_restJson1BatchCreateAttendeeCommand = async ( Attendees: serializeAws_restJson1CreateAttendeeRequestItemList(input.Attendees, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -845,11 +850,13 @@ export const serializeAws_restJson1BatchCreateChannelMembershipCommand = async ( input: BatchCreateChannelMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/memberships"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/memberships"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -875,7 +882,6 @@ export const serializeAws_restJson1BatchCreateChannelMembershipCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -892,10 +898,13 @@ export const serializeAws_restJson1BatchCreateRoomMembershipCommand = async ( input: BatchCreateRoomMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/rooms/{RoomId}/memberships"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/rooms/{RoomId}/memberships"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -924,7 +933,6 @@ export const serializeAws_restJson1BatchCreateRoomMembershipCommand = async ( MembershipItemList: serializeAws_restJson1MembershipItemList(input.MembershipItemList, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -941,10 +949,11 @@ export const serializeAws_restJson1BatchDeletePhoneNumberCommand = async ( input: BatchDeletePhoneNumberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/phone-numbers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-numbers"; const query: any = { operation: "batch-delete", }; @@ -955,7 +964,6 @@ export const serializeAws_restJson1BatchDeletePhoneNumberCommand = async ( PhoneNumberIds: serializeAws_restJson1NonEmptyStringList(input.PhoneNumberIds, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -972,10 +980,12 @@ export const serializeAws_restJson1BatchSuspendUserCommand = async ( input: BatchSuspendUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/users"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -993,7 +1003,6 @@ export const serializeAws_restJson1BatchSuspendUserCommand = async ( ...(input.UserIdList !== undefined && input.UserIdList !== null && { UserIdList: serializeAws_restJson1UserIdList(input.UserIdList, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1010,10 +1019,12 @@ export const serializeAws_restJson1BatchUnsuspendUserCommand = async ( input: BatchUnsuspendUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/users"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -1031,7 +1042,6 @@ export const serializeAws_restJson1BatchUnsuspendUserCommand = async ( ...(input.UserIdList !== undefined && input.UserIdList !== null && { UserIdList: serializeAws_restJson1UserIdList(input.UserIdList, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1048,10 +1058,11 @@ export const serializeAws_restJson1BatchUpdatePhoneNumberCommand = async ( input: BatchUpdatePhoneNumberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/phone-numbers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-numbers"; const query: any = { operation: "batch-update", }; @@ -1065,7 +1076,6 @@ export const serializeAws_restJson1BatchUpdatePhoneNumberCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1082,10 +1092,12 @@ export const serializeAws_restJson1BatchUpdateUserCommand = async ( input: BatchUpdateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/users"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -1102,7 +1114,6 @@ export const serializeAws_restJson1BatchUpdateUserCommand = async ( UpdateUserRequestItems: serializeAws_restJson1UpdateUserRequestItemList(input.UpdateUserRequestItems, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1118,15 +1129,15 @@ export const serializeAws_restJson1CreateAccountCommand = async ( input: CreateAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1142,10 +1153,11 @@ export const serializeAws_restJson1CreateAppInstanceCommand = async ( input: CreateAppInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/app-instances"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instances"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -1161,7 +1173,6 @@ export const serializeAws_restJson1CreateAppInstanceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1177,10 +1188,12 @@ export const serializeAws_restJson1CreateAppInstanceAdminCommand = async ( input: CreateAppInstanceAdminCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/app-instances/{AppInstanceArn}/admins"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instances/{AppInstanceArn}/admins"; if (input.AppInstanceArn !== undefined) { const labelValue: string = input.AppInstanceArn; if (labelValue.length <= 0) { @@ -1202,7 +1215,6 @@ export const serializeAws_restJson1CreateAppInstanceAdminCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1218,10 +1230,11 @@ export const serializeAws_restJson1CreateAppInstanceUserCommand = async ( input: CreateAppInstanceUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/app-instance-users"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instance-users"; let body: any; body = JSON.stringify({ ...(input.AppInstanceArn !== undefined && @@ -1241,7 +1254,6 @@ export const serializeAws_restJson1CreateAppInstanceUserCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1257,10 +1269,12 @@ export const serializeAws_restJson1CreateAttendeeCommand = async ( input: CreateAttendeeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/meetings/{MeetingId}/attendees"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings/{MeetingId}/attendees"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -1277,7 +1291,6 @@ export const serializeAws_restJson1CreateAttendeeCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1AttendeeTagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1293,10 +1306,12 @@ export const serializeAws_restJson1CreateBotCommand = async ( input: CreateBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/bots"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/bots"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -1311,7 +1326,6 @@ export const serializeAws_restJson1CreateBotCommand = async ( ...(input.DisplayName !== undefined && input.DisplayName !== null && { DisplayName: input.DisplayName }), ...(input.Domain !== undefined && input.Domain !== null && { Domain: input.Domain }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1327,11 +1341,12 @@ export const serializeAws_restJson1CreateChannelCommand = async ( input: CreateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; let body: any; body = JSON.stringify({ ...(input.AppInstanceArn !== undefined && @@ -1351,7 +1366,6 @@ export const serializeAws_restJson1CreateChannelCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1367,11 +1381,13 @@ export const serializeAws_restJson1CreateChannelBanCommand = async ( input: CreateChannelBanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/bans"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -1392,7 +1408,6 @@ export const serializeAws_restJson1CreateChannelBanCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1408,11 +1423,13 @@ export const serializeAws_restJson1CreateChannelMembershipCommand = async ( input: CreateChannelMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/memberships"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/memberships"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -1434,7 +1451,6 @@ export const serializeAws_restJson1CreateChannelMembershipCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1450,11 +1466,13 @@ export const serializeAws_restJson1CreateChannelModeratorCommand = async ( input: CreateChannelModeratorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/moderators"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/moderators"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -1476,7 +1494,6 @@ export const serializeAws_restJson1CreateChannelModeratorCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1492,10 +1509,11 @@ export const serializeAws_restJson1CreateMeetingCommand = async ( input: CreateMeetingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/meetings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -1513,7 +1531,6 @@ export const serializeAws_restJson1CreateMeetingCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1MeetingTagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1529,10 +1546,12 @@ export const serializeAws_restJson1CreateMeetingDialOutCommand = async ( input: CreateMeetingDialOutCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/meetings/{MeetingId}/dial-outs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings/{MeetingId}/dial-outs"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -1549,7 +1568,6 @@ export const serializeAws_restJson1CreateMeetingDialOutCommand = async ( ...(input.JoinToken !== undefined && input.JoinToken !== null && { JoinToken: input.JoinToken }), ...(input.ToPhoneNumber !== undefined && input.ToPhoneNumber !== null && { ToPhoneNumber: input.ToPhoneNumber }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1565,10 +1583,11 @@ export const serializeAws_restJson1CreateMeetingWithAttendeesCommand = async ( input: CreateMeetingWithAttendeesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/meetings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings"; const query: any = { operation: "create-attendees", }; @@ -1593,7 +1612,6 @@ export const serializeAws_restJson1CreateMeetingWithAttendeesCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1MeetingTagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1610,10 +1628,11 @@ export const serializeAws_restJson1CreatePhoneNumberOrderCommand = async ( input: CreatePhoneNumberOrderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/phone-number-orders"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-number-orders"; let body: any; body = JSON.stringify({ ...(input.E164PhoneNumbers !== undefined && @@ -1622,7 +1641,6 @@ export const serializeAws_restJson1CreatePhoneNumberOrderCommand = async ( }), ...(input.ProductType !== undefined && input.ProductType !== null && { ProductType: input.ProductType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1638,10 +1656,13 @@ export const serializeAws_restJson1CreateProxySessionCommand = async ( input: CreateProxySessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/proxy-sessions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/proxy-sessions"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -1674,7 +1695,6 @@ export const serializeAws_restJson1CreateProxySessionCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1690,10 +1710,12 @@ export const serializeAws_restJson1CreateRoomCommand = async ( input: CreateRoomCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/rooms"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/rooms"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -1708,7 +1730,6 @@ export const serializeAws_restJson1CreateRoomCommand = async ( ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1724,10 +1745,13 @@ export const serializeAws_restJson1CreateRoomMembershipCommand = async ( input: CreateRoomMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/rooms/{RoomId}/memberships"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/rooms/{RoomId}/memberships"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -1751,7 +1775,6 @@ export const serializeAws_restJson1CreateRoomMembershipCommand = async ( ...(input.MemberId !== undefined && input.MemberId !== null && { MemberId: input.MemberId }), ...(input.Role !== undefined && input.Role !== null && { Role: input.Role }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1767,10 +1790,11 @@ export const serializeAws_restJson1CreateSipMediaApplicationCommand = async ( input: CreateSipMediaApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sip-media-applications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sip-media-applications"; let body: any; body = JSON.stringify({ ...(input.AwsRegion !== undefined && input.AwsRegion !== null && { AwsRegion: input.AwsRegion }), @@ -1780,7 +1804,6 @@ export const serializeAws_restJson1CreateSipMediaApplicationCommand = async ( }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1796,10 +1819,13 @@ export const serializeAws_restJson1CreateSipMediaApplicationCallCommand = async input: CreateSipMediaApplicationCallCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sip-media-applications/{SipMediaApplicationId}/calls"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sip-media-applications/{SipMediaApplicationId}/calls"; if (input.SipMediaApplicationId !== undefined) { const labelValue: string = input.SipMediaApplicationId; if (labelValue.length <= 0) { @@ -1815,7 +1841,6 @@ export const serializeAws_restJson1CreateSipMediaApplicationCallCommand = async input.FromPhoneNumber !== null && { FromPhoneNumber: input.FromPhoneNumber }), ...(input.ToPhoneNumber !== undefined && input.ToPhoneNumber !== null && { ToPhoneNumber: input.ToPhoneNumber }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1831,10 +1856,11 @@ export const serializeAws_restJson1CreateSipRuleCommand = async ( input: CreateSipRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sip-rules"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sip-rules"; let body: any; body = JSON.stringify({ ...(input.Disabled !== undefined && input.Disabled !== null && { Disabled: input.Disabled }), @@ -1846,7 +1872,6 @@ export const serializeAws_restJson1CreateSipRuleCommand = async ( ...(input.TriggerType !== undefined && input.TriggerType !== null && { TriggerType: input.TriggerType }), ...(input.TriggerValue !== undefined && input.TriggerValue !== null && { TriggerValue: input.TriggerValue }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1862,10 +1887,12 @@ export const serializeAws_restJson1CreateUserCommand = async ( input: CreateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/users"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -1884,7 +1911,6 @@ export const serializeAws_restJson1CreateUserCommand = async ( ...(input.UserType !== undefined && input.UserType !== null && { UserType: input.UserType }), ...(input.Username !== undefined && input.Username !== null && { Username: input.Username }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1901,10 +1927,11 @@ export const serializeAws_restJson1CreateVoiceConnectorCommand = async ( input: CreateVoiceConnectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/voice-connectors"; let body: any; body = JSON.stringify({ ...(input.AwsRegion !== undefined && input.AwsRegion !== null && { AwsRegion: input.AwsRegion }), @@ -1912,7 +1939,6 @@ export const serializeAws_restJson1CreateVoiceConnectorCommand = async ( ...(input.RequireEncryption !== undefined && input.RequireEncryption !== null && { RequireEncryption: input.RequireEncryption }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1928,10 +1954,11 @@ export const serializeAws_restJson1CreateVoiceConnectorGroupCommand = async ( input: CreateVoiceConnectorGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connector-groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/voice-connector-groups"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), @@ -1940,7 +1967,6 @@ export const serializeAws_restJson1CreateVoiceConnectorGroupCommand = async ( VoiceConnectorItems: serializeAws_restJson1VoiceConnectorItemList(input.VoiceConnectorItems, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1956,8 +1982,9 @@ export const serializeAws_restJson1DeleteAccountCommand = async ( input: DeleteAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -1968,7 +1995,6 @@ export const serializeAws_restJson1DeleteAccountCommand = async ( throw new Error("No value provided for input HTTP label: AccountId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1984,8 +2010,10 @@ export const serializeAws_restJson1DeleteAppInstanceCommand = async ( input: DeleteAppInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instances/{AppInstanceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instances/{AppInstanceArn}"; if (input.AppInstanceArn !== undefined) { const labelValue: string = input.AppInstanceArn; if (labelValue.length <= 0) { @@ -2003,7 +2031,6 @@ export const serializeAws_restJson1DeleteAppInstanceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2019,8 +2046,11 @@ export const serializeAws_restJson1DeleteAppInstanceAdminCommand = async ( input: DeleteAppInstanceAdminCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instances/{AppInstanceArn}/admins/{AppInstanceAdminArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/app-instances/{AppInstanceArn}/admins/{AppInstanceAdminArn}"; if (input.AppInstanceAdminArn !== undefined) { const labelValue: string = input.AppInstanceAdminArn; if (labelValue.length <= 0) { @@ -2047,7 +2077,6 @@ export const serializeAws_restJson1DeleteAppInstanceAdminCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2063,8 +2092,11 @@ export const serializeAws_restJson1DeleteAppInstanceStreamingConfigurationsComma input: DeleteAppInstanceStreamingConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instances/{AppInstanceArn}/streaming-configurations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/app-instances/{AppInstanceArn}/streaming-configurations"; if (input.AppInstanceArn !== undefined) { const labelValue: string = input.AppInstanceArn; if (labelValue.length <= 0) { @@ -2075,7 +2107,6 @@ export const serializeAws_restJson1DeleteAppInstanceStreamingConfigurationsComma throw new Error("No value provided for input HTTP label: AppInstanceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2091,8 +2122,10 @@ export const serializeAws_restJson1DeleteAppInstanceUserCommand = async ( input: DeleteAppInstanceUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instance-users/{AppInstanceUserArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instance-users/{AppInstanceUserArn}"; if (input.AppInstanceUserArn !== undefined) { const labelValue: string = input.AppInstanceUserArn; if (labelValue.length <= 0) { @@ -2110,7 +2143,6 @@ export const serializeAws_restJson1DeleteAppInstanceUserCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2126,8 +2158,11 @@ export const serializeAws_restJson1DeleteAttendeeCommand = async ( input: DeleteAttendeeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/meetings/{MeetingId}/attendees/{AttendeeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/meetings/{MeetingId}/attendees/{AttendeeId}"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -2147,7 +2182,6 @@ export const serializeAws_restJson1DeleteAttendeeCommand = async ( throw new Error("No value provided for input HTTP label: AttendeeId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2163,10 +2197,11 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( input: DeleteChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -2184,7 +2219,6 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2200,10 +2234,12 @@ export const serializeAws_restJson1DeleteChannelBanCommand = async ( input: DeleteChannelBanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/bans/{MemberArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans/{MemberArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -2230,7 +2266,6 @@ export const serializeAws_restJson1DeleteChannelBanCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2246,10 +2281,13 @@ export const serializeAws_restJson1DeleteChannelMembershipCommand = async ( input: DeleteChannelMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/memberships/{MemberArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channels/{ChannelArn}/memberships/{MemberArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -2276,7 +2314,6 @@ export const serializeAws_restJson1DeleteChannelMembershipCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2292,10 +2329,13 @@ export const serializeAws_restJson1DeleteChannelMessageCommand = async ( input: DeleteChannelMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/messages/{MessageId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channels/{ChannelArn}/messages/{MessageId}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -2322,7 +2362,6 @@ export const serializeAws_restJson1DeleteChannelMessageCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2338,10 +2377,13 @@ export const serializeAws_restJson1DeleteChannelModeratorCommand = async ( input: DeleteChannelModeratorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/moderators/{ChannelModeratorArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channels/{ChannelArn}/moderators/{ChannelModeratorArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -2368,7 +2410,6 @@ export const serializeAws_restJson1DeleteChannelModeratorCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2384,8 +2425,11 @@ export const serializeAws_restJson1DeleteEventsConfigurationCommand = async ( input: DeleteEventsConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/bots/{BotId}/events-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/bots/{BotId}/events-configuration"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -2405,7 +2449,6 @@ export const serializeAws_restJson1DeleteEventsConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: BotId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2421,8 +2464,9 @@ export const serializeAws_restJson1DeleteMeetingCommand = async ( input: DeleteMeetingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/meetings/{MeetingId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings/{MeetingId}"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -2433,7 +2477,6 @@ export const serializeAws_restJson1DeleteMeetingCommand = async ( throw new Error("No value provided for input HTTP label: MeetingId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2449,8 +2492,10 @@ export const serializeAws_restJson1DeletePhoneNumberCommand = async ( input: DeletePhoneNumberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/phone-numbers/{PhoneNumberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-numbers/{PhoneNumberId}"; if (input.PhoneNumberId !== undefined) { const labelValue: string = input.PhoneNumberId; if (labelValue.length <= 0) { @@ -2461,7 +2506,6 @@ export const serializeAws_restJson1DeletePhoneNumberCommand = async ( throw new Error("No value provided for input HTTP label: PhoneNumberId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2477,8 +2521,11 @@ export const serializeAws_restJson1DeleteProxySessionCommand = async ( input: DeleteProxySessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/proxy-sessions/{ProxySessionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/proxy-sessions/{ProxySessionId}"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -2498,7 +2545,6 @@ export const serializeAws_restJson1DeleteProxySessionCommand = async ( throw new Error("No value provided for input HTTP label: ProxySessionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2514,8 +2560,10 @@ export const serializeAws_restJson1DeleteRoomCommand = async ( input: DeleteRoomCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/rooms/{RoomId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/rooms/{RoomId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -2535,7 +2583,6 @@ export const serializeAws_restJson1DeleteRoomCommand = async ( throw new Error("No value provided for input HTTP label: RoomId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2551,8 +2598,11 @@ export const serializeAws_restJson1DeleteRoomMembershipCommand = async ( input: DeleteRoomMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/rooms/{RoomId}/memberships/{MemberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/rooms/{RoomId}/memberships/{MemberId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -2581,7 +2631,6 @@ export const serializeAws_restJson1DeleteRoomMembershipCommand = async ( throw new Error("No value provided for input HTTP label: MemberId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2597,8 +2646,11 @@ export const serializeAws_restJson1DeleteSipMediaApplicationCommand = async ( input: DeleteSipMediaApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sip-media-applications/{SipMediaApplicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sip-media-applications/{SipMediaApplicationId}"; if (input.SipMediaApplicationId !== undefined) { const labelValue: string = input.SipMediaApplicationId; if (labelValue.length <= 0) { @@ -2609,7 +2661,6 @@ export const serializeAws_restJson1DeleteSipMediaApplicationCommand = async ( throw new Error("No value provided for input HTTP label: SipMediaApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2625,8 +2676,9 @@ export const serializeAws_restJson1DeleteSipRuleCommand = async ( input: DeleteSipRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sip-rules/{SipRuleId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sip-rules/{SipRuleId}"; if (input.SipRuleId !== undefined) { const labelValue: string = input.SipRuleId; if (labelValue.length <= 0) { @@ -2637,7 +2689,6 @@ export const serializeAws_restJson1DeleteSipRuleCommand = async ( throw new Error("No value provided for input HTTP label: SipRuleId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2653,8 +2704,10 @@ export const serializeAws_restJson1DeleteVoiceConnectorCommand = async ( input: DeleteVoiceConnectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/voice-connectors/{VoiceConnectorId}"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -2665,7 +2718,6 @@ export const serializeAws_restJson1DeleteVoiceConnectorCommand = async ( throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2681,8 +2733,11 @@ export const serializeAws_restJson1DeleteVoiceConnectorEmergencyCallingConfigura input: DeleteVoiceConnectorEmergencyCallingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/emergency-calling-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/emergency-calling-configuration"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -2693,7 +2748,6 @@ export const serializeAws_restJson1DeleteVoiceConnectorEmergencyCallingConfigura throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2709,8 +2763,11 @@ export const serializeAws_restJson1DeleteVoiceConnectorGroupCommand = async ( input: DeleteVoiceConnectorGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connector-groups/{VoiceConnectorGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connector-groups/{VoiceConnectorGroupId}"; if (input.VoiceConnectorGroupId !== undefined) { const labelValue: string = input.VoiceConnectorGroupId; if (labelValue.length <= 0) { @@ -2721,7 +2778,6 @@ export const serializeAws_restJson1DeleteVoiceConnectorGroupCommand = async ( throw new Error("No value provided for input HTTP label: VoiceConnectorGroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2737,8 +2793,11 @@ export const serializeAws_restJson1DeleteVoiceConnectorOriginationCommand = asyn input: DeleteVoiceConnectorOriginationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/origination"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/origination"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -2749,7 +2808,6 @@ export const serializeAws_restJson1DeleteVoiceConnectorOriginationCommand = asyn throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2765,8 +2823,11 @@ export const serializeAws_restJson1DeleteVoiceConnectorProxyCommand = async ( input: DeleteVoiceConnectorProxyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/programmable-numbers/proxy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/programmable-numbers/proxy"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -2777,7 +2838,6 @@ export const serializeAws_restJson1DeleteVoiceConnectorProxyCommand = async ( throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2793,8 +2853,11 @@ export const serializeAws_restJson1DeleteVoiceConnectorStreamingConfigurationCom input: DeleteVoiceConnectorStreamingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/streaming-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/streaming-configuration"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -2805,7 +2868,6 @@ export const serializeAws_restJson1DeleteVoiceConnectorStreamingConfigurationCom throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2821,8 +2883,11 @@ export const serializeAws_restJson1DeleteVoiceConnectorTerminationCommand = asyn input: DeleteVoiceConnectorTerminationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/termination"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/termination"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -2833,7 +2898,6 @@ export const serializeAws_restJson1DeleteVoiceConnectorTerminationCommand = asyn throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2849,10 +2913,13 @@ export const serializeAws_restJson1DeleteVoiceConnectorTerminationCredentialsCom input: DeleteVoiceConnectorTerminationCredentialsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/termination/credentials"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/termination/credentials"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -2870,7 +2937,6 @@ export const serializeAws_restJson1DeleteVoiceConnectorTerminationCredentialsCom ...(input.Usernames !== undefined && input.Usernames !== null && { Usernames: serializeAws_restJson1SensitiveStringList(input.Usernames, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2887,8 +2953,10 @@ export const serializeAws_restJson1DescribeAppInstanceCommand = async ( input: DescribeAppInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instances/{AppInstanceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instances/{AppInstanceArn}"; if (input.AppInstanceArn !== undefined) { const labelValue: string = input.AppInstanceArn; if (labelValue.length <= 0) { @@ -2906,7 +2974,6 @@ export const serializeAws_restJson1DescribeAppInstanceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2922,8 +2989,11 @@ export const serializeAws_restJson1DescribeAppInstanceAdminCommand = async ( input: DescribeAppInstanceAdminCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instances/{AppInstanceArn}/admins/{AppInstanceAdminArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/app-instances/{AppInstanceArn}/admins/{AppInstanceAdminArn}"; if (input.AppInstanceAdminArn !== undefined) { const labelValue: string = input.AppInstanceAdminArn; if (labelValue.length <= 0) { @@ -2950,7 +3020,6 @@ export const serializeAws_restJson1DescribeAppInstanceAdminCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2966,8 +3035,10 @@ export const serializeAws_restJson1DescribeAppInstanceUserCommand = async ( input: DescribeAppInstanceUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instance-users/{AppInstanceUserArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instance-users/{AppInstanceUserArn}"; if (input.AppInstanceUserArn !== undefined) { const labelValue: string = input.AppInstanceUserArn; if (labelValue.length <= 0) { @@ -2985,7 +3056,6 @@ export const serializeAws_restJson1DescribeAppInstanceUserCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -3001,10 +3071,11 @@ export const serializeAws_restJson1DescribeChannelCommand = async ( input: DescribeChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -3022,7 +3093,6 @@ export const serializeAws_restJson1DescribeChannelCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -3038,10 +3108,12 @@ export const serializeAws_restJson1DescribeChannelBanCommand = async ( input: DescribeChannelBanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/bans/{MemberArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans/{MemberArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -3068,7 +3140,6 @@ export const serializeAws_restJson1DescribeChannelBanCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -3084,10 +3155,13 @@ export const serializeAws_restJson1DescribeChannelMembershipCommand = async ( input: DescribeChannelMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/memberships/{MemberArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channels/{ChannelArn}/memberships/{MemberArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -3114,7 +3188,6 @@ export const serializeAws_restJson1DescribeChannelMembershipCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -3130,10 +3203,11 @@ export const serializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCo input: DescribeChannelMembershipForAppInstanceUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -3155,7 +3229,6 @@ export const serializeAws_restJson1DescribeChannelMembershipForAppInstanceUserCo throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -3172,10 +3245,11 @@ export const serializeAws_restJson1DescribeChannelModeratedByAppInstanceUserComm input: DescribeChannelModeratedByAppInstanceUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -3197,7 +3271,6 @@ export const serializeAws_restJson1DescribeChannelModeratedByAppInstanceUserComm throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -3214,10 +3287,13 @@ export const serializeAws_restJson1DescribeChannelModeratorCommand = async ( input: DescribeChannelModeratorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/moderators/{ChannelModeratorArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channels/{ChannelArn}/moderators/{ChannelModeratorArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -3244,7 +3320,6 @@ export const serializeAws_restJson1DescribeChannelModeratorCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -3260,8 +3335,10 @@ export const serializeAws_restJson1DisassociatePhoneNumberFromUserCommand = asyn input: DisassociatePhoneNumberFromUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/users/{UserId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users/{UserId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -3284,7 +3361,6 @@ export const serializeAws_restJson1DisassociatePhoneNumberFromUserCommand = asyn operation: "disassociate-phone-number", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3301,10 +3377,12 @@ export const serializeAws_restJson1DisassociatePhoneNumbersFromVoiceConnectorCom input: DisassociatePhoneNumbersFromVoiceConnectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/voice-connectors/{VoiceConnectorId}"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -3324,7 +3402,6 @@ export const serializeAws_restJson1DisassociatePhoneNumbersFromVoiceConnectorCom E164PhoneNumbers: serializeAws_restJson1E164PhoneNumberList(input.E164PhoneNumbers, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3341,10 +3418,13 @@ export const serializeAws_restJson1DisassociatePhoneNumbersFromVoiceConnectorGro input: DisassociatePhoneNumbersFromVoiceConnectorGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connector-groups/{VoiceConnectorGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connector-groups/{VoiceConnectorGroupId}"; if (input.VoiceConnectorGroupId !== undefined) { const labelValue: string = input.VoiceConnectorGroupId; if (labelValue.length <= 0) { @@ -3364,7 +3444,6 @@ export const serializeAws_restJson1DisassociatePhoneNumbersFromVoiceConnectorGro E164PhoneNumbers: serializeAws_restJson1E164PhoneNumberList(input.E164PhoneNumbers, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3381,10 +3460,11 @@ export const serializeAws_restJson1DisassociateSigninDelegateGroupsFromAccountCo input: DisassociateSigninDelegateGroupsFromAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -3402,7 +3482,6 @@ export const serializeAws_restJson1DisassociateSigninDelegateGroupsFromAccountCo ...(input.GroupNames !== undefined && input.GroupNames !== null && { GroupNames: serializeAws_restJson1NonEmptyStringList(input.GroupNames, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3419,8 +3498,9 @@ export const serializeAws_restJson1GetAccountCommand = async ( input: GetAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -3431,7 +3511,6 @@ export const serializeAws_restJson1GetAccountCommand = async ( throw new Error("No value provided for input HTTP label: AccountId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3447,8 +3526,10 @@ export const serializeAws_restJson1GetAccountSettingsCommand = async ( input: GetAccountSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/settings"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -3459,7 +3540,6 @@ export const serializeAws_restJson1GetAccountSettingsCommand = async ( throw new Error("No value provided for input HTTP label: AccountId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3475,8 +3555,11 @@ export const serializeAws_restJson1GetAppInstanceRetentionSettingsCommand = asyn input: GetAppInstanceRetentionSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instances/{AppInstanceArn}/retention-settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/app-instances/{AppInstanceArn}/retention-settings"; if (input.AppInstanceArn !== undefined) { const labelValue: string = input.AppInstanceArn; if (labelValue.length <= 0) { @@ -3494,7 +3577,6 @@ export const serializeAws_restJson1GetAppInstanceRetentionSettingsCommand = asyn throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -3510,8 +3592,11 @@ export const serializeAws_restJson1GetAppInstanceStreamingConfigurationsCommand input: GetAppInstanceStreamingConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instances/{AppInstanceArn}/streaming-configurations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/app-instances/{AppInstanceArn}/streaming-configurations"; if (input.AppInstanceArn !== undefined) { const labelValue: string = input.AppInstanceArn; if (labelValue.length <= 0) { @@ -3522,7 +3607,6 @@ export const serializeAws_restJson1GetAppInstanceStreamingConfigurationsCommand throw new Error("No value provided for input HTTP label: AppInstanceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3538,8 +3622,11 @@ export const serializeAws_restJson1GetAttendeeCommand = async ( input: GetAttendeeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/meetings/{MeetingId}/attendees/{AttendeeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/meetings/{MeetingId}/attendees/{AttendeeId}"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -3559,7 +3646,6 @@ export const serializeAws_restJson1GetAttendeeCommand = async ( throw new Error("No value provided for input HTTP label: AttendeeId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3575,8 +3661,10 @@ export const serializeAws_restJson1GetBotCommand = async ( input: GetBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/bots/{BotId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/bots/{BotId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -3596,7 +3684,6 @@ export const serializeAws_restJson1GetBotCommand = async ( throw new Error("No value provided for input HTTP label: BotId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3612,10 +3699,13 @@ export const serializeAws_restJson1GetChannelMessageCommand = async ( input: GetChannelMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/messages/{MessageId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channels/{ChannelArn}/messages/{MessageId}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -3642,7 +3732,6 @@ export const serializeAws_restJson1GetChannelMessageCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -3658,8 +3747,11 @@ export const serializeAws_restJson1GetEventsConfigurationCommand = async ( input: GetEventsConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/bots/{BotId}/events-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/bots/{BotId}/events-configuration"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -3679,7 +3771,6 @@ export const serializeAws_restJson1GetEventsConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: BotId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3695,13 +3786,13 @@ export const serializeAws_restJson1GetGlobalSettingsCommand = async ( input: GetGlobalSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/settings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/settings"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3717,8 +3808,9 @@ export const serializeAws_restJson1GetMeetingCommand = async ( input: GetMeetingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/meetings/{MeetingId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings/{MeetingId}"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -3729,7 +3821,6 @@ export const serializeAws_restJson1GetMeetingCommand = async ( throw new Error("No value provided for input HTTP label: MeetingId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3745,10 +3836,12 @@ export const serializeAws_restJson1GetMessagingSessionEndpointCommand = async ( input: GetMessagingSessionEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/endpoints/messaging-session"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/endpoints/messaging-session"; let body: any; body = ""; let { hostname: resolvedHostname } = await context.endpoint(); @@ -3758,7 +3851,6 @@ export const serializeAws_restJson1GetMessagingSessionEndpointCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -3774,8 +3866,10 @@ export const serializeAws_restJson1GetPhoneNumberCommand = async ( input: GetPhoneNumberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/phone-numbers/{PhoneNumberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-numbers/{PhoneNumberId}"; if (input.PhoneNumberId !== undefined) { const labelValue: string = input.PhoneNumberId; if (labelValue.length <= 0) { @@ -3786,7 +3880,6 @@ export const serializeAws_restJson1GetPhoneNumberCommand = async ( throw new Error("No value provided for input HTTP label: PhoneNumberId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3802,8 +3895,10 @@ export const serializeAws_restJson1GetPhoneNumberOrderCommand = async ( input: GetPhoneNumberOrderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/phone-number-orders/{PhoneNumberOrderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-number-orders/{PhoneNumberOrderId}"; if (input.PhoneNumberOrderId !== undefined) { const labelValue: string = input.PhoneNumberOrderId; if (labelValue.length <= 0) { @@ -3814,7 +3909,6 @@ export const serializeAws_restJson1GetPhoneNumberOrderCommand = async ( throw new Error("No value provided for input HTTP label: PhoneNumberOrderId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3830,13 +3924,13 @@ export const serializeAws_restJson1GetPhoneNumberSettingsCommand = async ( input: GetPhoneNumberSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/settings/phone-number"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/settings/phone-number"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3852,8 +3946,11 @@ export const serializeAws_restJson1GetProxySessionCommand = async ( input: GetProxySessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/proxy-sessions/{ProxySessionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/proxy-sessions/{ProxySessionId}"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -3873,7 +3970,6 @@ export const serializeAws_restJson1GetProxySessionCommand = async ( throw new Error("No value provided for input HTTP label: ProxySessionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3889,8 +3985,10 @@ export const serializeAws_restJson1GetRetentionSettingsCommand = async ( input: GetRetentionSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/retention-settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/retention-settings"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -3901,7 +3999,6 @@ export const serializeAws_restJson1GetRetentionSettingsCommand = async ( throw new Error("No value provided for input HTTP label: AccountId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3917,8 +4014,10 @@ export const serializeAws_restJson1GetRoomCommand = async ( input: GetRoomCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/rooms/{RoomId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/rooms/{RoomId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -3938,7 +4037,6 @@ export const serializeAws_restJson1GetRoomCommand = async ( throw new Error("No value provided for input HTTP label: RoomId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3954,8 +4052,11 @@ export const serializeAws_restJson1GetSipMediaApplicationCommand = async ( input: GetSipMediaApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sip-media-applications/{SipMediaApplicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sip-media-applications/{SipMediaApplicationId}"; if (input.SipMediaApplicationId !== undefined) { const labelValue: string = input.SipMediaApplicationId; if (labelValue.length <= 0) { @@ -3966,7 +4067,6 @@ export const serializeAws_restJson1GetSipMediaApplicationCommand = async ( throw new Error("No value provided for input HTTP label: SipMediaApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3982,8 +4082,11 @@ export const serializeAws_restJson1GetSipMediaApplicationLoggingConfigurationCom input: GetSipMediaApplicationLoggingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sip-media-applications/{SipMediaApplicationId}/logging-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sip-media-applications/{SipMediaApplicationId}/logging-configuration"; if (input.SipMediaApplicationId !== undefined) { const labelValue: string = input.SipMediaApplicationId; if (labelValue.length <= 0) { @@ -3994,7 +4097,6 @@ export const serializeAws_restJson1GetSipMediaApplicationLoggingConfigurationCom throw new Error("No value provided for input HTTP label: SipMediaApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4010,8 +4112,9 @@ export const serializeAws_restJson1GetSipRuleCommand = async ( input: GetSipRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sip-rules/{SipRuleId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sip-rules/{SipRuleId}"; if (input.SipRuleId !== undefined) { const labelValue: string = input.SipRuleId; if (labelValue.length <= 0) { @@ -4022,7 +4125,6 @@ export const serializeAws_restJson1GetSipRuleCommand = async ( throw new Error("No value provided for input HTTP label: SipRuleId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4038,8 +4140,10 @@ export const serializeAws_restJson1GetUserCommand = async ( input: GetUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/users/{UserId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users/{UserId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -4059,7 +4163,6 @@ export const serializeAws_restJson1GetUserCommand = async ( throw new Error("No value provided for input HTTP label: UserId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4075,8 +4178,11 @@ export const serializeAws_restJson1GetUserSettingsCommand = async ( input: GetUserSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/users/{UserId}/settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/users/{UserId}/settings"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -4096,7 +4202,6 @@ export const serializeAws_restJson1GetUserSettingsCommand = async ( throw new Error("No value provided for input HTTP label: UserId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4112,8 +4217,10 @@ export const serializeAws_restJson1GetVoiceConnectorCommand = async ( input: GetVoiceConnectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/voice-connectors/{VoiceConnectorId}"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -4124,7 +4231,6 @@ export const serializeAws_restJson1GetVoiceConnectorCommand = async ( throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4140,8 +4246,11 @@ export const serializeAws_restJson1GetVoiceConnectorEmergencyCallingConfiguratio input: GetVoiceConnectorEmergencyCallingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/emergency-calling-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/emergency-calling-configuration"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -4152,7 +4261,6 @@ export const serializeAws_restJson1GetVoiceConnectorEmergencyCallingConfiguratio throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4168,8 +4276,11 @@ export const serializeAws_restJson1GetVoiceConnectorGroupCommand = async ( input: GetVoiceConnectorGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connector-groups/{VoiceConnectorGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connector-groups/{VoiceConnectorGroupId}"; if (input.VoiceConnectorGroupId !== undefined) { const labelValue: string = input.VoiceConnectorGroupId; if (labelValue.length <= 0) { @@ -4180,7 +4291,6 @@ export const serializeAws_restJson1GetVoiceConnectorGroupCommand = async ( throw new Error("No value provided for input HTTP label: VoiceConnectorGroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4196,8 +4306,11 @@ export const serializeAws_restJson1GetVoiceConnectorLoggingConfigurationCommand input: GetVoiceConnectorLoggingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/logging-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/logging-configuration"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -4208,7 +4321,6 @@ export const serializeAws_restJson1GetVoiceConnectorLoggingConfigurationCommand throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4224,8 +4336,11 @@ export const serializeAws_restJson1GetVoiceConnectorOriginationCommand = async ( input: GetVoiceConnectorOriginationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/origination"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/origination"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -4236,7 +4351,6 @@ export const serializeAws_restJson1GetVoiceConnectorOriginationCommand = async ( throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4252,8 +4366,11 @@ export const serializeAws_restJson1GetVoiceConnectorProxyCommand = async ( input: GetVoiceConnectorProxyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/programmable-numbers/proxy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/programmable-numbers/proxy"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -4264,7 +4381,6 @@ export const serializeAws_restJson1GetVoiceConnectorProxyCommand = async ( throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4280,8 +4396,11 @@ export const serializeAws_restJson1GetVoiceConnectorStreamingConfigurationComman input: GetVoiceConnectorStreamingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/streaming-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/streaming-configuration"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -4292,7 +4411,6 @@ export const serializeAws_restJson1GetVoiceConnectorStreamingConfigurationComman throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4308,8 +4426,11 @@ export const serializeAws_restJson1GetVoiceConnectorTerminationCommand = async ( input: GetVoiceConnectorTerminationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/termination"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/termination"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -4320,7 +4441,6 @@ export const serializeAws_restJson1GetVoiceConnectorTerminationCommand = async ( throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4336,8 +4456,11 @@ export const serializeAws_restJson1GetVoiceConnectorTerminationHealthCommand = a input: GetVoiceConnectorTerminationHealthCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/termination/health"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/termination/health"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -4348,7 +4471,6 @@ export const serializeAws_restJson1GetVoiceConnectorTerminationHealthCommand = a throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4364,10 +4486,12 @@ export const serializeAws_restJson1InviteUsersCommand = async ( input: InviteUsersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/users"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -4388,7 +4512,6 @@ export const serializeAws_restJson1InviteUsersCommand = async ( }), ...(input.UserType !== undefined && input.UserType !== null && { UserType: input.UserType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4405,8 +4528,9 @@ export const serializeAws_restJson1ListAccountsCommand = async ( input: ListAccountsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts"; const query: any = { ...(input.Name !== undefined && { name: input.Name }), ...(input.UserEmail !== undefined && { "user-email": input.UserEmail }), @@ -4414,7 +4538,6 @@ export const serializeAws_restJson1ListAccountsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4431,8 +4554,10 @@ export const serializeAws_restJson1ListAppInstanceAdminsCommand = async ( input: ListAppInstanceAdminsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instances/{AppInstanceArn}/admins"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instances/{AppInstanceArn}/admins"; if (input.AppInstanceArn !== undefined) { const labelValue: string = input.AppInstanceArn; if (labelValue.length <= 0) { @@ -4454,7 +4579,6 @@ export const serializeAws_restJson1ListAppInstanceAdminsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -4471,8 +4595,9 @@ export const serializeAws_restJson1ListAppInstancesCommand = async ( input: ListAppInstancesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instances"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instances"; const query: any = { ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), ...(input.NextToken !== undefined && { "next-token": input.NextToken }), @@ -4485,7 +4610,6 @@ export const serializeAws_restJson1ListAppInstancesCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -4502,8 +4626,9 @@ export const serializeAws_restJson1ListAppInstanceUsersCommand = async ( input: ListAppInstanceUsersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/app-instance-users"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instance-users"; const query: any = { ...(input.AppInstanceArn !== undefined && { "app-instance-arn": input.AppInstanceArn }), ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), @@ -4517,7 +4642,6 @@ export const serializeAws_restJson1ListAppInstanceUsersCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -4534,8 +4658,10 @@ export const serializeAws_restJson1ListAttendeesCommand = async ( input: ListAttendeesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/meetings/{MeetingId}/attendees"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings/{MeetingId}/attendees"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -4550,7 +4676,6 @@ export const serializeAws_restJson1ListAttendeesCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4567,8 +4692,11 @@ export const serializeAws_restJson1ListAttendeeTagsCommand = async ( input: ListAttendeeTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/meetings/{MeetingId}/attendees/{AttendeeId}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/meetings/{MeetingId}/attendees/{AttendeeId}/tags"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -4588,7 +4716,6 @@ export const serializeAws_restJson1ListAttendeeTagsCommand = async ( throw new Error("No value provided for input HTTP label: AttendeeId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4604,8 +4731,10 @@ export const serializeAws_restJson1ListBotsCommand = async ( input: ListBotsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/bots"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/bots"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -4620,7 +4749,6 @@ export const serializeAws_restJson1ListBotsCommand = async ( ...(input.NextToken !== undefined && { "next-token": input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4637,10 +4765,12 @@ export const serializeAws_restJson1ListChannelBansCommand = async ( input: ListChannelBansCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/bans"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/bans"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -4662,7 +4792,6 @@ export const serializeAws_restJson1ListChannelBansCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -4679,10 +4808,12 @@ export const serializeAws_restJson1ListChannelMembershipsCommand = async ( input: ListChannelMembershipsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/memberships"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/memberships"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -4705,7 +4836,6 @@ export const serializeAws_restJson1ListChannelMembershipsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -4722,10 +4852,11 @@ export const serializeAws_restJson1ListChannelMembershipsForAppInstanceUserComma input: ListChannelMembershipsForAppInstanceUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; const query: any = { scope: "app-instance-user-memberships", ...(input.AppInstanceUserArn !== undefined && { "app-instance-user-arn": input.AppInstanceUserArn }), @@ -4740,7 +4871,6 @@ export const serializeAws_restJson1ListChannelMembershipsForAppInstanceUserComma throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -4757,10 +4887,12 @@ export const serializeAws_restJson1ListChannelMessagesCommand = async ( input: ListChannelMessagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/messages"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/messages"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -4787,7 +4919,6 @@ export const serializeAws_restJson1ListChannelMessagesCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -4804,10 +4935,12 @@ export const serializeAws_restJson1ListChannelModeratorsCommand = async ( input: ListChannelModeratorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/moderators"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/moderators"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -4829,7 +4962,6 @@ export const serializeAws_restJson1ListChannelModeratorsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -4846,10 +4978,11 @@ export const serializeAws_restJson1ListChannelsCommand = async ( input: ListChannelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; const query: any = { ...(input.AppInstanceArn !== undefined && { "app-instance-arn": input.AppInstanceArn }), ...(input.Privacy !== undefined && { privacy: input.Privacy }), @@ -4864,7 +4997,6 @@ export const serializeAws_restJson1ListChannelsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -4881,10 +5013,11 @@ export const serializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommand input: ListChannelsModeratedByAppInstanceUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; const query: any = { scope: "app-instance-user-moderated-channels", ...(input.AppInstanceUserArn !== undefined && { "app-instance-user-arn": input.AppInstanceUserArn }), @@ -4899,7 +5032,6 @@ export const serializeAws_restJson1ListChannelsModeratedByAppInstanceUserCommand throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -4916,14 +5048,14 @@ export const serializeAws_restJson1ListMeetingsCommand = async ( input: ListMeetingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/meetings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings"; const query: any = { ...(input.NextToken !== undefined && { "next-token": input.NextToken }), ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4940,8 +5072,10 @@ export const serializeAws_restJson1ListMeetingTagsCommand = async ( input: ListMeetingTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/meetings/{MeetingId}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings/{MeetingId}/tags"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -4952,7 +5086,6 @@ export const serializeAws_restJson1ListMeetingTagsCommand = async ( throw new Error("No value provided for input HTTP label: MeetingId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4968,14 +5101,14 @@ export const serializeAws_restJson1ListPhoneNumberOrdersCommand = async ( input: ListPhoneNumberOrdersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/phone-number-orders"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-number-orders"; const query: any = { ...(input.NextToken !== undefined && { "next-token": input.NextToken }), ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4992,8 +5125,9 @@ export const serializeAws_restJson1ListPhoneNumbersCommand = async ( input: ListPhoneNumbersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/phone-numbers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-numbers"; const query: any = { ...(input.Status !== undefined && { status: input.Status }), ...(input.ProductType !== undefined && { "product-type": input.ProductType }), @@ -5003,7 +5137,6 @@ export const serializeAws_restJson1ListPhoneNumbersCommand = async ( ...(input.NextToken !== undefined && { "next-token": input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5020,8 +5153,11 @@ export const serializeAws_restJson1ListProxySessionsCommand = async ( input: ListProxySessionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/proxy-sessions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/proxy-sessions"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -5037,7 +5173,6 @@ export const serializeAws_restJson1ListProxySessionsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5054,8 +5189,11 @@ export const serializeAws_restJson1ListRoomMembershipsCommand = async ( input: ListRoomMembershipsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/rooms/{RoomId}/memberships"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/rooms/{RoomId}/memberships"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -5079,7 +5217,6 @@ export const serializeAws_restJson1ListRoomMembershipsCommand = async ( ...(input.NextToken !== undefined && { "next-token": input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5096,8 +5233,10 @@ export const serializeAws_restJson1ListRoomsCommand = async ( input: ListRoomsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/rooms"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/rooms"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -5113,7 +5252,6 @@ export const serializeAws_restJson1ListRoomsCommand = async ( ...(input.NextToken !== undefined && { "next-token": input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5130,14 +5268,14 @@ export const serializeAws_restJson1ListSipMediaApplicationsCommand = async ( input: ListSipMediaApplicationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sip-media-applications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sip-media-applications"; const query: any = { ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), ...(input.NextToken !== undefined && { "next-token": input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5154,15 +5292,15 @@ export const serializeAws_restJson1ListSipRulesCommand = async ( input: ListSipRulesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sip-rules"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sip-rules"; const query: any = { ...(input.SipMediaApplicationId !== undefined && { "sip-media-application": input.SipMediaApplicationId }), ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), ...(input.NextToken !== undefined && { "next-token": input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5179,13 +5317,13 @@ export const serializeAws_restJson1ListSupportedPhoneNumberCountriesCommand = as input: ListSupportedPhoneNumberCountriesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/phone-number-countries"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-number-countries"; const query: any = { ...(input.ProductType !== undefined && { "product-type": input.ProductType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5202,13 +5340,13 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.ResourceARN !== undefined && { arn: input.ResourceARN }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5225,8 +5363,10 @@ export const serializeAws_restJson1ListUsersCommand = async ( input: ListUsersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/users"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -5243,7 +5383,6 @@ export const serializeAws_restJson1ListUsersCommand = async ( ...(input.NextToken !== undefined && { "next-token": input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5260,14 +5399,14 @@ export const serializeAws_restJson1ListVoiceConnectorGroupsCommand = async ( input: ListVoiceConnectorGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connector-groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/voice-connector-groups"; const query: any = { ...(input.NextToken !== undefined && { "next-token": input.NextToken }), ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5284,14 +5423,14 @@ export const serializeAws_restJson1ListVoiceConnectorsCommand = async ( input: ListVoiceConnectorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/voice-connectors"; const query: any = { ...(input.NextToken !== undefined && { "next-token": input.NextToken }), ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5308,8 +5447,11 @@ export const serializeAws_restJson1ListVoiceConnectorTerminationCredentialsComma input: ListVoiceConnectorTerminationCredentialsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/termination/credentials"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/termination/credentials"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -5320,7 +5462,6 @@ export const serializeAws_restJson1ListVoiceConnectorTerminationCredentialsComma throw new Error("No value provided for input HTTP label: VoiceConnectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5336,8 +5477,10 @@ export const serializeAws_restJson1LogoutUserCommand = async ( input: LogoutUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/users/{UserId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users/{UserId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -5360,7 +5503,6 @@ export const serializeAws_restJson1LogoutUserCommand = async ( operation: "logout", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5377,10 +5519,13 @@ export const serializeAws_restJson1PutAppInstanceRetentionSettingsCommand = asyn input: PutAppInstanceRetentionSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/app-instances/{AppInstanceArn}/retention-settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/app-instances/{AppInstanceArn}/retention-settings"; if (input.AppInstanceArn !== undefined) { const labelValue: string = input.AppInstanceArn; if (labelValue.length <= 0) { @@ -5407,7 +5552,6 @@ export const serializeAws_restJson1PutAppInstanceRetentionSettingsCommand = asyn throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -5423,10 +5567,13 @@ export const serializeAws_restJson1PutAppInstanceStreamingConfigurationsCommand input: PutAppInstanceStreamingConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/app-instances/{AppInstanceArn}/streaming-configurations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/app-instances/{AppInstanceArn}/streaming-configurations"; if (input.AppInstanceArn !== undefined) { const labelValue: string = input.AppInstanceArn; if (labelValue.length <= 0) { @@ -5446,7 +5593,6 @@ export const serializeAws_restJson1PutAppInstanceStreamingConfigurationsCommand ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5462,10 +5608,13 @@ export const serializeAws_restJson1PutEventsConfigurationCommand = async ( input: PutEventsConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/bots/{BotId}/events-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/bots/{BotId}/events-configuration"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -5491,7 +5640,6 @@ export const serializeAws_restJson1PutEventsConfigurationCommand = async ( ...(input.OutboundEventsHTTPSEndpoint !== undefined && input.OutboundEventsHTTPSEndpoint !== null && { OutboundEventsHTTPSEndpoint: input.OutboundEventsHTTPSEndpoint }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5507,10 +5655,12 @@ export const serializeAws_restJson1PutRetentionSettingsCommand = async ( input: PutRetentionSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/retention-settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/retention-settings"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -5527,7 +5677,6 @@ export const serializeAws_restJson1PutRetentionSettingsCommand = async ( RetentionSettings: serializeAws_restJson1RetentionSettings(input.RetentionSettings, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5543,10 +5692,13 @@ export const serializeAws_restJson1PutSipMediaApplicationLoggingConfigurationCom input: PutSipMediaApplicationLoggingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sip-media-applications/{SipMediaApplicationId}/logging-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sip-media-applications/{SipMediaApplicationId}/logging-configuration"; if (input.SipMediaApplicationId !== undefined) { const labelValue: string = input.SipMediaApplicationId; if (labelValue.length <= 0) { @@ -5566,7 +5718,6 @@ export const serializeAws_restJson1PutSipMediaApplicationLoggingConfigurationCom ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5582,10 +5733,13 @@ export const serializeAws_restJson1PutVoiceConnectorEmergencyCallingConfiguratio input: PutVoiceConnectorEmergencyCallingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/emergency-calling-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/emergency-calling-configuration"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -5605,7 +5759,6 @@ export const serializeAws_restJson1PutVoiceConnectorEmergencyCallingConfiguratio ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5621,10 +5774,13 @@ export const serializeAws_restJson1PutVoiceConnectorLoggingConfigurationCommand input: PutVoiceConnectorLoggingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/logging-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/logging-configuration"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -5641,7 +5797,6 @@ export const serializeAws_restJson1PutVoiceConnectorLoggingConfigurationCommand LoggingConfiguration: serializeAws_restJson1LoggingConfiguration(input.LoggingConfiguration, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5657,10 +5812,13 @@ export const serializeAws_restJson1PutVoiceConnectorOriginationCommand = async ( input: PutVoiceConnectorOriginationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/origination"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/origination"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -5675,7 +5833,6 @@ export const serializeAws_restJson1PutVoiceConnectorOriginationCommand = async ( ...(input.Origination !== undefined && input.Origination !== null && { Origination: serializeAws_restJson1Origination(input.Origination, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5691,10 +5848,13 @@ export const serializeAws_restJson1PutVoiceConnectorProxyCommand = async ( input: PutVoiceConnectorProxyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/programmable-numbers/proxy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/programmable-numbers/proxy"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -5716,7 +5876,6 @@ export const serializeAws_restJson1PutVoiceConnectorProxyCommand = async ( PhoneNumberPoolCountries: serializeAws_restJson1CountryList(input.PhoneNumberPoolCountries, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5732,10 +5891,13 @@ export const serializeAws_restJson1PutVoiceConnectorStreamingConfigurationComman input: PutVoiceConnectorStreamingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/streaming-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/streaming-configuration"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -5752,7 +5914,6 @@ export const serializeAws_restJson1PutVoiceConnectorStreamingConfigurationComman StreamingConfiguration: serializeAws_restJson1StreamingConfiguration(input.StreamingConfiguration, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5768,10 +5929,13 @@ export const serializeAws_restJson1PutVoiceConnectorTerminationCommand = async ( input: PutVoiceConnectorTerminationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/termination"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/termination"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -5786,7 +5950,6 @@ export const serializeAws_restJson1PutVoiceConnectorTerminationCommand = async ( ...(input.Termination !== undefined && input.Termination !== null && { Termination: serializeAws_restJson1Termination(input.Termination, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5802,10 +5965,13 @@ export const serializeAws_restJson1PutVoiceConnectorTerminationCredentialsComman input: PutVoiceConnectorTerminationCredentialsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/termination/credentials"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/termination/credentials"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -5823,7 +5989,6 @@ export const serializeAws_restJson1PutVoiceConnectorTerminationCredentialsComman ...(input.Credentials !== undefined && input.Credentials !== null && { Credentials: serializeAws_restJson1CredentialList(input.Credentials, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5840,10 +6005,13 @@ export const serializeAws_restJson1RedactChannelMessageCommand = async ( input: RedactChannelMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/messages/{MessageId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channels/{ChannelArn}/messages/{MessageId}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -5873,7 +6041,6 @@ export const serializeAws_restJson1RedactChannelMessageCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -5890,8 +6057,11 @@ export const serializeAws_restJson1RedactConversationMessageCommand = async ( input: RedactConversationMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/conversations/{ConversationId}/messages/{MessageId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/conversations/{ConversationId}/messages/{MessageId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -5923,7 +6093,6 @@ export const serializeAws_restJson1RedactConversationMessageCommand = async ( operation: "redact", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5940,8 +6109,11 @@ export const serializeAws_restJson1RedactRoomMessageCommand = async ( input: RedactRoomMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/rooms/{RoomId}/messages/{MessageId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/rooms/{RoomId}/messages/{MessageId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -5973,7 +6145,6 @@ export const serializeAws_restJson1RedactRoomMessageCommand = async ( operation: "redact", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5990,8 +6161,10 @@ export const serializeAws_restJson1RegenerateSecurityTokenCommand = async ( input: RegenerateSecurityTokenCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/bots/{BotId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/bots/{BotId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -6014,7 +6187,6 @@ export const serializeAws_restJson1RegenerateSecurityTokenCommand = async ( operation: "regenerate-security-token", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6031,8 +6203,10 @@ export const serializeAws_restJson1ResetPersonalPINCommand = async ( input: ResetPersonalPINCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AccountId}/users/{UserId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users/{UserId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -6055,7 +6229,6 @@ export const serializeAws_restJson1ResetPersonalPINCommand = async ( operation: "reset-personal-pin", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6072,8 +6245,10 @@ export const serializeAws_restJson1RestorePhoneNumberCommand = async ( input: RestorePhoneNumberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/phone-numbers/{PhoneNumberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-numbers/{PhoneNumberId}"; if (input.PhoneNumberId !== undefined) { const labelValue: string = input.PhoneNumberId; if (labelValue.length <= 0) { @@ -6087,7 +6262,6 @@ export const serializeAws_restJson1RestorePhoneNumberCommand = async ( operation: "restore", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6104,8 +6278,9 @@ export const serializeAws_restJson1SearchAvailablePhoneNumbersCommand = async ( input: SearchAvailablePhoneNumbersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/search"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/search"; const query: any = { type: "phone-numbers", ...(input.AreaCode !== undefined && { "area-code": input.AreaCode }), @@ -6118,7 +6293,6 @@ export const serializeAws_restJson1SearchAvailablePhoneNumbersCommand = async ( ...(input.NextToken !== undefined && { "next-token": input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6135,11 +6309,13 @@ export const serializeAws_restJson1SendChannelMessageCommand = async ( input: SendChannelMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/messages"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/messages"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -6164,7 +6340,6 @@ export const serializeAws_restJson1SendChannelMessageCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -6180,10 +6355,13 @@ export const serializeAws_restJson1TagAttendeeCommand = async ( input: TagAttendeeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/meetings/{MeetingId}/attendees/{AttendeeId}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/meetings/{MeetingId}/attendees/{AttendeeId}/tags"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -6210,7 +6388,6 @@ export const serializeAws_restJson1TagAttendeeCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1AttendeeTagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6227,10 +6404,12 @@ export const serializeAws_restJson1TagMeetingCommand = async ( input: TagMeetingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/meetings/{MeetingId}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings/{MeetingId}/tags"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -6248,7 +6427,6 @@ export const serializeAws_restJson1TagMeetingCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1MeetingTagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6265,10 +6443,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { operation: "tag-resource", }; @@ -6278,7 +6457,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6295,10 +6473,13 @@ export const serializeAws_restJson1UntagAttendeeCommand = async ( input: UntagAttendeeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/meetings/{MeetingId}/attendees/{AttendeeId}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/meetings/{MeetingId}/attendees/{AttendeeId}/tags"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -6325,7 +6506,6 @@ export const serializeAws_restJson1UntagAttendeeCommand = async ( ...(input.TagKeys !== undefined && input.TagKeys !== null && { TagKeys: serializeAws_restJson1AttendeeTagKeyList(input.TagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6342,10 +6522,12 @@ export const serializeAws_restJson1UntagMeetingCommand = async ( input: UntagMeetingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/meetings/{MeetingId}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/meetings/{MeetingId}/tags"; if (input.MeetingId !== undefined) { const labelValue: string = input.MeetingId; if (labelValue.length <= 0) { @@ -6363,7 +6545,6 @@ export const serializeAws_restJson1UntagMeetingCommand = async ( ...(input.TagKeys !== undefined && input.TagKeys !== null && { TagKeys: serializeAws_restJson1MeetingTagKeyList(input.TagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6380,10 +6561,11 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { operation: "untag-resource", }; @@ -6393,7 +6575,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && input.TagKeys !== null && { TagKeys: serializeAws_restJson1TagKeyList(input.TagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6410,10 +6591,11 @@ export const serializeAws_restJson1UpdateAccountCommand = async ( input: UpdateAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -6429,7 +6611,6 @@ export const serializeAws_restJson1UpdateAccountCommand = async ( input.DefaultLicense !== null && { DefaultLicense: input.DefaultLicense }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6445,10 +6626,12 @@ export const serializeAws_restJson1UpdateAccountSettingsCommand = async ( input: UpdateAccountSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/settings"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -6465,7 +6648,6 @@ export const serializeAws_restJson1UpdateAccountSettingsCommand = async ( AccountSettings: serializeAws_restJson1AccountSettings(input.AccountSettings, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6481,10 +6663,12 @@ export const serializeAws_restJson1UpdateAppInstanceCommand = async ( input: UpdateAppInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/app-instances/{AppInstanceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instances/{AppInstanceArn}"; if (input.AppInstanceArn !== undefined) { const labelValue: string = input.AppInstanceArn; if (labelValue.length <= 0) { @@ -6506,7 +6690,6 @@ export const serializeAws_restJson1UpdateAppInstanceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -6522,10 +6705,12 @@ export const serializeAws_restJson1UpdateAppInstanceUserCommand = async ( input: UpdateAppInstanceUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/app-instance-users/{AppInstanceUserArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/app-instance-users/{AppInstanceUserArn}"; if (input.AppInstanceUserArn !== undefined) { const labelValue: string = input.AppInstanceUserArn; if (labelValue.length <= 0) { @@ -6547,7 +6732,6 @@ export const serializeAws_restJson1UpdateAppInstanceUserCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -6563,10 +6747,12 @@ export const serializeAws_restJson1UpdateBotCommand = async ( input: UpdateBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/bots/{BotId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/bots/{BotId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -6589,7 +6775,6 @@ export const serializeAws_restJson1UpdateBotCommand = async ( body = JSON.stringify({ ...(input.Disabled !== undefined && input.Disabled !== null && { Disabled: input.Disabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6605,11 +6790,12 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( input: UpdateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -6632,7 +6818,6 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -6648,11 +6833,14 @@ export const serializeAws_restJson1UpdateChannelMessageCommand = async ( input: UpdateChannelMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/messages/{MessageId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channels/{ChannelArn}/messages/{MessageId}"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -6683,7 +6871,6 @@ export const serializeAws_restJson1UpdateChannelMessageCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -6699,10 +6886,12 @@ export const serializeAws_restJson1UpdateChannelReadMarkerCommand = async ( input: UpdateChannelReadMarkerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChimeBearer) && { "x-amz-chime-bearer": input.ChimeBearer! }), }; - let resolvedPath = "/channels/{ChannelArn}/readMarker"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{ChannelArn}/readMarker"; if (input.ChannelArn !== undefined) { const labelValue: string = input.ChannelArn; if (labelValue.length <= 0) { @@ -6720,7 +6909,6 @@ export const serializeAws_restJson1UpdateChannelReadMarkerCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -6736,10 +6924,11 @@ export const serializeAws_restJson1UpdateGlobalSettingsCommand = async ( input: UpdateGlobalSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/settings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/settings"; let body: any; body = JSON.stringify({ ...(input.BusinessCalling !== undefined && @@ -6751,7 +6940,6 @@ export const serializeAws_restJson1UpdateGlobalSettingsCommand = async ( VoiceConnector: serializeAws_restJson1VoiceConnectorSettings(input.VoiceConnector, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6767,10 +6955,12 @@ export const serializeAws_restJson1UpdatePhoneNumberCommand = async ( input: UpdatePhoneNumberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/phone-numbers/{PhoneNumberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-numbers/{PhoneNumberId}"; if (input.PhoneNumberId !== undefined) { const labelValue: string = input.PhoneNumberId; if (labelValue.length <= 0) { @@ -6785,7 +6975,6 @@ export const serializeAws_restJson1UpdatePhoneNumberCommand = async ( ...(input.CallingName !== undefined && input.CallingName !== null && { CallingName: input.CallingName }), ...(input.ProductType !== undefined && input.ProductType !== null && { ProductType: input.ProductType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6801,15 +6990,15 @@ export const serializeAws_restJson1UpdatePhoneNumberSettingsCommand = async ( input: UpdatePhoneNumberSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/settings/phone-number"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/settings/phone-number"; let body: any; body = JSON.stringify({ ...(input.CallingName !== undefined && input.CallingName !== null && { CallingName: input.CallingName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6825,10 +7014,13 @@ export const serializeAws_restJson1UpdateProxySessionCommand = async ( input: UpdateProxySessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}/proxy-sessions/{ProxySessionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connectors/{VoiceConnectorId}/proxy-sessions/{ProxySessionId}"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -6855,7 +7047,6 @@ export const serializeAws_restJson1UpdateProxySessionCommand = async ( }), ...(input.ExpiryMinutes !== undefined && input.ExpiryMinutes !== null && { ExpiryMinutes: input.ExpiryMinutes }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6871,10 +7062,12 @@ export const serializeAws_restJson1UpdateRoomCommand = async ( input: UpdateRoomCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/rooms/{RoomId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/rooms/{RoomId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -6897,7 +7090,6 @@ export const serializeAws_restJson1UpdateRoomCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6913,10 +7105,13 @@ export const serializeAws_restJson1UpdateRoomMembershipCommand = async ( input: UpdateRoomMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/rooms/{RoomId}/memberships/{MemberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/rooms/{RoomId}/memberships/{MemberId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -6948,7 +7143,6 @@ export const serializeAws_restJson1UpdateRoomMembershipCommand = async ( body = JSON.stringify({ ...(input.Role !== undefined && input.Role !== null && { Role: input.Role }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6964,10 +7158,13 @@ export const serializeAws_restJson1UpdateSipMediaApplicationCommand = async ( input: UpdateSipMediaApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sip-media-applications/{SipMediaApplicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sip-media-applications/{SipMediaApplicationId}"; if (input.SipMediaApplicationId !== undefined) { const labelValue: string = input.SipMediaApplicationId; if (labelValue.length <= 0) { @@ -6985,7 +7182,6 @@ export const serializeAws_restJson1UpdateSipMediaApplicationCommand = async ( }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7001,10 +7197,13 @@ export const serializeAws_restJson1UpdateSipMediaApplicationCallCommand = async input: UpdateSipMediaApplicationCallCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sip-media-applications/{SipMediaApplicationId}/calls/{TransactionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sip-media-applications/{SipMediaApplicationId}/calls/{TransactionId}"; if (input.SipMediaApplicationId !== undefined) { const labelValue: string = input.SipMediaApplicationId; if (labelValue.length <= 0) { @@ -7030,7 +7229,6 @@ export const serializeAws_restJson1UpdateSipMediaApplicationCallCommand = async Arguments: serializeAws_restJson1SMAUpdateCallArgumentsMap(input.Arguments, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7046,10 +7244,11 @@ export const serializeAws_restJson1UpdateSipRuleCommand = async ( input: UpdateSipRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sip-rules/{SipRuleId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sip-rules/{SipRuleId}"; if (input.SipRuleId !== undefined) { const labelValue: string = input.SipRuleId; if (labelValue.length <= 0) { @@ -7068,7 +7267,6 @@ export const serializeAws_restJson1UpdateSipRuleCommand = async ( TargetApplications: serializeAws_restJson1SipRuleTargetApplicationList(input.TargetApplications, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7084,10 +7282,12 @@ export const serializeAws_restJson1UpdateUserCommand = async ( input: UpdateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/users/{UserId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AccountId}/users/{UserId}"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -7118,7 +7318,6 @@ export const serializeAws_restJson1UpdateUserCommand = async ( ...(input.LicenseType !== undefined && input.LicenseType !== null && { LicenseType: input.LicenseType }), ...(input.UserType !== undefined && input.UserType !== null && { UserType: input.UserType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7134,10 +7333,13 @@ export const serializeAws_restJson1UpdateUserSettingsCommand = async ( input: UpdateUserSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AccountId}/users/{UserId}/settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AccountId}/users/{UserId}/settings"; if (input.AccountId !== undefined) { const labelValue: string = input.AccountId; if (labelValue.length <= 0) { @@ -7161,7 +7363,6 @@ export const serializeAws_restJson1UpdateUserSettingsCommand = async ( ...(input.UserSettings !== undefined && input.UserSettings !== null && { UserSettings: serializeAws_restJson1UserSettings(input.UserSettings, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7177,10 +7378,12 @@ export const serializeAws_restJson1UpdateVoiceConnectorCommand = async ( input: UpdateVoiceConnectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connectors/{VoiceConnectorId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/voice-connectors/{VoiceConnectorId}"; if (input.VoiceConnectorId !== undefined) { const labelValue: string = input.VoiceConnectorId; if (labelValue.length <= 0) { @@ -7196,7 +7399,6 @@ export const serializeAws_restJson1UpdateVoiceConnectorCommand = async ( ...(input.RequireEncryption !== undefined && input.RequireEncryption !== null && { RequireEncryption: input.RequireEncryption }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7212,10 +7414,13 @@ export const serializeAws_restJson1UpdateVoiceConnectorGroupCommand = async ( input: UpdateVoiceConnectorGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/voice-connector-groups/{VoiceConnectorGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/voice-connector-groups/{VoiceConnectorGroupId}"; if (input.VoiceConnectorGroupId !== undefined) { const labelValue: string = input.VoiceConnectorGroupId; if (labelValue.length <= 0) { @@ -7233,7 +7438,6 @@ export const serializeAws_restJson1UpdateVoiceConnectorGroupCommand = async ( VoiceConnectorItems: serializeAws_restJson1VoiceConnectorItemList(input.VoiceConnectorItems, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-clouddirectory/protocols/Aws_restJson1.ts b/clients/client-clouddirectory/protocols/Aws_restJson1.ts index 698775fb9a60c..92976b9b0ba4e 100644 --- a/clients/client-clouddirectory/protocols/Aws_restJson1.ts +++ b/clients/client-clouddirectory/protocols/Aws_restJson1.ts @@ -292,11 +292,14 @@ export const serializeAws_restJson1AddFacetToObjectCommand = async ( input: AddFacetToObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/facets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/facets"; let body: any; body = JSON.stringify({ ...(input.ObjectAttributeList !== undefined && @@ -310,7 +313,6 @@ export const serializeAws_restJson1AddFacetToObjectCommand = async ( ...(input.SchemaFacet !== undefined && input.SchemaFacet !== null && { SchemaFacet: serializeAws_restJson1SchemaFacet(input.SchemaFacet, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -326,17 +328,19 @@ export const serializeAws_restJson1ApplySchemaCommand = async ( input: ApplySchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/apply"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/apply"; let body: any; body = JSON.stringify({ ...(input.PublishedSchemaArn !== undefined && input.PublishedSchemaArn !== null && { PublishedSchemaArn: input.PublishedSchemaArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -352,11 +356,14 @@ export const serializeAws_restJson1AttachObjectCommand = async ( input: AttachObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/attach"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/attach"; let body: any; body = JSON.stringify({ ...(input.ChildReference !== undefined && @@ -369,7 +376,6 @@ export const serializeAws_restJson1AttachObjectCommand = async ( ParentReference: serializeAws_restJson1ObjectReference(input.ParentReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -385,11 +391,14 @@ export const serializeAws_restJson1AttachPolicyCommand = async ( input: AttachPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/policy/attach"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/policy/attach"; let body: any; body = JSON.stringify({ ...(input.ObjectReference !== undefined && @@ -401,7 +410,6 @@ export const serializeAws_restJson1AttachPolicyCommand = async ( PolicyReference: serializeAws_restJson1ObjectReference(input.PolicyReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -417,11 +425,14 @@ export const serializeAws_restJson1AttachToIndexCommand = async ( input: AttachToIndexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/index/attach"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/index/attach"; let body: any; body = JSON.stringify({ ...(input.IndexReference !== undefined && @@ -433,7 +444,6 @@ export const serializeAws_restJson1AttachToIndexCommand = async ( TargetReference: serializeAws_restJson1ObjectReference(input.TargetReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -449,11 +459,14 @@ export const serializeAws_restJson1AttachTypedLinkCommand = async ( input: AttachTypedLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/attach"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/attach"; let body: any; body = JSON.stringify({ ...(input.Attributes !== undefined && @@ -473,7 +486,6 @@ export const serializeAws_restJson1AttachTypedLinkCommand = async ( TypedLinkFacet: serializeAws_restJson1TypedLinkSchemaAndFacetName(input.TypedLinkFacet, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -489,12 +501,15 @@ export const serializeAws_restJson1BatchReadCommand = async ( input: BatchReadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), ...(isSerializableHeaderValue(input.ConsistencyLevel) && { "x-amz-consistency-level": input.ConsistencyLevel! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/batchread"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/batchread"; let body: any; body = JSON.stringify({ ...(input.Operations !== undefined && @@ -502,7 +517,6 @@ export const serializeAws_restJson1BatchReadCommand = async ( Operations: serializeAws_restJson1BatchReadOperationList(input.Operations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -518,11 +532,14 @@ export const serializeAws_restJson1BatchWriteCommand = async ( input: BatchWriteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/batchwrite"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/batchwrite"; let body: any; body = JSON.stringify({ ...(input.Operations !== undefined && @@ -530,7 +547,6 @@ export const serializeAws_restJson1BatchWriteCommand = async ( Operations: serializeAws_restJson1BatchWriteOperationList(input.Operations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -546,16 +562,18 @@ export const serializeAws_restJson1CreateDirectoryCommand = async ( input: CreateDirectoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/directory/create"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/directory/create"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -571,11 +589,14 @@ export const serializeAws_restJson1CreateFacetCommand = async ( input: CreateFacetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/facet/create"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/facet/create"; let body: any; body = JSON.stringify({ ...(input.Attributes !== undefined && @@ -584,7 +605,6 @@ export const serializeAws_restJson1CreateFacetCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.ObjectType !== undefined && input.ObjectType !== null && { ObjectType: input.ObjectType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -600,11 +620,13 @@ export const serializeAws_restJson1CreateIndexCommand = async ( input: CreateIndexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/index"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/amazonclouddirectory/2017-01-11/index"; let body: any; body = JSON.stringify({ ...(input.IsUnique !== undefined && input.IsUnique !== null && { IsUnique: input.IsUnique }), @@ -618,7 +640,6 @@ export const serializeAws_restJson1CreateIndexCommand = async ( ParentReference: serializeAws_restJson1ObjectReference(input.ParentReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -634,11 +655,13 @@ export const serializeAws_restJson1CreateObjectCommand = async ( input: CreateObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/amazonclouddirectory/2017-01-11/object"; let body: any; body = JSON.stringify({ ...(input.LinkName !== undefined && input.LinkName !== null && { LinkName: input.LinkName }), @@ -655,7 +678,6 @@ export const serializeAws_restJson1CreateObjectCommand = async ( SchemaFacets: serializeAws_restJson1SchemaFacetList(input.SchemaFacets, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -671,15 +693,17 @@ export const serializeAws_restJson1CreateSchemaCommand = async ( input: CreateSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/create"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/create"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -695,17 +719,19 @@ export const serializeAws_restJson1CreateTypedLinkFacetCommand = async ( input: CreateTypedLinkFacetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/facet/create"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/facet/create"; let body: any; body = JSON.stringify({ ...(input.Facet !== undefined && input.Facet !== null && { Facet: serializeAws_restJson1TypedLinkFacet(input.Facet, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -721,12 +747,14 @@ export const serializeAws_restJson1DeleteDirectoryCommand = async ( input: DeleteDirectoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/directory"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/directory"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -742,16 +770,18 @@ export const serializeAws_restJson1DeleteFacetCommand = async ( input: DeleteFacetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/facet/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/facet/delete"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -767,11 +797,14 @@ export const serializeAws_restJson1DeleteObjectCommand = async ( input: DeleteObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/delete"; let body: any; body = JSON.stringify({ ...(input.ObjectReference !== undefined && @@ -779,7 +812,6 @@ export const serializeAws_restJson1DeleteObjectCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -795,12 +827,13 @@ export const serializeAws_restJson1DeleteSchemaCommand = async ( input: DeleteSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/amazonclouddirectory/2017-01-11/schema"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -816,16 +849,18 @@ export const serializeAws_restJson1DeleteTypedLinkFacetCommand = async ( input: DeleteTypedLinkFacetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/facet/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/facet/delete"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -841,11 +876,14 @@ export const serializeAws_restJson1DetachFromIndexCommand = async ( input: DetachFromIndexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/index/detach"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/index/detach"; let body: any; body = JSON.stringify({ ...(input.IndexReference !== undefined && @@ -857,7 +895,6 @@ export const serializeAws_restJson1DetachFromIndexCommand = async ( TargetReference: serializeAws_restJson1ObjectReference(input.TargetReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -873,11 +910,14 @@ export const serializeAws_restJson1DetachObjectCommand = async ( input: DetachObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/detach"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/detach"; let body: any; body = JSON.stringify({ ...(input.LinkName !== undefined && input.LinkName !== null && { LinkName: input.LinkName }), @@ -886,7 +926,6 @@ export const serializeAws_restJson1DetachObjectCommand = async ( ParentReference: serializeAws_restJson1ObjectReference(input.ParentReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -902,11 +941,14 @@ export const serializeAws_restJson1DetachPolicyCommand = async ( input: DetachPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/policy/detach"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/policy/detach"; let body: any; body = JSON.stringify({ ...(input.ObjectReference !== undefined && @@ -918,7 +960,6 @@ export const serializeAws_restJson1DetachPolicyCommand = async ( PolicyReference: serializeAws_restJson1ObjectReference(input.PolicyReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -934,11 +975,14 @@ export const serializeAws_restJson1DetachTypedLinkCommand = async ( input: DetachTypedLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/detach"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/detach"; let body: any; body = JSON.stringify({ ...(input.TypedLinkSpecifier !== undefined && @@ -946,7 +990,6 @@ export const serializeAws_restJson1DetachTypedLinkCommand = async ( TypedLinkSpecifier: serializeAws_restJson1TypedLinkSpecifier(input.TypedLinkSpecifier, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -962,12 +1005,14 @@ export const serializeAws_restJson1DisableDirectoryCommand = async ( input: DisableDirectoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/directory/disable"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/directory/disable"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -983,12 +1028,14 @@ export const serializeAws_restJson1EnableDirectoryCommand = async ( input: EnableDirectoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/directory/enable"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/directory/enable"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1004,15 +1051,17 @@ export const serializeAws_restJson1GetAppliedSchemaVersionCommand = async ( input: GetAppliedSchemaVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/getappliedschema"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/getappliedschema"; let body: any; body = JSON.stringify({ ...(input.SchemaArn !== undefined && input.SchemaArn !== null && { SchemaArn: input.SchemaArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1028,12 +1077,14 @@ export const serializeAws_restJson1GetDirectoryCommand = async ( input: GetDirectoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/directory/get"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/directory/get"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1049,16 +1100,17 @@ export const serializeAws_restJson1GetFacetCommand = async ( input: GetFacetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/facet"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/amazonclouddirectory/2017-01-11/facet"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1074,11 +1126,14 @@ export const serializeAws_restJson1GetLinkAttributesCommand = async ( input: GetLinkAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/attributes/get"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/attributes/get"; let body: any; body = JSON.stringify({ ...(input.AttributeNames !== undefined && @@ -1092,7 +1147,6 @@ export const serializeAws_restJson1GetLinkAttributesCommand = async ( TypedLinkSpecifier: serializeAws_restJson1TypedLinkSpecifier(input.TypedLinkSpecifier, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1108,12 +1162,15 @@ export const serializeAws_restJson1GetObjectAttributesCommand = async ( input: GetObjectAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), ...(isSerializableHeaderValue(input.ConsistencyLevel) && { "x-amz-consistency-level": input.ConsistencyLevel! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/attributes/get"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/attributes/get"; let body: any; body = JSON.stringify({ ...(input.AttributeNames !== undefined && @@ -1127,7 +1184,6 @@ export const serializeAws_restJson1GetObjectAttributesCommand = async ( ...(input.SchemaFacet !== undefined && input.SchemaFacet !== null && { SchemaFacet: serializeAws_restJson1SchemaFacet(input.SchemaFacet, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1143,12 +1199,15 @@ export const serializeAws_restJson1GetObjectInformationCommand = async ( input: GetObjectInformationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), ...(isSerializableHeaderValue(input.ConsistencyLevel) && { "x-amz-consistency-level": input.ConsistencyLevel! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/information"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/information"; let body: any; body = JSON.stringify({ ...(input.ObjectReference !== undefined && @@ -1156,7 +1215,6 @@ export const serializeAws_restJson1GetObjectInformationCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1172,12 +1230,14 @@ export const serializeAws_restJson1GetSchemaAsJsonCommand = async ( input: GetSchemaAsJsonCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/json"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/json"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1193,16 +1253,18 @@ export const serializeAws_restJson1GetTypedLinkFacetInformationCommand = async ( input: GetTypedLinkFacetInformationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/facet/get"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/facet/get"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1218,10 +1280,13 @@ export const serializeAws_restJson1ListAppliedSchemaArnsCommand = async ( input: ListAppliedSchemaArnsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/applied"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/applied"; let body: any; body = JSON.stringify({ ...(input.DirectoryArn !== undefined && input.DirectoryArn !== null && { DirectoryArn: input.DirectoryArn }), @@ -1229,7 +1294,6 @@ export const serializeAws_restJson1ListAppliedSchemaArnsCommand = async ( ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.SchemaArn !== undefined && input.SchemaArn !== null && { SchemaArn: input.SchemaArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1245,12 +1309,15 @@ export const serializeAws_restJson1ListAttachedIndicesCommand = async ( input: ListAttachedIndicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), ...(isSerializableHeaderValue(input.ConsistencyLevel) && { "x-amz-consistency-level": input.ConsistencyLevel! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/indices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/indices"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1260,7 +1327,6 @@ export const serializeAws_restJson1ListAttachedIndicesCommand = async ( TargetReference: serializeAws_restJson1ObjectReference(input.TargetReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1276,16 +1342,18 @@ export const serializeAws_restJson1ListDevelopmentSchemaArnsCommand = async ( input: ListDevelopmentSchemaArnsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/development"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/development"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1301,17 +1369,19 @@ export const serializeAws_restJson1ListDirectoriesCommand = async ( input: ListDirectoriesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/directory/list"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/directory/list"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.state !== undefined && input.state !== null && { state: input.state }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1327,18 +1397,20 @@ export const serializeAws_restJson1ListFacetAttributesCommand = async ( input: ListFacetAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/facet/attributes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/facet/attributes"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1354,17 +1426,19 @@ export const serializeAws_restJson1ListFacetNamesCommand = async ( input: ListFacetNamesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/facet/list"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/facet/list"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1380,11 +1454,14 @@ export const serializeAws_restJson1ListIncomingTypedLinksCommand = async ( input: ListIncomingTypedLinksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/incoming"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/incoming"; let body: any; body = JSON.stringify({ ...(input.ConsistencyLevel !== undefined && @@ -1404,7 +1481,6 @@ export const serializeAws_restJson1ListIncomingTypedLinksCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1420,12 +1496,15 @@ export const serializeAws_restJson1ListIndexCommand = async ( input: ListIndexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), ...(isSerializableHeaderValue(input.ConsistencyLevel) && { "x-amz-consistency-level": input.ConsistencyLevel! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/index/targets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/index/targets"; let body: any; body = JSON.stringify({ ...(input.IndexReference !== undefined && @@ -1439,7 +1518,6 @@ export const serializeAws_restJson1ListIndexCommand = async ( RangesOnIndexedValues: serializeAws_restJson1ObjectAttributeRangeList(input.RangesOnIndexedValues, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1455,17 +1533,19 @@ export const serializeAws_restJson1ListManagedSchemaArnsCommand = async ( input: ListManagedSchemaArnsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/managed"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/managed"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.SchemaArn !== undefined && input.SchemaArn !== null && { SchemaArn: input.SchemaArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1481,12 +1561,15 @@ export const serializeAws_restJson1ListObjectAttributesCommand = async ( input: ListObjectAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), ...(isSerializableHeaderValue(input.ConsistencyLevel) && { "x-amz-consistency-level": input.ConsistencyLevel! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/attributes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/attributes"; let body: any; body = JSON.stringify({ ...(input.FacetFilter !== undefined && @@ -1498,7 +1581,6 @@ export const serializeAws_restJson1ListObjectAttributesCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1514,12 +1596,15 @@ export const serializeAws_restJson1ListObjectChildrenCommand = async ( input: ListObjectChildrenCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), ...(isSerializableHeaderValue(input.ConsistencyLevel) && { "x-amz-consistency-level": input.ConsistencyLevel! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/children"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/children"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1529,7 +1614,6 @@ export const serializeAws_restJson1ListObjectChildrenCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1545,11 +1629,14 @@ export const serializeAws_restJson1ListObjectParentPathsCommand = async ( input: ListObjectParentPathsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/parentpaths"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/parentpaths"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1559,7 +1646,6 @@ export const serializeAws_restJson1ListObjectParentPathsCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1575,12 +1661,15 @@ export const serializeAws_restJson1ListObjectParentsCommand = async ( input: ListObjectParentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), ...(isSerializableHeaderValue(input.ConsistencyLevel) && { "x-amz-consistency-level": input.ConsistencyLevel! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/parent"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/parent"; let body: any; body = JSON.stringify({ ...(input.IncludeAllLinksToEachParent !== undefined && @@ -1592,7 +1681,6 @@ export const serializeAws_restJson1ListObjectParentsCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1608,12 +1696,15 @@ export const serializeAws_restJson1ListObjectPoliciesCommand = async ( input: ListObjectPoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), ...(isSerializableHeaderValue(input.ConsistencyLevel) && { "x-amz-consistency-level": input.ConsistencyLevel! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/policy"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1623,7 +1714,6 @@ export const serializeAws_restJson1ListObjectPoliciesCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1639,11 +1729,14 @@ export const serializeAws_restJson1ListOutgoingTypedLinksCommand = async ( input: ListOutgoingTypedLinksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/outgoing"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/outgoing"; let body: any; body = JSON.stringify({ ...(input.ConsistencyLevel !== undefined && @@ -1663,7 +1756,6 @@ export const serializeAws_restJson1ListOutgoingTypedLinksCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1679,12 +1771,15 @@ export const serializeAws_restJson1ListPolicyAttachmentsCommand = async ( input: ListPolicyAttachmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), ...(isSerializableHeaderValue(input.ConsistencyLevel) && { "x-amz-consistency-level": input.ConsistencyLevel! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/policy/attachment"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/policy/attachment"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1694,7 +1789,6 @@ export const serializeAws_restJson1ListPolicyAttachmentsCommand = async ( PolicyReference: serializeAws_restJson1ObjectReference(input.PolicyReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1710,17 +1804,19 @@ export const serializeAws_restJson1ListPublishedSchemaArnsCommand = async ( input: ListPublishedSchemaArnsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/published"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/published"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.SchemaArn !== undefined && input.SchemaArn !== null && { SchemaArn: input.SchemaArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1736,17 +1832,18 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/amazonclouddirectory/2017-01-11/tags"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1762,18 +1859,20 @@ export const serializeAws_restJson1ListTypedLinkFacetAttributesCommand = async ( input: ListTypedLinkFacetAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/facet/attributes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/facet/attributes"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1789,17 +1888,19 @@ export const serializeAws_restJson1ListTypedLinkFacetNamesCommand = async ( input: ListTypedLinkFacetNamesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/facet/list"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/facet/list"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1815,11 +1916,14 @@ export const serializeAws_restJson1LookupPolicyCommand = async ( input: LookupPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/policy/lookup"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/policy/lookup"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1829,7 +1933,6 @@ export const serializeAws_restJson1LookupPolicyCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1845,20 +1948,22 @@ export const serializeAws_restJson1PublishSchemaCommand = async ( input: PublishSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DevelopmentSchemaArn) && { "x-amz-data-partition": input.DevelopmentSchemaArn!, }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/publish"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/publish"; let body: any; body = JSON.stringify({ ...(input.MinorVersion !== undefined && input.MinorVersion !== null && { MinorVersion: input.MinorVersion }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.Version !== undefined && input.Version !== null && { Version: input.Version }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1874,16 +1979,18 @@ export const serializeAws_restJson1PutSchemaFromJsonCommand = async ( input: PutSchemaFromJsonCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/json"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/json"; let body: any; body = JSON.stringify({ ...(input.Document !== undefined && input.Document !== null && { Document: input.Document }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1899,11 +2006,14 @@ export const serializeAws_restJson1RemoveFacetFromObjectCommand = async ( input: RemoveFacetFromObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/facets/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/facets/delete"; let body: any; body = JSON.stringify({ ...(input.ObjectReference !== undefined && @@ -1913,7 +2023,6 @@ export const serializeAws_restJson1RemoveFacetFromObjectCommand = async ( ...(input.SchemaFacet !== undefined && input.SchemaFacet !== null && { SchemaFacet: serializeAws_restJson1SchemaFacet(input.SchemaFacet, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1929,17 +2038,18 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/tags/add"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/amazonclouddirectory/2017-01-11/tags/add"; let body: any; body = JSON.stringify({ ...(input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1955,17 +2065,19 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/tags/remove"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/tags/remove"; let body: any; body = JSON.stringify({ ...(input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }), ...(input.TagKeys !== undefined && input.TagKeys !== null && { TagKeys: serializeAws_restJson1TagKeyList(input.TagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1981,11 +2093,13 @@ export const serializeAws_restJson1UpdateFacetCommand = async ( input: UpdateFacetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/facet"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/amazonclouddirectory/2017-01-11/facet"; let body: any; body = JSON.stringify({ ...(input.AttributeUpdates !== undefined && @@ -1995,7 +2109,6 @@ export const serializeAws_restJson1UpdateFacetCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.ObjectType !== undefined && input.ObjectType !== null && { ObjectType: input.ObjectType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2011,11 +2124,14 @@ export const serializeAws_restJson1UpdateLinkAttributesCommand = async ( input: UpdateLinkAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/attributes/update"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/attributes/update"; let body: any; body = JSON.stringify({ ...(input.AttributeUpdates !== undefined && @@ -2027,7 +2143,6 @@ export const serializeAws_restJson1UpdateLinkAttributesCommand = async ( TypedLinkSpecifier: serializeAws_restJson1TypedLinkSpecifier(input.TypedLinkSpecifier, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2043,11 +2158,14 @@ export const serializeAws_restJson1UpdateObjectAttributesCommand = async ( input: UpdateObjectAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.DirectoryArn) && { "x-amz-data-partition": input.DirectoryArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/object/update"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/object/update"; let body: any; body = JSON.stringify({ ...(input.AttributeUpdates !== undefined && @@ -2059,7 +2177,6 @@ export const serializeAws_restJson1UpdateObjectAttributesCommand = async ( ObjectReference: serializeAws_restJson1ObjectReference(input.ObjectReference, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2075,16 +2192,18 @@ export const serializeAws_restJson1UpdateSchemaCommand = async ( input: UpdateSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/update"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/update"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2100,11 +2219,14 @@ export const serializeAws_restJson1UpdateTypedLinkFacetCommand = async ( input: UpdateTypedLinkFacetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.SchemaArn) && { "x-amz-data-partition": input.SchemaArn! }), }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/typedlink/facet"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/typedlink/facet"; let body: any; body = JSON.stringify({ ...(input.AttributeUpdates !== undefined && @@ -2117,7 +2239,6 @@ export const serializeAws_restJson1UpdateTypedLinkFacetCommand = async ( }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2133,10 +2254,13 @@ export const serializeAws_restJson1UpgradeAppliedSchemaCommand = async ( input: UpgradeAppliedSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/upgradeapplied"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/upgradeapplied"; let body: any; body = JSON.stringify({ ...(input.DirectoryArn !== undefined && input.DirectoryArn !== null && { DirectoryArn: input.DirectoryArn }), @@ -2144,7 +2268,6 @@ export const serializeAws_restJson1UpgradeAppliedSchemaCommand = async ( ...(input.PublishedSchemaArn !== undefined && input.PublishedSchemaArn !== null && { PublishedSchemaArn: input.PublishedSchemaArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2160,10 +2283,13 @@ export const serializeAws_restJson1UpgradePublishedSchemaCommand = async ( input: UpgradePublishedSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/amazonclouddirectory/2017-01-11/schema/upgradepublished"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/amazonclouddirectory/2017-01-11/schema/upgradepublished"; let body: any; body = JSON.stringify({ ...(input.DevelopmentSchemaArn !== undefined && @@ -2173,7 +2299,6 @@ export const serializeAws_restJson1UpgradePublishedSchemaCommand = async ( ...(input.PublishedSchemaArn !== undefined && input.PublishedSchemaArn !== null && { PublishedSchemaArn: input.PublishedSchemaArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-cloudfront/protocols/Aws_restXml.ts b/clients/client-cloudfront/protocols/Aws_restXml.ts index ba5eeb4e8b252..63559e574c427 100644 --- a/clients/client-cloudfront/protocols/Aws_restXml.ts +++ b/clients/client-cloudfront/protocols/Aws_restXml.ts @@ -495,10 +495,11 @@ export const serializeAws_restXmlCreateCachePolicyCommand = async ( input: CreateCachePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/cache-policy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/cache-policy"; let body: any; if (input.CachePolicyConfig !== undefined) { body = serializeAws_restXmlCachePolicyConfig(input.CachePolicyConfig, context); @@ -510,7 +511,6 @@ export const serializeAws_restXmlCreateCachePolicyCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -526,10 +526,13 @@ export const serializeAws_restXmlCreateCloudFrontOriginAccessIdentityCommand = a input: CreateCloudFrontOriginAccessIdentityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/origin-access-identity/cloudfront"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/origin-access-identity/cloudfront"; let body: any; if (input.CloudFrontOriginAccessIdentityConfig !== undefined) { body = serializeAws_restXmlCloudFrontOriginAccessIdentityConfig( @@ -547,7 +550,6 @@ export const serializeAws_restXmlCreateCloudFrontOriginAccessIdentityCommand = a contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -563,10 +565,11 @@ export const serializeAws_restXmlCreateDistributionCommand = async ( input: CreateDistributionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/distribution"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/distribution"; let body: any; if (input.DistributionConfig !== undefined) { body = serializeAws_restXmlDistributionConfig(input.DistributionConfig, context); @@ -578,7 +581,6 @@ export const serializeAws_restXmlCreateDistributionCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -594,10 +596,11 @@ export const serializeAws_restXmlCreateDistributionWithTagsCommand = async ( input: CreateDistributionWithTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/distribution"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/distribution"; const query: any = { WithTags: "", }; @@ -612,7 +615,6 @@ export const serializeAws_restXmlCreateDistributionWithTagsCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -629,10 +631,12 @@ export const serializeAws_restXmlCreateFieldLevelEncryptionConfigCommand = async input: CreateFieldLevelEncryptionConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/field-level-encryption"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/field-level-encryption"; let body: any; if (input.FieldLevelEncryptionConfig !== undefined) { body = serializeAws_restXmlFieldLevelEncryptionConfig(input.FieldLevelEncryptionConfig, context); @@ -644,7 +648,6 @@ export const serializeAws_restXmlCreateFieldLevelEncryptionConfigCommand = async contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -660,10 +663,13 @@ export const serializeAws_restXmlCreateFieldLevelEncryptionProfileCommand = asyn input: CreateFieldLevelEncryptionProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/field-level-encryption-profile"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/field-level-encryption-profile"; let body: any; if (input.FieldLevelEncryptionProfileConfig !== undefined) { body = serializeAws_restXmlFieldLevelEncryptionProfileConfig(input.FieldLevelEncryptionProfileConfig, context); @@ -675,7 +681,6 @@ export const serializeAws_restXmlCreateFieldLevelEncryptionProfileCommand = asyn contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -691,10 +696,11 @@ export const serializeAws_restXmlCreateFunctionCommand = async ( input: CreateFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/function"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/function"; let body: any; body = ''; const bodyNode = new __XmlNode("CreateFunctionRequest"); @@ -714,7 +720,6 @@ export const serializeAws_restXmlCreateFunctionCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -730,10 +735,13 @@ export const serializeAws_restXmlCreateInvalidationCommand = async ( input: CreateInvalidationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/distribution/{DistributionId}/invalidation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distribution/{DistributionId}/invalidation"; if (input.DistributionId !== undefined) { const labelValue: string = input.DistributionId; if (labelValue.length <= 0) { @@ -754,7 +762,6 @@ export const serializeAws_restXmlCreateInvalidationCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -770,10 +777,11 @@ export const serializeAws_restXmlCreateKeyGroupCommand = async ( input: CreateKeyGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/key-group"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/key-group"; let body: any; if (input.KeyGroupConfig !== undefined) { body = serializeAws_restXmlKeyGroupConfig(input.KeyGroupConfig, context); @@ -785,7 +793,6 @@ export const serializeAws_restXmlCreateKeyGroupCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -801,10 +808,13 @@ export const serializeAws_restXmlCreateMonitoringSubscriptionCommand = async ( input: CreateMonitoringSubscriptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/distributions/{DistributionId}/monitoring-subscription"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distributions/{DistributionId}/monitoring-subscription"; if (input.DistributionId !== undefined) { const labelValue: string = input.DistributionId; if (labelValue.length <= 0) { @@ -825,7 +835,6 @@ export const serializeAws_restXmlCreateMonitoringSubscriptionCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -841,10 +850,12 @@ export const serializeAws_restXmlCreateOriginRequestPolicyCommand = async ( input: CreateOriginRequestPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/origin-request-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/origin-request-policy"; let body: any; if (input.OriginRequestPolicyConfig !== undefined) { body = serializeAws_restXmlOriginRequestPolicyConfig(input.OriginRequestPolicyConfig, context); @@ -856,7 +867,6 @@ export const serializeAws_restXmlCreateOriginRequestPolicyCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -872,10 +882,11 @@ export const serializeAws_restXmlCreatePublicKeyCommand = async ( input: CreatePublicKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/public-key"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/public-key"; let body: any; if (input.PublicKeyConfig !== undefined) { body = serializeAws_restXmlPublicKeyConfig(input.PublicKeyConfig, context); @@ -887,7 +898,6 @@ export const serializeAws_restXmlCreatePublicKeyCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -903,10 +913,12 @@ export const serializeAws_restXmlCreateRealtimeLogConfigCommand = async ( input: CreateRealtimeLogConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/realtime-log-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/realtime-log-config"; let body: any; body = ''; const bodyNode = new __XmlNode("CreateRealtimeLogConfigRequest"); @@ -936,7 +948,6 @@ export const serializeAws_restXmlCreateRealtimeLogConfigCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -952,10 +963,12 @@ export const serializeAws_restXmlCreateStreamingDistributionCommand = async ( input: CreateStreamingDistributionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/streaming-distribution"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/streaming-distribution"; let body: any; if (input.StreamingDistributionConfig !== undefined) { body = serializeAws_restXmlStreamingDistributionConfig(input.StreamingDistributionConfig, context); @@ -967,7 +980,6 @@ export const serializeAws_restXmlCreateStreamingDistributionCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -983,10 +995,12 @@ export const serializeAws_restXmlCreateStreamingDistributionWithTagsCommand = as input: CreateStreamingDistributionWithTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/streaming-distribution"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/streaming-distribution"; const query: any = { WithTags: "", }; @@ -1004,7 +1018,6 @@ export const serializeAws_restXmlCreateStreamingDistributionWithTagsCommand = as contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1021,10 +1034,12 @@ export const serializeAws_restXmlDeleteCachePolicyCommand = async ( input: DeleteCachePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/cache-policy/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/cache-policy/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1035,7 +1050,6 @@ export const serializeAws_restXmlDeleteCachePolicyCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1051,10 +1065,13 @@ export const serializeAws_restXmlDeleteCloudFrontOriginAccessIdentityCommand = a input: DeleteCloudFrontOriginAccessIdentityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/origin-access-identity/cloudfront/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/origin-access-identity/cloudfront/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1065,7 +1082,6 @@ export const serializeAws_restXmlDeleteCloudFrontOriginAccessIdentityCommand = a throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1081,10 +1097,12 @@ export const serializeAws_restXmlDeleteDistributionCommand = async ( input: DeleteDistributionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/distribution/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/distribution/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1095,7 +1113,6 @@ export const serializeAws_restXmlDeleteDistributionCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1111,10 +1128,12 @@ export const serializeAws_restXmlDeleteFieldLevelEncryptionConfigCommand = async input: DeleteFieldLevelEncryptionConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/field-level-encryption/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/field-level-encryption/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1125,7 +1144,6 @@ export const serializeAws_restXmlDeleteFieldLevelEncryptionConfigCommand = async throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1141,10 +1159,13 @@ export const serializeAws_restXmlDeleteFieldLevelEncryptionProfileCommand = asyn input: DeleteFieldLevelEncryptionProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/field-level-encryption-profile/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/field-level-encryption-profile/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1155,7 +1176,6 @@ export const serializeAws_restXmlDeleteFieldLevelEncryptionProfileCommand = asyn throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1171,10 +1191,12 @@ export const serializeAws_restXmlDeleteFunctionCommand = async ( input: DeleteFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/function/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/function/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1185,7 +1207,6 @@ export const serializeAws_restXmlDeleteFunctionCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1201,10 +1222,12 @@ export const serializeAws_restXmlDeleteKeyGroupCommand = async ( input: DeleteKeyGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/key-group/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/key-group/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1215,7 +1238,6 @@ export const serializeAws_restXmlDeleteKeyGroupCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1231,8 +1253,11 @@ export const serializeAws_restXmlDeleteMonitoringSubscriptionCommand = async ( input: DeleteMonitoringSubscriptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distributions/{DistributionId}/monitoring-subscription"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distributions/{DistributionId}/monitoring-subscription"; if (input.DistributionId !== undefined) { const labelValue: string = input.DistributionId; if (labelValue.length <= 0) { @@ -1243,7 +1268,6 @@ export const serializeAws_restXmlDeleteMonitoringSubscriptionCommand = async ( throw new Error("No value provided for input HTTP label: DistributionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1259,10 +1283,12 @@ export const serializeAws_restXmlDeleteOriginRequestPolicyCommand = async ( input: DeleteOriginRequestPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/origin-request-policy/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/origin-request-policy/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1273,7 +1299,6 @@ export const serializeAws_restXmlDeleteOriginRequestPolicyCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1289,10 +1314,12 @@ export const serializeAws_restXmlDeletePublicKeyCommand = async ( input: DeletePublicKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/public-key/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/public-key/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1303,7 +1330,6 @@ export const serializeAws_restXmlDeletePublicKeyCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1319,10 +1345,12 @@ export const serializeAws_restXmlDeleteRealtimeLogConfigCommand = async ( input: DeleteRealtimeLogConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/delete-realtime-log-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/delete-realtime-log-config"; let body: any; body = ''; const bodyNode = new __XmlNode("DeleteRealtimeLogConfigRequest"); @@ -1336,7 +1364,6 @@ export const serializeAws_restXmlDeleteRealtimeLogConfigCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1352,10 +1379,12 @@ export const serializeAws_restXmlDeleteStreamingDistributionCommand = async ( input: DeleteStreamingDistributionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/streaming-distribution/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/streaming-distribution/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1366,7 +1395,6 @@ export const serializeAws_restXmlDeleteStreamingDistributionCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1382,8 +1410,10 @@ export const serializeAws_restXmlDescribeFunctionCommand = async ( input: DescribeFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/function/{Name}/describe"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/function/{Name}/describe"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1397,7 +1427,6 @@ export const serializeAws_restXmlDescribeFunctionCommand = async ( ...(input.Stage !== undefined && { Stage: input.Stage }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1414,8 +1443,10 @@ export const serializeAws_restXmlGetCachePolicyCommand = async ( input: GetCachePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/cache-policy/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/cache-policy/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1426,7 +1457,6 @@ export const serializeAws_restXmlGetCachePolicyCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1442,8 +1472,10 @@ export const serializeAws_restXmlGetCachePolicyConfigCommand = async ( input: GetCachePolicyConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/cache-policy/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/cache-policy/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1454,7 +1486,6 @@ export const serializeAws_restXmlGetCachePolicyConfigCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1470,8 +1501,11 @@ export const serializeAws_restXmlGetCloudFrontOriginAccessIdentityCommand = asyn input: GetCloudFrontOriginAccessIdentityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/origin-access-identity/cloudfront/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/origin-access-identity/cloudfront/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1482,7 +1516,6 @@ export const serializeAws_restXmlGetCloudFrontOriginAccessIdentityCommand = asyn throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1498,8 +1531,11 @@ export const serializeAws_restXmlGetCloudFrontOriginAccessIdentityConfigCommand input: GetCloudFrontOriginAccessIdentityConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/origin-access-identity/cloudfront/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/origin-access-identity/cloudfront/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1510,7 +1546,6 @@ export const serializeAws_restXmlGetCloudFrontOriginAccessIdentityConfigCommand throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1526,8 +1561,10 @@ export const serializeAws_restXmlGetDistributionCommand = async ( input: GetDistributionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distribution/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/distribution/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1538,7 +1575,6 @@ export const serializeAws_restXmlGetDistributionCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1554,8 +1590,10 @@ export const serializeAws_restXmlGetDistributionConfigCommand = async ( input: GetDistributionConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distribution/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/distribution/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1566,7 +1604,6 @@ export const serializeAws_restXmlGetDistributionConfigCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1582,8 +1619,10 @@ export const serializeAws_restXmlGetFieldLevelEncryptionCommand = async ( input: GetFieldLevelEncryptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/field-level-encryption/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/field-level-encryption/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1594,7 +1633,6 @@ export const serializeAws_restXmlGetFieldLevelEncryptionCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1610,8 +1648,11 @@ export const serializeAws_restXmlGetFieldLevelEncryptionConfigCommand = async ( input: GetFieldLevelEncryptionConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/field-level-encryption/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/field-level-encryption/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1622,7 +1663,6 @@ export const serializeAws_restXmlGetFieldLevelEncryptionConfigCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1638,8 +1678,11 @@ export const serializeAws_restXmlGetFieldLevelEncryptionProfileCommand = async ( input: GetFieldLevelEncryptionProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/field-level-encryption-profile/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/field-level-encryption-profile/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1650,7 +1693,6 @@ export const serializeAws_restXmlGetFieldLevelEncryptionProfileCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1666,8 +1708,11 @@ export const serializeAws_restXmlGetFieldLevelEncryptionProfileConfigCommand = a input: GetFieldLevelEncryptionProfileConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/field-level-encryption-profile/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/field-level-encryption-profile/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1678,7 +1723,6 @@ export const serializeAws_restXmlGetFieldLevelEncryptionProfileConfigCommand = a throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1694,8 +1738,10 @@ export const serializeAws_restXmlGetFunctionCommand = async ( input: GetFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/function/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/function/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1709,7 +1755,6 @@ export const serializeAws_restXmlGetFunctionCommand = async ( ...(input.Stage !== undefined && { Stage: input.Stage }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1726,8 +1771,11 @@ export const serializeAws_restXmlGetInvalidationCommand = async ( input: GetInvalidationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distribution/{DistributionId}/invalidation/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distribution/{DistributionId}/invalidation/{Id}"; if (input.DistributionId !== undefined) { const labelValue: string = input.DistributionId; if (labelValue.length <= 0) { @@ -1747,7 +1795,6 @@ export const serializeAws_restXmlGetInvalidationCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1763,8 +1810,10 @@ export const serializeAws_restXmlGetKeyGroupCommand = async ( input: GetKeyGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/key-group/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/key-group/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1775,7 +1824,6 @@ export const serializeAws_restXmlGetKeyGroupCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1791,8 +1839,10 @@ export const serializeAws_restXmlGetKeyGroupConfigCommand = async ( input: GetKeyGroupConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/key-group/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/key-group/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1803,7 +1853,6 @@ export const serializeAws_restXmlGetKeyGroupConfigCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1819,8 +1868,11 @@ export const serializeAws_restXmlGetMonitoringSubscriptionCommand = async ( input: GetMonitoringSubscriptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distributions/{DistributionId}/monitoring-subscription"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distributions/{DistributionId}/monitoring-subscription"; if (input.DistributionId !== undefined) { const labelValue: string = input.DistributionId; if (labelValue.length <= 0) { @@ -1831,7 +1883,6 @@ export const serializeAws_restXmlGetMonitoringSubscriptionCommand = async ( throw new Error("No value provided for input HTTP label: DistributionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1847,8 +1898,10 @@ export const serializeAws_restXmlGetOriginRequestPolicyCommand = async ( input: GetOriginRequestPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/origin-request-policy/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/origin-request-policy/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1859,7 +1912,6 @@ export const serializeAws_restXmlGetOriginRequestPolicyCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1875,8 +1927,11 @@ export const serializeAws_restXmlGetOriginRequestPolicyConfigCommand = async ( input: GetOriginRequestPolicyConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/origin-request-policy/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/origin-request-policy/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1887,7 +1942,6 @@ export const serializeAws_restXmlGetOriginRequestPolicyConfigCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1903,8 +1957,10 @@ export const serializeAws_restXmlGetPublicKeyCommand = async ( input: GetPublicKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/public-key/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/public-key/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1915,7 +1971,6 @@ export const serializeAws_restXmlGetPublicKeyCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1931,8 +1986,10 @@ export const serializeAws_restXmlGetPublicKeyConfigCommand = async ( input: GetPublicKeyConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/public-key/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/public-key/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1943,7 +2000,6 @@ export const serializeAws_restXmlGetPublicKeyConfigCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1959,10 +2015,12 @@ export const serializeAws_restXmlGetRealtimeLogConfigCommand = async ( input: GetRealtimeLogConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/get-realtime-log-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/get-realtime-log-config"; let body: any; body = ''; const bodyNode = new __XmlNode("GetRealtimeLogConfigRequest"); @@ -1976,7 +2034,6 @@ export const serializeAws_restXmlGetRealtimeLogConfigCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1992,8 +2049,10 @@ export const serializeAws_restXmlGetStreamingDistributionCommand = async ( input: GetStreamingDistributionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/streaming-distribution/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/streaming-distribution/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2004,7 +2063,6 @@ export const serializeAws_restXmlGetStreamingDistributionCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2020,8 +2078,11 @@ export const serializeAws_restXmlGetStreamingDistributionConfigCommand = async ( input: GetStreamingDistributionConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/streaming-distribution/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/streaming-distribution/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2032,7 +2093,6 @@ export const serializeAws_restXmlGetStreamingDistributionConfigCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2048,15 +2108,15 @@ export const serializeAws_restXmlListCachePoliciesCommand = async ( input: ListCachePoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/cache-policy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/cache-policy"; const query: any = { ...(input.Type !== undefined && { Type: input.Type }), ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2073,14 +2133,16 @@ export const serializeAws_restXmlListCloudFrontOriginAccessIdentitiesCommand = a input: ListCloudFrontOriginAccessIdentitiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/origin-access-identity/cloudfront"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/origin-access-identity/cloudfront"; const query: any = { ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2097,14 +2159,14 @@ export const serializeAws_restXmlListDistributionsCommand = async ( input: ListDistributionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distribution"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/distribution"; const query: any = { ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2121,8 +2183,11 @@ export const serializeAws_restXmlListDistributionsByCachePolicyIdCommand = async input: ListDistributionsByCachePolicyIdCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distributionsByCachePolicyId/{CachePolicyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distributionsByCachePolicyId/{CachePolicyId}"; if (input.CachePolicyId !== undefined) { const labelValue: string = input.CachePolicyId; if (labelValue.length <= 0) { @@ -2137,7 +2202,6 @@ export const serializeAws_restXmlListDistributionsByCachePolicyIdCommand = async ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2154,8 +2218,11 @@ export const serializeAws_restXmlListDistributionsByKeyGroupCommand = async ( input: ListDistributionsByKeyGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distributionsByKeyGroupId/{KeyGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distributionsByKeyGroupId/{KeyGroupId}"; if (input.KeyGroupId !== undefined) { const labelValue: string = input.KeyGroupId; if (labelValue.length <= 0) { @@ -2170,7 +2237,6 @@ export const serializeAws_restXmlListDistributionsByKeyGroupCommand = async ( ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2187,8 +2253,11 @@ export const serializeAws_restXmlListDistributionsByOriginRequestPolicyIdCommand input: ListDistributionsByOriginRequestPolicyIdCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distributionsByOriginRequestPolicyId/{OriginRequestPolicyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distributionsByOriginRequestPolicyId/{OriginRequestPolicyId}"; if (input.OriginRequestPolicyId !== undefined) { const labelValue: string = input.OriginRequestPolicyId; if (labelValue.length <= 0) { @@ -2203,7 +2272,6 @@ export const serializeAws_restXmlListDistributionsByOriginRequestPolicyIdCommand ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2220,10 +2288,13 @@ export const serializeAws_restXmlListDistributionsByRealtimeLogConfigCommand = a input: ListDistributionsByRealtimeLogConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/distributionsByRealtimeLogConfig"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distributionsByRealtimeLogConfig"; let body: any; body = ''; const bodyNode = new __XmlNode("ListDistributionsByRealtimeLogConfigRequest"); @@ -2249,7 +2320,6 @@ export const serializeAws_restXmlListDistributionsByRealtimeLogConfigCommand = a bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2265,8 +2335,11 @@ export const serializeAws_restXmlListDistributionsByWebACLIdCommand = async ( input: ListDistributionsByWebACLIdCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distributionsByWebACLId/{WebACLId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distributionsByWebACLId/{WebACLId}"; if (input.WebACLId !== undefined) { const labelValue: string = input.WebACLId; if (labelValue.length <= 0) { @@ -2281,7 +2354,6 @@ export const serializeAws_restXmlListDistributionsByWebACLIdCommand = async ( ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2298,14 +2370,15 @@ export const serializeAws_restXmlListFieldLevelEncryptionConfigsCommand = async input: ListFieldLevelEncryptionConfigsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/field-level-encryption"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/field-level-encryption"; const query: any = { ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2322,14 +2395,16 @@ export const serializeAws_restXmlListFieldLevelEncryptionProfilesCommand = async input: ListFieldLevelEncryptionProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/field-level-encryption-profile"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/field-level-encryption-profile"; const query: any = { ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2346,15 +2421,15 @@ export const serializeAws_restXmlListFunctionsCommand = async ( input: ListFunctionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/function"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/function"; const query: any = { ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), ...(input.Stage !== undefined && { Stage: input.Stage }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2371,8 +2446,11 @@ export const serializeAws_restXmlListInvalidationsCommand = async ( input: ListInvalidationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/distribution/{DistributionId}/invalidation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/distribution/{DistributionId}/invalidation"; if (input.DistributionId !== undefined) { const labelValue: string = input.DistributionId; if (labelValue.length <= 0) { @@ -2387,7 +2465,6 @@ export const serializeAws_restXmlListInvalidationsCommand = async ( ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2404,14 +2481,14 @@ export const serializeAws_restXmlListKeyGroupsCommand = async ( input: ListKeyGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/key-group"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/key-group"; const query: any = { ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2428,15 +2505,16 @@ export const serializeAws_restXmlListOriginRequestPoliciesCommand = async ( input: ListOriginRequestPoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/origin-request-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/origin-request-policy"; const query: any = { ...(input.Type !== undefined && { Type: input.Type }), ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2453,14 +2531,14 @@ export const serializeAws_restXmlListPublicKeysCommand = async ( input: ListPublicKeysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/public-key"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/public-key"; const query: any = { ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2477,14 +2555,15 @@ export const serializeAws_restXmlListRealtimeLogConfigsCommand = async ( input: ListRealtimeLogConfigsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/realtime-log-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/realtime-log-config"; const query: any = { ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), ...(input.Marker !== undefined && { Marker: input.Marker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2501,14 +2580,15 @@ export const serializeAws_restXmlListStreamingDistributionsCommand = async ( input: ListStreamingDistributionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/streaming-distribution"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/streaming-distribution"; const query: any = { ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2525,13 +2605,13 @@ export const serializeAws_restXmlListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-05-31/tagging"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/tagging"; const query: any = { ...(input.Resource !== undefined && { Resource: input.Resource }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2548,10 +2628,12 @@ export const serializeAws_restXmlPublishFunctionCommand = async ( input: PublishFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/function/{Name}/publish"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/function/{Name}/publish"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -2562,7 +2644,6 @@ export const serializeAws_restXmlPublishFunctionCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2578,10 +2659,11 @@ export const serializeAws_restXmlTagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/tagging"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/tagging"; const query: any = { Operation: "Tag", ...(input.Resource !== undefined && { Resource: input.Resource }), @@ -2597,7 +2679,6 @@ export const serializeAws_restXmlTagResourceCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2614,11 +2695,13 @@ export const serializeAws_restXmlTestFunctionCommand = async ( input: TestFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/function/{Name}/test"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/function/{Name}/test"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -2643,7 +2726,6 @@ export const serializeAws_restXmlTestFunctionCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2659,10 +2741,11 @@ export const serializeAws_restXmlUntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/tagging"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/tagging"; const query: any = { Operation: "Untag", ...(input.Resource !== undefined && { Resource: input.Resource }), @@ -2678,7 +2761,6 @@ export const serializeAws_restXmlUntagResourceCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2695,11 +2777,13 @@ export const serializeAws_restXmlUpdateCachePolicyCommand = async ( input: UpdateCachePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/cache-policy/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/cache-policy/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2720,7 +2804,6 @@ export const serializeAws_restXmlUpdateCachePolicyCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2736,11 +2819,14 @@ export const serializeAws_restXmlUpdateCloudFrontOriginAccessIdentityCommand = a input: UpdateCloudFrontOriginAccessIdentityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/origin-access-identity/cloudfront/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/origin-access-identity/cloudfront/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2767,7 +2853,6 @@ export const serializeAws_restXmlUpdateCloudFrontOriginAccessIdentityCommand = a contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2783,11 +2868,13 @@ export const serializeAws_restXmlUpdateDistributionCommand = async ( input: UpdateDistributionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/distribution/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/distribution/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2808,7 +2895,6 @@ export const serializeAws_restXmlUpdateDistributionCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2824,11 +2910,14 @@ export const serializeAws_restXmlUpdateFieldLevelEncryptionConfigCommand = async input: UpdateFieldLevelEncryptionConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/field-level-encryption/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/field-level-encryption/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2849,7 +2938,6 @@ export const serializeAws_restXmlUpdateFieldLevelEncryptionConfigCommand = async contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2865,11 +2953,14 @@ export const serializeAws_restXmlUpdateFieldLevelEncryptionProfileCommand = asyn input: UpdateFieldLevelEncryptionProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/field-level-encryption-profile/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/field-level-encryption-profile/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2890,7 +2981,6 @@ export const serializeAws_restXmlUpdateFieldLevelEncryptionProfileCommand = asyn contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2906,11 +2996,13 @@ export const serializeAws_restXmlUpdateFunctionCommand = async ( input: UpdateFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/function/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/function/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -2935,7 +3027,6 @@ export const serializeAws_restXmlUpdateFunctionCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2951,11 +3042,13 @@ export const serializeAws_restXmlUpdateKeyGroupCommand = async ( input: UpdateKeyGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/key-group/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/key-group/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2976,7 +3069,6 @@ export const serializeAws_restXmlUpdateKeyGroupCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2992,11 +3084,13 @@ export const serializeAws_restXmlUpdateOriginRequestPolicyCommand = async ( input: UpdateOriginRequestPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/origin-request-policy/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/origin-request-policy/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -3017,7 +3111,6 @@ export const serializeAws_restXmlUpdateOriginRequestPolicyCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3033,11 +3126,13 @@ export const serializeAws_restXmlUpdatePublicKeyCommand = async ( input: UpdatePublicKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/public-key/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/public-key/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -3058,7 +3153,6 @@ export const serializeAws_restXmlUpdatePublicKeyCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3074,10 +3168,12 @@ export const serializeAws_restXmlUpdateRealtimeLogConfigCommand = async ( input: UpdateRealtimeLogConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2020-05-31/realtime-log-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-05-31/realtime-log-config"; let body: any; body = ''; const bodyNode = new __XmlNode("UpdateRealtimeLogConfigRequest"); @@ -3111,7 +3207,6 @@ export const serializeAws_restXmlUpdateRealtimeLogConfigCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3127,11 +3222,14 @@ export const serializeAws_restXmlUpdateStreamingDistributionCommand = async ( input: UpdateStreamingDistributionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), }; - let resolvedPath = "/2020-05-31/streaming-distribution/{Id}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-05-31/streaming-distribution/{Id}/config"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -3152,7 +3250,6 @@ export const serializeAws_restXmlUpdateStreamingDistributionCommand = async ( contents.addAttribute("xmlns", "http://cloudfront.amazonaws.com/doc/2020-05-31/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-cloudsearch-domain/protocols/Aws_restJson1.ts b/clients/client-cloudsearch-domain/protocols/Aws_restJson1.ts index 9d813fd204dec..31a158c59c794 100644 --- a/clients/client-cloudsearch-domain/protocols/Aws_restJson1.ts +++ b/clients/client-cloudsearch-domain/protocols/Aws_restJson1.ts @@ -34,8 +34,9 @@ export const serializeAws_restJson1SearchCommand = async ( input: SearchCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-01-01/search"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/search"; const query: any = { format: "sdk", pretty: "true", @@ -55,7 +56,6 @@ export const serializeAws_restJson1SearchCommand = async ( ...(input.stats !== undefined && { stats: input.stats }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -72,8 +72,9 @@ export const serializeAws_restJson1SuggestCommand = async ( input: SuggestCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-01-01/suggest"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/suggest"; const query: any = { format: "sdk", pretty: "true", @@ -82,7 +83,6 @@ export const serializeAws_restJson1SuggestCommand = async ( ...(input.size !== undefined && { size: input.size.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -99,11 +99,13 @@ export const serializeAws_restJson1UploadDocumentsCommand = async ( input: UploadDocumentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.contentType) && { "content-type": input.contentType! }), }; - let resolvedPath = "/2013-01-01/documents/batch"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-01-01/documents/batch"; const query: any = { format: "sdk", }; @@ -111,7 +113,6 @@ export const serializeAws_restJson1UploadDocumentsCommand = async ( if (input.documents !== undefined) { body = input.documents; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-codeartifact/protocols/Aws_restJson1.ts b/clients/client-codeartifact/protocols/Aws_restJson1.ts index 2aa66af47b7a8..5e1711750c5a9 100644 --- a/clients/client-codeartifact/protocols/Aws_restJson1.ts +++ b/clients/client-codeartifact/protocols/Aws_restJson1.ts @@ -143,8 +143,10 @@ export const serializeAws_restJson1AssociateExternalConnectionCommand = async ( input: AssociateExternalConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/repository/external-connection"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repository/external-connection"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -152,7 +154,6 @@ export const serializeAws_restJson1AssociateExternalConnectionCommand = async ( ...(input.externalConnection !== undefined && { "external-connection": input.externalConnection }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -169,10 +170,12 @@ export const serializeAws_restJson1CopyPackageVersionsCommand = async ( input: CopyPackageVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/package/versions/copy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/package/versions/copy"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -195,7 +198,6 @@ export const serializeAws_restJson1CopyPackageVersionsCommand = async ( ...(input.versions !== undefined && input.versions !== null && { versions: serializeAws_restJson1PackageVersionList(input.versions, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -212,10 +214,11 @@ export const serializeAws_restJson1CreateDomainCommand = async ( input: CreateDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/domain"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domain"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), }; @@ -225,7 +228,6 @@ export const serializeAws_restJson1CreateDomainCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -242,10 +244,11 @@ export const serializeAws_restJson1CreateRepositoryCommand = async ( input: CreateRepositoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/repository"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repository"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -261,7 +264,6 @@ export const serializeAws_restJson1CreateRepositoryCommand = async ( upstreams: serializeAws_restJson1UpstreamRepositoryList(input.upstreams, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -278,14 +280,14 @@ export const serializeAws_restJson1DeleteDomainCommand = async ( input: DeleteDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/domain"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domain"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -302,15 +304,16 @@ export const serializeAws_restJson1DeleteDomainPermissionsPolicyCommand = async input: DeleteDomainPermissionsPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/domain/permissions/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domain/permissions/policy"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), ...(input.policyRevision !== undefined && { "policy-revision": input.policyRevision }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -327,10 +330,12 @@ export const serializeAws_restJson1DeletePackageVersionsCommand = async ( input: DeletePackageVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/package/versions/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/package/versions/delete"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -346,7 +351,6 @@ export const serializeAws_restJson1DeletePackageVersionsCommand = async ( ...(input.versions !== undefined && input.versions !== null && { versions: serializeAws_restJson1PackageVersionList(input.versions, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -363,15 +367,15 @@ export const serializeAws_restJson1DeleteRepositoryCommand = async ( input: DeleteRepositoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/repository"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repository"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), ...(input.repository !== undefined && { repository: input.repository }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -388,8 +392,10 @@ export const serializeAws_restJson1DeleteRepositoryPermissionsPolicyCommand = as input: DeleteRepositoryPermissionsPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/repository/permissions/policies"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repository/permissions/policies"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -397,7 +403,6 @@ export const serializeAws_restJson1DeleteRepositoryPermissionsPolicyCommand = as ...(input.policyRevision !== undefined && { "policy-revision": input.policyRevision }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -414,14 +419,14 @@ export const serializeAws_restJson1DescribeDomainCommand = async ( input: DescribeDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/domain"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domain"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -438,8 +443,9 @@ export const serializeAws_restJson1DescribePackageVersionCommand = async ( input: DescribePackageVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/package/version"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/package/version"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -450,7 +456,6 @@ export const serializeAws_restJson1DescribePackageVersionCommand = async ( ...(input.packageVersion !== undefined && { version: input.packageVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -467,15 +472,15 @@ export const serializeAws_restJson1DescribeRepositoryCommand = async ( input: DescribeRepositoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/repository"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repository"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), ...(input.repository !== undefined && { repository: input.repository }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -492,8 +497,10 @@ export const serializeAws_restJson1DisassociateExternalConnectionCommand = async input: DisassociateExternalConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/repository/external-connection"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repository/external-connection"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -501,7 +508,6 @@ export const serializeAws_restJson1DisassociateExternalConnectionCommand = async ...(input.externalConnection !== undefined && { "external-connection": input.externalConnection }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -518,10 +524,12 @@ export const serializeAws_restJson1DisposePackageVersionsCommand = async ( input: DisposePackageVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/package/versions/dispose"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/package/versions/dispose"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -541,7 +549,6 @@ export const serializeAws_restJson1DisposePackageVersionsCommand = async ( ...(input.versions !== undefined && input.versions !== null && { versions: serializeAws_restJson1PackageVersionList(input.versions, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -558,15 +565,15 @@ export const serializeAws_restJson1GetAuthorizationTokenCommand = async ( input: GetAuthorizationTokenCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/authorization-token"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/authorization-token"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), ...(input.durationSeconds !== undefined && { duration: input.durationSeconds.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -583,14 +590,15 @@ export const serializeAws_restJson1GetDomainPermissionsPolicyCommand = async ( input: GetDomainPermissionsPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/domain/permissions/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domain/permissions/policy"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -607,8 +615,10 @@ export const serializeAws_restJson1GetPackageVersionAssetCommand = async ( input: GetPackageVersionAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/package/version/asset"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/package/version/asset"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -621,7 +631,6 @@ export const serializeAws_restJson1GetPackageVersionAssetCommand = async ( ...(input.packageVersionRevision !== undefined && { revision: input.packageVersionRevision }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -638,8 +647,10 @@ export const serializeAws_restJson1GetPackageVersionReadmeCommand = async ( input: GetPackageVersionReadmeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/package/version/readme"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/package/version/readme"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -650,7 +661,6 @@ export const serializeAws_restJson1GetPackageVersionReadmeCommand = async ( ...(input.packageVersion !== undefined && { version: input.packageVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -667,8 +677,9 @@ export const serializeAws_restJson1GetRepositoryEndpointCommand = async ( input: GetRepositoryEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/repository/endpoint"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repository/endpoint"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -676,7 +687,6 @@ export const serializeAws_restJson1GetRepositoryEndpointCommand = async ( ...(input.format !== undefined && { format: input.format }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -693,15 +703,16 @@ export const serializeAws_restJson1GetRepositoryPermissionsPolicyCommand = async input: GetRepositoryPermissionsPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/repository/permissions/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repository/permissions/policy"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), ...(input.repository !== undefined && { repository: input.repository }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -718,16 +729,16 @@ export const serializeAws_restJson1ListDomainsCommand = async ( input: ListDomainsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/domains"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domains"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -743,8 +754,9 @@ export const serializeAws_restJson1ListPackagesCommand = async ( input: ListPackagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/packages"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/packages"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -756,7 +768,6 @@ export const serializeAws_restJson1ListPackagesCommand = async ( ...(input.nextToken !== undefined && { "next-token": input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -773,8 +784,10 @@ export const serializeAws_restJson1ListPackageVersionAssetsCommand = async ( input: ListPackageVersionAssetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/package/version/assets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/package/version/assets"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -787,7 +800,6 @@ export const serializeAws_restJson1ListPackageVersionAssetsCommand = async ( ...(input.nextToken !== undefined && { "next-token": input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -804,8 +816,10 @@ export const serializeAws_restJson1ListPackageVersionDependenciesCommand = async input: ListPackageVersionDependenciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/package/version/dependencies"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/package/version/dependencies"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -817,7 +831,6 @@ export const serializeAws_restJson1ListPackageVersionDependenciesCommand = async ...(input.nextToken !== undefined && { "next-token": input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -834,8 +847,9 @@ export const serializeAws_restJson1ListPackageVersionsCommand = async ( input: ListPackageVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/package/versions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/package/versions"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -849,7 +863,6 @@ export const serializeAws_restJson1ListPackageVersionsCommand = async ( ...(input.nextToken !== undefined && { "next-token": input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -866,15 +879,15 @@ export const serializeAws_restJson1ListRepositoriesCommand = async ( input: ListRepositoriesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/repositories"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repositories"; const query: any = { ...(input.repositoryPrefix !== undefined && { "repository-prefix": input.repositoryPrefix }), ...(input.maxResults !== undefined && { "max-results": input.maxResults.toString() }), ...(input.nextToken !== undefined && { "next-token": input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -891,8 +904,9 @@ export const serializeAws_restJson1ListRepositoriesInDomainCommand = async ( input: ListRepositoriesInDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/domain/repositories"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domain/repositories"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -902,7 +916,6 @@ export const serializeAws_restJson1ListRepositoriesInDomainCommand = async ( ...(input.nextToken !== undefined && { "next-token": input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -919,13 +932,13 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -942,10 +955,12 @@ export const serializeAws_restJson1PutDomainPermissionsPolicyCommand = async ( input: PutDomainPermissionsPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/domain/permissions/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domain/permissions/policy"; let body: any; body = JSON.stringify({ ...(input.domain !== undefined && input.domain !== null && { domain: input.domain }), @@ -955,7 +970,6 @@ export const serializeAws_restJson1PutDomainPermissionsPolicyCommand = async ( ...(input.policyRevision !== undefined && input.policyRevision !== null && { policyRevision: input.policyRevision }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -971,10 +985,12 @@ export const serializeAws_restJson1PutRepositoryPermissionsPolicyCommand = async input: PutRepositoryPermissionsPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/repository/permissions/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repository/permissions/policy"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -987,7 +1003,6 @@ export const serializeAws_restJson1PutRepositoryPermissionsPolicyCommand = async ...(input.policyRevision !== undefined && input.policyRevision !== null && { policyRevision: input.policyRevision }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1004,10 +1019,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/tag"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tag"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; @@ -1016,7 +1032,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1033,10 +1048,11 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/untag"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/untag"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; @@ -1045,7 +1061,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && input.tagKeys !== null && { tagKeys: serializeAws_restJson1TagKeyList(input.tagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1062,10 +1077,12 @@ export const serializeAws_restJson1UpdatePackageVersionsStatusCommand = async ( input: UpdatePackageVersionsStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/package/versions/update_status"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/package/versions/update_status"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -1086,7 +1103,6 @@ export const serializeAws_restJson1UpdatePackageVersionsStatusCommand = async ( ...(input.versions !== undefined && input.versions !== null && { versions: serializeAws_restJson1PackageVersionList(input.versions, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1103,10 +1119,11 @@ export const serializeAws_restJson1UpdateRepositoryCommand = async ( input: UpdateRepositoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/repository"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/repository"; const query: any = { ...(input.domain !== undefined && { domain: input.domain }), ...(input.domainOwner !== undefined && { "domain-owner": input.domainOwner }), @@ -1120,7 +1137,6 @@ export const serializeAws_restJson1UpdateRepositoryCommand = async ( upstreams: serializeAws_restJson1UpstreamRepositoryList(input.upstreams, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-codeguru-reviewer/protocols/Aws_restJson1.ts b/clients/client-codeguru-reviewer/protocols/Aws_restJson1.ts index a5b796b4e8d5c..622bf02d6f89c 100644 --- a/clients/client-codeguru-reviewer/protocols/Aws_restJson1.ts +++ b/clients/client-codeguru-reviewer/protocols/Aws_restJson1.ts @@ -94,10 +94,11 @@ export const serializeAws_restJson1AssociateRepositoryCommand = async ( input: AssociateRepositoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/associations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/associations"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -109,7 +110,6 @@ export const serializeAws_restJson1AssociateRepositoryCommand = async ( input.Repository !== null && { Repository: serializeAws_restJson1Repository(input.Repository, context) }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -125,10 +125,11 @@ export const serializeAws_restJson1CreateCodeReviewCommand = async ( input: CreateCodeReviewCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/codereviews"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/codereviews"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -138,7 +139,6 @@ export const serializeAws_restJson1CreateCodeReviewCommand = async ( ...(input.Type !== undefined && input.Type !== null && { Type: serializeAws_restJson1CodeReviewType(input.Type, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -154,8 +154,10 @@ export const serializeAws_restJson1DescribeCodeReviewCommand = async ( input: DescribeCodeReviewCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/codereviews/{CodeReviewArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/codereviews/{CodeReviewArn}"; if (input.CodeReviewArn !== undefined) { const labelValue: string = input.CodeReviewArn; if (labelValue.length <= 0) { @@ -166,7 +168,6 @@ export const serializeAws_restJson1DescribeCodeReviewCommand = async ( throw new Error("No value provided for input HTTP label: CodeReviewArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -182,8 +183,10 @@ export const serializeAws_restJson1DescribeRecommendationFeedbackCommand = async input: DescribeRecommendationFeedbackCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/feedback/{CodeReviewArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/feedback/{CodeReviewArn}"; if (input.CodeReviewArn !== undefined) { const labelValue: string = input.CodeReviewArn; if (labelValue.length <= 0) { @@ -198,7 +201,6 @@ export const serializeAws_restJson1DescribeRecommendationFeedbackCommand = async ...(input.UserId !== undefined && { UserId: input.UserId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -215,8 +217,10 @@ export const serializeAws_restJson1DescribeRepositoryAssociationCommand = async input: DescribeRepositoryAssociationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/associations/{AssociationArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/associations/{AssociationArn}"; if (input.AssociationArn !== undefined) { const labelValue: string = input.AssociationArn; if (labelValue.length <= 0) { @@ -227,7 +231,6 @@ export const serializeAws_restJson1DescribeRepositoryAssociationCommand = async throw new Error("No value provided for input HTTP label: AssociationArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -243,8 +246,10 @@ export const serializeAws_restJson1DisassociateRepositoryCommand = async ( input: DisassociateRepositoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/associations/{AssociationArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/associations/{AssociationArn}"; if (input.AssociationArn !== undefined) { const labelValue: string = input.AssociationArn; if (labelValue.length <= 0) { @@ -255,7 +260,6 @@ export const serializeAws_restJson1DisassociateRepositoryCommand = async ( throw new Error("No value provided for input HTTP label: AssociationArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -271,8 +275,9 @@ export const serializeAws_restJson1ListCodeReviewsCommand = async ( input: ListCodeReviewsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/codereviews"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/codereviews"; const query: any = { ...(input.ProviderTypes !== undefined && { ProviderTypes: (input.ProviderTypes || []).map((_entry) => _entry) }), ...(input.States !== undefined && { States: (input.States || []).map((_entry) => _entry) }), @@ -284,7 +289,6 @@ export const serializeAws_restJson1ListCodeReviewsCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -301,8 +305,11 @@ export const serializeAws_restJson1ListRecommendationFeedbackCommand = async ( input: ListRecommendationFeedbackCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/feedback/{CodeReviewArn}/RecommendationFeedback"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/feedback/{CodeReviewArn}/RecommendationFeedback"; if (input.CodeReviewArn !== undefined) { const labelValue: string = input.CodeReviewArn; if (labelValue.length <= 0) { @@ -321,7 +328,6 @@ export const serializeAws_restJson1ListRecommendationFeedbackCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -338,8 +344,11 @@ export const serializeAws_restJson1ListRecommendationsCommand = async ( input: ListRecommendationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/codereviews/{CodeReviewArn}/Recommendations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/codereviews/{CodeReviewArn}/Recommendations"; if (input.CodeReviewArn !== undefined) { const labelValue: string = input.CodeReviewArn; if (labelValue.length <= 0) { @@ -354,7 +363,6 @@ export const serializeAws_restJson1ListRecommendationsCommand = async ( ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -371,8 +379,9 @@ export const serializeAws_restJson1ListRepositoryAssociationsCommand = async ( input: ListRepositoryAssociationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/associations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/associations"; const query: any = { ...(input.ProviderTypes !== undefined && { ProviderType: (input.ProviderTypes || []).map((_entry) => _entry) }), ...(input.States !== undefined && { State: (input.States || []).map((_entry) => _entry) }), @@ -382,7 +391,6 @@ export const serializeAws_restJson1ListRepositoryAssociationsCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -399,8 +407,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -411,7 +420,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -427,10 +435,11 @@ export const serializeAws_restJson1PutRecommendationFeedbackCommand = async ( input: PutRecommendationFeedbackCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/feedback"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/feedback"; let body: any; body = JSON.stringify({ ...(input.CodeReviewArn !== undefined && input.CodeReviewArn !== null && { CodeReviewArn: input.CodeReviewArn }), @@ -439,7 +448,6 @@ export const serializeAws_restJson1PutRecommendationFeedbackCommand = async ( ...(input.RecommendationId !== undefined && input.RecommendationId !== null && { RecommendationId: input.RecommendationId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -455,10 +463,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -472,7 +481,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -488,8 +496,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -503,7 +512,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-codeguruprofiler/protocols/Aws_restJson1.ts b/clients/client-codeguruprofiler/protocols/Aws_restJson1.ts index 902191ee66f2f..609c3277daaa9 100644 --- a/clients/client-codeguruprofiler/protocols/Aws_restJson1.ts +++ b/clients/client-codeguruprofiler/protocols/Aws_restJson1.ts @@ -108,10 +108,13 @@ export const serializeAws_restJson1AddNotificationChannelsCommand = async ( input: AddNotificationChannelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/profilingGroups/{profilingGroupName}/notificationConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/notificationConfiguration"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -126,7 +129,6 @@ export const serializeAws_restJson1AddNotificationChannelsCommand = async ( ...(input.channels !== undefined && input.channels !== null && { channels: serializeAws_restJson1Channels(input.channels, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -142,10 +144,13 @@ export const serializeAws_restJson1BatchGetFrameMetricDataCommand = async ( input: BatchGetFrameMetricDataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/profilingGroups/{profilingGroupName}/frames/-/metrics"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/frames/-/metrics"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -166,7 +171,6 @@ export const serializeAws_restJson1BatchGetFrameMetricDataCommand = async ( ...(input.frameMetrics !== undefined && input.frameMetrics !== null && { frameMetrics: serializeAws_restJson1FrameMetrics(input.frameMetrics, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -183,10 +187,13 @@ export const serializeAws_restJson1ConfigureAgentCommand = async ( input: ConfigureAgentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/profilingGroups/{profilingGroupName}/configureAgent"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/configureAgent"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -203,7 +210,6 @@ export const serializeAws_restJson1ConfigureAgentCommand = async ( ...(input.metadata !== undefined && input.metadata !== null && { metadata: serializeAws_restJson1Metadata(input.metadata, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -219,10 +225,11 @@ export const serializeAws_restJson1CreateProfilingGroupCommand = async ( input: CreateProfilingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/profilingGroups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/profilingGroups"; const query: any = { ...(input.clientToken !== undefined && { clientToken: input.clientToken }), }; @@ -242,7 +249,6 @@ export const serializeAws_restJson1CreateProfilingGroupCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -259,8 +265,10 @@ export const serializeAws_restJson1DeleteProfilingGroupCommand = async ( input: DeleteProfilingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/profilingGroups/{profilingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/profilingGroups/{profilingGroupName}"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -271,7 +279,6 @@ export const serializeAws_restJson1DeleteProfilingGroupCommand = async ( throw new Error("No value provided for input HTTP label: profilingGroupName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -287,8 +294,10 @@ export const serializeAws_restJson1DescribeProfilingGroupCommand = async ( input: DescribeProfilingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/profilingGroups/{profilingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/profilingGroups/{profilingGroupName}"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -299,7 +308,6 @@ export const serializeAws_restJson1DescribeProfilingGroupCommand = async ( throw new Error("No value provided for input HTTP label: profilingGroupName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -315,15 +323,16 @@ export const serializeAws_restJson1GetFindingsReportAccountSummaryCommand = asyn input: GetFindingsReportAccountSummaryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/internal/findingsReports"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/internal/findingsReports"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.dailyReportsOnly !== undefined && { dailyReportsOnly: input.dailyReportsOnly.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -340,8 +349,11 @@ export const serializeAws_restJson1GetNotificationConfigurationCommand = async ( input: GetNotificationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/profilingGroups/{profilingGroupName}/notificationConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/notificationConfiguration"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -352,7 +364,6 @@ export const serializeAws_restJson1GetNotificationConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: profilingGroupName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -368,8 +379,11 @@ export const serializeAws_restJson1GetPolicyCommand = async ( input: GetPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/profilingGroups/{profilingGroupName}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/policy"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -380,7 +394,6 @@ export const serializeAws_restJson1GetPolicyCommand = async ( throw new Error("No value provided for input HTTP label: profilingGroupName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -396,10 +409,13 @@ export const serializeAws_restJson1GetProfileCommand = async ( input: GetProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.accept) && { accept: input.accept! }), }; - let resolvedPath = "/profilingGroups/{profilingGroupName}/profile"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/profile"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -416,7 +432,6 @@ export const serializeAws_restJson1GetProfileCommand = async ( ...(input.maxDepth !== undefined && { maxDepth: input.maxDepth.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -433,8 +448,11 @@ export const serializeAws_restJson1GetRecommendationsCommand = async ( input: GetRecommendationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/internal/profilingGroups/{profilingGroupName}/recommendations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/internal/profilingGroups/{profilingGroupName}/recommendations"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -450,7 +468,6 @@ export const serializeAws_restJson1GetRecommendationsCommand = async ( ...(input.locale !== undefined && { locale: input.locale }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -467,8 +484,11 @@ export const serializeAws_restJson1ListFindingsReportsCommand = async ( input: ListFindingsReportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/internal/profilingGroups/{profilingGroupName}/findingsReports"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/internal/profilingGroups/{profilingGroupName}/findingsReports"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -486,7 +506,6 @@ export const serializeAws_restJson1ListFindingsReportsCommand = async ( ...(input.dailyReportsOnly !== undefined && { dailyReportsOnly: input.dailyReportsOnly.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -503,8 +522,11 @@ export const serializeAws_restJson1ListProfileTimesCommand = async ( input: ListProfileTimesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/profilingGroups/{profilingGroupName}/profileTimes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/profileTimes"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -523,7 +545,6 @@ export const serializeAws_restJson1ListProfileTimesCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -540,15 +561,15 @@ export const serializeAws_restJson1ListProfilingGroupsCommand = async ( input: ListProfilingGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/profilingGroups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/profilingGroups"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.includeDescription !== undefined && { includeDescription: input.includeDescription.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -565,8 +586,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -577,7 +599,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -593,11 +614,14 @@ export const serializeAws_restJson1PostAgentProfileCommand = async ( input: PostAgentProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.contentType) && { "content-type": input.contentType! }), }; - let resolvedPath = "/profilingGroups/{profilingGroupName}/agentProfile"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/agentProfile"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -614,7 +638,6 @@ export const serializeAws_restJson1PostAgentProfileCommand = async ( if (input.agentProfile !== undefined) { body = input.agentProfile; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -631,10 +654,13 @@ export const serializeAws_restJson1PutPermissionCommand = async ( input: PutPermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/profilingGroups/{profilingGroupName}/policy/{actionGroup}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/policy/{actionGroup}"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -659,7 +685,6 @@ export const serializeAws_restJson1PutPermissionCommand = async ( input.principals !== null && { principals: serializeAws_restJson1Principals(input.principals, context) }), ...(input.revisionId !== undefined && input.revisionId !== null && { revisionId: input.revisionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -675,8 +700,11 @@ export const serializeAws_restJson1RemoveNotificationChannelCommand = async ( input: RemoveNotificationChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/profilingGroups/{profilingGroupName}/notificationConfiguration/{channelId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/notificationConfiguration/{channelId}"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -696,7 +724,6 @@ export const serializeAws_restJson1RemoveNotificationChannelCommand = async ( throw new Error("No value provided for input HTTP label: channelId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -712,8 +739,11 @@ export const serializeAws_restJson1RemovePermissionCommand = async ( input: RemovePermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/profilingGroups/{profilingGroupName}/policy/{actionGroup}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/profilingGroups/{profilingGroupName}/policy/{actionGroup}"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -736,7 +766,6 @@ export const serializeAws_restJson1RemovePermissionCommand = async ( ...(input.revisionId !== undefined && { revisionId: input.revisionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -753,10 +782,13 @@ export const serializeAws_restJson1SubmitFeedbackCommand = async ( input: SubmitFeedbackCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/internal/profilingGroups/{profilingGroupName}/anomalies/{anomalyInstanceId}/feedback"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/internal/profilingGroups/{profilingGroupName}/anomalies/{anomalyInstanceId}/feedback"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -780,7 +812,6 @@ export const serializeAws_restJson1SubmitFeedbackCommand = async ( ...(input.comment !== undefined && input.comment !== null && { comment: input.comment }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -796,10 +827,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -814,7 +846,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -830,8 +861,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -845,7 +877,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -862,10 +893,12 @@ export const serializeAws_restJson1UpdateProfilingGroupCommand = async ( input: UpdateProfilingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/profilingGroups/{profilingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/profilingGroups/{profilingGroupName}"; if (input.profilingGroupName !== undefined) { const labelValue: string = input.profilingGroupName; if (labelValue.length <= 0) { @@ -885,7 +918,6 @@ export const serializeAws_restJson1UpdateProfilingGroupCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-codestar-notifications/protocols/Aws_restJson1.ts b/clients/client-codestar-notifications/protocols/Aws_restJson1.ts index 4dcca4ddbed1f..9bcc76bd0ba72 100644 --- a/clients/client-codestar-notifications/protocols/Aws_restJson1.ts +++ b/clients/client-codestar-notifications/protocols/Aws_restJson1.ts @@ -60,10 +60,11 @@ export const serializeAws_restJson1CreateNotificationRuleCommand = async ( input: CreateNotificationRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createNotificationRule"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createNotificationRule"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -77,7 +78,6 @@ export const serializeAws_restJson1CreateNotificationRuleCommand = async ( ...(input.Targets !== undefined && input.Targets !== null && { Targets: serializeAws_restJson1Targets(input.Targets, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -93,15 +93,15 @@ export const serializeAws_restJson1DeleteNotificationRuleCommand = async ( input: DeleteNotificationRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteNotificationRule"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteNotificationRule"; let body: any; body = JSON.stringify({ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -117,17 +117,17 @@ export const serializeAws_restJson1DeleteTargetCommand = async ( input: DeleteTargetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteTarget"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteTarget"; let body: any; body = JSON.stringify({ ...(input.ForceUnsubscribeAll !== undefined && input.ForceUnsubscribeAll !== null && { ForceUnsubscribeAll: input.ForceUnsubscribeAll }), ...(input.TargetAddress !== undefined && input.TargetAddress !== null && { TargetAddress: input.TargetAddress }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -143,15 +143,16 @@ export const serializeAws_restJson1DescribeNotificationRuleCommand = async ( input: DescribeNotificationRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeNotificationRule"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeNotificationRule"; let body: any; body = JSON.stringify({ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -167,10 +168,11 @@ export const serializeAws_restJson1ListEventTypesCommand = async ( input: ListEventTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listEventTypes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listEventTypes"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -178,7 +180,6 @@ export const serializeAws_restJson1ListEventTypesCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -194,10 +195,11 @@ export const serializeAws_restJson1ListNotificationRulesCommand = async ( input: ListNotificationRulesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listNotificationRules"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listNotificationRules"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -207,7 +209,6 @@ export const serializeAws_restJson1ListNotificationRulesCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -223,15 +224,15 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listTagsForResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listTagsForResource"; let body: any; body = JSON.stringify({ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -247,10 +248,11 @@ export const serializeAws_restJson1ListTargetsCommand = async ( input: ListTargetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listTargets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listTargets"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -258,7 +260,6 @@ export const serializeAws_restJson1ListTargetsCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -274,10 +275,11 @@ export const serializeAws_restJson1SubscribeCommand = async ( input: SubscribeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/subscribe"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/subscribe"; let body: any; body = JSON.stringify({ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }), @@ -286,7 +288,6 @@ export const serializeAws_restJson1SubscribeCommand = async ( ...(input.Target !== undefined && input.Target !== null && { Target: serializeAws_restJson1Target(input.Target, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -302,16 +303,16 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tagResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tagResource"; let body: any; body = JSON.stringify({ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -327,16 +328,16 @@ export const serializeAws_restJson1UnsubscribeCommand = async ( input: UnsubscribeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/unsubscribe"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/unsubscribe"; let body: any; body = JSON.stringify({ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }), ...(input.TargetAddress !== undefined && input.TargetAddress !== null && { TargetAddress: input.TargetAddress }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -352,17 +353,17 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/untagResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/untagResource"; let body: any; body = JSON.stringify({ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }), ...(input.TagKeys !== undefined && input.TagKeys !== null && { TagKeys: serializeAws_restJson1TagKeys(input.TagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -378,10 +379,11 @@ export const serializeAws_restJson1UpdateNotificationRuleCommand = async ( input: UpdateNotificationRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateNotificationRule"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateNotificationRule"; let body: any; body = JSON.stringify({ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }), @@ -393,7 +395,6 @@ export const serializeAws_restJson1UpdateNotificationRuleCommand = async ( ...(input.Targets !== undefined && input.Targets !== null && { Targets: serializeAws_restJson1Targets(input.Targets, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-cognito-sync/protocols/Aws_restJson1.ts b/clients/client-cognito-sync/protocols/Aws_restJson1.ts index 0927ba5604a9c..63217f0c0416c 100644 --- a/clients/client-cognito-sync/protocols/Aws_restJson1.ts +++ b/clients/client-cognito-sync/protocols/Aws_restJson1.ts @@ -77,8 +77,11 @@ export const serializeAws_restJson1BulkPublishCommand = async ( input: BulkPublishCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools/{IdentityPoolId}/bulkpublish"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/bulkpublish"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -89,7 +92,6 @@ export const serializeAws_restJson1BulkPublishCommand = async ( throw new Error("No value provided for input HTTP label: IdentityPoolId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -105,8 +107,11 @@ export const serializeAws_restJson1DeleteDatasetCommand = async ( input: DeleteDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -135,7 +140,6 @@ export const serializeAws_restJson1DeleteDatasetCommand = async ( throw new Error("No value provided for input HTTP label: DatasetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -151,8 +155,11 @@ export const serializeAws_restJson1DescribeDatasetCommand = async ( input: DescribeDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -181,7 +188,6 @@ export const serializeAws_restJson1DescribeDatasetCommand = async ( throw new Error("No value provided for input HTTP label: DatasetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -197,8 +203,10 @@ export const serializeAws_restJson1DescribeIdentityPoolUsageCommand = async ( input: DescribeIdentityPoolUsageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools/{IdentityPoolId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -209,7 +217,6 @@ export const serializeAws_restJson1DescribeIdentityPoolUsageCommand = async ( throw new Error("No value provided for input HTTP label: IdentityPoolId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -225,8 +232,11 @@ export const serializeAws_restJson1DescribeIdentityUsageCommand = async ( input: DescribeIdentityUsageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools/{IdentityPoolId}/identities/{IdentityId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/identities/{IdentityId}"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -246,7 +256,6 @@ export const serializeAws_restJson1DescribeIdentityUsageCommand = async ( throw new Error("No value provided for input HTTP label: IdentityId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -262,8 +271,11 @@ export const serializeAws_restJson1GetBulkPublishDetailsCommand = async ( input: GetBulkPublishDetailsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools/{IdentityPoolId}/getBulkPublishDetails"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/getBulkPublishDetails"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -274,7 +286,6 @@ export const serializeAws_restJson1GetBulkPublishDetailsCommand = async ( throw new Error("No value provided for input HTTP label: IdentityPoolId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -290,8 +301,10 @@ export const serializeAws_restJson1GetCognitoEventsCommand = async ( input: GetCognitoEventsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools/{IdentityPoolId}/events"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}/events"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -302,7 +315,6 @@ export const serializeAws_restJson1GetCognitoEventsCommand = async ( throw new Error("No value provided for input HTTP label: IdentityPoolId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -318,8 +330,11 @@ export const serializeAws_restJson1GetIdentityPoolConfigurationCommand = async ( input: GetIdentityPoolConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools/{IdentityPoolId}/configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/configuration"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -330,7 +345,6 @@ export const serializeAws_restJson1GetIdentityPoolConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: IdentityPoolId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -346,8 +360,11 @@ export const serializeAws_restJson1ListDatasetsCommand = async ( input: ListDatasetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -371,7 +388,6 @@ export const serializeAws_restJson1ListDatasetsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -388,14 +404,14 @@ export const serializeAws_restJson1ListIdentityPoolUsageCommand = async ( input: ListIdentityPoolUsageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -412,8 +428,11 @@ export const serializeAws_restJson1ListRecordsCommand = async ( input: ListRecordsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/records"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/records"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -448,7 +467,6 @@ export const serializeAws_restJson1ListRecordsCommand = async ( ...(input.SyncSessionToken !== undefined && { syncSessionToken: input.SyncSessionToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -465,10 +483,13 @@ export const serializeAws_restJson1RegisterDeviceCommand = async ( input: RegisterDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/identitypools/{IdentityPoolId}/identity/{IdentityId}/device"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/identity/{IdentityId}/device"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -492,7 +513,6 @@ export const serializeAws_restJson1RegisterDeviceCommand = async ( ...(input.Platform !== undefined && input.Platform !== null && { Platform: input.Platform }), ...(input.Token !== undefined && input.Token !== null && { Token: input.Token }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -508,10 +528,12 @@ export const serializeAws_restJson1SetCognitoEventsCommand = async ( input: SetCognitoEventsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/identitypools/{IdentityPoolId}/events"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}/events"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -526,7 +548,6 @@ export const serializeAws_restJson1SetCognitoEventsCommand = async ( ...(input.Events !== undefined && input.Events !== null && { Events: serializeAws_restJson1Events(input.Events, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -542,10 +563,13 @@ export const serializeAws_restJson1SetIdentityPoolConfigurationCommand = async ( input: SetIdentityPoolConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/identitypools/{IdentityPoolId}/configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/configuration"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -564,7 +588,6 @@ export const serializeAws_restJson1SetIdentityPoolConfigurationCommand = async ( ...(input.PushSync !== undefined && input.PushSync !== null && { PushSync: serializeAws_restJson1PushSync(input.PushSync, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -580,8 +603,10 @@ export const serializeAws_restJson1SubscribeToDatasetCommand = async ( input: SubscribeToDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; @@ -620,7 +645,6 @@ export const serializeAws_restJson1SubscribeToDatasetCommand = async ( throw new Error("No value provided for input HTTP label: DeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -636,8 +660,10 @@ export const serializeAws_restJson1UnsubscribeFromDatasetCommand = async ( input: UnsubscribeFromDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}/subscriptions/{DeviceId}"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; @@ -676,7 +702,6 @@ export const serializeAws_restJson1UnsubscribeFromDatasetCommand = async ( throw new Error("No value provided for input HTTP label: DeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -692,11 +717,14 @@ export const serializeAws_restJson1UpdateRecordsCommand = async ( input: UpdateRecordsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ClientContext) && { "x-amz-client-context": input.ClientContext! }), }; - let resolvedPath = "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/identitypools/{IdentityPoolId}/identities/{IdentityId}/datasets/{DatasetName}"; if (input.IdentityPoolId !== undefined) { const labelValue: string = input.IdentityPoolId; if (labelValue.length <= 0) { @@ -734,7 +762,6 @@ export const serializeAws_restJson1UpdateRecordsCommand = async ( ...(input.SyncSessionToken !== undefined && input.SyncSessionToken !== null && { SyncSessionToken: input.SyncSessionToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-connect-contact-lens/protocols/Aws_restJson1.ts b/clients/client-connect-contact-lens/protocols/Aws_restJson1.ts index 3eee612daa5fa..82ddaecd6f6c1 100644 --- a/clients/client-connect-contact-lens/protocols/Aws_restJson1.ts +++ b/clients/client-connect-contact-lens/protocols/Aws_restJson1.ts @@ -33,10 +33,13 @@ export const serializeAws_restJson1ListRealtimeContactAnalysisSegmentsCommand = input: ListRealtimeContactAnalysisSegmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/realtime-contact-analysis/analysis-segments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/realtime-contact-analysis/analysis-segments"; let body: any; body = JSON.stringify({ ...(input.ContactId !== undefined && input.ContactId !== null && { ContactId: input.ContactId }), @@ -44,7 +47,6 @@ export const serializeAws_restJson1ListRealtimeContactAnalysisSegmentsCommand = ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-connect/protocols/Aws_restJson1.ts b/clients/client-connect/protocols/Aws_restJson1.ts index c1d04c10a49a5..ba3b78c34a2f2 100644 --- a/clients/client-connect/protocols/Aws_restJson1.ts +++ b/clients/client-connect/protocols/Aws_restJson1.ts @@ -404,10 +404,12 @@ export const serializeAws_restJson1AssociateApprovedOriginCommand = async ( input: AssociateApprovedOriginCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/approved-origin"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/approved-origin"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -421,7 +423,6 @@ export const serializeAws_restJson1AssociateApprovedOriginCommand = async ( body = JSON.stringify({ ...(input.Origin !== undefined && input.Origin !== null && { Origin: input.Origin }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -437,10 +438,12 @@ export const serializeAws_restJson1AssociateBotCommand = async ( input: AssociateBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/bot"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/bot"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -457,7 +460,6 @@ export const serializeAws_restJson1AssociateBotCommand = async ( ...(input.LexV2Bot !== undefined && input.LexV2Bot !== null && { LexV2Bot: serializeAws_restJson1LexV2Bot(input.LexV2Bot, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -473,10 +475,12 @@ export const serializeAws_restJson1AssociateInstanceStorageConfigCommand = async input: AssociateInstanceStorageConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/storage-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/storage-config"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -494,7 +498,6 @@ export const serializeAws_restJson1AssociateInstanceStorageConfigCommand = async StorageConfig: serializeAws_restJson1InstanceStorageConfig(input.StorageConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -510,10 +513,12 @@ export const serializeAws_restJson1AssociateLambdaFunctionCommand = async ( input: AssociateLambdaFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/lambda-function"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/lambda-function"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -527,7 +532,6 @@ export const serializeAws_restJson1AssociateLambdaFunctionCommand = async ( body = JSON.stringify({ ...(input.FunctionArn !== undefined && input.FunctionArn !== null && { FunctionArn: input.FunctionArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -543,10 +547,12 @@ export const serializeAws_restJson1AssociateLexBotCommand = async ( input: AssociateLexBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/lex-bot"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/lex-bot"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -561,7 +567,6 @@ export const serializeAws_restJson1AssociateLexBotCommand = async ( ...(input.LexBot !== undefined && input.LexBot !== null && { LexBot: serializeAws_restJson1LexBot(input.LexBot, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -577,10 +582,13 @@ export const serializeAws_restJson1AssociateQueueQuickConnectsCommand = async ( input: AssociateQueueQuickConnectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/queues/{InstanceId}/{QueueId}/associate-quick-connects"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/queues/{InstanceId}/{QueueId}/associate-quick-connects"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -606,7 +614,6 @@ export const serializeAws_restJson1AssociateQueueQuickConnectsCommand = async ( QuickConnectIds: serializeAws_restJson1QuickConnectsList(input.QuickConnectIds, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -622,10 +629,13 @@ export const serializeAws_restJson1AssociateRoutingProfileQueuesCommand = async input: AssociateRoutingProfileQueuesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/routing-profiles/{InstanceId}/{RoutingProfileId}/associate-queues"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/routing-profiles/{InstanceId}/{RoutingProfileId}/associate-queues"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -651,7 +661,6 @@ export const serializeAws_restJson1AssociateRoutingProfileQueuesCommand = async QueueConfigs: serializeAws_restJson1RoutingProfileQueueConfigList(input.QueueConfigs, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -667,10 +676,12 @@ export const serializeAws_restJson1AssociateSecurityKeyCommand = async ( input: AssociateSecurityKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/security-key"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/security-key"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -684,7 +695,6 @@ export const serializeAws_restJson1AssociateSecurityKeyCommand = async ( body = JSON.stringify({ ...(input.Key !== undefined && input.Key !== null && { Key: input.Key }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -700,10 +710,12 @@ export const serializeAws_restJson1CreateContactFlowCommand = async ( input: CreateContactFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact-flows/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact-flows/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -721,7 +733,6 @@ export const serializeAws_restJson1CreateContactFlowCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -737,10 +748,11 @@ export const serializeAws_restJson1CreateInstanceCommand = async ( input: CreateInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance"; let body: any; body = JSON.stringify({ ...(input.ClientToken !== undefined && input.ClientToken !== null && { ClientToken: input.ClientToken }), @@ -753,7 +765,6 @@ export const serializeAws_restJson1CreateInstanceCommand = async ( ...(input.OutboundCallsEnabled !== undefined && input.OutboundCallsEnabled !== null && { OutboundCallsEnabled: input.OutboundCallsEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -769,10 +780,13 @@ export const serializeAws_restJson1CreateIntegrationAssociationCommand = async ( input: CreateIntegrationAssociationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/integration-associations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/integration-associations"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -795,7 +809,6 @@ export const serializeAws_restJson1CreateIntegrationAssociationCommand = async ( ...(input.SourceType !== undefined && input.SourceType !== null && { SourceType: input.SourceType }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -811,10 +824,11 @@ export const serializeAws_restJson1CreateQueueCommand = async ( input: CreateQueueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/queues/{InstanceId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/queues/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -841,7 +855,6 @@ export const serializeAws_restJson1CreateQueueCommand = async ( }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -857,10 +870,12 @@ export const serializeAws_restJson1CreateQuickConnectCommand = async ( input: CreateQuickConnectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/quick-connects/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/quick-connects/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -880,7 +895,6 @@ export const serializeAws_restJson1CreateQuickConnectCommand = async ( }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -896,10 +910,12 @@ export const serializeAws_restJson1CreateRoutingProfileCommand = async ( input: CreateRoutingProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/routing-profiles/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/routing-profiles/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -925,7 +941,6 @@ export const serializeAws_restJson1CreateRoutingProfileCommand = async ( }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -941,10 +956,13 @@ export const serializeAws_restJson1CreateUseCaseCommand = async ( input: CreateUseCaseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/integration-associations/{IntegrationAssociationId}/use-cases"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/integration-associations/{IntegrationAssociationId}/use-cases"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -968,7 +986,6 @@ export const serializeAws_restJson1CreateUseCaseCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), ...(input.UseCaseType !== undefined && input.UseCaseType !== null && { UseCaseType: input.UseCaseType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -984,10 +1001,11 @@ export const serializeAws_restJson1CreateUserCommand = async ( input: CreateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/users/{InstanceId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/users/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1019,7 +1037,6 @@ export const serializeAws_restJson1CreateUserCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), ...(input.Username !== undefined && input.Username !== null && { Username: input.Username }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1035,10 +1052,12 @@ export const serializeAws_restJson1CreateUserHierarchyGroupCommand = async ( input: CreateUserHierarchyGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/user-hierarchy-groups/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/user-hierarchy-groups/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1053,7 +1072,6 @@ export const serializeAws_restJson1CreateUserHierarchyGroupCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.ParentGroupId !== undefined && input.ParentGroupId !== null && { ParentGroupId: input.ParentGroupId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1069,8 +1087,9 @@ export const serializeAws_restJson1DeleteInstanceCommand = async ( input: DeleteInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1081,7 +1100,6 @@ export const serializeAws_restJson1DeleteInstanceCommand = async ( throw new Error("No value provided for input HTTP label: InstanceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1097,8 +1115,11 @@ export const serializeAws_restJson1DeleteIntegrationAssociationCommand = async ( input: DeleteIntegrationAssociationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/integration-associations/{IntegrationAssociationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/integration-associations/{IntegrationAssociationId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1118,7 +1139,6 @@ export const serializeAws_restJson1DeleteIntegrationAssociationCommand = async ( throw new Error("No value provided for input HTTP label: IntegrationAssociationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1134,8 +1154,11 @@ export const serializeAws_restJson1DeleteQuickConnectCommand = async ( input: DeleteQuickConnectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/quick-connects/{InstanceId}/{QuickConnectId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/quick-connects/{InstanceId}/{QuickConnectId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1155,7 +1178,6 @@ export const serializeAws_restJson1DeleteQuickConnectCommand = async ( throw new Error("No value provided for input HTTP label: QuickConnectId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1171,8 +1193,11 @@ export const serializeAws_restJson1DeleteUseCaseCommand = async ( input: DeleteUseCaseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/integration-associations/{IntegrationAssociationId}/use-cases/{UseCaseId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/integration-associations/{IntegrationAssociationId}/use-cases/{UseCaseId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1201,7 +1226,6 @@ export const serializeAws_restJson1DeleteUseCaseCommand = async ( throw new Error("No value provided for input HTTP label: UseCaseId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1217,8 +1241,10 @@ export const serializeAws_restJson1DeleteUserCommand = async ( input: DeleteUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/users/{InstanceId}/{UserId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/users/{InstanceId}/{UserId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1238,7 +1264,6 @@ export const serializeAws_restJson1DeleteUserCommand = async ( throw new Error("No value provided for input HTTP label: UserId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1254,8 +1279,11 @@ export const serializeAws_restJson1DeleteUserHierarchyGroupCommand = async ( input: DeleteUserHierarchyGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/user-hierarchy-groups/{InstanceId}/{HierarchyGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/user-hierarchy-groups/{InstanceId}/{HierarchyGroupId}"; if (input.HierarchyGroupId !== undefined) { const labelValue: string = input.HierarchyGroupId; if (labelValue.length <= 0) { @@ -1275,7 +1303,6 @@ export const serializeAws_restJson1DeleteUserHierarchyGroupCommand = async ( throw new Error("No value provided for input HTTP label: InstanceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1291,8 +1318,11 @@ export const serializeAws_restJson1DescribeContactFlowCommand = async ( input: DescribeContactFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/contact-flows/{InstanceId}/{ContactFlowId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/contact-flows/{InstanceId}/{ContactFlowId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1312,7 +1342,6 @@ export const serializeAws_restJson1DescribeContactFlowCommand = async ( throw new Error("No value provided for input HTTP label: ContactFlowId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1328,8 +1357,11 @@ export const serializeAws_restJson1DescribeHoursOfOperationCommand = async ( input: DescribeHoursOfOperationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/hours-of-operations/{InstanceId}/{HoursOfOperationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/hours-of-operations/{InstanceId}/{HoursOfOperationId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1349,7 +1381,6 @@ export const serializeAws_restJson1DescribeHoursOfOperationCommand = async ( throw new Error("No value provided for input HTTP label: HoursOfOperationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1365,8 +1396,9 @@ export const serializeAws_restJson1DescribeInstanceCommand = async ( input: DescribeInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1377,7 +1409,6 @@ export const serializeAws_restJson1DescribeInstanceCommand = async ( throw new Error("No value provided for input HTTP label: InstanceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1393,8 +1424,11 @@ export const serializeAws_restJson1DescribeInstanceAttributeCommand = async ( input: DescribeInstanceAttributeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/attribute/{AttributeType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/attribute/{AttributeType}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1414,7 +1448,6 @@ export const serializeAws_restJson1DescribeInstanceAttributeCommand = async ( throw new Error("No value provided for input HTTP label: AttributeType."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1430,8 +1463,11 @@ export const serializeAws_restJson1DescribeInstanceStorageConfigCommand = async input: DescribeInstanceStorageConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/storage-config/{AssociationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/storage-config/{AssociationId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1454,7 +1490,6 @@ export const serializeAws_restJson1DescribeInstanceStorageConfigCommand = async ...(input.ResourceType !== undefined && { resourceType: input.ResourceType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1471,8 +1506,10 @@ export const serializeAws_restJson1DescribeQueueCommand = async ( input: DescribeQueueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/queues/{InstanceId}/{QueueId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/queues/{InstanceId}/{QueueId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1492,7 +1529,6 @@ export const serializeAws_restJson1DescribeQueueCommand = async ( throw new Error("No value provided for input HTTP label: QueueId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1508,8 +1544,11 @@ export const serializeAws_restJson1DescribeQuickConnectCommand = async ( input: DescribeQuickConnectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/quick-connects/{InstanceId}/{QuickConnectId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/quick-connects/{InstanceId}/{QuickConnectId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1529,7 +1568,6 @@ export const serializeAws_restJson1DescribeQuickConnectCommand = async ( throw new Error("No value provided for input HTTP label: QuickConnectId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1545,8 +1583,11 @@ export const serializeAws_restJson1DescribeRoutingProfileCommand = async ( input: DescribeRoutingProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/routing-profiles/{InstanceId}/{RoutingProfileId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/routing-profiles/{InstanceId}/{RoutingProfileId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1566,7 +1607,6 @@ export const serializeAws_restJson1DescribeRoutingProfileCommand = async ( throw new Error("No value provided for input HTTP label: RoutingProfileId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1582,8 +1622,10 @@ export const serializeAws_restJson1DescribeUserCommand = async ( input: DescribeUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/users/{InstanceId}/{UserId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/users/{InstanceId}/{UserId}"; if (input.UserId !== undefined) { const labelValue: string = input.UserId; if (labelValue.length <= 0) { @@ -1603,7 +1645,6 @@ export const serializeAws_restJson1DescribeUserCommand = async ( throw new Error("No value provided for input HTTP label: InstanceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1619,8 +1660,11 @@ export const serializeAws_restJson1DescribeUserHierarchyGroupCommand = async ( input: DescribeUserHierarchyGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/user-hierarchy-groups/{InstanceId}/{HierarchyGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/user-hierarchy-groups/{InstanceId}/{HierarchyGroupId}"; if (input.HierarchyGroupId !== undefined) { const labelValue: string = input.HierarchyGroupId; if (labelValue.length <= 0) { @@ -1640,7 +1684,6 @@ export const serializeAws_restJson1DescribeUserHierarchyGroupCommand = async ( throw new Error("No value provided for input HTTP label: InstanceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1656,8 +1699,10 @@ export const serializeAws_restJson1DescribeUserHierarchyStructureCommand = async input: DescribeUserHierarchyStructureCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/user-hierarchy-structure/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/user-hierarchy-structure/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1668,7 +1713,6 @@ export const serializeAws_restJson1DescribeUserHierarchyStructureCommand = async throw new Error("No value provided for input HTTP label: InstanceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1684,8 +1728,10 @@ export const serializeAws_restJson1DisassociateApprovedOriginCommand = async ( input: DisassociateApprovedOriginCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/approved-origin"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/approved-origin"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1699,7 +1745,6 @@ export const serializeAws_restJson1DisassociateApprovedOriginCommand = async ( ...(input.Origin !== undefined && { origin: input.Origin }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1716,10 +1761,12 @@ export const serializeAws_restJson1DisassociateBotCommand = async ( input: DisassociateBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/bot"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/bot"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1736,7 +1783,6 @@ export const serializeAws_restJson1DisassociateBotCommand = async ( ...(input.LexV2Bot !== undefined && input.LexV2Bot !== null && { LexV2Bot: serializeAws_restJson1LexV2Bot(input.LexV2Bot, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1752,8 +1798,11 @@ export const serializeAws_restJson1DisassociateInstanceStorageConfigCommand = as input: DisassociateInstanceStorageConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/storage-config/{AssociationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/storage-config/{AssociationId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1776,7 +1825,6 @@ export const serializeAws_restJson1DisassociateInstanceStorageConfigCommand = as ...(input.ResourceType !== undefined && { resourceType: input.ResourceType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1793,8 +1841,10 @@ export const serializeAws_restJson1DisassociateLambdaFunctionCommand = async ( input: DisassociateLambdaFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/lambda-function"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/lambda-function"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1808,7 +1858,6 @@ export const serializeAws_restJson1DisassociateLambdaFunctionCommand = async ( ...(input.FunctionArn !== undefined && { functionArn: input.FunctionArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1825,8 +1874,10 @@ export const serializeAws_restJson1DisassociateLexBotCommand = async ( input: DisassociateLexBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/lex-bot"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/lex-bot"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1841,7 +1892,6 @@ export const serializeAws_restJson1DisassociateLexBotCommand = async ( ...(input.LexRegion !== undefined && { lexRegion: input.LexRegion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1858,10 +1908,13 @@ export const serializeAws_restJson1DisassociateQueueQuickConnectsCommand = async input: DisassociateQueueQuickConnectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/queues/{InstanceId}/{QueueId}/disassociate-quick-connects"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/queues/{InstanceId}/{QueueId}/disassociate-quick-connects"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1887,7 +1940,6 @@ export const serializeAws_restJson1DisassociateQueueQuickConnectsCommand = async QuickConnectIds: serializeAws_restJson1QuickConnectsList(input.QuickConnectIds, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1903,10 +1955,13 @@ export const serializeAws_restJson1DisassociateRoutingProfileQueuesCommand = asy input: DisassociateRoutingProfileQueuesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/routing-profiles/{InstanceId}/{RoutingProfileId}/disassociate-queues"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/routing-profiles/{InstanceId}/{RoutingProfileId}/disassociate-queues"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1932,7 +1987,6 @@ export const serializeAws_restJson1DisassociateRoutingProfileQueuesCommand = asy QueueReferences: serializeAws_restJson1RoutingProfileQueueReferenceList(input.QueueReferences, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1948,8 +2002,11 @@ export const serializeAws_restJson1DisassociateSecurityKeyCommand = async ( input: DisassociateSecurityKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/security-key/{AssociationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/security-key/{AssociationId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -1969,7 +2026,6 @@ export const serializeAws_restJson1DisassociateSecurityKeyCommand = async ( throw new Error("No value provided for input HTTP label: AssociationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1985,8 +2041,11 @@ export const serializeAws_restJson1GetContactAttributesCommand = async ( input: GetContactAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/contact/attributes/{InstanceId}/{InitialContactId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/contact/attributes/{InstanceId}/{InitialContactId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2006,7 +2065,6 @@ export const serializeAws_restJson1GetContactAttributesCommand = async ( throw new Error("No value provided for input HTTP label: InitialContactId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2022,10 +2080,12 @@ export const serializeAws_restJson1GetCurrentMetricDataCommand = async ( input: GetCurrentMetricDataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/metrics/current/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/metrics/current/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2048,7 +2108,6 @@ export const serializeAws_restJson1GetCurrentMetricDataCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2064,8 +2123,10 @@ export const serializeAws_restJson1GetFederationTokenCommand = async ( input: GetFederationTokenCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/user/federate/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/user/federate/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2076,7 +2137,6 @@ export const serializeAws_restJson1GetFederationTokenCommand = async ( throw new Error("No value provided for input HTTP label: InstanceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2092,10 +2152,12 @@ export const serializeAws_restJson1GetMetricDataCommand = async ( input: GetMetricDataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/metrics/historical/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/metrics/historical/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2122,7 +2184,6 @@ export const serializeAws_restJson1GetMetricDataCommand = async ( ...(input.StartTime !== undefined && input.StartTime !== null && { StartTime: Math.round(input.StartTime.getTime() / 1000) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2138,8 +2199,10 @@ export const serializeAws_restJson1ListApprovedOriginsCommand = async ( input: ListApprovedOriginsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/approved-origins"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/approved-origins"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2154,7 +2217,6 @@ export const serializeAws_restJson1ListApprovedOriginsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2171,8 +2233,10 @@ export const serializeAws_restJson1ListBotsCommand = async ( input: ListBotsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/bots"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/bots"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2188,7 +2252,6 @@ export const serializeAws_restJson1ListBotsCommand = async ( ...(input.LexVersion !== undefined && { lexVersion: input.LexVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2205,8 +2268,10 @@ export const serializeAws_restJson1ListContactFlowsCommand = async ( input: ListContactFlowsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/contact-flows-summary/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact-flows-summary/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2224,7 +2289,6 @@ export const serializeAws_restJson1ListContactFlowsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2241,8 +2305,10 @@ export const serializeAws_restJson1ListHoursOfOperationsCommand = async ( input: ListHoursOfOperationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/hours-of-operations-summary/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/hours-of-operations-summary/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2257,7 +2323,6 @@ export const serializeAws_restJson1ListHoursOfOperationsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2274,8 +2339,10 @@ export const serializeAws_restJson1ListInstanceAttributesCommand = async ( input: ListInstanceAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/attributes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/attributes"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2290,7 +2357,6 @@ export const serializeAws_restJson1ListInstanceAttributesCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2307,14 +2373,14 @@ export const serializeAws_restJson1ListInstancesCommand = async ( input: ListInstancesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2331,8 +2397,10 @@ export const serializeAws_restJson1ListInstanceStorageConfigsCommand = async ( input: ListInstanceStorageConfigsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/storage-configs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/storage-configs"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2348,7 +2416,6 @@ export const serializeAws_restJson1ListInstanceStorageConfigsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2365,8 +2432,11 @@ export const serializeAws_restJson1ListIntegrationAssociationsCommand = async ( input: ListIntegrationAssociationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/integration-associations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/integration-associations"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2381,7 +2451,6 @@ export const serializeAws_restJson1ListIntegrationAssociationsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2398,8 +2467,10 @@ export const serializeAws_restJson1ListLambdaFunctionsCommand = async ( input: ListLambdaFunctionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/lambda-functions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/lambda-functions"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2414,7 +2485,6 @@ export const serializeAws_restJson1ListLambdaFunctionsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2431,8 +2501,10 @@ export const serializeAws_restJson1ListLexBotsCommand = async ( input: ListLexBotsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/lex-bots"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/lex-bots"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2447,7 +2519,6 @@ export const serializeAws_restJson1ListLexBotsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2464,8 +2535,10 @@ export const serializeAws_restJson1ListPhoneNumbersCommand = async ( input: ListPhoneNumbersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/phone-numbers-summary/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/phone-numbers-summary/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2486,7 +2559,6 @@ export const serializeAws_restJson1ListPhoneNumbersCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2503,8 +2575,10 @@ export const serializeAws_restJson1ListPromptsCommand = async ( input: ListPromptsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prompts-summary/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prompts-summary/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2519,7 +2593,6 @@ export const serializeAws_restJson1ListPromptsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2536,8 +2609,11 @@ export const serializeAws_restJson1ListQueueQuickConnectsCommand = async ( input: ListQueueQuickConnectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/queues/{InstanceId}/{QueueId}/quick-connects"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/queues/{InstanceId}/{QueueId}/quick-connects"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2561,7 +2637,6 @@ export const serializeAws_restJson1ListQueueQuickConnectsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2578,8 +2653,10 @@ export const serializeAws_restJson1ListQueuesCommand = async ( input: ListQueuesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/queues-summary/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/queues-summary/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2595,7 +2672,6 @@ export const serializeAws_restJson1ListQueuesCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2612,8 +2688,10 @@ export const serializeAws_restJson1ListQuickConnectsCommand = async ( input: ListQuickConnectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/quick-connects/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/quick-connects/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2631,7 +2709,6 @@ export const serializeAws_restJson1ListQuickConnectsCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2648,8 +2725,11 @@ export const serializeAws_restJson1ListRoutingProfileQueuesCommand = async ( input: ListRoutingProfileQueuesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/routing-profiles/{InstanceId}/{RoutingProfileId}/queues"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/routing-profiles/{InstanceId}/{RoutingProfileId}/queues"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2673,7 +2753,6 @@ export const serializeAws_restJson1ListRoutingProfileQueuesCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2690,8 +2769,10 @@ export const serializeAws_restJson1ListRoutingProfilesCommand = async ( input: ListRoutingProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/routing-profiles-summary/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/routing-profiles-summary/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2706,7 +2787,6 @@ export const serializeAws_restJson1ListRoutingProfilesCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2723,8 +2803,10 @@ export const serializeAws_restJson1ListSecurityKeysCommand = async ( input: ListSecurityKeysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/security-keys"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/instance/{InstanceId}/security-keys"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2739,7 +2821,6 @@ export const serializeAws_restJson1ListSecurityKeysCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2756,8 +2837,10 @@ export const serializeAws_restJson1ListSecurityProfilesCommand = async ( input: ListSecurityProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/security-profiles-summary/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/security-profiles-summary/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2772,7 +2855,6 @@ export const serializeAws_restJson1ListSecurityProfilesCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2789,8 +2871,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -2801,7 +2884,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2817,8 +2899,11 @@ export const serializeAws_restJson1ListUseCasesCommand = async ( input: ListUseCasesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/instance/{InstanceId}/integration-associations/{IntegrationAssociationId}/use-cases"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/integration-associations/{IntegrationAssociationId}/use-cases"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2842,7 +2927,6 @@ export const serializeAws_restJson1ListUseCasesCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2859,8 +2943,11 @@ export const serializeAws_restJson1ListUserHierarchyGroupsCommand = async ( input: ListUserHierarchyGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/user-hierarchy-groups-summary/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/user-hierarchy-groups-summary/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2875,7 +2962,6 @@ export const serializeAws_restJson1ListUserHierarchyGroupsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2892,8 +2978,10 @@ export const serializeAws_restJson1ListUsersCommand = async ( input: ListUsersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/users-summary/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/users-summary/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -2908,7 +2996,6 @@ export const serializeAws_restJson1ListUsersCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2925,10 +3012,12 @@ export const serializeAws_restJson1ResumeContactRecordingCommand = async ( input: ResumeContactRecordingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact/resume-recording"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/resume-recording"; let body: any; body = JSON.stringify({ ...(input.ContactId !== undefined && input.ContactId !== null && { ContactId: input.ContactId }), @@ -2936,7 +3025,6 @@ export const serializeAws_restJson1ResumeContactRecordingCommand = async ( input.InitialContactId !== null && { InitialContactId: input.InitialContactId }), ...(input.InstanceId !== undefined && input.InstanceId !== null && { InstanceId: input.InstanceId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2952,10 +3040,11 @@ export const serializeAws_restJson1StartChatContactCommand = async ( input: StartChatContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact/chat"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/chat"; let body: any; body = JSON.stringify({ ...(input.Attributes !== undefined && @@ -2972,7 +3061,6 @@ export const serializeAws_restJson1StartChatContactCommand = async ( ParticipantDetails: serializeAws_restJson1ParticipantDetails(input.ParticipantDetails, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2988,10 +3076,11 @@ export const serializeAws_restJson1StartContactRecordingCommand = async ( input: StartContactRecordingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact/start-recording"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/start-recording"; let body: any; body = JSON.stringify({ ...(input.ContactId !== undefined && input.ContactId !== null && { ContactId: input.ContactId }), @@ -3006,7 +3095,6 @@ export const serializeAws_restJson1StartContactRecordingCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3022,10 +3110,11 @@ export const serializeAws_restJson1StartOutboundVoiceContactCommand = async ( input: StartOutboundVoiceContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact/outbound-voice"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/outbound-voice"; let body: any; body = JSON.stringify({ ...(input.Attributes !== undefined && @@ -3039,7 +3128,6 @@ export const serializeAws_restJson1StartOutboundVoiceContactCommand = async ( ...(input.SourcePhoneNumber !== undefined && input.SourcePhoneNumber !== null && { SourcePhoneNumber: input.SourcePhoneNumber }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3055,10 +3143,11 @@ export const serializeAws_restJson1StartTaskContactCommand = async ( input: StartTaskContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact/task"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/task"; let body: any; body = JSON.stringify({ ...(input.Attributes !== undefined && @@ -3073,7 +3162,6 @@ export const serializeAws_restJson1StartTaskContactCommand = async ( ...(input.References !== undefined && input.References !== null && { References: serializeAws_restJson1ContactReferences(input.References, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3089,16 +3177,16 @@ export const serializeAws_restJson1StopContactCommand = async ( input: StopContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact/stop"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/stop"; let body: any; body = JSON.stringify({ ...(input.ContactId !== undefined && input.ContactId !== null && { ContactId: input.ContactId }), ...(input.InstanceId !== undefined && input.InstanceId !== null && { InstanceId: input.InstanceId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3114,10 +3202,11 @@ export const serializeAws_restJson1StopContactRecordingCommand = async ( input: StopContactRecordingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact/stop-recording"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/stop-recording"; let body: any; body = JSON.stringify({ ...(input.ContactId !== undefined && input.ContactId !== null && { ContactId: input.ContactId }), @@ -3125,7 +3214,6 @@ export const serializeAws_restJson1StopContactRecordingCommand = async ( input.InitialContactId !== null && { InitialContactId: input.InitialContactId }), ...(input.InstanceId !== undefined && input.InstanceId !== null && { InstanceId: input.InstanceId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3141,10 +3229,12 @@ export const serializeAws_restJson1SuspendContactRecordingCommand = async ( input: SuspendContactRecordingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact/suspend-recording"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/suspend-recording"; let body: any; body = JSON.stringify({ ...(input.ContactId !== undefined && input.ContactId !== null && { ContactId: input.ContactId }), @@ -3152,7 +3242,6 @@ export const serializeAws_restJson1SuspendContactRecordingCommand = async ( input.InitialContactId !== null && { InitialContactId: input.InitialContactId }), ...(input.InstanceId !== undefined && input.InstanceId !== null && { InstanceId: input.InstanceId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3168,10 +3257,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -3185,7 +3275,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3201,8 +3290,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -3216,7 +3306,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3233,10 +3322,11 @@ export const serializeAws_restJson1UpdateContactAttributesCommand = async ( input: UpdateContactAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact/attributes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/attributes"; let body: any; body = JSON.stringify({ ...(input.Attributes !== undefined && @@ -3245,7 +3335,6 @@ export const serializeAws_restJson1UpdateContactAttributesCommand = async ( input.InitialContactId !== null && { InitialContactId: input.InitialContactId }), ...(input.InstanceId !== undefined && input.InstanceId !== null && { InstanceId: input.InstanceId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3261,10 +3350,13 @@ export const serializeAws_restJson1UpdateContactFlowContentCommand = async ( input: UpdateContactFlowContentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact-flows/{InstanceId}/{ContactFlowId}/content"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/contact-flows/{InstanceId}/{ContactFlowId}/content"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3287,7 +3379,6 @@ export const serializeAws_restJson1UpdateContactFlowContentCommand = async ( body = JSON.stringify({ ...(input.Content !== undefined && input.Content !== null && { Content: input.Content }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3303,10 +3394,13 @@ export const serializeAws_restJson1UpdateContactFlowNameCommand = async ( input: UpdateContactFlowNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact-flows/{InstanceId}/{ContactFlowId}/name"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/contact-flows/{InstanceId}/{ContactFlowId}/name"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3330,7 +3424,6 @@ export const serializeAws_restJson1UpdateContactFlowNameCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3346,10 +3439,13 @@ export const serializeAws_restJson1UpdateInstanceAttributeCommand = async ( input: UpdateInstanceAttributeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/attribute/{AttributeType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/attribute/{AttributeType}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3372,7 +3468,6 @@ export const serializeAws_restJson1UpdateInstanceAttributeCommand = async ( body = JSON.stringify({ ...(input.Value !== undefined && input.Value !== null && { Value: input.Value }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3388,10 +3483,13 @@ export const serializeAws_restJson1UpdateInstanceStorageConfigCommand = async ( input: UpdateInstanceStorageConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/instance/{InstanceId}/storage-config/{AssociationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/instance/{InstanceId}/storage-config/{AssociationId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3420,7 +3518,6 @@ export const serializeAws_restJson1UpdateInstanceStorageConfigCommand = async ( StorageConfig: serializeAws_restJson1InstanceStorageConfig(input.StorageConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3437,10 +3534,13 @@ export const serializeAws_restJson1UpdateQueueHoursOfOperationCommand = async ( input: UpdateQueueHoursOfOperationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/queues/{InstanceId}/{QueueId}/hours-of-operation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/queues/{InstanceId}/{QueueId}/hours-of-operation"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3464,7 +3564,6 @@ export const serializeAws_restJson1UpdateQueueHoursOfOperationCommand = async ( ...(input.HoursOfOperationId !== undefined && input.HoursOfOperationId !== null && { HoursOfOperationId: input.HoursOfOperationId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3480,10 +3579,13 @@ export const serializeAws_restJson1UpdateQueueMaxContactsCommand = async ( input: UpdateQueueMaxContactsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/queues/{InstanceId}/{QueueId}/max-contacts"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/queues/{InstanceId}/{QueueId}/max-contacts"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3506,7 +3608,6 @@ export const serializeAws_restJson1UpdateQueueMaxContactsCommand = async ( body = JSON.stringify({ ...(input.MaxContacts !== undefined && input.MaxContacts !== null && { MaxContacts: input.MaxContacts }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3522,10 +3623,12 @@ export const serializeAws_restJson1UpdateQueueNameCommand = async ( input: UpdateQueueNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/queues/{InstanceId}/{QueueId}/name"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/queues/{InstanceId}/{QueueId}/name"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3549,7 +3652,6 @@ export const serializeAws_restJson1UpdateQueueNameCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3565,10 +3667,13 @@ export const serializeAws_restJson1UpdateQueueOutboundCallerConfigCommand = asyn input: UpdateQueueOutboundCallerConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/queues/{InstanceId}/{QueueId}/outbound-caller-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/queues/{InstanceId}/{QueueId}/outbound-caller-config"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3594,7 +3699,6 @@ export const serializeAws_restJson1UpdateQueueOutboundCallerConfigCommand = asyn OutboundCallerConfig: serializeAws_restJson1OutboundCallerConfig(input.OutboundCallerConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3610,10 +3714,12 @@ export const serializeAws_restJson1UpdateQueueStatusCommand = async ( input: UpdateQueueStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/queues/{InstanceId}/{QueueId}/status"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/queues/{InstanceId}/{QueueId}/status"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3636,7 +3742,6 @@ export const serializeAws_restJson1UpdateQueueStatusCommand = async ( body = JSON.stringify({ ...(input.Status !== undefined && input.Status !== null && { Status: input.Status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3652,10 +3757,13 @@ export const serializeAws_restJson1UpdateQuickConnectConfigCommand = async ( input: UpdateQuickConnectConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/quick-connects/{InstanceId}/{QuickConnectId}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/quick-connects/{InstanceId}/{QuickConnectId}/config"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3681,7 +3789,6 @@ export const serializeAws_restJson1UpdateQuickConnectConfigCommand = async ( QuickConnectConfig: serializeAws_restJson1QuickConnectConfig(input.QuickConnectConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3697,10 +3804,13 @@ export const serializeAws_restJson1UpdateQuickConnectNameCommand = async ( input: UpdateQuickConnectNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/quick-connects/{InstanceId}/{QuickConnectId}/name"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/quick-connects/{InstanceId}/{QuickConnectId}/name"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3724,7 +3834,6 @@ export const serializeAws_restJson1UpdateQuickConnectNameCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3740,10 +3849,13 @@ export const serializeAws_restJson1UpdateRoutingProfileConcurrencyCommand = asyn input: UpdateRoutingProfileConcurrencyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/routing-profiles/{InstanceId}/{RoutingProfileId}/concurrency"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/routing-profiles/{InstanceId}/{RoutingProfileId}/concurrency"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3769,7 +3881,6 @@ export const serializeAws_restJson1UpdateRoutingProfileConcurrencyCommand = asyn MediaConcurrencies: serializeAws_restJson1MediaConcurrencies(input.MediaConcurrencies, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3785,10 +3896,13 @@ export const serializeAws_restJson1UpdateRoutingProfileDefaultOutboundQueueComma input: UpdateRoutingProfileDefaultOutboundQueueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/routing-profiles/{InstanceId}/{RoutingProfileId}/default-outbound-queue"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/routing-profiles/{InstanceId}/{RoutingProfileId}/default-outbound-queue"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3812,7 +3926,6 @@ export const serializeAws_restJson1UpdateRoutingProfileDefaultOutboundQueueComma ...(input.DefaultOutboundQueueId !== undefined && input.DefaultOutboundQueueId !== null && { DefaultOutboundQueueId: input.DefaultOutboundQueueId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3828,10 +3941,13 @@ export const serializeAws_restJson1UpdateRoutingProfileNameCommand = async ( input: UpdateRoutingProfileNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/routing-profiles/{InstanceId}/{RoutingProfileId}/name"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/routing-profiles/{InstanceId}/{RoutingProfileId}/name"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3855,7 +3971,6 @@ export const serializeAws_restJson1UpdateRoutingProfileNameCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3871,10 +3986,13 @@ export const serializeAws_restJson1UpdateRoutingProfileQueuesCommand = async ( input: UpdateRoutingProfileQueuesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/routing-profiles/{InstanceId}/{RoutingProfileId}/queues"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/routing-profiles/{InstanceId}/{RoutingProfileId}/queues"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -3900,7 +4018,6 @@ export const serializeAws_restJson1UpdateRoutingProfileQueuesCommand = async ( QueueConfigs: serializeAws_restJson1RoutingProfileQueueConfigList(input.QueueConfigs, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3916,10 +4033,12 @@ export const serializeAws_restJson1UpdateUserHierarchyCommand = async ( input: UpdateUserHierarchyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/users/{InstanceId}/{UserId}/hierarchy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/users/{InstanceId}/{UserId}/hierarchy"; if (input.UserId !== undefined) { const labelValue: string = input.UserId; if (labelValue.length <= 0) { @@ -3943,7 +4062,6 @@ export const serializeAws_restJson1UpdateUserHierarchyCommand = async ( ...(input.HierarchyGroupId !== undefined && input.HierarchyGroupId !== null && { HierarchyGroupId: input.HierarchyGroupId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3959,10 +4077,13 @@ export const serializeAws_restJson1UpdateUserHierarchyGroupNameCommand = async ( input: UpdateUserHierarchyGroupNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/user-hierarchy-groups/{InstanceId}/{HierarchyGroupId}/name"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/user-hierarchy-groups/{InstanceId}/{HierarchyGroupId}/name"; if (input.HierarchyGroupId !== undefined) { const labelValue: string = input.HierarchyGroupId; if (labelValue.length <= 0) { @@ -3985,7 +4106,6 @@ export const serializeAws_restJson1UpdateUserHierarchyGroupNameCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4001,10 +4121,12 @@ export const serializeAws_restJson1UpdateUserHierarchyStructureCommand = async ( input: UpdateUserHierarchyStructureCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/user-hierarchy-structure/{InstanceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/user-hierarchy-structure/{InstanceId}"; if (input.InstanceId !== undefined) { const labelValue: string = input.InstanceId; if (labelValue.length <= 0) { @@ -4021,7 +4143,6 @@ export const serializeAws_restJson1UpdateUserHierarchyStructureCommand = async ( HierarchyStructure: serializeAws_restJson1HierarchyStructureUpdate(input.HierarchyStructure, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4037,10 +4158,13 @@ export const serializeAws_restJson1UpdateUserIdentityInfoCommand = async ( input: UpdateUserIdentityInfoCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/users/{InstanceId}/{UserId}/identity-info"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/users/{InstanceId}/{UserId}/identity-info"; if (input.UserId !== undefined) { const labelValue: string = input.UserId; if (labelValue.length <= 0) { @@ -4066,7 +4190,6 @@ export const serializeAws_restJson1UpdateUserIdentityInfoCommand = async ( IdentityInfo: serializeAws_restJson1UserIdentityInfo(input.IdentityInfo, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4082,10 +4205,12 @@ export const serializeAws_restJson1UpdateUserPhoneConfigCommand = async ( input: UpdateUserPhoneConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/users/{InstanceId}/{UserId}/phone-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/users/{InstanceId}/{UserId}/phone-config"; if (input.UserId !== undefined) { const labelValue: string = input.UserId; if (labelValue.length <= 0) { @@ -4109,7 +4234,6 @@ export const serializeAws_restJson1UpdateUserPhoneConfigCommand = async ( ...(input.PhoneConfig !== undefined && input.PhoneConfig !== null && { PhoneConfig: serializeAws_restJson1UserPhoneConfig(input.PhoneConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4125,10 +4249,13 @@ export const serializeAws_restJson1UpdateUserRoutingProfileCommand = async ( input: UpdateUserRoutingProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/users/{InstanceId}/{UserId}/routing-profile"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/users/{InstanceId}/{UserId}/routing-profile"; if (input.UserId !== undefined) { const labelValue: string = input.UserId; if (labelValue.length <= 0) { @@ -4152,7 +4279,6 @@ export const serializeAws_restJson1UpdateUserRoutingProfileCommand = async ( ...(input.RoutingProfileId !== undefined && input.RoutingProfileId !== null && { RoutingProfileId: input.RoutingProfileId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4168,10 +4294,13 @@ export const serializeAws_restJson1UpdateUserSecurityProfilesCommand = async ( input: UpdateUserSecurityProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/users/{InstanceId}/{UserId}/security-profiles"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/users/{InstanceId}/{UserId}/security-profiles"; if (input.UserId !== undefined) { const labelValue: string = input.UserId; if (labelValue.length <= 0) { @@ -4197,7 +4326,6 @@ export const serializeAws_restJson1UpdateUserSecurityProfilesCommand = async ( SecurityProfileIds: serializeAws_restJson1SecurityProfileIds(input.SecurityProfileIds, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-connectparticipant/protocols/Aws_restJson1.ts b/clients/client-connectparticipant/protocols/Aws_restJson1.ts index 30f6593f61bb8..822b1dee1c156 100644 --- a/clients/client-connectparticipant/protocols/Aws_restJson1.ts +++ b/clients/client-connectparticipant/protocols/Aws_restJson1.ts @@ -47,11 +47,13 @@ export const serializeAws_restJson1CompleteAttachmentUploadCommand = async ( input: CompleteAttachmentUploadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken! }), }; - let resolvedPath = "/participant/complete-attachment-upload"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/complete-attachment-upload"; let body: any; body = JSON.stringify({ ...(input.AttachmentIds !== undefined && @@ -60,7 +62,6 @@ export const serializeAws_restJson1CompleteAttachmentUploadCommand = async ( }), ClientToken: input.ClientToken ?? generateIdempotencyToken(), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -76,17 +77,17 @@ export const serializeAws_restJson1CreateParticipantConnectionCommand = async ( input: CreateParticipantConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ParticipantToken) && { "x-amz-bearer": input.ParticipantToken! }), }; - let resolvedPath = "/participant/connection"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/connection"; let body: any; body = JSON.stringify({ ...(input.Type !== undefined && input.Type !== null && { Type: serializeAws_restJson1ConnectionTypeList(input.Type, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -102,16 +103,16 @@ export const serializeAws_restJson1DisconnectParticipantCommand = async ( input: DisconnectParticipantCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken! }), }; - let resolvedPath = "/participant/disconnect"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/disconnect"; let body: any; body = JSON.stringify({ ClientToken: input.ClientToken ?? generateIdempotencyToken(), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -127,16 +128,16 @@ export const serializeAws_restJson1GetAttachmentCommand = async ( input: GetAttachmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken! }), }; - let resolvedPath = "/participant/attachment"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/attachment"; let body: any; body = JSON.stringify({ ...(input.AttachmentId !== undefined && input.AttachmentId !== null && { AttachmentId: input.AttachmentId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -152,11 +153,12 @@ export const serializeAws_restJson1GetTranscriptCommand = async ( input: GetTranscriptCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken! }), }; - let resolvedPath = "/participant/transcript"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/transcript"; let body: any; body = JSON.stringify({ ...(input.ContactId !== undefined && input.ContactId !== null && { ContactId: input.ContactId }), @@ -169,7 +171,6 @@ export const serializeAws_restJson1GetTranscriptCommand = async ( StartPosition: serializeAws_restJson1StartPosition(input.StartPosition, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -185,18 +186,18 @@ export const serializeAws_restJson1SendEventCommand = async ( input: SendEventCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken! }), }; - let resolvedPath = "/participant/event"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/event"; let body: any; body = JSON.stringify({ ClientToken: input.ClientToken ?? generateIdempotencyToken(), ...(input.Content !== undefined && input.Content !== null && { Content: input.Content }), ...(input.ContentType !== undefined && input.ContentType !== null && { ContentType: input.ContentType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -212,18 +213,18 @@ export const serializeAws_restJson1SendMessageCommand = async ( input: SendMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken! }), }; - let resolvedPath = "/participant/message"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/message"; let body: any; body = JSON.stringify({ ClientToken: input.ClientToken ?? generateIdempotencyToken(), ...(input.Content !== undefined && input.Content !== null && { Content: input.Content }), ...(input.ContentType !== undefined && input.ContentType !== null && { ContentType: input.ContentType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -239,11 +240,13 @@ export const serializeAws_restJson1StartAttachmentUploadCommand = async ( input: StartAttachmentUploadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ConnectionToken) && { "x-amz-bearer": input.ConnectionToken! }), }; - let resolvedPath = "/participant/start-attachment-upload"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/participant/start-attachment-upload"; let body: any; body = JSON.stringify({ ...(input.AttachmentName !== undefined && @@ -253,7 +256,6 @@ export const serializeAws_restJson1StartAttachmentUploadCommand = async ( ClientToken: input.ClientToken ?? generateIdempotencyToken(), ...(input.ContentType !== undefined && input.ContentType !== null && { ContentType: input.ContentType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-customer-profiles/protocols/Aws_restJson1.ts b/clients/client-customer-profiles/protocols/Aws_restJson1.ts index 2bb85d788148b..10419d18d35a2 100644 --- a/clients/client-customer-profiles/protocols/Aws_restJson1.ts +++ b/clients/client-customer-profiles/protocols/Aws_restJson1.ts @@ -112,10 +112,12 @@ export const serializeAws_restJson1AddProfileKeyCommand = async ( input: AddProfileKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/profiles/keys"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/profiles/keys"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -132,7 +134,6 @@ export const serializeAws_restJson1AddProfileKeyCommand = async ( ...(input.Values !== undefined && input.Values !== null && { Values: serializeAws_restJson1requestValueList(input.Values, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -148,10 +149,11 @@ export const serializeAws_restJson1CreateDomainCommand = async ( input: CreateDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -173,7 +175,6 @@ export const serializeAws_restJson1CreateDomainCommand = async ( input.Matching !== null && { Matching: serializeAws_restJson1MatchingRequest(input.Matching, context) }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -189,10 +190,12 @@ export const serializeAws_restJson1CreateProfileCommand = async ( input: CreateProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/profiles"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/profiles"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -243,7 +246,6 @@ export const serializeAws_restJson1CreateProfileCommand = async ( ShippingAddress: serializeAws_restJson1Address(input.ShippingAddress, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -259,8 +261,9 @@ export const serializeAws_restJson1DeleteDomainCommand = async ( input: DeleteDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domains/{DomainName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -271,7 +274,6 @@ export const serializeAws_restJson1DeleteDomainCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -287,10 +289,12 @@ export const serializeAws_restJson1DeleteIntegrationCommand = async ( input: DeleteIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/integrations/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/integrations/delete"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -304,7 +308,6 @@ export const serializeAws_restJson1DeleteIntegrationCommand = async ( body = JSON.stringify({ ...(input.Uri !== undefined && input.Uri !== null && { Uri: input.Uri }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -320,10 +323,12 @@ export const serializeAws_restJson1DeleteProfileCommand = async ( input: DeleteProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/profiles/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/profiles/delete"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -337,7 +342,6 @@ export const serializeAws_restJson1DeleteProfileCommand = async ( body = JSON.stringify({ ...(input.ProfileId !== undefined && input.ProfileId !== null && { ProfileId: input.ProfileId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -353,10 +357,13 @@ export const serializeAws_restJson1DeleteProfileKeyCommand = async ( input: DeleteProfileKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/profiles/keys/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domains/{DomainName}/profiles/keys/delete"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -373,7 +380,6 @@ export const serializeAws_restJson1DeleteProfileKeyCommand = async ( ...(input.Values !== undefined && input.Values !== null && { Values: serializeAws_restJson1requestValueList(input.Values, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -389,10 +395,13 @@ export const serializeAws_restJson1DeleteProfileObjectCommand = async ( input: DeleteProfileObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/profiles/objects/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domains/{DomainName}/profiles/objects/delete"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -410,7 +419,6 @@ export const serializeAws_restJson1DeleteProfileObjectCommand = async ( ...(input.ProfileObjectUniqueKey !== undefined && input.ProfileObjectUniqueKey !== null && { ProfileObjectUniqueKey: input.ProfileObjectUniqueKey }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -426,8 +434,11 @@ export const serializeAws_restJson1DeleteProfileObjectTypeCommand = async ( input: DeleteProfileObjectTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domains/{DomainName}/object-types/{ObjectTypeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domains/{DomainName}/object-types/{ObjectTypeName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -447,7 +458,6 @@ export const serializeAws_restJson1DeleteProfileObjectTypeCommand = async ( throw new Error("No value provided for input HTTP label: ObjectTypeName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -463,8 +473,9 @@ export const serializeAws_restJson1GetDomainCommand = async ( input: GetDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domains/{DomainName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -475,7 +486,6 @@ export const serializeAws_restJson1GetDomainCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -491,10 +501,12 @@ export const serializeAws_restJson1GetIntegrationCommand = async ( input: GetIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/integrations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/integrations"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -508,7 +520,6 @@ export const serializeAws_restJson1GetIntegrationCommand = async ( body = JSON.stringify({ ...(input.Uri !== undefined && input.Uri !== null && { Uri: input.Uri }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -524,8 +535,10 @@ export const serializeAws_restJson1GetMatchesCommand = async ( input: GetMatchesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domains/{DomainName}/matches"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/matches"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -540,7 +553,6 @@ export const serializeAws_restJson1GetMatchesCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -557,8 +569,11 @@ export const serializeAws_restJson1GetProfileObjectTypeCommand = async ( input: GetProfileObjectTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domains/{DomainName}/object-types/{ObjectTypeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domains/{DomainName}/object-types/{ObjectTypeName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -578,7 +593,6 @@ export const serializeAws_restJson1GetProfileObjectTypeCommand = async ( throw new Error("No value provided for input HTTP label: ObjectTypeName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -594,8 +608,9 @@ export const serializeAws_restJson1GetProfileObjectTypeTemplateCommand = async ( input: GetProfileObjectTypeTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/templates/{TemplateId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/templates/{TemplateId}"; if (input.TemplateId !== undefined) { const labelValue: string = input.TemplateId; if (labelValue.length <= 0) { @@ -606,7 +621,6 @@ export const serializeAws_restJson1GetProfileObjectTypeTemplateCommand = async ( throw new Error("No value provided for input HTTP label: TemplateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -622,10 +636,11 @@ export const serializeAws_restJson1ListAccountIntegrationsCommand = async ( input: ListAccountIntegrationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/integrations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/integrations"; const query: any = { ...(input.NextToken !== undefined && { "next-token": input.NextToken }), ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), @@ -634,7 +649,6 @@ export const serializeAws_restJson1ListAccountIntegrationsCommand = async ( body = JSON.stringify({ ...(input.Uri !== undefined && input.Uri !== null && { Uri: input.Uri }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -651,14 +665,14 @@ export const serializeAws_restJson1ListDomainsCommand = async ( input: ListDomainsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domains"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains"; const query: any = { ...(input.NextToken !== undefined && { "next-token": input.NextToken }), ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -675,8 +689,10 @@ export const serializeAws_restJson1ListIntegrationsCommand = async ( input: ListIntegrationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domains/{DomainName}/integrations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/integrations"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -691,7 +707,6 @@ export const serializeAws_restJson1ListIntegrationsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -708,10 +723,12 @@ export const serializeAws_restJson1ListProfileObjectsCommand = async ( input: ListProfileObjectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/profiles/objects"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/profiles/objects"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -731,7 +748,6 @@ export const serializeAws_restJson1ListProfileObjectsCommand = async ( input.ObjectTypeName !== null && { ObjectTypeName: input.ObjectTypeName }), ...(input.ProfileId !== undefined && input.ProfileId !== null && { ProfileId: input.ProfileId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -748,8 +764,10 @@ export const serializeAws_restJson1ListProfileObjectTypesCommand = async ( input: ListProfileObjectTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domains/{DomainName}/object-types"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/object-types"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -764,7 +782,6 @@ export const serializeAws_restJson1ListProfileObjectTypesCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -781,14 +798,14 @@ export const serializeAws_restJson1ListProfileObjectTypeTemplatesCommand = async input: ListProfileObjectTypeTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/templates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/templates"; const query: any = { ...(input.NextToken !== undefined && { "next-token": input.NextToken }), ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -805,8 +822,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -817,7 +835,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -833,10 +850,13 @@ export const serializeAws_restJson1MergeProfilesCommand = async ( input: MergeProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/profiles/objects/merge"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domains/{DomainName}/profiles/objects/merge"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -858,7 +878,6 @@ export const serializeAws_restJson1MergeProfilesCommand = async ( ProfileIdsToBeMerged: serializeAws_restJson1ProfileIdToBeMergedList(input.ProfileIdsToBeMerged, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -874,10 +893,12 @@ export const serializeAws_restJson1PutIntegrationCommand = async ( input: PutIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/integrations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/integrations"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -898,7 +919,6 @@ export const serializeAws_restJson1PutIntegrationCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), ...(input.Uri !== undefined && input.Uri !== null && { Uri: input.Uri }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -914,10 +934,12 @@ export const serializeAws_restJson1PutProfileObjectCommand = async ( input: PutProfileObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/profiles/objects"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/profiles/objects"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -933,7 +955,6 @@ export const serializeAws_restJson1PutProfileObjectCommand = async ( ...(input.ObjectTypeName !== undefined && input.ObjectTypeName !== null && { ObjectTypeName: input.ObjectTypeName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -949,10 +970,13 @@ export const serializeAws_restJson1PutProfileObjectTypeCommand = async ( input: PutProfileObjectTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/object-types/{ObjectTypeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domains/{DomainName}/object-types/{ObjectTypeName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -985,7 +1009,6 @@ export const serializeAws_restJson1PutProfileObjectTypeCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), ...(input.TemplateId !== undefined && input.TemplateId !== null && { TemplateId: input.TemplateId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1001,10 +1024,12 @@ export const serializeAws_restJson1SearchProfilesCommand = async ( input: SearchProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/profiles/search"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/profiles/search"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -1024,7 +1049,6 @@ export const serializeAws_restJson1SearchProfilesCommand = async ( ...(input.Values !== undefined && input.Values !== null && { Values: serializeAws_restJson1requestValueList(input.Values, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1041,10 +1065,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1058,7 +1083,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1074,8 +1098,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1089,7 +1114,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1106,10 +1130,11 @@ export const serializeAws_restJson1UpdateDomainCommand = async ( input: UpdateDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -1131,7 +1156,6 @@ export const serializeAws_restJson1UpdateDomainCommand = async ( input.Matching !== null && { Matching: serializeAws_restJson1MatchingRequest(input.Matching, context) }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1147,10 +1171,12 @@ export const serializeAws_restJson1UpdateProfileCommand = async ( input: UpdateProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domains/{DomainName}/profiles"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domains/{DomainName}/profiles"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -1202,7 +1228,6 @@ export const serializeAws_restJson1UpdateProfileCommand = async ( ShippingAddress: serializeAws_restJson1UpdateAddress(input.ShippingAddress, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-databrew/protocols/Aws_restJson1.ts b/clients/client-databrew/protocols/Aws_restJson1.ts index fca164dc83d89..210b388ce01fd 100644 --- a/clients/client-databrew/protocols/Aws_restJson1.ts +++ b/clients/client-databrew/protocols/Aws_restJson1.ts @@ -112,10 +112,12 @@ export const serializeAws_restJson1BatchDeleteRecipeVersionCommand = async ( input: BatchDeleteRecipeVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/recipes/{Name}/batchDeleteRecipeVersion"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recipes/{Name}/batchDeleteRecipeVersion"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -132,7 +134,6 @@ export const serializeAws_restJson1BatchDeleteRecipeVersionCommand = async ( RecipeVersions: serializeAws_restJson1RecipeVersionList(input.RecipeVersions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -148,10 +149,11 @@ export const serializeAws_restJson1CreateDatasetCommand = async ( input: CreateDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datasets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets"; let body: any; body = JSON.stringify({ ...(input.Format !== undefined && input.Format !== null && { Format: input.Format }), @@ -166,7 +168,6 @@ export const serializeAws_restJson1CreateDatasetCommand = async ( input.PathOptions !== null && { PathOptions: serializeAws_restJson1PathOptions(input.PathOptions, context) }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -182,10 +183,11 @@ export const serializeAws_restJson1CreateProfileJobCommand = async ( input: CreateProfileJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/profileJobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/profileJobs"; let body: any; body = JSON.stringify({ ...(input.DatasetName !== undefined && input.DatasetName !== null && { DatasetName: input.DatasetName }), @@ -208,7 +210,6 @@ export const serializeAws_restJson1CreateProfileJobCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), ...(input.Timeout !== undefined && input.Timeout !== null && { Timeout: input.Timeout }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -224,10 +225,11 @@ export const serializeAws_restJson1CreateProjectCommand = async ( input: CreateProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects"; let body: any; body = JSON.stringify({ ...(input.DatasetName !== undefined && input.DatasetName !== null && { DatasetName: input.DatasetName }), @@ -238,7 +240,6 @@ export const serializeAws_restJson1CreateProjectCommand = async ( input.Sample !== null && { Sample: serializeAws_restJson1Sample(input.Sample, context) }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -254,10 +255,11 @@ export const serializeAws_restJson1CreateRecipeCommand = async ( input: CreateRecipeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/recipes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recipes"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), @@ -266,7 +268,6 @@ export const serializeAws_restJson1CreateRecipeCommand = async ( input.Steps !== null && { Steps: serializeAws_restJson1RecipeStepList(input.Steps, context) }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -282,10 +283,11 @@ export const serializeAws_restJson1CreateRecipeJobCommand = async ( input: CreateRecipeJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/recipeJobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recipeJobs"; let body: any; body = JSON.stringify({ ...(input.DataCatalogOutputs !== undefined && @@ -313,7 +315,6 @@ export const serializeAws_restJson1CreateRecipeJobCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), ...(input.Timeout !== undefined && input.Timeout !== null && { Timeout: input.Timeout }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -329,10 +330,11 @@ export const serializeAws_restJson1CreateScheduleCommand = async ( input: CreateScheduleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/schedules"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/schedules"; let body: any; body = JSON.stringify({ ...(input.CronExpression !== undefined && @@ -342,7 +344,6 @@ export const serializeAws_restJson1CreateScheduleCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -358,8 +359,9 @@ export const serializeAws_restJson1DeleteDatasetCommand = async ( input: DeleteDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datasets/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -370,7 +372,6 @@ export const serializeAws_restJson1DeleteDatasetCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -386,8 +387,9 @@ export const serializeAws_restJson1DeleteJobCommand = async ( input: DeleteJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -398,7 +400,6 @@ export const serializeAws_restJson1DeleteJobCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -414,8 +415,9 @@ export const serializeAws_restJson1DeleteProjectCommand = async ( input: DeleteProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -426,7 +428,6 @@ export const serializeAws_restJson1DeleteProjectCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -442,8 +443,11 @@ export const serializeAws_restJson1DeleteRecipeVersionCommand = async ( input: DeleteRecipeVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/recipes/{Name}/recipeVersion/{RecipeVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/recipes/{Name}/recipeVersion/{RecipeVersion}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -463,7 +467,6 @@ export const serializeAws_restJson1DeleteRecipeVersionCommand = async ( throw new Error("No value provided for input HTTP label: RecipeVersion."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -479,8 +482,9 @@ export const serializeAws_restJson1DeleteScheduleCommand = async ( input: DeleteScheduleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/schedules/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/schedules/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -491,7 +495,6 @@ export const serializeAws_restJson1DeleteScheduleCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -507,8 +510,9 @@ export const serializeAws_restJson1DescribeDatasetCommand = async ( input: DescribeDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datasets/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -519,7 +523,6 @@ export const serializeAws_restJson1DescribeDatasetCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -535,8 +538,9 @@ export const serializeAws_restJson1DescribeJobCommand = async ( input: DescribeJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -547,7 +551,6 @@ export const serializeAws_restJson1DescribeJobCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -563,8 +566,10 @@ export const serializeAws_restJson1DescribeJobRunCommand = async ( input: DescribeJobRunCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{Name}/jobRun/{RunId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{Name}/jobRun/{RunId}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -584,7 +589,6 @@ export const serializeAws_restJson1DescribeJobRunCommand = async ( throw new Error("No value provided for input HTTP label: RunId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -600,8 +604,9 @@ export const serializeAws_restJson1DescribeProjectCommand = async ( input: DescribeProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -612,7 +617,6 @@ export const serializeAws_restJson1DescribeProjectCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -628,8 +632,9 @@ export const serializeAws_restJson1DescribeRecipeCommand = async ( input: DescribeRecipeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/recipes/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recipes/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -643,7 +648,6 @@ export const serializeAws_restJson1DescribeRecipeCommand = async ( ...(input.RecipeVersion !== undefined && { recipeVersion: input.RecipeVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -660,8 +664,9 @@ export const serializeAws_restJson1DescribeScheduleCommand = async ( input: DescribeScheduleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/schedules/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/schedules/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -672,7 +677,6 @@ export const serializeAws_restJson1DescribeScheduleCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -688,14 +692,14 @@ export const serializeAws_restJson1ListDatasetsCommand = async ( input: ListDatasetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datasets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -712,8 +716,9 @@ export const serializeAws_restJson1ListJobRunsCommand = async ( input: ListJobRunsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{Name}/jobRuns"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{Name}/jobRuns"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -728,7 +733,6 @@ export const serializeAws_restJson1ListJobRunsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -745,8 +749,9 @@ export const serializeAws_restJson1ListJobsCommand = async ( input: ListJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs"; const query: any = { ...(input.DatasetName !== undefined && { datasetName: input.DatasetName }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), @@ -754,7 +759,6 @@ export const serializeAws_restJson1ListJobsCommand = async ( ...(input.ProjectName !== undefined && { projectName: input.ProjectName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -771,14 +775,14 @@ export const serializeAws_restJson1ListProjectsCommand = async ( input: ListProjectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -795,15 +799,15 @@ export const serializeAws_restJson1ListRecipesCommand = async ( input: ListRecipesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/recipes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recipes"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.RecipeVersion !== undefined && { recipeVersion: input.RecipeVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -820,15 +824,15 @@ export const serializeAws_restJson1ListRecipeVersionsCommand = async ( input: ListRecipeVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/recipeVersions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recipeVersions"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.Name !== undefined && { name: input.Name }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -845,15 +849,15 @@ export const serializeAws_restJson1ListSchedulesCommand = async ( input: ListSchedulesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/schedules"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/schedules"; const query: any = { ...(input.JobName !== undefined && { jobName: input.JobName }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -870,8 +874,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -882,7 +887,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -898,10 +902,12 @@ export const serializeAws_restJson1PublishRecipeCommand = async ( input: PublishRecipeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/recipes/{Name}/publishRecipe"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recipes/{Name}/publishRecipe"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -915,7 +921,6 @@ export const serializeAws_restJson1PublishRecipeCommand = async ( body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -931,10 +936,12 @@ export const serializeAws_restJson1SendProjectSessionActionCommand = async ( input: SendProjectSessionActionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects/{Name}/sendProjectSessionAction"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{Name}/sendProjectSessionAction"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -955,7 +962,6 @@ export const serializeAws_restJson1SendProjectSessionActionCommand = async ( ...(input.ViewFrame !== undefined && input.ViewFrame !== null && { ViewFrame: serializeAws_restJson1ViewFrame(input.ViewFrame, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -971,8 +977,9 @@ export const serializeAws_restJson1StartJobRunCommand = async ( input: StartJobRunCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{Name}/startJobRun"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{Name}/startJobRun"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -983,7 +990,6 @@ export const serializeAws_restJson1StartJobRunCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -999,10 +1005,12 @@ export const serializeAws_restJson1StartProjectSessionCommand = async ( input: StartProjectSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects/{Name}/startProjectSession"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{Name}/startProjectSession"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1016,7 +1024,6 @@ export const serializeAws_restJson1StartProjectSessionCommand = async ( body = JSON.stringify({ ...(input.AssumeControl !== undefined && input.AssumeControl !== null && { AssumeControl: input.AssumeControl }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1032,8 +1039,10 @@ export const serializeAws_restJson1StopJobRunCommand = async ( input: StopJobRunCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{Name}/jobRun/{RunId}/stopJobRun"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{Name}/jobRun/{RunId}/stopJobRun"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1053,7 +1062,6 @@ export const serializeAws_restJson1StopJobRunCommand = async ( throw new Error("No value provided for input HTTP label: RunId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1069,10 +1077,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1086,7 +1095,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1102,8 +1110,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1117,7 +1126,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1134,10 +1142,11 @@ export const serializeAws_restJson1UpdateDatasetCommand = async ( input: UpdateDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datasets/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1159,7 +1168,6 @@ export const serializeAws_restJson1UpdateDatasetCommand = async ( ...(input.PathOptions !== undefined && input.PathOptions !== null && { PathOptions: serializeAws_restJson1PathOptions(input.PathOptions, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1175,10 +1183,11 @@ export const serializeAws_restJson1UpdateProfileJobCommand = async ( input: UpdateProfileJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/profileJobs/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/profileJobs/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1207,7 +1216,6 @@ export const serializeAws_restJson1UpdateProfileJobCommand = async ( ...(input.RoleArn !== undefined && input.RoleArn !== null && { RoleArn: input.RoleArn }), ...(input.Timeout !== undefined && input.Timeout !== null && { Timeout: input.Timeout }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1223,10 +1231,11 @@ export const serializeAws_restJson1UpdateProjectCommand = async ( input: UpdateProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1242,7 +1251,6 @@ export const serializeAws_restJson1UpdateProjectCommand = async ( ...(input.Sample !== undefined && input.Sample !== null && { Sample: serializeAws_restJson1Sample(input.Sample, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1258,10 +1266,11 @@ export const serializeAws_restJson1UpdateRecipeCommand = async ( input: UpdateRecipeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/recipes/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recipes/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1277,7 +1286,6 @@ export const serializeAws_restJson1UpdateRecipeCommand = async ( ...(input.Steps !== undefined && input.Steps !== null && { Steps: serializeAws_restJson1RecipeStepList(input.Steps, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1293,10 +1301,11 @@ export const serializeAws_restJson1UpdateRecipeJobCommand = async ( input: UpdateRecipeJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/recipeJobs/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recipeJobs/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1325,7 +1334,6 @@ export const serializeAws_restJson1UpdateRecipeJobCommand = async ( ...(input.RoleArn !== undefined && input.RoleArn !== null && { RoleArn: input.RoleArn }), ...(input.Timeout !== undefined && input.Timeout !== null && { Timeout: input.Timeout }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1341,10 +1349,11 @@ export const serializeAws_restJson1UpdateScheduleCommand = async ( input: UpdateScheduleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/schedules/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/schedules/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1361,7 +1370,6 @@ export const serializeAws_restJson1UpdateScheduleCommand = async ( ...(input.JobNames !== undefined && input.JobNames !== null && { JobNames: serializeAws_restJson1JobNameList(input.JobNames, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-dataexchange/protocols/Aws_restJson1.ts b/clients/client-dataexchange/protocols/Aws_restJson1.ts index 7670c210d3b36..f006693032457 100644 --- a/clients/client-dataexchange/protocols/Aws_restJson1.ts +++ b/clients/client-dataexchange/protocols/Aws_restJson1.ts @@ -80,8 +80,9 @@ export const serializeAws_restJson1CancelJobCommand = async ( input: CancelJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/jobs/{JobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/jobs/{JobId}"; if (input.JobId !== undefined) { const labelValue: string = input.JobId; if (labelValue.length <= 0) { @@ -92,7 +93,6 @@ export const serializeAws_restJson1CancelJobCommand = async ( throw new Error("No value provided for input HTTP label: JobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -108,10 +108,11 @@ export const serializeAws_restJson1CreateDataSetCommand = async ( input: CreateDataSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/data-sets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/data-sets"; let body: any; body = JSON.stringify({ ...(input.AssetType !== undefined && input.AssetType !== null && { AssetType: input.AssetType }), @@ -120,7 +121,6 @@ export const serializeAws_restJson1CreateDataSetCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1MapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -136,17 +136,17 @@ export const serializeAws_restJson1CreateJobCommand = async ( input: CreateJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/jobs"; let body: any; body = JSON.stringify({ ...(input.Details !== undefined && input.Details !== null && { Details: serializeAws_restJson1RequestDetails(input.Details, context) }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -162,10 +162,12 @@ export const serializeAws_restJson1CreateRevisionCommand = async ( input: CreateRevisionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/data-sets/{DataSetId}/revisions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/data-sets/{DataSetId}/revisions"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -181,7 +183,6 @@ export const serializeAws_restJson1CreateRevisionCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1MapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -197,8 +198,11 @@ export const serializeAws_restJson1DeleteAssetCommand = async ( input: DeleteAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets/{AssetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets/{AssetId}"; if (input.AssetId !== undefined) { const labelValue: string = input.AssetId; if (labelValue.length <= 0) { @@ -227,7 +231,6 @@ export const serializeAws_restJson1DeleteAssetCommand = async ( throw new Error("No value provided for input HTTP label: RevisionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -243,8 +246,10 @@ export const serializeAws_restJson1DeleteDataSetCommand = async ( input: DeleteDataSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/data-sets/{DataSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/data-sets/{DataSetId}"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -255,7 +260,6 @@ export const serializeAws_restJson1DeleteDataSetCommand = async ( throw new Error("No value provided for input HTTP label: DataSetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -271,8 +275,11 @@ export const serializeAws_restJson1DeleteRevisionCommand = async ( input: DeleteRevisionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/data-sets/{DataSetId}/revisions/{RevisionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -292,7 +299,6 @@ export const serializeAws_restJson1DeleteRevisionCommand = async ( throw new Error("No value provided for input HTTP label: RevisionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -308,8 +314,11 @@ export const serializeAws_restJson1GetAssetCommand = async ( input: GetAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets/{AssetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets/{AssetId}"; if (input.AssetId !== undefined) { const labelValue: string = input.AssetId; if (labelValue.length <= 0) { @@ -338,7 +347,6 @@ export const serializeAws_restJson1GetAssetCommand = async ( throw new Error("No value provided for input HTTP label: RevisionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -354,8 +362,10 @@ export const serializeAws_restJson1GetDataSetCommand = async ( input: GetDataSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/data-sets/{DataSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/data-sets/{DataSetId}"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -366,7 +376,6 @@ export const serializeAws_restJson1GetDataSetCommand = async ( throw new Error("No value provided for input HTTP label: DataSetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -382,8 +391,9 @@ export const serializeAws_restJson1GetJobCommand = async ( input: GetJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/jobs/{JobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/jobs/{JobId}"; if (input.JobId !== undefined) { const labelValue: string = input.JobId; if (labelValue.length <= 0) { @@ -394,7 +404,6 @@ export const serializeAws_restJson1GetJobCommand = async ( throw new Error("No value provided for input HTTP label: JobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -410,8 +419,11 @@ export const serializeAws_restJson1GetRevisionCommand = async ( input: GetRevisionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/data-sets/{DataSetId}/revisions/{RevisionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -431,7 +443,6 @@ export const serializeAws_restJson1GetRevisionCommand = async ( throw new Error("No value provided for input HTTP label: RevisionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -447,8 +458,10 @@ export const serializeAws_restJson1ListDataSetRevisionsCommand = async ( input: ListDataSetRevisionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/data-sets/{DataSetId}/revisions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/data-sets/{DataSetId}/revisions"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -463,7 +476,6 @@ export const serializeAws_restJson1ListDataSetRevisionsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -480,15 +492,15 @@ export const serializeAws_restJson1ListDataSetsCommand = async ( input: ListDataSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/data-sets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/data-sets"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.Origin !== undefined && { origin: input.Origin }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -505,8 +517,9 @@ export const serializeAws_restJson1ListJobsCommand = async ( input: ListJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/jobs"; const query: any = { ...(input.DataSetId !== undefined && { dataSetId: input.DataSetId }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), @@ -514,7 +527,6 @@ export const serializeAws_restJson1ListJobsCommand = async ( ...(input.RevisionId !== undefined && { revisionId: input.RevisionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -531,8 +543,11 @@ export const serializeAws_restJson1ListRevisionAssetsCommand = async ( input: ListRevisionAssetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -556,7 +571,6 @@ export const serializeAws_restJson1ListRevisionAssetsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -573,8 +587,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -585,7 +600,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -601,8 +615,9 @@ export const serializeAws_restJson1StartJobCommand = async ( input: StartJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/jobs/{JobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/jobs/{JobId}"; if (input.JobId !== undefined) { const labelValue: string = input.JobId; if (labelValue.length <= 0) { @@ -613,7 +628,6 @@ export const serializeAws_restJson1StartJobCommand = async ( throw new Error("No value provided for input HTTP label: JobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -629,10 +643,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -647,7 +662,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1MapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -663,8 +677,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -678,7 +693,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -695,10 +709,13 @@ export const serializeAws_restJson1UpdateAssetCommand = async ( input: UpdateAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets/{AssetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}/assets/{AssetId}"; if (input.AssetId !== undefined) { const labelValue: string = input.AssetId; if (labelValue.length <= 0) { @@ -730,7 +747,6 @@ export const serializeAws_restJson1UpdateAssetCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -746,10 +762,12 @@ export const serializeAws_restJson1UpdateDataSetCommand = async ( input: UpdateDataSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/data-sets/{DataSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/data-sets/{DataSetId}"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -764,7 +782,6 @@ export const serializeAws_restJson1UpdateDataSetCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -780,10 +797,13 @@ export const serializeAws_restJson1UpdateRevisionCommand = async ( input: UpdateRevisionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/data-sets/{DataSetId}/revisions/{RevisionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/data-sets/{DataSetId}/revisions/{RevisionId}"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -807,7 +827,6 @@ export const serializeAws_restJson1UpdateRevisionCommand = async ( ...(input.Comment !== undefined && input.Comment !== null && { Comment: input.Comment }), ...(input.Finalized !== undefined && input.Finalized !== null && { Finalized: input.Finalized }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-detective/protocols/Aws_restJson1.ts b/clients/client-detective/protocols/Aws_restJson1.ts index b7012d4fe39bf..738aa0c7e6338 100644 --- a/clients/client-detective/protocols/Aws_restJson1.ts +++ b/clients/client-detective/protocols/Aws_restJson1.ts @@ -52,15 +52,15 @@ export const serializeAws_restJson1AcceptInvitationCommand = async ( input: AcceptInvitationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitation"; let body: any; body = JSON.stringify({ ...(input.GraphArn !== undefined && input.GraphArn !== null && { GraphArn: input.GraphArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -76,15 +76,15 @@ export const serializeAws_restJson1CreateGraphCommand = async ( input: CreateGraphCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/graph"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/graph"; let body: any; body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -100,10 +100,11 @@ export const serializeAws_restJson1CreateMembersCommand = async ( input: CreateMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/graph/members"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/graph/members"; let body: any; body = JSON.stringify({ ...(input.Accounts !== undefined && @@ -113,7 +114,6 @@ export const serializeAws_restJson1CreateMembersCommand = async ( ...(input.GraphArn !== undefined && input.GraphArn !== null && { GraphArn: input.GraphArn }), ...(input.Message !== undefined && input.Message !== null && { Message: input.Message }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -129,15 +129,15 @@ export const serializeAws_restJson1DeleteGraphCommand = async ( input: DeleteGraphCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/graph/removal"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/graph/removal"; let body: any; body = JSON.stringify({ ...(input.GraphArn !== undefined && input.GraphArn !== null && { GraphArn: input.GraphArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -153,17 +153,17 @@ export const serializeAws_restJson1DeleteMembersCommand = async ( input: DeleteMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/graph/members/removal"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/graph/members/removal"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && input.AccountIds !== null && { AccountIds: serializeAws_restJson1AccountIdList(input.AccountIds, context) }), ...(input.GraphArn !== undefined && input.GraphArn !== null && { GraphArn: input.GraphArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -179,15 +179,15 @@ export const serializeAws_restJson1DisassociateMembershipCommand = async ( input: DisassociateMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/membership/removal"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/membership/removal"; let body: any; body = JSON.stringify({ ...(input.GraphArn !== undefined && input.GraphArn !== null && { GraphArn: input.GraphArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -203,17 +203,17 @@ export const serializeAws_restJson1GetMembersCommand = async ( input: GetMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/graph/members/get"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/graph/members/get"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && input.AccountIds !== null && { AccountIds: serializeAws_restJson1AccountIdList(input.AccountIds, context) }), ...(input.GraphArn !== undefined && input.GraphArn !== null && { GraphArn: input.GraphArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -229,16 +229,16 @@ export const serializeAws_restJson1ListGraphsCommand = async ( input: ListGraphsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/graphs/list"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/graphs/list"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -254,16 +254,16 @@ export const serializeAws_restJson1ListInvitationsCommand = async ( input: ListInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitations/list"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations/list"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -279,17 +279,17 @@ export const serializeAws_restJson1ListMembersCommand = async ( input: ListMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/graph/members/list"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/graph/members/list"; let body: any; body = JSON.stringify({ ...(input.GraphArn !== undefined && input.GraphArn !== null && { GraphArn: input.GraphArn }), ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -305,8 +305,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -317,7 +318,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -333,15 +333,15 @@ export const serializeAws_restJson1RejectInvitationCommand = async ( input: RejectInvitationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitation/removal"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitation/removal"; let body: any; body = JSON.stringify({ ...(input.GraphArn !== undefined && input.GraphArn !== null && { GraphArn: input.GraphArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -357,16 +357,17 @@ export const serializeAws_restJson1StartMonitoringMemberCommand = async ( input: StartMonitoringMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/graph/member/monitoringstate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/graph/member/monitoringstate"; let body: any; body = JSON.stringify({ ...(input.AccountId !== undefined && input.AccountId !== null && { AccountId: input.AccountId }), ...(input.GraphArn !== undefined && input.GraphArn !== null && { GraphArn: input.GraphArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -382,10 +383,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -399,7 +401,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -415,8 +416,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -430,7 +432,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-devops-guru/protocols/Aws_restJson1.ts b/clients/client-devops-guru/protocols/Aws_restJson1.ts index 4f4bf9006ef05..90137af5c0130 100644 --- a/clients/client-devops-guru/protocols/Aws_restJson1.ts +++ b/clients/client-devops-guru/protocols/Aws_restJson1.ts @@ -146,16 +146,16 @@ export const serializeAws_restJson1AddNotificationChannelCommand = async ( input: AddNotificationChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; let body: any; body = JSON.stringify({ ...(input.Config !== undefined && input.Config !== null && { Config: serializeAws_restJson1NotificationChannelConfig(input.Config, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -171,13 +171,13 @@ export const serializeAws_restJson1DescribeAccountHealthCommand = async ( input: DescribeAccountHealthCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/health"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/health"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -193,17 +193,17 @@ export const serializeAws_restJson1DescribeAccountOverviewCommand = async ( input: DescribeAccountOverviewCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/overview"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/overview"; let body: any; body = JSON.stringify({ ...(input.FromTime !== undefined && input.FromTime !== null && { FromTime: Math.round(input.FromTime.getTime() / 1000) }), ...(input.ToTime !== undefined && input.ToTime !== null && { ToTime: Math.round(input.ToTime.getTime() / 1000) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -219,8 +219,9 @@ export const serializeAws_restJson1DescribeAnomalyCommand = async ( input: DescribeAnomalyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/anomalies/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/anomalies/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -231,7 +232,6 @@ export const serializeAws_restJson1DescribeAnomalyCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -247,15 +247,15 @@ export const serializeAws_restJson1DescribeFeedbackCommand = async ( input: DescribeFeedbackCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/feedback"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/feedback"; let body: any; body = JSON.stringify({ ...(input.InsightId !== undefined && input.InsightId !== null && { InsightId: input.InsightId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -271,8 +271,9 @@ export const serializeAws_restJson1DescribeInsightCommand = async ( input: DescribeInsightCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/insights/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -283,7 +284,6 @@ export const serializeAws_restJson1DescribeInsightCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -299,8 +299,11 @@ export const serializeAws_restJson1DescribeResourceCollectionHealthCommand = asy input: DescribeResourceCollectionHealthCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/health/resource-collection/{ResourceCollectionType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/health/resource-collection/{ResourceCollectionType}"; if (input.ResourceCollectionType !== undefined) { const labelValue: string = input.ResourceCollectionType; if (labelValue.length <= 0) { @@ -314,7 +317,6 @@ export const serializeAws_restJson1DescribeResourceCollectionHealthCommand = asy ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -331,13 +333,13 @@ export const serializeAws_restJson1DescribeServiceIntegrationCommand = async ( input: DescribeServiceIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/service-integrations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/service-integrations"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -353,13 +355,13 @@ export const serializeAws_restJson1GetCostEstimationCommand = async ( input: GetCostEstimationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/cost-estimation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cost-estimation"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -376,8 +378,11 @@ export const serializeAws_restJson1GetResourceCollectionCommand = async ( input: GetResourceCollectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/resource-collections/{ResourceCollectionType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/resource-collections/{ResourceCollectionType}"; if (input.ResourceCollectionType !== undefined) { const labelValue: string = input.ResourceCollectionType; if (labelValue.length <= 0) { @@ -391,7 +396,6 @@ export const serializeAws_restJson1GetResourceCollectionCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -408,10 +412,12 @@ export const serializeAws_restJson1ListAnomaliesForInsightCommand = async ( input: ListAnomaliesForInsightCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/anomalies/insight/{InsightId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/anomalies/insight/{InsightId}"; if (input.InsightId !== undefined) { const labelValue: string = input.InsightId; if (labelValue.length <= 0) { @@ -430,7 +436,6 @@ export const serializeAws_restJson1ListAnomaliesForInsightCommand = async ( StartTimeRange: serializeAws_restJson1StartTimeRange(input.StartTimeRange, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -446,10 +451,11 @@ export const serializeAws_restJson1ListEventsCommand = async ( input: ListEventsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/events"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/events"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -457,7 +463,6 @@ export const serializeAws_restJson1ListEventsCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -473,10 +478,11 @@ export const serializeAws_restJson1ListInsightsCommand = async ( input: ListInsightsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/insights"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -486,7 +492,6 @@ export const serializeAws_restJson1ListInsightsCommand = async ( StatusFilter: serializeAws_restJson1ListInsightsStatusFilter(input.StatusFilter, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -502,15 +507,15 @@ export const serializeAws_restJson1ListNotificationChannelsCommand = async ( input: ListNotificationChannelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; let body: any; body = JSON.stringify({ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -526,17 +531,17 @@ export const serializeAws_restJson1ListRecommendationsCommand = async ( input: ListRecommendationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/recommendations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recommendations"; let body: any; body = JSON.stringify({ ...(input.InsightId !== undefined && input.InsightId !== null && { InsightId: input.InsightId }), ...(input.Locale !== undefined && input.Locale !== null && { Locale: input.Locale }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -552,10 +557,11 @@ export const serializeAws_restJson1PutFeedbackCommand = async ( input: PutFeedbackCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/feedback"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/feedback"; let body: any; body = JSON.stringify({ ...(input.InsightFeedback !== undefined && @@ -563,7 +569,6 @@ export const serializeAws_restJson1PutFeedbackCommand = async ( InsightFeedback: serializeAws_restJson1InsightFeedback(input.InsightFeedback, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -579,8 +584,9 @@ export const serializeAws_restJson1RemoveNotificationChannelCommand = async ( input: RemoveNotificationChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -591,7 +597,6 @@ export const serializeAws_restJson1RemoveNotificationChannelCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -607,10 +612,11 @@ export const serializeAws_restJson1SearchInsightsCommand = async ( input: SearchInsightsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/insights/search"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights/search"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -623,7 +629,6 @@ export const serializeAws_restJson1SearchInsightsCommand = async ( }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -639,10 +644,11 @@ export const serializeAws_restJson1StartCostEstimationCommand = async ( input: StartCostEstimationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/cost-estimation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cost-estimation"; let body: any; body = JSON.stringify({ ClientToken: input.ClientToken ?? generateIdempotencyToken(), @@ -654,7 +660,6 @@ export const serializeAws_restJson1StartCostEstimationCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -670,10 +675,11 @@ export const serializeAws_restJson1UpdateResourceCollectionCommand = async ( input: UpdateResourceCollectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/resource-collections"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resource-collections"; let body: any; body = JSON.stringify({ ...(input.Action !== undefined && input.Action !== null && { Action: input.Action }), @@ -682,7 +688,6 @@ export const serializeAws_restJson1UpdateResourceCollectionCommand = async ( ResourceCollection: serializeAws_restJson1UpdateResourceCollectionFilter(input.ResourceCollection, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -698,10 +703,11 @@ export const serializeAws_restJson1UpdateServiceIntegrationCommand = async ( input: UpdateServiceIntegrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/service-integrations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/service-integrations"; let body: any; body = JSON.stringify({ ...(input.ServiceIntegration !== undefined && @@ -709,7 +715,6 @@ export const serializeAws_restJson1UpdateServiceIntegrationCommand = async ( ServiceIntegration: serializeAws_restJson1UpdateServiceIntegrationConfig(input.ServiceIntegration, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-dlm/protocols/Aws_restJson1.ts b/clients/client-dlm/protocols/Aws_restJson1.ts index bf80579b08005..393ae4590a226 100644 --- a/clients/client-dlm/protocols/Aws_restJson1.ts +++ b/clients/client-dlm/protocols/Aws_restJson1.ts @@ -65,10 +65,11 @@ export const serializeAws_restJson1CreateLifecyclePolicyCommand = async ( input: CreateLifecyclePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/policies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), @@ -81,7 +82,6 @@ export const serializeAws_restJson1CreateLifecyclePolicyCommand = async ( ...(input.State !== undefined && input.State !== null && { State: input.State }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -97,8 +97,9 @@ export const serializeAws_restJson1DeleteLifecyclePolicyCommand = async ( input: DeleteLifecyclePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policies/{PolicyId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{PolicyId}"; if (input.PolicyId !== undefined) { const labelValue: string = input.PolicyId; if (labelValue.length <= 0) { @@ -109,7 +110,6 @@ export const serializeAws_restJson1DeleteLifecyclePolicyCommand = async ( throw new Error("No value provided for input HTTP label: PolicyId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -125,8 +125,9 @@ export const serializeAws_restJson1GetLifecyclePoliciesCommand = async ( input: GetLifecyclePoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies"; const query: any = { ...(input.PolicyIds !== undefined && { policyIds: (input.PolicyIds || []).map((_entry) => _entry) }), ...(input.State !== undefined && { state: input.State }), @@ -135,7 +136,6 @@ export const serializeAws_restJson1GetLifecyclePoliciesCommand = async ( ...(input.TagsToAdd !== undefined && { tagsToAdd: (input.TagsToAdd || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -152,8 +152,9 @@ export const serializeAws_restJson1GetLifecyclePolicyCommand = async ( input: GetLifecyclePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policies/{PolicyId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{PolicyId}"; if (input.PolicyId !== undefined) { const labelValue: string = input.PolicyId; if (labelValue.length <= 0) { @@ -164,7 +165,6 @@ export const serializeAws_restJson1GetLifecyclePolicyCommand = async ( throw new Error("No value provided for input HTTP label: PolicyId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -180,8 +180,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -192,7 +193,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -208,10 +208,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -225,7 +226,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -241,8 +241,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -256,7 +257,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -273,10 +273,11 @@ export const serializeAws_restJson1UpdateLifecyclePolicyCommand = async ( input: UpdateLifecyclePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/policies/{PolicyId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{PolicyId}"; if (input.PolicyId !== undefined) { const labelValue: string = input.PolicyId; if (labelValue.length <= 0) { @@ -297,7 +298,6 @@ export const serializeAws_restJson1UpdateLifecyclePolicyCommand = async ( }), ...(input.State !== undefined && input.State !== null && { State: input.State }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-ebs/protocols/Aws_restJson1.ts b/clients/client-ebs/protocols/Aws_restJson1.ts index e193207e541ed..2034fa3077418 100644 --- a/clients/client-ebs/protocols/Aws_restJson1.ts +++ b/clients/client-ebs/protocols/Aws_restJson1.ts @@ -36,6 +36,7 @@ export const serializeAws_restJson1CompleteSnapshotCommand = async ( input: CompleteSnapshotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ChangedBlocksCount) && { "x-amz-changedblockscount": input.ChangedBlocksCount!.toString(), @@ -46,7 +47,8 @@ export const serializeAws_restJson1CompleteSnapshotCommand = async ( "x-amz-checksum-aggregation-method": input.ChecksumAggregationMethod!, }), }; - let resolvedPath = "/snapshots/completion/{SnapshotId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots/completion/{SnapshotId}"; if (input.SnapshotId !== undefined) { const labelValue: string = input.SnapshotId; if (labelValue.length <= 0) { @@ -57,7 +59,6 @@ export const serializeAws_restJson1CompleteSnapshotCommand = async ( throw new Error("No value provided for input HTTP label: SnapshotId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -73,8 +74,11 @@ export const serializeAws_restJson1GetSnapshotBlockCommand = async ( input: GetSnapshotBlockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/snapshots/{SnapshotId}/blocks/{BlockIndex}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/snapshots/{SnapshotId}/blocks/{BlockIndex}"; if (input.SnapshotId !== undefined) { const labelValue: string = input.SnapshotId; if (labelValue.length <= 0) { @@ -97,7 +101,6 @@ export const serializeAws_restJson1GetSnapshotBlockCommand = async ( ...(input.BlockToken !== undefined && { blockToken: input.BlockToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -114,8 +117,11 @@ export const serializeAws_restJson1ListChangedBlocksCommand = async ( input: ListChangedBlocksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/snapshots/{SecondSnapshotId}/changedblocks"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/snapshots/{SecondSnapshotId}/changedblocks"; if (input.SecondSnapshotId !== undefined) { const labelValue: string = input.SecondSnapshotId; if (labelValue.length <= 0) { @@ -132,7 +138,6 @@ export const serializeAws_restJson1ListChangedBlocksCommand = async ( ...(input.StartingBlockIndex !== undefined && { startingBlockIndex: input.StartingBlockIndex.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -149,8 +154,10 @@ export const serializeAws_restJson1ListSnapshotBlocksCommand = async ( input: ListSnapshotBlocksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/snapshots/{SnapshotId}/blocks"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots/{SnapshotId}/blocks"; if (input.SnapshotId !== undefined) { const labelValue: string = input.SnapshotId; if (labelValue.length <= 0) { @@ -166,7 +173,6 @@ export const serializeAws_restJson1ListSnapshotBlocksCommand = async ( ...(input.StartingBlockIndex !== undefined && { startingBlockIndex: input.StartingBlockIndex.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -183,6 +189,7 @@ export const serializeAws_restJson1PutSnapshotBlockCommand = async ( input: PutSnapshotBlockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", "x-amz-content-sha256": "UNSIGNED-PAYLOAD", @@ -191,7 +198,9 @@ export const serializeAws_restJson1PutSnapshotBlockCommand = async ( ...(isSerializableHeaderValue(input.Checksum) && { "x-amz-checksum": input.Checksum! }), ...(isSerializableHeaderValue(input.ChecksumAlgorithm) && { "x-amz-checksum-algorithm": input.ChecksumAlgorithm! }), }; - let resolvedPath = "/snapshots/{SnapshotId}/blocks/{BlockIndex}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/snapshots/{SnapshotId}/blocks/{BlockIndex}"; if (input.SnapshotId !== undefined) { const labelValue: string = input.SnapshotId; if (labelValue.length <= 0) { @@ -214,7 +223,6 @@ export const serializeAws_restJson1PutSnapshotBlockCommand = async ( if (input.BlockData !== undefined) { body = input.BlockData; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -230,10 +238,11 @@ export const serializeAws_restJson1StartSnapshotCommand = async ( input: StartSnapshotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/snapshots"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots"; let body: any; body = JSON.stringify({ ClientToken: input.ClientToken ?? generateIdempotencyToken(), @@ -246,7 +255,6 @@ export const serializeAws_restJson1StartSnapshotCommand = async ( ...(input.Timeout !== undefined && input.Timeout !== null && { Timeout: input.Timeout }), ...(input.VolumeSize !== undefined && input.VolumeSize !== null && { VolumeSize: input.VolumeSize }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-efs/protocols/Aws_restJson1.ts b/clients/client-efs/protocols/Aws_restJson1.ts index 945af343ec15e..c60656fde370e 100644 --- a/clients/client-efs/protocols/Aws_restJson1.ts +++ b/clients/client-efs/protocols/Aws_restJson1.ts @@ -131,10 +131,12 @@ export const serializeAws_restJson1CreateAccessPointCommand = async ( input: CreateAccessPointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/access-points"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/access-points"; let body: any; body = JSON.stringify({ ClientToken: input.ClientToken ?? generateIdempotencyToken(), @@ -147,7 +149,6 @@ export const serializeAws_restJson1CreateAccessPointCommand = async ( }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -163,10 +164,11 @@ export const serializeAws_restJson1CreateFileSystemCommand = async ( input: CreateFileSystemCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/file-systems"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/file-systems"; let body: any; body = JSON.stringify({ ...(input.AvailabilityZoneName !== undefined && @@ -185,7 +187,6 @@ export const serializeAws_restJson1CreateFileSystemCommand = async ( ...(input.ThroughputMode !== undefined && input.ThroughputMode !== null && { ThroughputMode: input.ThroughputMode }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -201,10 +202,12 @@ export const serializeAws_restJson1CreateMountTargetCommand = async ( input: CreateMountTargetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/mount-targets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/mount-targets"; let body: any; body = JSON.stringify({ ...(input.FileSystemId !== undefined && input.FileSystemId !== null && { FileSystemId: input.FileSystemId }), @@ -215,7 +218,6 @@ export const serializeAws_restJson1CreateMountTargetCommand = async ( }), ...(input.SubnetId !== undefined && input.SubnetId !== null && { SubnetId: input.SubnetId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -231,10 +233,12 @@ export const serializeAws_restJson1CreateTagsCommand = async ( input: CreateTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/create-tags/{FileSystemId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/create-tags/{FileSystemId}"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -248,7 +252,6 @@ export const serializeAws_restJson1CreateTagsCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -264,8 +267,10 @@ export const serializeAws_restJson1DeleteAccessPointCommand = async ( input: DeleteAccessPointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/access-points/{AccessPointId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/access-points/{AccessPointId}"; if (input.AccessPointId !== undefined) { const labelValue: string = input.AccessPointId; if (labelValue.length <= 0) { @@ -276,7 +281,6 @@ export const serializeAws_restJson1DeleteAccessPointCommand = async ( throw new Error("No value provided for input HTTP label: AccessPointId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -292,8 +296,10 @@ export const serializeAws_restJson1DeleteFileSystemCommand = async ( input: DeleteFileSystemCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/file-systems/{FileSystemId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/file-systems/{FileSystemId}"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -304,7 +310,6 @@ export const serializeAws_restJson1DeleteFileSystemCommand = async ( throw new Error("No value provided for input HTTP label: FileSystemId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -320,8 +325,11 @@ export const serializeAws_restJson1DeleteFileSystemPolicyCommand = async ( input: DeleteFileSystemPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/file-systems/{FileSystemId}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-02-01/file-systems/{FileSystemId}/policy"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -332,7 +340,6 @@ export const serializeAws_restJson1DeleteFileSystemPolicyCommand = async ( throw new Error("No value provided for input HTTP label: FileSystemId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -348,8 +355,10 @@ export const serializeAws_restJson1DeleteMountTargetCommand = async ( input: DeleteMountTargetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/mount-targets/{MountTargetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/mount-targets/{MountTargetId}"; if (input.MountTargetId !== undefined) { const labelValue: string = input.MountTargetId; if (labelValue.length <= 0) { @@ -360,7 +369,6 @@ export const serializeAws_restJson1DeleteMountTargetCommand = async ( throw new Error("No value provided for input HTTP label: MountTargetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -376,10 +384,12 @@ export const serializeAws_restJson1DeleteTagsCommand = async ( input: DeleteTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/delete-tags/{FileSystemId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/delete-tags/{FileSystemId}"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -394,7 +404,6 @@ export const serializeAws_restJson1DeleteTagsCommand = async ( ...(input.TagKeys !== undefined && input.TagKeys !== null && { TagKeys: serializeAws_restJson1TagKeys(input.TagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -410,8 +419,10 @@ export const serializeAws_restJson1DescribeAccessPointsCommand = async ( input: DescribeAccessPointsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/access-points"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/access-points"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), @@ -419,7 +430,6 @@ export const serializeAws_restJson1DescribeAccessPointsCommand = async ( ...(input.FileSystemId !== undefined && { FileSystemId: input.FileSystemId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -436,16 +446,17 @@ export const serializeAws_restJson1DescribeAccountPreferencesCommand = async ( input: DescribeAccountPreferencesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/account-preferences"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/account-preferences"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -461,8 +472,11 @@ export const serializeAws_restJson1DescribeBackupPolicyCommand = async ( input: DescribeBackupPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/file-systems/{FileSystemId}/backup-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-02-01/file-systems/{FileSystemId}/backup-policy"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -473,7 +487,6 @@ export const serializeAws_restJson1DescribeBackupPolicyCommand = async ( throw new Error("No value provided for input HTTP label: FileSystemId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -489,8 +502,11 @@ export const serializeAws_restJson1DescribeFileSystemPolicyCommand = async ( input: DescribeFileSystemPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/file-systems/{FileSystemId}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-02-01/file-systems/{FileSystemId}/policy"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -501,7 +517,6 @@ export const serializeAws_restJson1DescribeFileSystemPolicyCommand = async ( throw new Error("No value provided for input HTTP label: FileSystemId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -517,8 +532,9 @@ export const serializeAws_restJson1DescribeFileSystemsCommand = async ( input: DescribeFileSystemsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/file-systems"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/file-systems"; const query: any = { ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), ...(input.Marker !== undefined && { Marker: input.Marker }), @@ -526,7 +542,6 @@ export const serializeAws_restJson1DescribeFileSystemsCommand = async ( ...(input.FileSystemId !== undefined && { FileSystemId: input.FileSystemId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -543,8 +558,11 @@ export const serializeAws_restJson1DescribeLifecycleConfigurationCommand = async input: DescribeLifecycleConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/file-systems/{FileSystemId}/lifecycle-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-02-01/file-systems/{FileSystemId}/lifecycle-configuration"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -555,7 +573,6 @@ export const serializeAws_restJson1DescribeLifecycleConfigurationCommand = async throw new Error("No value provided for input HTTP label: FileSystemId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -571,8 +588,10 @@ export const serializeAws_restJson1DescribeMountTargetsCommand = async ( input: DescribeMountTargetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/mount-targets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/mount-targets"; const query: any = { ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), ...(input.Marker !== undefined && { Marker: input.Marker }), @@ -581,7 +600,6 @@ export const serializeAws_restJson1DescribeMountTargetsCommand = async ( ...(input.AccessPointId !== undefined && { AccessPointId: input.AccessPointId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -598,8 +616,11 @@ export const serializeAws_restJson1DescribeMountTargetSecurityGroupsCommand = as input: DescribeMountTargetSecurityGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/mount-targets/{MountTargetId}/security-groups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-02-01/mount-targets/{MountTargetId}/security-groups"; if (input.MountTargetId !== undefined) { const labelValue: string = input.MountTargetId; if (labelValue.length <= 0) { @@ -610,7 +631,6 @@ export const serializeAws_restJson1DescribeMountTargetSecurityGroupsCommand = as throw new Error("No value provided for input HTTP label: MountTargetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -626,8 +646,10 @@ export const serializeAws_restJson1DescribeTagsCommand = async ( input: DescribeTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/tags/{FileSystemId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/tags/{FileSystemId}"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -642,7 +664,6 @@ export const serializeAws_restJson1DescribeTagsCommand = async ( ...(input.Marker !== undefined && { Marker: input.Marker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -659,8 +680,10 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/resource-tags/{ResourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/resource-tags/{ResourceId}"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -675,7 +698,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -692,10 +714,13 @@ export const serializeAws_restJson1ModifyMountTargetSecurityGroupsCommand = asyn input: ModifyMountTargetSecurityGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/mount-targets/{MountTargetId}/security-groups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-02-01/mount-targets/{MountTargetId}/security-groups"; if (input.MountTargetId !== undefined) { const labelValue: string = input.MountTargetId; if (labelValue.length <= 0) { @@ -712,7 +737,6 @@ export const serializeAws_restJson1ModifyMountTargetSecurityGroupsCommand = asyn SecurityGroups: serializeAws_restJson1SecurityGroups(input.SecurityGroups, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -728,16 +752,17 @@ export const serializeAws_restJson1PutAccountPreferencesCommand = async ( input: PutAccountPreferencesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/account-preferences"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/account-preferences"; let body: any; body = JSON.stringify({ ...(input.ResourceIdType !== undefined && input.ResourceIdType !== null && { ResourceIdType: input.ResourceIdType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -753,10 +778,13 @@ export const serializeAws_restJson1PutBackupPolicyCommand = async ( input: PutBackupPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/file-systems/{FileSystemId}/backup-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-02-01/file-systems/{FileSystemId}/backup-policy"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -771,7 +799,6 @@ export const serializeAws_restJson1PutBackupPolicyCommand = async ( ...(input.BackupPolicy !== undefined && input.BackupPolicy !== null && { BackupPolicy: serializeAws_restJson1BackupPolicy(input.BackupPolicy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -787,10 +814,13 @@ export const serializeAws_restJson1PutFileSystemPolicyCommand = async ( input: PutFileSystemPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/file-systems/{FileSystemId}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-02-01/file-systems/{FileSystemId}/policy"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -808,7 +838,6 @@ export const serializeAws_restJson1PutFileSystemPolicyCommand = async ( }), ...(input.Policy !== undefined && input.Policy !== null && { Policy: input.Policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -824,10 +853,13 @@ export const serializeAws_restJson1PutLifecycleConfigurationCommand = async ( input: PutLifecycleConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/file-systems/{FileSystemId}/lifecycle-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-02-01/file-systems/{FileSystemId}/lifecycle-configuration"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -844,7 +876,6 @@ export const serializeAws_restJson1PutLifecycleConfigurationCommand = async ( LifecyclePolicies: serializeAws_restJson1LifecyclePolicies(input.LifecyclePolicies, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -860,10 +891,12 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/resource-tags/{ResourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/resource-tags/{ResourceId}"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -877,7 +910,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -893,8 +925,10 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-02-01/resource-tags/{ResourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/resource-tags/{ResourceId}"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -908,7 +942,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -925,10 +958,12 @@ export const serializeAws_restJson1UpdateFileSystemCommand = async ( input: UpdateFileSystemCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-02-01/file-systems/{FileSystemId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-02-01/file-systems/{FileSystemId}"; if (input.FileSystemId !== undefined) { const labelValue: string = input.FileSystemId; if (labelValue.length <= 0) { @@ -947,7 +982,6 @@ export const serializeAws_restJson1UpdateFileSystemCommand = async ( ...(input.ThroughputMode !== undefined && input.ThroughputMode !== null && { ThroughputMode: input.ThroughputMode }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-eks/protocols/Aws_restJson1.ts b/clients/client-eks/protocols/Aws_restJson1.ts index fd9e6f27bcf54..9e51bfc388618 100644 --- a/clients/client-eks/protocols/Aws_restJson1.ts +++ b/clients/client-eks/protocols/Aws_restJson1.ts @@ -148,10 +148,13 @@ export const serializeAws_restJson1AssociateEncryptionConfigCommand = async ( input: AssociateEncryptionConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{clusterName}/encryption-config/associate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/encryption-config/associate"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -169,7 +172,6 @@ export const serializeAws_restJson1AssociateEncryptionConfigCommand = async ( encryptionConfig: serializeAws_restJson1EncryptionConfigList(input.encryptionConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -185,10 +187,13 @@ export const serializeAws_restJson1AssociateIdentityProviderConfigCommand = asyn input: AssociateIdentityProviderConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{clusterName}/identity-provider-configs/associate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/identity-provider-configs/associate"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -205,7 +210,6 @@ export const serializeAws_restJson1AssociateIdentityProviderConfigCommand = asyn input.oidc !== null && { oidc: serializeAws_restJson1OidcIdentityProviderConfigRequest(input.oidc, context) }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -221,10 +225,12 @@ export const serializeAws_restJson1CreateAddonCommand = async ( input: CreateAddonCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{clusterName}/addons"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{clusterName}/addons"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -245,7 +251,6 @@ export const serializeAws_restJson1CreateAddonCommand = async ( input.serviceAccountRoleArn !== null && { serviceAccountRoleArn: input.serviceAccountRoleArn }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -261,10 +266,11 @@ export const serializeAws_restJson1CreateClusterCommand = async ( input: CreateClusterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters"; let body: any; body = JSON.stringify({ clientRequestToken: input.clientRequestToken ?? generateIdempotencyToken(), @@ -290,7 +296,6 @@ export const serializeAws_restJson1CreateClusterCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), ...(input.version !== undefined && input.version !== null && { version: input.version }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -306,10 +311,12 @@ export const serializeAws_restJson1CreateFargateProfileCommand = async ( input: CreateFargateProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{clusterName}/fargate-profiles"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{clusterName}/fargate-profiles"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -334,7 +341,6 @@ export const serializeAws_restJson1CreateFargateProfileCommand = async ( input.subnets !== null && { subnets: serializeAws_restJson1StringList(input.subnets, context) }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -350,10 +356,12 @@ export const serializeAws_restJson1CreateNodegroupCommand = async ( input: CreateNodegroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{clusterName}/node-groups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{clusterName}/node-groups"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -402,7 +410,6 @@ export const serializeAws_restJson1CreateNodegroupCommand = async ( }), ...(input.version !== undefined && input.version !== null && { version: input.version }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -418,8 +425,11 @@ export const serializeAws_restJson1DeleteAddonCommand = async ( input: DeleteAddonCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{clusterName}/addons/{addonName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/addons/{addonName}"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -439,7 +449,6 @@ export const serializeAws_restJson1DeleteAddonCommand = async ( throw new Error("No value provided for input HTTP label: addonName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -455,8 +464,9 @@ export const serializeAws_restJson1DeleteClusterCommand = async ( input: DeleteClusterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -467,7 +477,6 @@ export const serializeAws_restJson1DeleteClusterCommand = async ( throw new Error("No value provided for input HTTP label: name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -483,8 +492,11 @@ export const serializeAws_restJson1DeleteFargateProfileCommand = async ( input: DeleteFargateProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{clusterName}/fargate-profiles/{fargateProfileName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/fargate-profiles/{fargateProfileName}"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -504,7 +516,6 @@ export const serializeAws_restJson1DeleteFargateProfileCommand = async ( throw new Error("No value provided for input HTTP label: fargateProfileName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -520,8 +531,11 @@ export const serializeAws_restJson1DeleteNodegroupCommand = async ( input: DeleteNodegroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{clusterName}/node-groups/{nodegroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/node-groups/{nodegroupName}"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -541,7 +555,6 @@ export const serializeAws_restJson1DeleteNodegroupCommand = async ( throw new Error("No value provided for input HTTP label: nodegroupName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -557,8 +570,11 @@ export const serializeAws_restJson1DescribeAddonCommand = async ( input: DescribeAddonCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{clusterName}/addons/{addonName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/addons/{addonName}"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -578,7 +594,6 @@ export const serializeAws_restJson1DescribeAddonCommand = async ( throw new Error("No value provided for input HTTP label: addonName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -594,8 +609,10 @@ export const serializeAws_restJson1DescribeAddonVersionsCommand = async ( input: DescribeAddonVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/addons/supported-versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/addons/supported-versions"; const query: any = { ...(input.kubernetesVersion !== undefined && { kubernetesVersion: input.kubernetesVersion }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -603,7 +620,6 @@ export const serializeAws_restJson1DescribeAddonVersionsCommand = async ( ...(input.addonName !== undefined && { addonName: input.addonName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -620,8 +636,9 @@ export const serializeAws_restJson1DescribeClusterCommand = async ( input: DescribeClusterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -632,7 +649,6 @@ export const serializeAws_restJson1DescribeClusterCommand = async ( throw new Error("No value provided for input HTTP label: name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -648,8 +664,11 @@ export const serializeAws_restJson1DescribeFargateProfileCommand = async ( input: DescribeFargateProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{clusterName}/fargate-profiles/{fargateProfileName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/fargate-profiles/{fargateProfileName}"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -669,7 +688,6 @@ export const serializeAws_restJson1DescribeFargateProfileCommand = async ( throw new Error("No value provided for input HTTP label: fargateProfileName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -685,10 +703,13 @@ export const serializeAws_restJson1DescribeIdentityProviderConfigCommand = async input: DescribeIdentityProviderConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{clusterName}/identity-provider-configs/describe"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/identity-provider-configs/describe"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -705,7 +726,6 @@ export const serializeAws_restJson1DescribeIdentityProviderConfigCommand = async identityProviderConfig: serializeAws_restJson1IdentityProviderConfig(input.identityProviderConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -721,8 +741,11 @@ export const serializeAws_restJson1DescribeNodegroupCommand = async ( input: DescribeNodegroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{clusterName}/node-groups/{nodegroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/node-groups/{nodegroupName}"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -742,7 +765,6 @@ export const serializeAws_restJson1DescribeNodegroupCommand = async ( throw new Error("No value provided for input HTTP label: nodegroupName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -758,8 +780,10 @@ export const serializeAws_restJson1DescribeUpdateCommand = async ( input: DescribeUpdateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{name}/updates/{updateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{name}/updates/{updateId}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -783,7 +807,6 @@ export const serializeAws_restJson1DescribeUpdateCommand = async ( ...(input.addonName !== undefined && { addonName: input.addonName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -800,10 +823,13 @@ export const serializeAws_restJson1DisassociateIdentityProviderConfigCommand = a input: DisassociateIdentityProviderConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{clusterName}/identity-provider-configs/disassociate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/identity-provider-configs/disassociate"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -821,7 +847,6 @@ export const serializeAws_restJson1DisassociateIdentityProviderConfigCommand = a identityProviderConfig: serializeAws_restJson1IdentityProviderConfig(input.identityProviderConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -837,8 +862,10 @@ export const serializeAws_restJson1ListAddonsCommand = async ( input: ListAddonsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{clusterName}/addons"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{clusterName}/addons"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -853,7 +880,6 @@ export const serializeAws_restJson1ListAddonsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -870,14 +896,14 @@ export const serializeAws_restJson1ListClustersCommand = async ( input: ListClustersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -894,8 +920,10 @@ export const serializeAws_restJson1ListFargateProfilesCommand = async ( input: ListFargateProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{clusterName}/fargate-profiles"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{clusterName}/fargate-profiles"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -910,7 +938,6 @@ export const serializeAws_restJson1ListFargateProfilesCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -927,8 +954,11 @@ export const serializeAws_restJson1ListIdentityProviderConfigsCommand = async ( input: ListIdentityProviderConfigsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{clusterName}/identity-provider-configs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/identity-provider-configs"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -943,7 +973,6 @@ export const serializeAws_restJson1ListIdentityProviderConfigsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -960,8 +989,10 @@ export const serializeAws_restJson1ListNodegroupsCommand = async ( input: ListNodegroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{clusterName}/node-groups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{clusterName}/node-groups"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -976,7 +1007,6 @@ export const serializeAws_restJson1ListNodegroupsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -993,8 +1023,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1005,7 +1036,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1021,8 +1051,9 @@ export const serializeAws_restJson1ListUpdatesCommand = async ( input: ListUpdatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clusters/{name}/updates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{name}/updates"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1039,7 +1070,6 @@ export const serializeAws_restJson1ListUpdatesCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1056,10 +1086,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1073,7 +1104,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1089,8 +1119,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1104,7 +1135,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1121,10 +1151,13 @@ export const serializeAws_restJson1UpdateAddonCommand = async ( input: UpdateAddonCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{clusterName}/addons/{addonName}/update"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/addons/{addonName}/update"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -1152,7 +1185,6 @@ export const serializeAws_restJson1UpdateAddonCommand = async ( ...(input.serviceAccountRoleArn !== undefined && input.serviceAccountRoleArn !== null && { serviceAccountRoleArn: input.serviceAccountRoleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1168,10 +1200,12 @@ export const serializeAws_restJson1UpdateClusterConfigCommand = async ( input: UpdateClusterConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{name}/update-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{name}/update-config"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1191,7 +1225,6 @@ export const serializeAws_restJson1UpdateClusterConfigCommand = async ( resourcesVpcConfig: serializeAws_restJson1VpcConfigRequest(input.resourcesVpcConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1207,10 +1240,11 @@ export const serializeAws_restJson1UpdateClusterVersionCommand = async ( input: UpdateClusterVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{name}/updates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{name}/updates"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1225,7 +1259,6 @@ export const serializeAws_restJson1UpdateClusterVersionCommand = async ( clientRequestToken: input.clientRequestToken ?? generateIdempotencyToken(), ...(input.version !== undefined && input.version !== null && { version: input.version }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1241,10 +1274,13 @@ export const serializeAws_restJson1UpdateNodegroupConfigCommand = async ( input: UpdateNodegroupConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{clusterName}/node-groups/{nodegroupName}/update-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/node-groups/{nodegroupName}/update-config"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -1279,7 +1315,6 @@ export const serializeAws_restJson1UpdateNodegroupConfigCommand = async ( updateConfig: serializeAws_restJson1NodegroupUpdateConfig(input.updateConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1295,10 +1330,13 @@ export const serializeAws_restJson1UpdateNodegroupVersionCommand = async ( input: UpdateNodegroupVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/clusters/{clusterName}/node-groups/{nodegroupName}/update-version"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/clusters/{clusterName}/node-groups/{nodegroupName}/update-version"; if (input.clusterName !== undefined) { const labelValue: string = input.clusterName; if (labelValue.length <= 0) { @@ -1329,7 +1367,6 @@ export const serializeAws_restJson1UpdateNodegroupVersionCommand = async ( input.releaseVersion !== null && { releaseVersion: input.releaseVersion }), ...(input.version !== undefined && input.version !== null && { version: input.version }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-elastic-inference/protocols/Aws_restJson1.ts b/clients/client-elastic-inference/protocols/Aws_restJson1.ts index 145735aaf0459..435fbe449bc34 100644 --- a/clients/client-elastic-inference/protocols/Aws_restJson1.ts +++ b/clients/client-elastic-inference/protocols/Aws_restJson1.ts @@ -46,10 +46,12 @@ export const serializeAws_restJson1DescribeAcceleratorOfferingsCommand = async ( input: DescribeAcceleratorOfferingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describe-accelerator-offerings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describe-accelerator-offerings"; let body: any; body = JSON.stringify({ ...(input.acceleratorTypes !== undefined && @@ -58,7 +60,6 @@ export const serializeAws_restJson1DescribeAcceleratorOfferingsCommand = async ( }), ...(input.locationType !== undefined && input.locationType !== null && { locationType: input.locationType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -74,10 +75,11 @@ export const serializeAws_restJson1DescribeAcceleratorsCommand = async ( input: DescribeAcceleratorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describe-accelerators"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describe-accelerators"; let body: any; body = JSON.stringify({ ...(input.acceleratorIds !== undefined && @@ -89,7 +91,6 @@ export const serializeAws_restJson1DescribeAcceleratorsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -105,13 +106,14 @@ export const serializeAws_restJson1DescribeAcceleratorTypesCommand = async ( input: DescribeAcceleratorTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describe-accelerator-types"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describe-accelerator-types"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -127,8 +129,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -139,7 +142,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -155,10 +157,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -172,7 +175,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -188,8 +190,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -203,7 +206,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-elastic-transcoder/protocols/Aws_restJson1.ts b/clients/client-elastic-transcoder/protocols/Aws_restJson1.ts index 4721d4ce2a14e..3cb4bdeccc77c 100644 --- a/clients/client-elastic-transcoder/protocols/Aws_restJson1.ts +++ b/clients/client-elastic-transcoder/protocols/Aws_restJson1.ts @@ -79,8 +79,9 @@ export const serializeAws_restJson1CancelJobCommand = async ( input: CancelJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2012-09-25/jobs/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/jobs/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -91,7 +92,6 @@ export const serializeAws_restJson1CancelJobCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -107,10 +107,11 @@ export const serializeAws_restJson1CreateJobCommand = async ( input: CreateJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2012-09-25/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/jobs"; let body: any; body = JSON.stringify({ ...(input.Input !== undefined && @@ -129,7 +130,6 @@ export const serializeAws_restJson1CreateJobCommand = async ( ...(input.UserMetadata !== undefined && input.UserMetadata !== null && { UserMetadata: serializeAws_restJson1UserMetadata(input.UserMetadata, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -145,10 +145,11 @@ export const serializeAws_restJson1CreatePipelineCommand = async ( input: CreatePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2012-09-25/pipelines"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/pipelines"; let body: any; body = JSON.stringify({ ...(input.AwsKmsKeyArn !== undefined && input.AwsKmsKeyArn !== null && { AwsKmsKeyArn: input.AwsKmsKeyArn }), @@ -169,7 +170,6 @@ export const serializeAws_restJson1CreatePipelineCommand = async ( ThumbnailConfig: serializeAws_restJson1PipelineOutputConfig(input.ThumbnailConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -185,10 +185,11 @@ export const serializeAws_restJson1CreatePresetCommand = async ( input: CreatePresetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2012-09-25/presets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/presets"; let body: any; body = JSON.stringify({ ...(input.Audio !== undefined && @@ -201,7 +202,6 @@ export const serializeAws_restJson1CreatePresetCommand = async ( ...(input.Video !== undefined && input.Video !== null && { Video: serializeAws_restJson1VideoParameters(input.Video, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -217,8 +217,10 @@ export const serializeAws_restJson1DeletePipelineCommand = async ( input: DeletePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2012-09-25/pipelines/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/pipelines/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -229,7 +231,6 @@ export const serializeAws_restJson1DeletePipelineCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -245,8 +246,9 @@ export const serializeAws_restJson1DeletePresetCommand = async ( input: DeletePresetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2012-09-25/presets/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/presets/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -257,7 +259,6 @@ export const serializeAws_restJson1DeletePresetCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -273,8 +274,10 @@ export const serializeAws_restJson1ListJobsByPipelineCommand = async ( input: ListJobsByPipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2012-09-25/jobsByPipeline/{PipelineId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/jobsByPipeline/{PipelineId}"; if (input.PipelineId !== undefined) { const labelValue: string = input.PipelineId; if (labelValue.length <= 0) { @@ -289,7 +292,6 @@ export const serializeAws_restJson1ListJobsByPipelineCommand = async ( ...(input.PageToken !== undefined && { PageToken: input.PageToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -306,8 +308,10 @@ export const serializeAws_restJson1ListJobsByStatusCommand = async ( input: ListJobsByStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2012-09-25/jobsByStatus/{Status}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/jobsByStatus/{Status}"; if (input.Status !== undefined) { const labelValue: string = input.Status; if (labelValue.length <= 0) { @@ -322,7 +326,6 @@ export const serializeAws_restJson1ListJobsByStatusCommand = async ( ...(input.PageToken !== undefined && { PageToken: input.PageToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -339,14 +342,14 @@ export const serializeAws_restJson1ListPipelinesCommand = async ( input: ListPipelinesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2012-09-25/pipelines"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/pipelines"; const query: any = { ...(input.Ascending !== undefined && { Ascending: input.Ascending }), ...(input.PageToken !== undefined && { PageToken: input.PageToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -363,14 +366,14 @@ export const serializeAws_restJson1ListPresetsCommand = async ( input: ListPresetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2012-09-25/presets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/presets"; const query: any = { ...(input.Ascending !== undefined && { Ascending: input.Ascending }), ...(input.PageToken !== undefined && { PageToken: input.PageToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -387,8 +390,9 @@ export const serializeAws_restJson1ReadJobCommand = async ( input: ReadJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2012-09-25/jobs/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/jobs/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -399,7 +403,6 @@ export const serializeAws_restJson1ReadJobCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -415,8 +418,10 @@ export const serializeAws_restJson1ReadPipelineCommand = async ( input: ReadPipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2012-09-25/pipelines/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/pipelines/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -427,7 +432,6 @@ export const serializeAws_restJson1ReadPipelineCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -443,8 +447,9 @@ export const serializeAws_restJson1ReadPresetCommand = async ( input: ReadPresetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2012-09-25/presets/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/presets/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -455,7 +460,6 @@ export const serializeAws_restJson1ReadPresetCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -471,10 +475,11 @@ export const serializeAws_restJson1TestRoleCommand = async ( input: TestRoleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2012-09-25/roleTests"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/roleTests"; let body: any; body = JSON.stringify({ ...(input.InputBucket !== undefined && input.InputBucket !== null && { InputBucket: input.InputBucket }), @@ -483,7 +488,6 @@ export const serializeAws_restJson1TestRoleCommand = async ( ...(input.Topics !== undefined && input.Topics !== null && { Topics: serializeAws_restJson1SnsTopics(input.Topics, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -499,10 +503,12 @@ export const serializeAws_restJson1UpdatePipelineCommand = async ( input: UpdatePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2012-09-25/pipelines/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/pipelines/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -531,7 +537,6 @@ export const serializeAws_restJson1UpdatePipelineCommand = async ( ThumbnailConfig: serializeAws_restJson1PipelineOutputConfig(input.ThumbnailConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -547,10 +552,12 @@ export const serializeAws_restJson1UpdatePipelineNotificationsCommand = async ( input: UpdatePipelineNotificationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2012-09-25/pipelines/{Id}/notifications"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/pipelines/{Id}/notifications"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -567,7 +574,6 @@ export const serializeAws_restJson1UpdatePipelineNotificationsCommand = async ( Notifications: serializeAws_restJson1Notifications(input.Notifications, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -583,10 +589,12 @@ export const serializeAws_restJson1UpdatePipelineStatusCommand = async ( input: UpdatePipelineStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2012-09-25/pipelines/{Id}/status"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2012-09-25/pipelines/{Id}/status"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -600,7 +608,6 @@ export const serializeAws_restJson1UpdatePipelineStatusCommand = async ( body = JSON.stringify({ ...(input.Status !== undefined && input.Status !== null && { Status: input.Status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-elasticsearch-service/protocols/Aws_restJson1.ts b/clients/client-elasticsearch-service/protocols/Aws_restJson1.ts index 8c8e3273f8c9b..6a8bec2c6be3a 100644 --- a/clients/client-elasticsearch-service/protocols/Aws_restJson1.ts +++ b/clients/client-elasticsearch-service/protocols/Aws_restJson1.ts @@ -228,8 +228,11 @@ export const serializeAws_restJson1AcceptInboundCrossClusterSearchConnectionComm input: AcceptInboundCrossClusterSearchConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/ccs/inboundConnection/{CrossClusterSearchConnectionId}/accept"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/ccs/inboundConnection/{CrossClusterSearchConnectionId}/accept"; if (input.CrossClusterSearchConnectionId !== undefined) { const labelValue: string = input.CrossClusterSearchConnectionId; if (labelValue.length <= 0) { @@ -240,7 +243,6 @@ export const serializeAws_restJson1AcceptInboundCrossClusterSearchConnectionComm throw new Error("No value provided for input HTTP label: CrossClusterSearchConnectionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -256,17 +258,17 @@ export const serializeAws_restJson1AddTagsCommand = async ( input: AddTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/tags"; let body: any; body = JSON.stringify({ ...(input.ARN !== undefined && input.ARN !== null && { ARN: input.ARN }), ...(input.TagList !== undefined && input.TagList !== null && { TagList: serializeAws_restJson1TagList(input.TagList, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -282,8 +284,11 @@ export const serializeAws_restJson1AssociatePackageCommand = async ( input: AssociatePackageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/packages/associate/{PackageID}/{DomainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/packages/associate/{PackageID}/{DomainName}"; if (input.PackageID !== undefined) { const labelValue: string = input.PackageID; if (labelValue.length <= 0) { @@ -303,7 +308,6 @@ export const serializeAws_restJson1AssociatePackageCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -319,15 +323,17 @@ export const serializeAws_restJson1CancelElasticsearchServiceSoftwareUpdateComma input: CancelElasticsearchServiceSoftwareUpdateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/serviceSoftwareUpdate/cancel"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/serviceSoftwareUpdate/cancel"; let body: any; body = JSON.stringify({ ...(input.DomainName !== undefined && input.DomainName !== null && { DomainName: input.DomainName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -343,10 +349,11 @@ export const serializeAws_restJson1CreateElasticsearchDomainCommand = async ( input: CreateElasticsearchDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/domain"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/domain"; let body: any; body = JSON.stringify({ ...(input.AccessPolicies !== undefined && @@ -410,7 +417,6 @@ export const serializeAws_restJson1CreateElasticsearchDomainCommand = async ( ...(input.VPCOptions !== undefined && input.VPCOptions !== null && { VPCOptions: serializeAws_restJson1VPCOptions(input.VPCOptions, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -426,10 +432,12 @@ export const serializeAws_restJson1CreateOutboundCrossClusterSearchConnectionCom input: CreateOutboundCrossClusterSearchConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/ccs/outboundConnection"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/ccs/outboundConnection"; let body: any; body = JSON.stringify({ ...(input.ConnectionAlias !== undefined && @@ -443,7 +451,6 @@ export const serializeAws_restJson1CreateOutboundCrossClusterSearchConnectionCom SourceDomainInfo: serializeAws_restJson1DomainInformation(input.SourceDomainInfo, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -459,10 +466,11 @@ export const serializeAws_restJson1CreatePackageCommand = async ( input: CreatePackageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/packages"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/packages"; let body: any; body = JSON.stringify({ ...(input.PackageDescription !== undefined && @@ -474,7 +482,6 @@ export const serializeAws_restJson1CreatePackageCommand = async ( }), ...(input.PackageType !== undefined && input.PackageType !== null && { PackageType: input.PackageType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -490,8 +497,10 @@ export const serializeAws_restJson1DeleteElasticsearchDomainCommand = async ( input: DeleteElasticsearchDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/domain/{DomainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/domain/{DomainName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -502,7 +511,6 @@ export const serializeAws_restJson1DeleteElasticsearchDomainCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -518,13 +526,13 @@ export const serializeAws_restJson1DeleteElasticsearchServiceRoleCommand = async input: DeleteElasticsearchServiceRoleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/role"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/role"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -540,8 +548,11 @@ export const serializeAws_restJson1DeleteInboundCrossClusterSearchConnectionComm input: DeleteInboundCrossClusterSearchConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/ccs/inboundConnection/{CrossClusterSearchConnectionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/ccs/inboundConnection/{CrossClusterSearchConnectionId}"; if (input.CrossClusterSearchConnectionId !== undefined) { const labelValue: string = input.CrossClusterSearchConnectionId; if (labelValue.length <= 0) { @@ -552,7 +563,6 @@ export const serializeAws_restJson1DeleteInboundCrossClusterSearchConnectionComm throw new Error("No value provided for input HTTP label: CrossClusterSearchConnectionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -568,8 +578,11 @@ export const serializeAws_restJson1DeleteOutboundCrossClusterSearchConnectionCom input: DeleteOutboundCrossClusterSearchConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/ccs/outboundConnection/{CrossClusterSearchConnectionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/ccs/outboundConnection/{CrossClusterSearchConnectionId}"; if (input.CrossClusterSearchConnectionId !== undefined) { const labelValue: string = input.CrossClusterSearchConnectionId; if (labelValue.length <= 0) { @@ -580,7 +593,6 @@ export const serializeAws_restJson1DeleteOutboundCrossClusterSearchConnectionCom throw new Error("No value provided for input HTTP label: CrossClusterSearchConnectionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -596,8 +608,10 @@ export const serializeAws_restJson1DeletePackageCommand = async ( input: DeletePackageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/packages/{PackageID}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/packages/{PackageID}"; if (input.PackageID !== undefined) { const labelValue: string = input.PackageID; if (labelValue.length <= 0) { @@ -608,7 +622,6 @@ export const serializeAws_restJson1DeletePackageCommand = async ( throw new Error("No value provided for input HTTP label: PackageID."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -624,10 +637,13 @@ export const serializeAws_restJson1DescribeDomainAutoTunesCommand = async ( input: DescribeDomainAutoTunesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/domain/{DomainName}/autoTunes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/domain/{DomainName}/autoTunes"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -642,7 +658,6 @@ export const serializeAws_restJson1DescribeDomainAutoTunesCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -658,8 +673,10 @@ export const serializeAws_restJson1DescribeElasticsearchDomainCommand = async ( input: DescribeElasticsearchDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/domain/{DomainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/domain/{DomainName}"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -670,7 +687,6 @@ export const serializeAws_restJson1DescribeElasticsearchDomainCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -686,8 +702,10 @@ export const serializeAws_restJson1DescribeElasticsearchDomainConfigCommand = as input: DescribeElasticsearchDomainConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/domain/{DomainName}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/domain/{DomainName}/config"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -698,7 +716,6 @@ export const serializeAws_restJson1DescribeElasticsearchDomainConfigCommand = as throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -714,16 +731,17 @@ export const serializeAws_restJson1DescribeElasticsearchDomainsCommand = async ( input: DescribeElasticsearchDomainsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/domain-info"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/domain-info"; let body: any; body = JSON.stringify({ ...(input.DomainNames !== undefined && input.DomainNames !== null && { DomainNames: serializeAws_restJson1DomainNameList(input.DomainNames, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -739,8 +757,11 @@ export const serializeAws_restJson1DescribeElasticsearchInstanceTypeLimitsComman input: DescribeElasticsearchInstanceTypeLimitsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/instanceTypeLimits/{ElasticsearchVersion}/{InstanceType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/instanceTypeLimits/{ElasticsearchVersion}/{InstanceType}"; if (input.InstanceType !== undefined) { const labelValue: string = input.InstanceType; if (labelValue.length <= 0) { @@ -763,7 +784,6 @@ export const serializeAws_restJson1DescribeElasticsearchInstanceTypeLimitsComman ...(input.DomainName !== undefined && { domainName: input.DomainName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -780,10 +800,13 @@ export const serializeAws_restJson1DescribeInboundCrossClusterSearchConnectionsC input: DescribeInboundCrossClusterSearchConnectionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/ccs/inboundConnection/search"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/ccs/inboundConnection/search"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -791,7 +814,6 @@ export const serializeAws_restJson1DescribeInboundCrossClusterSearchConnectionsC ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -807,10 +829,13 @@ export const serializeAws_restJson1DescribeOutboundCrossClusterSearchConnections input: DescribeOutboundCrossClusterSearchConnectionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/ccs/outboundConnection/search"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/ccs/outboundConnection/search"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -818,7 +843,6 @@ export const serializeAws_restJson1DescribeOutboundCrossClusterSearchConnections ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -834,10 +858,12 @@ export const serializeAws_restJson1DescribePackagesCommand = async ( input: DescribePackagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/packages/describe"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/packages/describe"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -845,7 +871,6 @@ export const serializeAws_restJson1DescribePackagesCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -861,8 +886,10 @@ export const serializeAws_restJson1DescribeReservedElasticsearchInstanceOffering input: DescribeReservedElasticsearchInstanceOfferingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/reservedInstanceOfferings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/reservedInstanceOfferings"; const query: any = { ...(input.ReservedElasticsearchInstanceOfferingId !== undefined && { offeringId: input.ReservedElasticsearchInstanceOfferingId, @@ -871,7 +898,6 @@ export const serializeAws_restJson1DescribeReservedElasticsearchInstanceOffering ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -888,8 +914,10 @@ export const serializeAws_restJson1DescribeReservedElasticsearchInstancesCommand input: DescribeReservedElasticsearchInstancesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/reservedInstances"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/reservedInstances"; const query: any = { ...(input.ReservedElasticsearchInstanceId !== undefined && { reservationId: input.ReservedElasticsearchInstanceId, @@ -898,7 +926,6 @@ export const serializeAws_restJson1DescribeReservedElasticsearchInstancesCommand ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -915,8 +942,11 @@ export const serializeAws_restJson1DissociatePackageCommand = async ( input: DissociatePackageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/packages/dissociate/{PackageID}/{DomainName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/packages/dissociate/{PackageID}/{DomainName}"; if (input.PackageID !== undefined) { const labelValue: string = input.PackageID; if (labelValue.length <= 0) { @@ -936,7 +966,6 @@ export const serializeAws_restJson1DissociatePackageCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -952,13 +981,14 @@ export const serializeAws_restJson1GetCompatibleElasticsearchVersionsCommand = a input: GetCompatibleElasticsearchVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/compatibleVersions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/compatibleVersions"; const query: any = { ...(input.DomainName !== undefined && { domainName: input.DomainName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -975,8 +1005,10 @@ export const serializeAws_restJson1GetPackageVersionHistoryCommand = async ( input: GetPackageVersionHistoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/packages/{PackageID}/history"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/packages/{PackageID}/history"; if (input.PackageID !== undefined) { const labelValue: string = input.PackageID; if (labelValue.length <= 0) { @@ -991,7 +1023,6 @@ export const serializeAws_restJson1GetPackageVersionHistoryCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1008,8 +1039,11 @@ export const serializeAws_restJson1GetUpgradeHistoryCommand = async ( input: GetUpgradeHistoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/upgradeDomain/{DomainName}/history"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/upgradeDomain/{DomainName}/history"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -1024,7 +1058,6 @@ export const serializeAws_restJson1GetUpgradeHistoryCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1041,8 +1074,11 @@ export const serializeAws_restJson1GetUpgradeStatusCommand = async ( input: GetUpgradeStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/upgradeDomain/{DomainName}/status"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/upgradeDomain/{DomainName}/status"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -1053,7 +1089,6 @@ export const serializeAws_restJson1GetUpgradeStatusCommand = async ( throw new Error("No value provided for input HTTP label: DomainName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1069,13 +1104,13 @@ export const serializeAws_restJson1ListDomainNamesCommand = async ( input: ListDomainNamesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/domain"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/domain"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1091,8 +1126,10 @@ export const serializeAws_restJson1ListDomainsForPackageCommand = async ( input: ListDomainsForPackageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/packages/{PackageID}/domains"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/packages/{PackageID}/domains"; if (input.PackageID !== undefined) { const labelValue: string = input.PackageID; if (labelValue.length <= 0) { @@ -1107,7 +1144,6 @@ export const serializeAws_restJson1ListDomainsForPackageCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1124,8 +1160,11 @@ export const serializeAws_restJson1ListElasticsearchInstanceTypesCommand = async input: ListElasticsearchInstanceTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/instanceTypes/{ElasticsearchVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/instanceTypes/{ElasticsearchVersion}"; if (input.ElasticsearchVersion !== undefined) { const labelValue: string = input.ElasticsearchVersion; if (labelValue.length <= 0) { @@ -1141,7 +1180,6 @@ export const serializeAws_restJson1ListElasticsearchInstanceTypesCommand = async ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1158,14 +1196,14 @@ export const serializeAws_restJson1ListElasticsearchVersionsCommand = async ( input: ListElasticsearchVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/versions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/versions"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1182,8 +1220,10 @@ export const serializeAws_restJson1ListPackagesForDomainCommand = async ( input: ListPackagesForDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/domain/{DomainName}/packages"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/domain/{DomainName}/packages"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -1198,7 +1238,6 @@ export const serializeAws_restJson1ListPackagesForDomainCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1215,13 +1254,13 @@ export const serializeAws_restJson1ListTagsCommand = async ( input: ListTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/tags"; const query: any = { ...(input.ARN !== undefined && { arn: input.ARN }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1238,10 +1277,13 @@ export const serializeAws_restJson1PurchaseReservedElasticsearchInstanceOffering input: PurchaseReservedElasticsearchInstanceOfferingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/purchaseReservedInstanceOffering"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/purchaseReservedInstanceOffering"; let body: any; body = JSON.stringify({ ...(input.InstanceCount !== undefined && input.InstanceCount !== null && { InstanceCount: input.InstanceCount }), @@ -1252,7 +1294,6 @@ export const serializeAws_restJson1PurchaseReservedElasticsearchInstanceOffering ReservedElasticsearchInstanceOfferingId: input.ReservedElasticsearchInstanceOfferingId, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1268,8 +1309,11 @@ export const serializeAws_restJson1RejectInboundCrossClusterSearchConnectionComm input: RejectInboundCrossClusterSearchConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-01-01/es/ccs/inboundConnection/{CrossClusterSearchConnectionId}/reject"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/ccs/inboundConnection/{CrossClusterSearchConnectionId}/reject"; if (input.CrossClusterSearchConnectionId !== undefined) { const labelValue: string = input.CrossClusterSearchConnectionId; if (labelValue.length <= 0) { @@ -1280,7 +1324,6 @@ export const serializeAws_restJson1RejectInboundCrossClusterSearchConnectionComm throw new Error("No value provided for input HTTP label: CrossClusterSearchConnectionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1296,17 +1339,17 @@ export const serializeAws_restJson1RemoveTagsCommand = async ( input: RemoveTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/tags-removal"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/tags-removal"; let body: any; body = JSON.stringify({ ...(input.ARN !== undefined && input.ARN !== null && { ARN: input.ARN }), ...(input.TagKeys !== undefined && input.TagKeys !== null && { TagKeys: serializeAws_restJson1StringList(input.TagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1322,15 +1365,17 @@ export const serializeAws_restJson1StartElasticsearchServiceSoftwareUpdateComman input: StartElasticsearchServiceSoftwareUpdateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/serviceSoftwareUpdate/start"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-01-01/es/serviceSoftwareUpdate/start"; let body: any; body = JSON.stringify({ ...(input.DomainName !== undefined && input.DomainName !== null && { DomainName: input.DomainName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1346,10 +1391,12 @@ export const serializeAws_restJson1UpdateElasticsearchDomainConfigCommand = asyn input: UpdateElasticsearchDomainConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/domain/{DomainName}/config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/domain/{DomainName}/config"; if (input.DomainName !== undefined) { const labelValue: string = input.DomainName; if (labelValue.length <= 0) { @@ -1417,7 +1464,6 @@ export const serializeAws_restJson1UpdateElasticsearchDomainConfigCommand = asyn ...(input.VPCOptions !== undefined && input.VPCOptions !== null && { VPCOptions: serializeAws_restJson1VPCOptions(input.VPCOptions, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1433,10 +1479,12 @@ export const serializeAws_restJson1UpdatePackageCommand = async ( input: UpdatePackageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/packages/update"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/packages/update"; let body: any; body = JSON.stringify({ ...(input.CommitMessage !== undefined && input.CommitMessage !== null && { CommitMessage: input.CommitMessage }), @@ -1448,7 +1496,6 @@ export const serializeAws_restJson1UpdatePackageCommand = async ( PackageSource: serializeAws_restJson1PackageSource(input.PackageSource, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1464,10 +1511,12 @@ export const serializeAws_restJson1UpgradeElasticsearchDomainCommand = async ( input: UpgradeElasticsearchDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-01-01/es/upgradeDomain"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-01-01/es/upgradeDomain"; let body: any; body = JSON.stringify({ ...(input.DomainName !== undefined && input.DomainName !== null && { DomainName: input.DomainName }), @@ -1475,7 +1524,6 @@ export const serializeAws_restJson1UpgradeElasticsearchDomainCommand = async ( input.PerformCheckOnly !== null && { PerformCheckOnly: input.PerformCheckOnly }), ...(input.TargetVersion !== undefined && input.TargetVersion !== null && { TargetVersion: input.TargetVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-emr-containers/protocols/Aws_restJson1.ts b/clients/client-emr-containers/protocols/Aws_restJson1.ts index 115dfadd9f80b..77bba09006633 100644 --- a/clients/client-emr-containers/protocols/Aws_restJson1.ts +++ b/clients/client-emr-containers/protocols/Aws_restJson1.ts @@ -76,8 +76,11 @@ export const serializeAws_restJson1CancelJobRunCommand = async ( input: CancelJobRunCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/virtualclusters/{virtualClusterId}/jobruns/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/virtualclusters/{virtualClusterId}/jobruns/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -97,7 +100,6 @@ export const serializeAws_restJson1CancelJobRunCommand = async ( throw new Error("No value provided for input HTTP label: virtualClusterId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -113,10 +115,13 @@ export const serializeAws_restJson1CreateManagedEndpointCommand = async ( input: CreateManagedEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/virtualclusters/{virtualClusterId}/endpoints"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/virtualclusters/{virtualClusterId}/endpoints"; if (input.virtualClusterId !== undefined) { const labelValue: string = input.virtualClusterId; if (labelValue.length <= 0) { @@ -142,7 +147,6 @@ export const serializeAws_restJson1CreateManagedEndpointCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -158,10 +162,11 @@ export const serializeAws_restJson1CreateVirtualClusterCommand = async ( input: CreateVirtualClusterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/virtualclusters"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/virtualclusters"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -172,7 +177,6 @@ export const serializeAws_restJson1CreateVirtualClusterCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -188,8 +192,11 @@ export const serializeAws_restJson1DeleteManagedEndpointCommand = async ( input: DeleteManagedEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/virtualclusters/{virtualClusterId}/endpoints/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/virtualclusters/{virtualClusterId}/endpoints/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -209,7 +216,6 @@ export const serializeAws_restJson1DeleteManagedEndpointCommand = async ( throw new Error("No value provided for input HTTP label: virtualClusterId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -225,8 +231,9 @@ export const serializeAws_restJson1DeleteVirtualClusterCommand = async ( input: DeleteVirtualClusterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/virtualclusters/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/virtualclusters/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -237,7 +244,6 @@ export const serializeAws_restJson1DeleteVirtualClusterCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -253,8 +259,11 @@ export const serializeAws_restJson1DescribeJobRunCommand = async ( input: DescribeJobRunCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/virtualclusters/{virtualClusterId}/jobruns/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/virtualclusters/{virtualClusterId}/jobruns/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -274,7 +283,6 @@ export const serializeAws_restJson1DescribeJobRunCommand = async ( throw new Error("No value provided for input HTTP label: virtualClusterId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -290,8 +298,11 @@ export const serializeAws_restJson1DescribeManagedEndpointCommand = async ( input: DescribeManagedEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/virtualclusters/{virtualClusterId}/endpoints/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/virtualclusters/{virtualClusterId}/endpoints/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -311,7 +322,6 @@ export const serializeAws_restJson1DescribeManagedEndpointCommand = async ( throw new Error("No value provided for input HTTP label: virtualClusterId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -327,8 +337,9 @@ export const serializeAws_restJson1DescribeVirtualClusterCommand = async ( input: DescribeVirtualClusterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/virtualclusters/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/virtualclusters/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -339,7 +350,6 @@ export const serializeAws_restJson1DescribeVirtualClusterCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -355,8 +365,11 @@ export const serializeAws_restJson1ListJobRunsCommand = async ( input: ListJobRunsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/virtualclusters/{virtualClusterId}/jobruns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/virtualclusters/{virtualClusterId}/jobruns"; if (input.virtualClusterId !== undefined) { const labelValue: string = input.virtualClusterId; if (labelValue.length <= 0) { @@ -379,7 +392,6 @@ export const serializeAws_restJson1ListJobRunsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -396,8 +408,11 @@ export const serializeAws_restJson1ListManagedEndpointsCommand = async ( input: ListManagedEndpointsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/virtualclusters/{virtualClusterId}/endpoints"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/virtualclusters/{virtualClusterId}/endpoints"; if (input.virtualClusterId !== undefined) { const labelValue: string = input.virtualClusterId; if (labelValue.length <= 0) { @@ -420,7 +435,6 @@ export const serializeAws_restJson1ListManagedEndpointsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -437,8 +451,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -449,7 +464,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -465,8 +479,9 @@ export const serializeAws_restJson1ListVirtualClustersCommand = async ( input: ListVirtualClustersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/virtualclusters"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/virtualclusters"; const query: any = { ...(input.containerProviderId !== undefined && { containerProviderId: input.containerProviderId }), ...(input.containerProviderType !== undefined && { containerProviderType: input.containerProviderType }), @@ -481,7 +496,6 @@ export const serializeAws_restJson1ListVirtualClustersCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -498,10 +512,13 @@ export const serializeAws_restJson1StartJobRunCommand = async ( input: StartJobRunCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/virtualclusters/{virtualClusterId}/jobruns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/virtualclusters/{virtualClusterId}/jobruns"; if (input.virtualClusterId !== undefined) { const labelValue: string = input.virtualClusterId; if (labelValue.length <= 0) { @@ -526,7 +543,6 @@ export const serializeAws_restJson1StartJobRunCommand = async ( ...(input.releaseLabel !== undefined && input.releaseLabel !== null && { releaseLabel: input.releaseLabel }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -542,10 +558,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -559,7 +576,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -575,8 +591,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -590,7 +607,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-finspace-data/protocols/Aws_restJson1.ts b/clients/client-finspace-data/protocols/Aws_restJson1.ts index b9eb3dacf671e..a7f387bf4a976 100644 --- a/clients/client-finspace-data/protocols/Aws_restJson1.ts +++ b/clients/client-finspace-data/protocols/Aws_restJson1.ts @@ -32,10 +32,12 @@ export const serializeAws_restJson1CreateChangesetCommand = async ( input: CreateChangesetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datasets/{datasetId}/changesets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{datasetId}/changesets"; if (input.datasetId !== undefined) { const labelValue: string = input.datasetId; if (labelValue.length <= 0) { @@ -57,7 +59,6 @@ export const serializeAws_restJson1CreateChangesetCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1stringMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -73,14 +74,15 @@ export const serializeAws_restJson1GetProgrammaticAccessCredentialsCommand = asy input: GetProgrammaticAccessCredentialsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/credentials/programmatic"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/credentials/programmatic"; const query: any = { ...(input.durationInMinutes !== undefined && { durationInMinutes: input.durationInMinutes.toString() }), ...(input.environmentId !== undefined && { environmentId: input.environmentId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -97,15 +99,15 @@ export const serializeAws_restJson1GetWorkingLocationCommand = async ( input: GetWorkingLocationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workingLocationV1"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workingLocationV1"; let body: any; body = JSON.stringify({ ...(input.locationType !== undefined && input.locationType !== null && { locationType: input.locationType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-finspace/protocols/Aws_restJson1.ts b/clients/client-finspace/protocols/Aws_restJson1.ts index 971e20f54a6ed..69680bd124481 100644 --- a/clients/client-finspace/protocols/Aws_restJson1.ts +++ b/clients/client-finspace/protocols/Aws_restJson1.ts @@ -38,10 +38,11 @@ export const serializeAws_restJson1CreateEnvironmentCommand = async ( input: CreateEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/environment"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/environment"; let body: any; body = JSON.stringify({ ...(input.description !== undefined && input.description !== null && { description: input.description }), @@ -55,7 +56,6 @@ export const serializeAws_restJson1CreateEnvironmentCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -71,8 +71,10 @@ export const serializeAws_restJson1DeleteEnvironmentCommand = async ( input: DeleteEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/environment/{environmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/environment/{environmentId}"; if (input.environmentId !== undefined) { const labelValue: string = input.environmentId; if (labelValue.length <= 0) { @@ -83,7 +85,6 @@ export const serializeAws_restJson1DeleteEnvironmentCommand = async ( throw new Error("No value provided for input HTTP label: environmentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -99,8 +100,10 @@ export const serializeAws_restJson1GetEnvironmentCommand = async ( input: GetEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/environment/{environmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/environment/{environmentId}"; if (input.environmentId !== undefined) { const labelValue: string = input.environmentId; if (labelValue.length <= 0) { @@ -111,7 +114,6 @@ export const serializeAws_restJson1GetEnvironmentCommand = async ( throw new Error("No value provided for input HTTP label: environmentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -127,14 +129,14 @@ export const serializeAws_restJson1ListEnvironmentsCommand = async ( input: ListEnvironmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/environment"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/environment"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -151,8 +153,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -163,7 +166,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -179,10 +181,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -196,7 +199,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -212,8 +214,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -227,7 +230,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -244,10 +246,12 @@ export const serializeAws_restJson1UpdateEnvironmentCommand = async ( input: UpdateEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/environment/{environmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/environment/{environmentId}"; if (input.environmentId !== undefined) { const labelValue: string = input.environmentId; if (labelValue.length <= 0) { @@ -268,7 +272,6 @@ export const serializeAws_restJson1UpdateEnvironmentCommand = async ( }), ...(input.name !== undefined && input.name !== null && { name: input.name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-fis/protocols/Aws_restJson1.ts b/clients/client-fis/protocols/Aws_restJson1.ts index 19b23f88156be..76e2cc8b171d7 100644 --- a/clients/client-fis/protocols/Aws_restJson1.ts +++ b/clients/client-fis/protocols/Aws_restJson1.ts @@ -80,10 +80,11 @@ export const serializeAws_restJson1CreateExperimentTemplateCommand = async ( input: CreateExperimentTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/experimentTemplates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/experimentTemplates"; let body: any; body = JSON.stringify({ ...(input.actions !== undefined && @@ -106,7 +107,6 @@ export const serializeAws_restJson1CreateExperimentTemplateCommand = async ( targets: serializeAws_restJson1CreateExperimentTemplateTargetInputMap(input.targets, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -122,8 +122,10 @@ export const serializeAws_restJson1DeleteExperimentTemplateCommand = async ( input: DeleteExperimentTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/experimentTemplates/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/experimentTemplates/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -134,7 +136,6 @@ export const serializeAws_restJson1DeleteExperimentTemplateCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -150,8 +151,9 @@ export const serializeAws_restJson1GetActionCommand = async ( input: GetActionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/actions/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/actions/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -162,7 +164,6 @@ export const serializeAws_restJson1GetActionCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -178,8 +179,9 @@ export const serializeAws_restJson1GetExperimentCommand = async ( input: GetExperimentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/experiments/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/experiments/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -190,7 +192,6 @@ export const serializeAws_restJson1GetExperimentCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -206,8 +207,10 @@ export const serializeAws_restJson1GetExperimentTemplateCommand = async ( input: GetExperimentTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/experimentTemplates/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/experimentTemplates/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -218,7 +221,6 @@ export const serializeAws_restJson1GetExperimentTemplateCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -234,14 +236,14 @@ export const serializeAws_restJson1ListActionsCommand = async ( input: ListActionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/actions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/actions"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -258,14 +260,14 @@ export const serializeAws_restJson1ListExperimentsCommand = async ( input: ListExperimentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/experiments"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/experiments"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -282,14 +284,14 @@ export const serializeAws_restJson1ListExperimentTemplatesCommand = async ( input: ListExperimentTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/experimentTemplates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/experimentTemplates"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -306,8 +308,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -318,7 +321,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -334,10 +336,11 @@ export const serializeAws_restJson1StartExperimentCommand = async ( input: StartExperimentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/experiments"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/experiments"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -345,7 +348,6 @@ export const serializeAws_restJson1StartExperimentCommand = async ( input.experimentTemplateId !== null && { experimentTemplateId: input.experimentTemplateId }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -361,8 +363,9 @@ export const serializeAws_restJson1StopExperimentCommand = async ( input: StopExperimentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/experiments/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/experiments/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -373,7 +376,6 @@ export const serializeAws_restJson1StopExperimentCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -389,10 +391,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -406,7 +409,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -422,8 +424,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -437,7 +440,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -454,10 +456,12 @@ export const serializeAws_restJson1UpdateExperimentTemplateCommand = async ( input: UpdateExperimentTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/experimentTemplates/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/experimentTemplates/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -487,7 +491,6 @@ export const serializeAws_restJson1UpdateExperimentTemplateCommand = async ( targets: serializeAws_restJson1UpdateExperimentTemplateTargetInputMap(input.targets, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-glacier/protocols/Aws_restJson1.ts b/clients/client-glacier/protocols/Aws_restJson1.ts index 6d4ef9ecd372f..fe07606efd9c4 100644 --- a/clients/client-glacier/protocols/Aws_restJson1.ts +++ b/clients/client-glacier/protocols/Aws_restJson1.ts @@ -131,8 +131,11 @@ export const serializeAws_restJson1AbortMultipartUploadCommand = async ( input: AbortMultipartUploadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -161,7 +164,6 @@ export const serializeAws_restJson1AbortMultipartUploadCommand = async ( throw new Error("No value provided for input HTTP label: uploadId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -177,8 +179,11 @@ export const serializeAws_restJson1AbortVaultLockCommand = async ( input: AbortVaultLockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/lock-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/lock-policy"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -198,7 +203,6 @@ export const serializeAws_restJson1AbortVaultLockCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -214,10 +218,12 @@ export const serializeAws_restJson1AddTagsToVaultCommand = async ( input: AddTagsToVaultCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/vaults/{vaultName}/tags"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -243,7 +249,6 @@ export const serializeAws_restJson1AddTagsToVaultCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -260,11 +265,14 @@ export const serializeAws_restJson1CompleteMultipartUploadCommand = async ( input: CompleteMultipartUploadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.archiveSize) && { "x-amz-archive-size": input.archiveSize! }), ...(isSerializableHeaderValue(input.checksum) && { "x-amz-sha256-tree-hash": input.checksum! }), }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -293,7 +301,6 @@ export const serializeAws_restJson1CompleteMultipartUploadCommand = async ( throw new Error("No value provided for input HTTP label: uploadId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -309,8 +316,11 @@ export const serializeAws_restJson1CompleteVaultLockCommand = async ( input: CompleteVaultLockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/lock-policy/{lockId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/lock-policy/{lockId}"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -339,7 +349,6 @@ export const serializeAws_restJson1CompleteVaultLockCommand = async ( throw new Error("No value provided for input HTTP label: lockId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -355,8 +364,10 @@ export const serializeAws_restJson1CreateVaultCommand = async ( input: CreateVaultCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/vaults/{vaultName}"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -376,7 +387,6 @@ export const serializeAws_restJson1CreateVaultCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -392,8 +402,11 @@ export const serializeAws_restJson1DeleteArchiveCommand = async ( input: DeleteArchiveCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/archives/{archiveId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/archives/{archiveId}"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -422,7 +435,6 @@ export const serializeAws_restJson1DeleteArchiveCommand = async ( throw new Error("No value provided for input HTTP label: archiveId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -438,8 +450,10 @@ export const serializeAws_restJson1DeleteVaultCommand = async ( input: DeleteVaultCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/vaults/{vaultName}"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -459,7 +473,6 @@ export const serializeAws_restJson1DeleteVaultCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -475,8 +488,11 @@ export const serializeAws_restJson1DeleteVaultAccessPolicyCommand = async ( input: DeleteVaultAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/access-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/access-policy"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -496,7 +512,6 @@ export const serializeAws_restJson1DeleteVaultAccessPolicyCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -512,8 +527,11 @@ export const serializeAws_restJson1DeleteVaultNotificationsCommand = async ( input: DeleteVaultNotificationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/notification-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/notification-configuration"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -533,7 +551,6 @@ export const serializeAws_restJson1DeleteVaultNotificationsCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -549,8 +566,11 @@ export const serializeAws_restJson1DescribeJobCommand = async ( input: DescribeJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/jobs/{jobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/jobs/{jobId}"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -579,7 +599,6 @@ export const serializeAws_restJson1DescribeJobCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -595,8 +614,10 @@ export const serializeAws_restJson1DescribeVaultCommand = async ( input: DescribeVaultCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/vaults/{vaultName}"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -616,7 +637,6 @@ export const serializeAws_restJson1DescribeVaultCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -632,8 +652,10 @@ export const serializeAws_restJson1GetDataRetrievalPolicyCommand = async ( input: GetDataRetrievalPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/policies/data-retrieval"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/policies/data-retrieval"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -644,7 +666,6 @@ export const serializeAws_restJson1GetDataRetrievalPolicyCommand = async ( throw new Error("No value provided for input HTTP label: accountId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -660,10 +681,13 @@ export const serializeAws_restJson1GetJobOutputCommand = async ( input: GetJobOutputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.range) && { range: input.range! }), }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/jobs/{jobId}/output"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/jobs/{jobId}/output"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -692,7 +716,6 @@ export const serializeAws_restJson1GetJobOutputCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -708,8 +731,11 @@ export const serializeAws_restJson1GetVaultAccessPolicyCommand = async ( input: GetVaultAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/access-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/access-policy"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -729,7 +755,6 @@ export const serializeAws_restJson1GetVaultAccessPolicyCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -745,8 +770,11 @@ export const serializeAws_restJson1GetVaultLockCommand = async ( input: GetVaultLockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/lock-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/lock-policy"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -766,7 +794,6 @@ export const serializeAws_restJson1GetVaultLockCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -782,8 +809,11 @@ export const serializeAws_restJson1GetVaultNotificationsCommand = async ( input: GetVaultNotificationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/notification-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/notification-configuration"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -803,7 +833,6 @@ export const serializeAws_restJson1GetVaultNotificationsCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -819,10 +848,12 @@ export const serializeAws_restJson1InitiateJobCommand = async ( input: InitiateJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/jobs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/vaults/{vaultName}/jobs"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -849,7 +880,6 @@ export const serializeAws_restJson1InitiateJobCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -865,13 +895,16 @@ export const serializeAws_restJson1InitiateMultipartUploadCommand = async ( input: InitiateMultipartUploadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.archiveDescription) && { "x-amz-archive-description": input.archiveDescription!, }), ...(isSerializableHeaderValue(input.partSize) && { "x-amz-part-size": input.partSize! }), }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/multipart-uploads"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/multipart-uploads"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -891,7 +924,6 @@ export const serializeAws_restJson1InitiateMultipartUploadCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -907,10 +939,13 @@ export const serializeAws_restJson1InitiateVaultLockCommand = async ( input: InitiateVaultLockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/lock-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/lock-policy"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -937,7 +972,6 @@ export const serializeAws_restJson1InitiateVaultLockCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -953,8 +987,10 @@ export const serializeAws_restJson1ListJobsCommand = async ( input: ListJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/jobs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/vaults/{vaultName}/jobs"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -980,7 +1016,6 @@ export const serializeAws_restJson1ListJobsCommand = async ( ...(input.completed !== undefined && { completed: input.completed }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -997,8 +1032,11 @@ export const serializeAws_restJson1ListMultipartUploadsCommand = async ( input: ListMultipartUploadsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/multipart-uploads"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/multipart-uploads"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1022,7 +1060,6 @@ export const serializeAws_restJson1ListMultipartUploadsCommand = async ( ...(input.marker !== undefined && { marker: input.marker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1039,8 +1076,11 @@ export const serializeAws_restJson1ListPartsCommand = async ( input: ListPartsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1073,7 +1113,6 @@ export const serializeAws_restJson1ListPartsCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1090,8 +1129,10 @@ export const serializeAws_restJson1ListProvisionedCapacityCommand = async ( input: ListProvisionedCapacityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/provisioned-capacity"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/provisioned-capacity"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1102,7 +1143,6 @@ export const serializeAws_restJson1ListProvisionedCapacityCommand = async ( throw new Error("No value provided for input HTTP label: accountId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1118,8 +1158,10 @@ export const serializeAws_restJson1ListTagsForVaultCommand = async ( input: ListTagsForVaultCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults/{vaultName}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/vaults/{vaultName}/tags"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1139,7 +1181,6 @@ export const serializeAws_restJson1ListTagsForVaultCommand = async ( throw new Error("No value provided for input HTTP label: vaultName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1155,8 +1196,9 @@ export const serializeAws_restJson1ListVaultsCommand = async ( input: ListVaultsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/vaults"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/vaults"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1171,7 +1213,6 @@ export const serializeAws_restJson1ListVaultsCommand = async ( ...(input.limit !== undefined && { limit: input.limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1188,8 +1229,10 @@ export const serializeAws_restJson1PurchaseProvisionedCapacityCommand = async ( input: PurchaseProvisionedCapacityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{accountId}/provisioned-capacity"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/provisioned-capacity"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1200,7 +1243,6 @@ export const serializeAws_restJson1PurchaseProvisionedCapacityCommand = async ( throw new Error("No value provided for input HTTP label: accountId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1216,10 +1258,12 @@ export const serializeAws_restJson1RemoveTagsFromVaultCommand = async ( input: RemoveTagsFromVaultCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/vaults/{vaultName}/tags"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1246,7 +1290,6 @@ export const serializeAws_restJson1RemoveTagsFromVaultCommand = async ( ...(input.TagKeys !== undefined && input.TagKeys !== null && { TagKeys: serializeAws_restJson1TagKeyList(input.TagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1263,10 +1306,12 @@ export const serializeAws_restJson1SetDataRetrievalPolicyCommand = async ( input: SetDataRetrievalPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/{accountId}/policies/data-retrieval"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/policies/data-retrieval"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1281,7 +1326,6 @@ export const serializeAws_restJson1SetDataRetrievalPolicyCommand = async ( ...(input.Policy !== undefined && input.Policy !== null && { Policy: serializeAws_restJson1DataRetrievalPolicy(input.Policy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1297,10 +1341,13 @@ export const serializeAws_restJson1SetVaultAccessPolicyCommand = async ( input: SetVaultAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/access-policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/access-policy"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1327,7 +1374,6 @@ export const serializeAws_restJson1SetVaultAccessPolicyCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1343,10 +1389,13 @@ export const serializeAws_restJson1SetVaultNotificationsCommand = async ( input: SetVaultNotificationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/notification-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/notification-configuration"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1373,7 +1422,6 @@ export const serializeAws_restJson1SetVaultNotificationsCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1389,6 +1437,7 @@ export const serializeAws_restJson1UploadArchiveCommand = async ( input: UploadArchiveCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.archiveDescription) && { @@ -1396,7 +1445,8 @@ export const serializeAws_restJson1UploadArchiveCommand = async ( }), ...(isSerializableHeaderValue(input.checksum) && { "x-amz-sha256-tree-hash": input.checksum! }), }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/archives"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{accountId}/vaults/{vaultName}/archives"; if (input.vaultName !== undefined) { const labelValue: string = input.vaultName; if (labelValue.length <= 0) { @@ -1419,7 +1469,6 @@ export const serializeAws_restJson1UploadArchiveCommand = async ( if (input.body !== undefined) { body = input.body; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1435,12 +1484,15 @@ export const serializeAws_restJson1UploadMultipartPartCommand = async ( input: UploadMultipartPartCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.checksum) && { "x-amz-sha256-tree-hash": input.checksum! }), ...(isSerializableHeaderValue(input.range) && { "content-range": input.range! }), }; - let resolvedPath = "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}"; if (input.accountId !== undefined) { const labelValue: string = input.accountId; if (labelValue.length <= 0) { @@ -1472,7 +1524,6 @@ export const serializeAws_restJson1UploadMultipartPartCommand = async ( if (input.body !== undefined) { body = input.body; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-greengrass/protocols/Aws_restJson1.ts b/clients/client-greengrass/protocols/Aws_restJson1.ts index d681a6cf640ad..3d0aafce96407 100644 --- a/clients/client-greengrass/protocols/Aws_restJson1.ts +++ b/clients/client-greengrass/protocols/Aws_restJson1.ts @@ -384,10 +384,12 @@ export const serializeAws_restJson1AssociateRoleToGroupCommand = async ( input: AssociateRoleToGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/groups/{GroupId}/role"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups/{GroupId}/role"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -401,7 +403,6 @@ export const serializeAws_restJson1AssociateRoleToGroupCommand = async ( body = JSON.stringify({ ...(input.RoleArn !== undefined && input.RoleArn !== null && { RoleArn: input.RoleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -417,15 +418,15 @@ export const serializeAws_restJson1AssociateServiceRoleToAccountCommand = async input: AssociateServiceRoleToAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/servicerole"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/servicerole"; let body: any; body = JSON.stringify({ ...(input.RoleArn !== undefined && input.RoleArn !== null && { RoleArn: input.RoleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -441,11 +442,13 @@ export const serializeAws_restJson1CreateConnectorDefinitionCommand = async ( input: CreateConnectorDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/connectors"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/connectors"; let body: any; body = JSON.stringify({ ...(input.InitialVersion !== undefined && @@ -455,7 +458,6 @@ export const serializeAws_restJson1CreateConnectorDefinitionCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -471,11 +473,14 @@ export const serializeAws_restJson1CreateConnectorDefinitionVersionCommand = asy input: CreateConnectorDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/connectors/{ConnectorDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/connectors/{ConnectorDefinitionId}/versions"; if (input.ConnectorDefinitionId !== undefined) { const labelValue: string = input.ConnectorDefinitionId; if (labelValue.length <= 0) { @@ -490,7 +495,6 @@ export const serializeAws_restJson1CreateConnectorDefinitionVersionCommand = asy ...(input.Connectors !== undefined && input.Connectors !== null && { Connectors: serializeAws_restJson1__listOfConnector(input.Connectors, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -506,11 +510,13 @@ export const serializeAws_restJson1CreateCoreDefinitionCommand = async ( input: CreateCoreDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/cores"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/cores"; let body: any; body = JSON.stringify({ ...(input.InitialVersion !== undefined && @@ -520,7 +526,6 @@ export const serializeAws_restJson1CreateCoreDefinitionCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -536,11 +541,14 @@ export const serializeAws_restJson1CreateCoreDefinitionVersionCommand = async ( input: CreateCoreDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/cores/{CoreDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/cores/{CoreDefinitionId}/versions"; if (input.CoreDefinitionId !== undefined) { const labelValue: string = input.CoreDefinitionId; if (labelValue.length <= 0) { @@ -555,7 +563,6 @@ export const serializeAws_restJson1CreateCoreDefinitionVersionCommand = async ( ...(input.Cores !== undefined && input.Cores !== null && { Cores: serializeAws_restJson1__listOfCore(input.Cores, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -571,11 +578,13 @@ export const serializeAws_restJson1CreateDeploymentCommand = async ( input: CreateDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/groups/{GroupId}/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups/{GroupId}/deployments"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -593,7 +602,6 @@ export const serializeAws_restJson1CreateDeploymentCommand = async ( ...(input.GroupVersionId !== undefined && input.GroupVersionId !== null && { GroupVersionId: input.GroupVersionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -609,11 +617,13 @@ export const serializeAws_restJson1CreateDeviceDefinitionCommand = async ( input: CreateDeviceDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/devices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/devices"; let body: any; body = JSON.stringify({ ...(input.InitialVersion !== undefined && @@ -623,7 +633,6 @@ export const serializeAws_restJson1CreateDeviceDefinitionCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -639,11 +648,14 @@ export const serializeAws_restJson1CreateDeviceDefinitionVersionCommand = async input: CreateDeviceDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/devices/{DeviceDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/devices/{DeviceDefinitionId}/versions"; if (input.DeviceDefinitionId !== undefined) { const labelValue: string = input.DeviceDefinitionId; if (labelValue.length <= 0) { @@ -658,7 +670,6 @@ export const serializeAws_restJson1CreateDeviceDefinitionVersionCommand = async ...(input.Devices !== undefined && input.Devices !== null && { Devices: serializeAws_restJson1__listOfDevice(input.Devices, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -674,11 +685,13 @@ export const serializeAws_restJson1CreateFunctionDefinitionCommand = async ( input: CreateFunctionDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/functions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/functions"; let body: any; body = JSON.stringify({ ...(input.InitialVersion !== undefined && @@ -688,7 +701,6 @@ export const serializeAws_restJson1CreateFunctionDefinitionCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -704,11 +716,14 @@ export const serializeAws_restJson1CreateFunctionDefinitionVersionCommand = asyn input: CreateFunctionDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/functions/{FunctionDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/functions/{FunctionDefinitionId}/versions"; if (input.FunctionDefinitionId !== undefined) { const labelValue: string = input.FunctionDefinitionId; if (labelValue.length <= 0) { @@ -727,7 +742,6 @@ export const serializeAws_restJson1CreateFunctionDefinitionVersionCommand = asyn ...(input.Functions !== undefined && input.Functions !== null && { Functions: serializeAws_restJson1__listOfFunction(input.Functions, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -743,11 +757,12 @@ export const serializeAws_restJson1CreateGroupCommand = async ( input: CreateGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups"; let body: any; body = JSON.stringify({ ...(input.InitialVersion !== undefined && @@ -757,7 +772,6 @@ export const serializeAws_restJson1CreateGroupCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -773,10 +787,13 @@ export const serializeAws_restJson1CreateGroupCertificateAuthorityCommand = asyn input: CreateGroupCertificateAuthorityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/groups/{GroupId}/certificateauthorities"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/groups/{GroupId}/certificateauthorities"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -787,7 +804,6 @@ export const serializeAws_restJson1CreateGroupCertificateAuthorityCommand = asyn throw new Error("No value provided for input HTTP label: GroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -803,11 +819,13 @@ export const serializeAws_restJson1CreateGroupVersionCommand = async ( input: CreateGroupVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/groups/{GroupId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups/{GroupId}/versions"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -842,7 +860,6 @@ export const serializeAws_restJson1CreateGroupVersionCommand = async ( SubscriptionDefinitionVersionArn: input.SubscriptionDefinitionVersionArn, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -858,11 +875,13 @@ export const serializeAws_restJson1CreateLoggerDefinitionCommand = async ( input: CreateLoggerDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/loggers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/loggers"; let body: any; body = JSON.stringify({ ...(input.InitialVersion !== undefined && @@ -872,7 +891,6 @@ export const serializeAws_restJson1CreateLoggerDefinitionCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -888,11 +906,14 @@ export const serializeAws_restJson1CreateLoggerDefinitionVersionCommand = async input: CreateLoggerDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/loggers/{LoggerDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/loggers/{LoggerDefinitionId}/versions"; if (input.LoggerDefinitionId !== undefined) { const labelValue: string = input.LoggerDefinitionId; if (labelValue.length <= 0) { @@ -907,7 +928,6 @@ export const serializeAws_restJson1CreateLoggerDefinitionVersionCommand = async ...(input.Loggers !== undefined && input.Loggers !== null && { Loggers: serializeAws_restJson1__listOfLogger(input.Loggers, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -923,11 +943,13 @@ export const serializeAws_restJson1CreateResourceDefinitionCommand = async ( input: CreateResourceDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/resources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/resources"; let body: any; body = JSON.stringify({ ...(input.InitialVersion !== undefined && @@ -937,7 +959,6 @@ export const serializeAws_restJson1CreateResourceDefinitionCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -953,11 +974,14 @@ export const serializeAws_restJson1CreateResourceDefinitionVersionCommand = asyn input: CreateResourceDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/resources/{ResourceDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/resources/{ResourceDefinitionId}/versions"; if (input.ResourceDefinitionId !== undefined) { const labelValue: string = input.ResourceDefinitionId; if (labelValue.length <= 0) { @@ -972,7 +996,6 @@ export const serializeAws_restJson1CreateResourceDefinitionVersionCommand = asyn ...(input.Resources !== undefined && input.Resources !== null && { Resources: serializeAws_restJson1__listOfResource(input.Resources, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -988,11 +1011,12 @@ export const serializeAws_restJson1CreateSoftwareUpdateJobCommand = async ( input: CreateSoftwareUpdateJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/updates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/updates"; let body: any; body = JSON.stringify({ ...(input.S3UrlSignerRole !== undefined && @@ -1012,7 +1036,6 @@ export const serializeAws_restJson1CreateSoftwareUpdateJobCommand = async ( UpdateTargetsOperatingSystem: input.UpdateTargetsOperatingSystem, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1028,11 +1051,13 @@ export const serializeAws_restJson1CreateSubscriptionDefinitionCommand = async ( input: CreateSubscriptionDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/subscriptions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/subscriptions"; let body: any; body = JSON.stringify({ ...(input.InitialVersion !== undefined && @@ -1042,7 +1067,6 @@ export const serializeAws_restJson1CreateSubscriptionDefinitionCommand = async ( ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1058,11 +1082,14 @@ export const serializeAws_restJson1CreateSubscriptionDefinitionVersionCommand = input: CreateSubscriptionDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}/versions"; if (input.SubscriptionDefinitionId !== undefined) { const labelValue: string = input.SubscriptionDefinitionId; if (labelValue.length <= 0) { @@ -1079,7 +1106,6 @@ export const serializeAws_restJson1CreateSubscriptionDefinitionVersionCommand = Subscriptions: serializeAws_restJson1__listOfSubscription(input.Subscriptions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1095,8 +1121,11 @@ export const serializeAws_restJson1DeleteConnectorDefinitionCommand = async ( input: DeleteConnectorDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/connectors/{ConnectorDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/connectors/{ConnectorDefinitionId}"; if (input.ConnectorDefinitionId !== undefined) { const labelValue: string = input.ConnectorDefinitionId; if (labelValue.length <= 0) { @@ -1107,7 +1136,6 @@ export const serializeAws_restJson1DeleteConnectorDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: ConnectorDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1123,8 +1151,11 @@ export const serializeAws_restJson1DeleteCoreDefinitionCommand = async ( input: DeleteCoreDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/cores/{CoreDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/cores/{CoreDefinitionId}"; if (input.CoreDefinitionId !== undefined) { const labelValue: string = input.CoreDefinitionId; if (labelValue.length <= 0) { @@ -1135,7 +1166,6 @@ export const serializeAws_restJson1DeleteCoreDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: CoreDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1151,8 +1181,11 @@ export const serializeAws_restJson1DeleteDeviceDefinitionCommand = async ( input: DeleteDeviceDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/devices/{DeviceDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/devices/{DeviceDefinitionId}"; if (input.DeviceDefinitionId !== undefined) { const labelValue: string = input.DeviceDefinitionId; if (labelValue.length <= 0) { @@ -1163,7 +1196,6 @@ export const serializeAws_restJson1DeleteDeviceDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: DeviceDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1179,8 +1211,11 @@ export const serializeAws_restJson1DeleteFunctionDefinitionCommand = async ( input: DeleteFunctionDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/functions/{FunctionDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/functions/{FunctionDefinitionId}"; if (input.FunctionDefinitionId !== undefined) { const labelValue: string = input.FunctionDefinitionId; if (labelValue.length <= 0) { @@ -1191,7 +1226,6 @@ export const serializeAws_restJson1DeleteFunctionDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: FunctionDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1207,8 +1241,10 @@ export const serializeAws_restJson1DeleteGroupCommand = async ( input: DeleteGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups/{GroupId}"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -1219,7 +1255,6 @@ export const serializeAws_restJson1DeleteGroupCommand = async ( throw new Error("No value provided for input HTTP label: GroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1235,8 +1270,11 @@ export const serializeAws_restJson1DeleteLoggerDefinitionCommand = async ( input: DeleteLoggerDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/loggers/{LoggerDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/loggers/{LoggerDefinitionId}"; if (input.LoggerDefinitionId !== undefined) { const labelValue: string = input.LoggerDefinitionId; if (labelValue.length <= 0) { @@ -1247,7 +1285,6 @@ export const serializeAws_restJson1DeleteLoggerDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: LoggerDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1263,8 +1300,11 @@ export const serializeAws_restJson1DeleteResourceDefinitionCommand = async ( input: DeleteResourceDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/resources/{ResourceDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/resources/{ResourceDefinitionId}"; if (input.ResourceDefinitionId !== undefined) { const labelValue: string = input.ResourceDefinitionId; if (labelValue.length <= 0) { @@ -1275,7 +1315,6 @@ export const serializeAws_restJson1DeleteResourceDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: ResourceDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1291,8 +1330,11 @@ export const serializeAws_restJson1DeleteSubscriptionDefinitionCommand = async ( input: DeleteSubscriptionDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}"; if (input.SubscriptionDefinitionId !== undefined) { const labelValue: string = input.SubscriptionDefinitionId; if (labelValue.length <= 0) { @@ -1303,7 +1345,6 @@ export const serializeAws_restJson1DeleteSubscriptionDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: SubscriptionDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1319,8 +1360,10 @@ export const serializeAws_restJson1DisassociateRoleFromGroupCommand = async ( input: DisassociateRoleFromGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}/role"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups/{GroupId}/role"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -1331,7 +1374,6 @@ export const serializeAws_restJson1DisassociateRoleFromGroupCommand = async ( throw new Error("No value provided for input HTTP label: GroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1347,13 +1389,13 @@ export const serializeAws_restJson1DisassociateServiceRoleFromAccountCommand = a input: DisassociateServiceRoleFromAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/servicerole"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/servicerole"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1369,8 +1411,10 @@ export const serializeAws_restJson1GetAssociatedRoleCommand = async ( input: GetAssociatedRoleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}/role"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups/{GroupId}/role"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -1381,7 +1425,6 @@ export const serializeAws_restJson1GetAssociatedRoleCommand = async ( throw new Error("No value provided for input HTTP label: GroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1397,8 +1440,11 @@ export const serializeAws_restJson1GetBulkDeploymentStatusCommand = async ( input: GetBulkDeploymentStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/bulk/deployments/{BulkDeploymentId}/status"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/bulk/deployments/{BulkDeploymentId}/status"; if (input.BulkDeploymentId !== undefined) { const labelValue: string = input.BulkDeploymentId; if (labelValue.length <= 0) { @@ -1409,7 +1455,6 @@ export const serializeAws_restJson1GetBulkDeploymentStatusCommand = async ( throw new Error("No value provided for input HTTP label: BulkDeploymentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1425,8 +1470,11 @@ export const serializeAws_restJson1GetConnectivityInfoCommand = async ( input: GetConnectivityInfoCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/things/{ThingName}/connectivityInfo"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/things/{ThingName}/connectivityInfo"; if (input.ThingName !== undefined) { const labelValue: string = input.ThingName; if (labelValue.length <= 0) { @@ -1437,7 +1485,6 @@ export const serializeAws_restJson1GetConnectivityInfoCommand = async ( throw new Error("No value provided for input HTTP label: ThingName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1453,8 +1500,11 @@ export const serializeAws_restJson1GetConnectorDefinitionCommand = async ( input: GetConnectorDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/connectors/{ConnectorDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/connectors/{ConnectorDefinitionId}"; if (input.ConnectorDefinitionId !== undefined) { const labelValue: string = input.ConnectorDefinitionId; if (labelValue.length <= 0) { @@ -1465,7 +1515,6 @@ export const serializeAws_restJson1GetConnectorDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: ConnectorDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1481,8 +1530,10 @@ export const serializeAws_restJson1GetConnectorDefinitionVersionCommand = async input: GetConnectorDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/connectors/{ConnectorDefinitionId}/versions/{ConnectorDefinitionVersionId}"; if (input.ConnectorDefinitionId !== undefined) { const labelValue: string = input.ConnectorDefinitionId; @@ -1506,7 +1557,6 @@ export const serializeAws_restJson1GetConnectorDefinitionVersionCommand = async ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1523,8 +1573,11 @@ export const serializeAws_restJson1GetCoreDefinitionCommand = async ( input: GetCoreDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/cores/{CoreDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/cores/{CoreDefinitionId}"; if (input.CoreDefinitionId !== undefined) { const labelValue: string = input.CoreDefinitionId; if (labelValue.length <= 0) { @@ -1535,7 +1588,6 @@ export const serializeAws_restJson1GetCoreDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: CoreDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1551,8 +1603,11 @@ export const serializeAws_restJson1GetCoreDefinitionVersionCommand = async ( input: GetCoreDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/cores/{CoreDefinitionId}/versions/{CoreDefinitionVersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/cores/{CoreDefinitionId}/versions/{CoreDefinitionVersionId}"; if (input.CoreDefinitionId !== undefined) { const labelValue: string = input.CoreDefinitionId; if (labelValue.length <= 0) { @@ -1572,7 +1627,6 @@ export const serializeAws_restJson1GetCoreDefinitionVersionCommand = async ( throw new Error("No value provided for input HTTP label: CoreDefinitionVersionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1588,8 +1642,11 @@ export const serializeAws_restJson1GetDeploymentStatusCommand = async ( input: GetDeploymentStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}/deployments/{DeploymentId}/status"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/groups/{GroupId}/deployments/{DeploymentId}/status"; if (input.DeploymentId !== undefined) { const labelValue: string = input.DeploymentId; if (labelValue.length <= 0) { @@ -1609,7 +1666,6 @@ export const serializeAws_restJson1GetDeploymentStatusCommand = async ( throw new Error("No value provided for input HTTP label: GroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1625,8 +1681,11 @@ export const serializeAws_restJson1GetDeviceDefinitionCommand = async ( input: GetDeviceDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/devices/{DeviceDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/devices/{DeviceDefinitionId}"; if (input.DeviceDefinitionId !== undefined) { const labelValue: string = input.DeviceDefinitionId; if (labelValue.length <= 0) { @@ -1637,7 +1696,6 @@ export const serializeAws_restJson1GetDeviceDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: DeviceDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1653,8 +1711,11 @@ export const serializeAws_restJson1GetDeviceDefinitionVersionCommand = async ( input: GetDeviceDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/devices/{DeviceDefinitionId}/versions/{DeviceDefinitionVersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/devices/{DeviceDefinitionId}/versions/{DeviceDefinitionVersionId}"; if (input.DeviceDefinitionId !== undefined) { const labelValue: string = input.DeviceDefinitionId; if (labelValue.length <= 0) { @@ -1677,7 +1738,6 @@ export const serializeAws_restJson1GetDeviceDefinitionVersionCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1694,8 +1754,11 @@ export const serializeAws_restJson1GetFunctionDefinitionCommand = async ( input: GetFunctionDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/functions/{FunctionDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/functions/{FunctionDefinitionId}"; if (input.FunctionDefinitionId !== undefined) { const labelValue: string = input.FunctionDefinitionId; if (labelValue.length <= 0) { @@ -1706,7 +1769,6 @@ export const serializeAws_restJson1GetFunctionDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: FunctionDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1722,8 +1784,11 @@ export const serializeAws_restJson1GetFunctionDefinitionVersionCommand = async ( input: GetFunctionDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/functions/{FunctionDefinitionId}/versions/{FunctionDefinitionVersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/functions/{FunctionDefinitionId}/versions/{FunctionDefinitionVersionId}"; if (input.FunctionDefinitionId !== undefined) { const labelValue: string = input.FunctionDefinitionId; if (labelValue.length <= 0) { @@ -1746,7 +1811,6 @@ export const serializeAws_restJson1GetFunctionDefinitionVersionCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1763,8 +1827,10 @@ export const serializeAws_restJson1GetGroupCommand = async ( input: GetGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups/{GroupId}"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -1775,7 +1841,6 @@ export const serializeAws_restJson1GetGroupCommand = async ( throw new Error("No value provided for input HTTP label: GroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1791,8 +1856,11 @@ export const serializeAws_restJson1GetGroupCertificateAuthorityCommand = async ( input: GetGroupCertificateAuthorityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}/certificateauthorities/{CertificateAuthorityId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/groups/{GroupId}/certificateauthorities/{CertificateAuthorityId}"; if (input.CertificateAuthorityId !== undefined) { const labelValue: string = input.CertificateAuthorityId; if (labelValue.length <= 0) { @@ -1812,7 +1880,6 @@ export const serializeAws_restJson1GetGroupCertificateAuthorityCommand = async ( throw new Error("No value provided for input HTTP label: GroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1828,8 +1895,11 @@ export const serializeAws_restJson1GetGroupCertificateConfigurationCommand = asy input: GetGroupCertificateConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}/certificateauthorities/configuration/expiry"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/groups/{GroupId}/certificateauthorities/configuration/expiry"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -1840,7 +1910,6 @@ export const serializeAws_restJson1GetGroupCertificateConfigurationCommand = asy throw new Error("No value provided for input HTTP label: GroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1856,8 +1925,11 @@ export const serializeAws_restJson1GetGroupVersionCommand = async ( input: GetGroupVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}/versions/{GroupVersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/groups/{GroupId}/versions/{GroupVersionId}"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -1877,7 +1949,6 @@ export const serializeAws_restJson1GetGroupVersionCommand = async ( throw new Error("No value provided for input HTTP label: GroupVersionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1893,8 +1964,11 @@ export const serializeAws_restJson1GetLoggerDefinitionCommand = async ( input: GetLoggerDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/loggers/{LoggerDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/loggers/{LoggerDefinitionId}"; if (input.LoggerDefinitionId !== undefined) { const labelValue: string = input.LoggerDefinitionId; if (labelValue.length <= 0) { @@ -1905,7 +1979,6 @@ export const serializeAws_restJson1GetLoggerDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: LoggerDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1921,8 +1994,11 @@ export const serializeAws_restJson1GetLoggerDefinitionVersionCommand = async ( input: GetLoggerDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/loggers/{LoggerDefinitionId}/versions/{LoggerDefinitionVersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/loggers/{LoggerDefinitionId}/versions/{LoggerDefinitionVersionId}"; if (input.LoggerDefinitionId !== undefined) { const labelValue: string = input.LoggerDefinitionId; if (labelValue.length <= 0) { @@ -1945,7 +2021,6 @@ export const serializeAws_restJson1GetLoggerDefinitionVersionCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1962,8 +2037,11 @@ export const serializeAws_restJson1GetResourceDefinitionCommand = async ( input: GetResourceDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/resources/{ResourceDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/resources/{ResourceDefinitionId}"; if (input.ResourceDefinitionId !== undefined) { const labelValue: string = input.ResourceDefinitionId; if (labelValue.length <= 0) { @@ -1974,7 +2052,6 @@ export const serializeAws_restJson1GetResourceDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: ResourceDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1990,8 +2067,11 @@ export const serializeAws_restJson1GetResourceDefinitionVersionCommand = async ( input: GetResourceDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/resources/{ResourceDefinitionId}/versions/{ResourceDefinitionVersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/resources/{ResourceDefinitionId}/versions/{ResourceDefinitionVersionId}"; if (input.ResourceDefinitionId !== undefined) { const labelValue: string = input.ResourceDefinitionId; if (labelValue.length <= 0) { @@ -2011,7 +2091,6 @@ export const serializeAws_restJson1GetResourceDefinitionVersionCommand = async ( throw new Error("No value provided for input HTTP label: ResourceDefinitionVersionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2027,13 +2106,13 @@ export const serializeAws_restJson1GetServiceRoleForAccountCommand = async ( input: GetServiceRoleForAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/servicerole"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/servicerole"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2049,8 +2128,11 @@ export const serializeAws_restJson1GetSubscriptionDefinitionCommand = async ( input: GetSubscriptionDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}"; if (input.SubscriptionDefinitionId !== undefined) { const labelValue: string = input.SubscriptionDefinitionId; if (labelValue.length <= 0) { @@ -2061,7 +2143,6 @@ export const serializeAws_restJson1GetSubscriptionDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: SubscriptionDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2077,8 +2158,10 @@ export const serializeAws_restJson1GetSubscriptionDefinitionVersionCommand = asy input: GetSubscriptionDefinitionVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}/versions/{SubscriptionDefinitionVersionId}"; if (input.SubscriptionDefinitionId !== undefined) { const labelValue: string = input.SubscriptionDefinitionId; @@ -2102,7 +2185,6 @@ export const serializeAws_restJson1GetSubscriptionDefinitionVersionCommand = asy ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2119,8 +2201,11 @@ export const serializeAws_restJson1GetThingRuntimeConfigurationCommand = async ( input: GetThingRuntimeConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/things/{ThingName}/runtimeconfig"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/things/{ThingName}/runtimeconfig"; if (input.ThingName !== undefined) { const labelValue: string = input.ThingName; if (labelValue.length <= 0) { @@ -2131,7 +2216,6 @@ export const serializeAws_restJson1GetThingRuntimeConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: ThingName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2147,8 +2231,11 @@ export const serializeAws_restJson1ListBulkDeploymentDetailedReportsCommand = as input: ListBulkDeploymentDetailedReportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/bulk/deployments/{BulkDeploymentId}/detailed-reports"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/bulk/deployments/{BulkDeploymentId}/detailed-reports"; if (input.BulkDeploymentId !== undefined) { const labelValue: string = input.BulkDeploymentId; if (labelValue.length <= 0) { @@ -2163,7 +2250,6 @@ export const serializeAws_restJson1ListBulkDeploymentDetailedReportsCommand = as ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2180,14 +2266,15 @@ export const serializeAws_restJson1ListBulkDeploymentsCommand = async ( input: ListBulkDeploymentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/bulk/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/bulk/deployments"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2204,14 +2291,15 @@ export const serializeAws_restJson1ListConnectorDefinitionsCommand = async ( input: ListConnectorDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/connectors"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/connectors"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2228,8 +2316,11 @@ export const serializeAws_restJson1ListConnectorDefinitionVersionsCommand = asyn input: ListConnectorDefinitionVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/connectors/{ConnectorDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/connectors/{ConnectorDefinitionId}/versions"; if (input.ConnectorDefinitionId !== undefined) { const labelValue: string = input.ConnectorDefinitionId; if (labelValue.length <= 0) { @@ -2244,7 +2335,6 @@ export const serializeAws_restJson1ListConnectorDefinitionVersionsCommand = asyn ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2261,14 +2351,15 @@ export const serializeAws_restJson1ListCoreDefinitionsCommand = async ( input: ListCoreDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/cores"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/cores"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2285,8 +2376,11 @@ export const serializeAws_restJson1ListCoreDefinitionVersionsCommand = async ( input: ListCoreDefinitionVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/cores/{CoreDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/cores/{CoreDefinitionId}/versions"; if (input.CoreDefinitionId !== undefined) { const labelValue: string = input.CoreDefinitionId; if (labelValue.length <= 0) { @@ -2301,7 +2395,6 @@ export const serializeAws_restJson1ListCoreDefinitionVersionsCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2318,8 +2411,10 @@ export const serializeAws_restJson1ListDeploymentsCommand = async ( input: ListDeploymentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups/{GroupId}/deployments"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -2334,7 +2429,6 @@ export const serializeAws_restJson1ListDeploymentsCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2351,14 +2445,15 @@ export const serializeAws_restJson1ListDeviceDefinitionsCommand = async ( input: ListDeviceDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/devices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/devices"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2375,8 +2470,11 @@ export const serializeAws_restJson1ListDeviceDefinitionVersionsCommand = async ( input: ListDeviceDefinitionVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/devices/{DeviceDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/devices/{DeviceDefinitionId}/versions"; if (input.DeviceDefinitionId !== undefined) { const labelValue: string = input.DeviceDefinitionId; if (labelValue.length <= 0) { @@ -2391,7 +2489,6 @@ export const serializeAws_restJson1ListDeviceDefinitionVersionsCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2408,14 +2505,15 @@ export const serializeAws_restJson1ListFunctionDefinitionsCommand = async ( input: ListFunctionDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/functions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/functions"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2432,8 +2530,11 @@ export const serializeAws_restJson1ListFunctionDefinitionVersionsCommand = async input: ListFunctionDefinitionVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/functions/{FunctionDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/functions/{FunctionDefinitionId}/versions"; if (input.FunctionDefinitionId !== undefined) { const labelValue: string = input.FunctionDefinitionId; if (labelValue.length <= 0) { @@ -2448,7 +2549,6 @@ export const serializeAws_restJson1ListFunctionDefinitionVersionsCommand = async ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2465,8 +2565,11 @@ export const serializeAws_restJson1ListGroupCertificateAuthoritiesCommand = asyn input: ListGroupCertificateAuthoritiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}/certificateauthorities"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/groups/{GroupId}/certificateauthorities"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -2477,7 +2580,6 @@ export const serializeAws_restJson1ListGroupCertificateAuthoritiesCommand = asyn throw new Error("No value provided for input HTTP label: GroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2493,14 +2595,14 @@ export const serializeAws_restJson1ListGroupsCommand = async ( input: ListGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2517,8 +2619,10 @@ export const serializeAws_restJson1ListGroupVersionsCommand = async ( input: ListGroupVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/groups/{GroupId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups/{GroupId}/versions"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -2533,7 +2637,6 @@ export const serializeAws_restJson1ListGroupVersionsCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2550,14 +2653,15 @@ export const serializeAws_restJson1ListLoggerDefinitionsCommand = async ( input: ListLoggerDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/loggers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/loggers"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2574,8 +2678,11 @@ export const serializeAws_restJson1ListLoggerDefinitionVersionsCommand = async ( input: ListLoggerDefinitionVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/loggers/{LoggerDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/loggers/{LoggerDefinitionId}/versions"; if (input.LoggerDefinitionId !== undefined) { const labelValue: string = input.LoggerDefinitionId; if (labelValue.length <= 0) { @@ -2590,7 +2697,6 @@ export const serializeAws_restJson1ListLoggerDefinitionVersionsCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2607,14 +2713,15 @@ export const serializeAws_restJson1ListResourceDefinitionsCommand = async ( input: ListResourceDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/resources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/resources"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2631,8 +2738,11 @@ export const serializeAws_restJson1ListResourceDefinitionVersionsCommand = async input: ListResourceDefinitionVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/resources/{ResourceDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/resources/{ResourceDefinitionId}/versions"; if (input.ResourceDefinitionId !== undefined) { const labelValue: string = input.ResourceDefinitionId; if (labelValue.length <= 0) { @@ -2647,7 +2757,6 @@ export const serializeAws_restJson1ListResourceDefinitionVersionsCommand = async ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2664,14 +2773,15 @@ export const serializeAws_restJson1ListSubscriptionDefinitionsCommand = async ( input: ListSubscriptionDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/subscriptions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/definition/subscriptions"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2688,8 +2798,11 @@ export const serializeAws_restJson1ListSubscriptionDefinitionVersionsCommand = a input: ListSubscriptionDefinitionVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}/versions"; if (input.SubscriptionDefinitionId !== undefined) { const labelValue: string = input.SubscriptionDefinitionId; if (labelValue.length <= 0) { @@ -2704,7 +2817,6 @@ export const serializeAws_restJson1ListSubscriptionDefinitionVersionsCommand = a ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2721,8 +2833,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -2733,7 +2846,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2749,11 +2861,14 @@ export const serializeAws_restJson1ResetDeploymentsCommand = async ( input: ResetDeploymentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/groups/{GroupId}/deployments/$reset"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/groups/{GroupId}/deployments/$reset"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -2767,7 +2882,6 @@ export const serializeAws_restJson1ResetDeploymentsCommand = async ( body = JSON.stringify({ ...(input.Force !== undefined && input.Force !== null && { Force: input.Force }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2783,11 +2897,13 @@ export const serializeAws_restJson1StartBulkDeploymentCommand = async ( input: StartBulkDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AmznClientToken) && { "x-amzn-client-token": input.AmznClientToken! }), }; - let resolvedPath = "/greengrass/bulk/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/bulk/deployments"; let body: any; body = JSON.stringify({ ...(input.ExecutionRoleArn !== undefined && @@ -2795,7 +2911,6 @@ export const serializeAws_restJson1StartBulkDeploymentCommand = async ( ...(input.InputFileUri !== undefined && input.InputFileUri !== null && { InputFileUri: input.InputFileUri }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2811,8 +2926,11 @@ export const serializeAws_restJson1StopBulkDeploymentCommand = async ( input: StopBulkDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/bulk/deployments/{BulkDeploymentId}/$stop"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/bulk/deployments/{BulkDeploymentId}/$stop"; if (input.BulkDeploymentId !== undefined) { const labelValue: string = input.BulkDeploymentId; if (labelValue.length <= 0) { @@ -2823,7 +2941,6 @@ export const serializeAws_restJson1StopBulkDeploymentCommand = async ( throw new Error("No value provided for input HTTP label: BulkDeploymentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2839,10 +2956,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -2856,7 +2974,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2872,8 +2989,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -2887,7 +3005,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2904,10 +3021,13 @@ export const serializeAws_restJson1UpdateConnectivityInfoCommand = async ( input: UpdateConnectivityInfoCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/things/{ThingName}/connectivityInfo"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/things/{ThingName}/connectivityInfo"; if (input.ThingName !== undefined) { const labelValue: string = input.ThingName; if (labelValue.length <= 0) { @@ -2924,7 +3044,6 @@ export const serializeAws_restJson1UpdateConnectivityInfoCommand = async ( ConnectivityInfo: serializeAws_restJson1__listOfConnectivityInfo(input.ConnectivityInfo, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2940,10 +3059,13 @@ export const serializeAws_restJson1UpdateConnectorDefinitionCommand = async ( input: UpdateConnectorDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/definition/connectors/{ConnectorDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/connectors/{ConnectorDefinitionId}"; if (input.ConnectorDefinitionId !== undefined) { const labelValue: string = input.ConnectorDefinitionId; if (labelValue.length <= 0) { @@ -2957,7 +3079,6 @@ export const serializeAws_restJson1UpdateConnectorDefinitionCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2973,10 +3094,13 @@ export const serializeAws_restJson1UpdateCoreDefinitionCommand = async ( input: UpdateCoreDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/definition/cores/{CoreDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/cores/{CoreDefinitionId}"; if (input.CoreDefinitionId !== undefined) { const labelValue: string = input.CoreDefinitionId; if (labelValue.length <= 0) { @@ -2990,7 +3114,6 @@ export const serializeAws_restJson1UpdateCoreDefinitionCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3006,10 +3129,13 @@ export const serializeAws_restJson1UpdateDeviceDefinitionCommand = async ( input: UpdateDeviceDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/definition/devices/{DeviceDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/devices/{DeviceDefinitionId}"; if (input.DeviceDefinitionId !== undefined) { const labelValue: string = input.DeviceDefinitionId; if (labelValue.length <= 0) { @@ -3023,7 +3149,6 @@ export const serializeAws_restJson1UpdateDeviceDefinitionCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3039,10 +3164,13 @@ export const serializeAws_restJson1UpdateFunctionDefinitionCommand = async ( input: UpdateFunctionDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/definition/functions/{FunctionDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/functions/{FunctionDefinitionId}"; if (input.FunctionDefinitionId !== undefined) { const labelValue: string = input.FunctionDefinitionId; if (labelValue.length <= 0) { @@ -3056,7 +3184,6 @@ export const serializeAws_restJson1UpdateFunctionDefinitionCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3072,10 +3199,12 @@ export const serializeAws_restJson1UpdateGroupCommand = async ( input: UpdateGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/groups/{GroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/groups/{GroupId}"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -3089,7 +3218,6 @@ export const serializeAws_restJson1UpdateGroupCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3105,10 +3233,13 @@ export const serializeAws_restJson1UpdateGroupCertificateConfigurationCommand = input: UpdateGroupCertificateConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/groups/{GroupId}/certificateauthorities/configuration/expiry"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/groups/{GroupId}/certificateauthorities/configuration/expiry"; if (input.GroupId !== undefined) { const labelValue: string = input.GroupId; if (labelValue.length <= 0) { @@ -3125,7 +3256,6 @@ export const serializeAws_restJson1UpdateGroupCertificateConfigurationCommand = CertificateExpiryInMilliseconds: input.CertificateExpiryInMilliseconds, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3141,10 +3271,13 @@ export const serializeAws_restJson1UpdateLoggerDefinitionCommand = async ( input: UpdateLoggerDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/definition/loggers/{LoggerDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/loggers/{LoggerDefinitionId}"; if (input.LoggerDefinitionId !== undefined) { const labelValue: string = input.LoggerDefinitionId; if (labelValue.length <= 0) { @@ -3158,7 +3291,6 @@ export const serializeAws_restJson1UpdateLoggerDefinitionCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3174,10 +3306,13 @@ export const serializeAws_restJson1UpdateResourceDefinitionCommand = async ( input: UpdateResourceDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/definition/resources/{ResourceDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/resources/{ResourceDefinitionId}"; if (input.ResourceDefinitionId !== undefined) { const labelValue: string = input.ResourceDefinitionId; if (labelValue.length <= 0) { @@ -3191,7 +3326,6 @@ export const serializeAws_restJson1UpdateResourceDefinitionCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3207,10 +3341,13 @@ export const serializeAws_restJson1UpdateSubscriptionDefinitionCommand = async ( input: UpdateSubscriptionDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/definition/subscriptions/{SubscriptionDefinitionId}"; if (input.SubscriptionDefinitionId !== undefined) { const labelValue: string = input.SubscriptionDefinitionId; if (labelValue.length <= 0) { @@ -3224,7 +3361,6 @@ export const serializeAws_restJson1UpdateSubscriptionDefinitionCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3240,10 +3376,13 @@ export const serializeAws_restJson1UpdateThingRuntimeConfigurationCommand = asyn input: UpdateThingRuntimeConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/things/{ThingName}/runtimeconfig"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/things/{ThingName}/runtimeconfig"; if (input.ThingName !== undefined) { const labelValue: string = input.ThingName; if (labelValue.length <= 0) { @@ -3263,7 +3402,6 @@ export const serializeAws_restJson1UpdateThingRuntimeConfigurationCommand = asyn ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-greengrassv2/protocols/Aws_restJson1.ts b/clients/client-greengrassv2/protocols/Aws_restJson1.ts index 235e9e000f8e5..bb3c25266b7fd 100644 --- a/clients/client-greengrassv2/protocols/Aws_restJson1.ts +++ b/clients/client-greengrassv2/protocols/Aws_restJson1.ts @@ -119,10 +119,13 @@ export const serializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceComma input: BatchAssociateClientDeviceWithCoreDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/v2/coreDevices/{coreDeviceThingName}/associateClientDevices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/v2/coreDevices/{coreDeviceThingName}/associateClientDevices"; if (input.coreDeviceThingName !== undefined) { const labelValue: string = input.coreDeviceThingName; if (labelValue.length <= 0) { @@ -139,7 +142,6 @@ export const serializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceComma entries: serializeAws_restJson1AssociateClientDeviceWithCoreDeviceEntryList(input.entries, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -155,10 +157,13 @@ export const serializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCo input: BatchDisassociateClientDeviceFromCoreDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/v2/coreDevices/{coreDeviceThingName}/disassociateClientDevices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/v2/coreDevices/{coreDeviceThingName}/disassociateClientDevices"; if (input.coreDeviceThingName !== undefined) { const labelValue: string = input.coreDeviceThingName; if (labelValue.length <= 0) { @@ -175,7 +180,6 @@ export const serializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCo entries: serializeAws_restJson1DisassociateClientDeviceFromCoreDeviceEntryList(input.entries, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -191,8 +195,11 @@ export const serializeAws_restJson1CancelDeploymentCommand = async ( input: CancelDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/deployments/{deploymentId}/cancel"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/v2/deployments/{deploymentId}/cancel"; if (input.deploymentId !== undefined) { const labelValue: string = input.deploymentId; if (labelValue.length <= 0) { @@ -203,7 +210,6 @@ export const serializeAws_restJson1CancelDeploymentCommand = async ( throw new Error("No value provided for input HTTP label: deploymentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -219,10 +225,12 @@ export const serializeAws_restJson1CreateComponentVersionCommand = async ( input: CreateComponentVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/v2/createComponentVersion"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/createComponentVersion"; let body: any; body = JSON.stringify({ ...(input.inlineRecipe !== undefined && @@ -233,7 +241,6 @@ export const serializeAws_restJson1CreateComponentVersionCommand = async ( }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -249,10 +256,12 @@ export const serializeAws_restJson1CreateDeploymentCommand = async ( input: CreateDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/v2/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/deployments"; let body: any; body = JSON.stringify({ ...(input.components !== undefined && @@ -272,7 +281,6 @@ export const serializeAws_restJson1CreateDeploymentCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), ...(input.targetArn !== undefined && input.targetArn !== null && { targetArn: input.targetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -288,8 +296,10 @@ export const serializeAws_restJson1DeleteComponentCommand = async ( input: DeleteComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/components/{arn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/components/{arn}"; if (input.arn !== undefined) { const labelValue: string = input.arn; if (labelValue.length <= 0) { @@ -300,7 +310,6 @@ export const serializeAws_restJson1DeleteComponentCommand = async ( throw new Error("No value provided for input HTTP label: arn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -316,8 +325,11 @@ export const serializeAws_restJson1DeleteCoreDeviceCommand = async ( input: DeleteCoreDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/coreDevices/{coreDeviceThingName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/v2/coreDevices/{coreDeviceThingName}"; if (input.coreDeviceThingName !== undefined) { const labelValue: string = input.coreDeviceThingName; if (labelValue.length <= 0) { @@ -328,7 +340,6 @@ export const serializeAws_restJson1DeleteCoreDeviceCommand = async ( throw new Error("No value provided for input HTTP label: coreDeviceThingName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -344,8 +355,10 @@ export const serializeAws_restJson1DescribeComponentCommand = async ( input: DescribeComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/components/{arn}/metadata"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/components/{arn}/metadata"; if (input.arn !== undefined) { const labelValue: string = input.arn; if (labelValue.length <= 0) { @@ -356,7 +369,6 @@ export const serializeAws_restJson1DescribeComponentCommand = async ( throw new Error("No value provided for input HTTP label: arn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -372,8 +384,10 @@ export const serializeAws_restJson1GetComponentCommand = async ( input: GetComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/components/{arn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/components/{arn}"; if (input.arn !== undefined) { const labelValue: string = input.arn; if (labelValue.length <= 0) { @@ -387,7 +401,6 @@ export const serializeAws_restJson1GetComponentCommand = async ( ...(input.recipeOutputFormat !== undefined && { recipeOutputFormat: input.recipeOutputFormat }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -404,8 +417,11 @@ export const serializeAws_restJson1GetComponentVersionArtifactCommand = async ( input: GetComponentVersionArtifactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/components/{arn}/artifacts/{artifactName+}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/v2/components/{arn}/artifacts/{artifactName+}"; if (input.arn !== undefined) { const labelValue: string = input.arn; if (labelValue.length <= 0) { @@ -431,7 +447,6 @@ export const serializeAws_restJson1GetComponentVersionArtifactCommand = async ( throw new Error("No value provided for input HTTP label: artifactName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -447,8 +462,11 @@ export const serializeAws_restJson1GetCoreDeviceCommand = async ( input: GetCoreDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/coreDevices/{coreDeviceThingName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/v2/coreDevices/{coreDeviceThingName}"; if (input.coreDeviceThingName !== undefined) { const labelValue: string = input.coreDeviceThingName; if (labelValue.length <= 0) { @@ -459,7 +477,6 @@ export const serializeAws_restJson1GetCoreDeviceCommand = async ( throw new Error("No value provided for input HTTP label: coreDeviceThingName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -475,8 +492,10 @@ export const serializeAws_restJson1GetDeploymentCommand = async ( input: GetDeploymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/deployments/{deploymentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/deployments/{deploymentId}"; if (input.deploymentId !== undefined) { const labelValue: string = input.deploymentId; if (labelValue.length <= 0) { @@ -487,7 +506,6 @@ export const serializeAws_restJson1GetDeploymentCommand = async ( throw new Error("No value provided for input HTTP label: deploymentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -503,8 +521,11 @@ export const serializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceComm input: ListClientDevicesAssociatedWithCoreDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/coreDevices/{coreDeviceThingName}/associatedClientDevices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/v2/coreDevices/{coreDeviceThingName}/associatedClientDevices"; if (input.coreDeviceThingName !== undefined) { const labelValue: string = input.coreDeviceThingName; if (labelValue.length <= 0) { @@ -519,7 +540,6 @@ export const serializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceComm ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -536,15 +556,16 @@ export const serializeAws_restJson1ListComponentsCommand = async ( input: ListComponentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/components"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/components"; const query: any = { ...(input.scope !== undefined && { scope: input.scope }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -561,8 +582,10 @@ export const serializeAws_restJson1ListComponentVersionsCommand = async ( input: ListComponentVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/components/{arn}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/components/{arn}/versions"; if (input.arn !== undefined) { const labelValue: string = input.arn; if (labelValue.length <= 0) { @@ -577,7 +600,6 @@ export const serializeAws_restJson1ListComponentVersionsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -594,8 +616,10 @@ export const serializeAws_restJson1ListCoreDevicesCommand = async ( input: ListCoreDevicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/coreDevices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/coreDevices"; const query: any = { ...(input.thingGroupArn !== undefined && { thingGroupArn: input.thingGroupArn }), ...(input.status !== undefined && { status: input.status }), @@ -603,7 +627,6 @@ export const serializeAws_restJson1ListCoreDevicesCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -620,8 +643,10 @@ export const serializeAws_restJson1ListDeploymentsCommand = async ( input: ListDeploymentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/deployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/deployments"; const query: any = { ...(input.targetArn !== undefined && { targetArn: input.targetArn }), ...(input.historyFilter !== undefined && { historyFilter: input.historyFilter }), @@ -629,7 +654,6 @@ export const serializeAws_restJson1ListDeploymentsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -646,8 +670,11 @@ export const serializeAws_restJson1ListEffectiveDeploymentsCommand = async ( input: ListEffectiveDeploymentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/coreDevices/{coreDeviceThingName}/effectiveDeployments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/v2/coreDevices/{coreDeviceThingName}/effectiveDeployments"; if (input.coreDeviceThingName !== undefined) { const labelValue: string = input.coreDeviceThingName; if (labelValue.length <= 0) { @@ -662,7 +689,6 @@ export const serializeAws_restJson1ListEffectiveDeploymentsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -679,8 +705,11 @@ export const serializeAws_restJson1ListInstalledComponentsCommand = async ( input: ListInstalledComponentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/greengrass/v2/coreDevices/{coreDeviceThingName}/installedComponents"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/greengrass/v2/coreDevices/{coreDeviceThingName}/installedComponents"; if (input.coreDeviceThingName !== undefined) { const labelValue: string = input.coreDeviceThingName; if (labelValue.length <= 0) { @@ -695,7 +724,6 @@ export const serializeAws_restJson1ListInstalledComponentsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -712,8 +740,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -724,7 +753,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -740,10 +768,12 @@ export const serializeAws_restJson1ResolveComponentCandidatesCommand = async ( input: ResolveComponentCandidatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/greengrass/v2/resolveComponentCandidates"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/resolveComponentCandidates"; let body: any; body = JSON.stringify({ ...(input.componentCandidates !== undefined && @@ -753,7 +783,6 @@ export const serializeAws_restJson1ResolveComponentCandidatesCommand = async ( ...(input.platform !== undefined && input.platform !== null && { platform: serializeAws_restJson1ComponentPlatform(input.platform, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -769,10 +798,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -786,7 +816,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -802,8 +831,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -817,7 +847,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-groundstation/protocols/Aws_restJson1.ts b/clients/client-groundstation/protocols/Aws_restJson1.ts index 5f4ab758e301e..5281c5610dc06 100644 --- a/clients/client-groundstation/protocols/Aws_restJson1.ts +++ b/clients/client-groundstation/protocols/Aws_restJson1.ts @@ -110,8 +110,9 @@ export const serializeAws_restJson1CancelContactCommand = async ( input: CancelContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/contact/{contactId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/{contactId}"; if (input.contactId !== undefined) { const labelValue: string = input.contactId; if (labelValue.length <= 0) { @@ -122,7 +123,6 @@ export const serializeAws_restJson1CancelContactCommand = async ( throw new Error("No value provided for input HTTP label: contactId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -138,10 +138,11 @@ export const serializeAws_restJson1CreateConfigCommand = async ( input: CreateConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/config"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/config"; let body: any; body = JSON.stringify({ ...(input.configData !== undefined && @@ -150,7 +151,6 @@ export const serializeAws_restJson1CreateConfigCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -166,10 +166,11 @@ export const serializeAws_restJson1CreateDataflowEndpointGroupCommand = async ( input: CreateDataflowEndpointGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/dataflowEndpointGroup"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dataflowEndpointGroup"; let body: any; body = JSON.stringify({ ...(input.endpointDetails !== undefined && @@ -179,7 +180,6 @@ export const serializeAws_restJson1CreateDataflowEndpointGroupCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -195,10 +195,11 @@ export const serializeAws_restJson1CreateMissionProfileCommand = async ( input: CreateMissionProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/missionprofile"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/missionprofile"; let body: any; body = JSON.stringify({ ...(input.contactPostPassDurationSeconds !== undefined && @@ -223,7 +224,6 @@ export const serializeAws_restJson1CreateMissionProfileCommand = async ( ...(input.trackingConfigArn !== undefined && input.trackingConfigArn !== null && { trackingConfigArn: input.trackingConfigArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -239,8 +239,10 @@ export const serializeAws_restJson1DeleteConfigCommand = async ( input: DeleteConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/config/{configType}/{configId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/config/{configType}/{configId}"; if (input.configId !== undefined) { const labelValue: string = input.configId; if (labelValue.length <= 0) { @@ -260,7 +262,6 @@ export const serializeAws_restJson1DeleteConfigCommand = async ( throw new Error("No value provided for input HTTP label: configType."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -276,8 +277,11 @@ export const serializeAws_restJson1DeleteDataflowEndpointGroupCommand = async ( input: DeleteDataflowEndpointGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dataflowEndpointGroup/{dataflowEndpointGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/dataflowEndpointGroup/{dataflowEndpointGroupId}"; if (input.dataflowEndpointGroupId !== undefined) { const labelValue: string = input.dataflowEndpointGroupId; if (labelValue.length <= 0) { @@ -288,7 +292,6 @@ export const serializeAws_restJson1DeleteDataflowEndpointGroupCommand = async ( throw new Error("No value provided for input HTTP label: dataflowEndpointGroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -304,8 +307,10 @@ export const serializeAws_restJson1DeleteMissionProfileCommand = async ( input: DeleteMissionProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/missionprofile/{missionProfileId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/missionprofile/{missionProfileId}"; if (input.missionProfileId !== undefined) { const labelValue: string = input.missionProfileId; if (labelValue.length <= 0) { @@ -316,7 +321,6 @@ export const serializeAws_restJson1DeleteMissionProfileCommand = async ( throw new Error("No value provided for input HTTP label: missionProfileId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -332,8 +336,9 @@ export const serializeAws_restJson1DescribeContactCommand = async ( input: DescribeContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/contact/{contactId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact/{contactId}"; if (input.contactId !== undefined) { const labelValue: string = input.contactId; if (labelValue.length <= 0) { @@ -344,7 +349,6 @@ export const serializeAws_restJson1DescribeContactCommand = async ( throw new Error("No value provided for input HTTP label: contactId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -360,8 +364,10 @@ export const serializeAws_restJson1GetConfigCommand = async ( input: GetConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/config/{configType}/{configId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/config/{configType}/{configId}"; if (input.configId !== undefined) { const labelValue: string = input.configId; if (labelValue.length <= 0) { @@ -381,7 +387,6 @@ export const serializeAws_restJson1GetConfigCommand = async ( throw new Error("No value provided for input HTTP label: configType."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -397,8 +402,11 @@ export const serializeAws_restJson1GetDataflowEndpointGroupCommand = async ( input: GetDataflowEndpointGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dataflowEndpointGroup/{dataflowEndpointGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/dataflowEndpointGroup/{dataflowEndpointGroupId}"; if (input.dataflowEndpointGroupId !== undefined) { const labelValue: string = input.dataflowEndpointGroupId; if (labelValue.length <= 0) { @@ -409,7 +417,6 @@ export const serializeAws_restJson1GetDataflowEndpointGroupCommand = async ( throw new Error("No value provided for input HTTP label: dataflowEndpointGroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -425,16 +432,16 @@ export const serializeAws_restJson1GetMinuteUsageCommand = async ( input: GetMinuteUsageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/minute-usage"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/minute-usage"; let body: any; body = JSON.stringify({ ...(input.month !== undefined && input.month !== null && { month: input.month }), ...(input.year !== undefined && input.year !== null && { year: input.year }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -450,8 +457,10 @@ export const serializeAws_restJson1GetMissionProfileCommand = async ( input: GetMissionProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/missionprofile/{missionProfileId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/missionprofile/{missionProfileId}"; if (input.missionProfileId !== undefined) { const labelValue: string = input.missionProfileId; if (labelValue.length <= 0) { @@ -462,7 +471,6 @@ export const serializeAws_restJson1GetMissionProfileCommand = async ( throw new Error("No value provided for input HTTP label: missionProfileId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -478,8 +486,9 @@ export const serializeAws_restJson1GetSatelliteCommand = async ( input: GetSatelliteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/satellite/{satelliteId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/satellite/{satelliteId}"; if (input.satelliteId !== undefined) { const labelValue: string = input.satelliteId; if (labelValue.length <= 0) { @@ -490,7 +499,6 @@ export const serializeAws_restJson1GetSatelliteCommand = async ( throw new Error("No value provided for input HTTP label: satelliteId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -506,14 +514,14 @@ export const serializeAws_restJson1ListConfigsCommand = async ( input: ListConfigsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/config"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/config"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -530,10 +538,11 @@ export const serializeAws_restJson1ListContactsCommand = async ( input: ListContactsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contacts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contacts"; let body: any; body = JSON.stringify({ ...(input.endTime !== undefined && @@ -549,7 +558,6 @@ export const serializeAws_restJson1ListContactsCommand = async ( ...(input.statusList !== undefined && input.statusList !== null && { statusList: serializeAws_restJson1StatusList(input.statusList, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -565,14 +573,14 @@ export const serializeAws_restJson1ListDataflowEndpointGroupsCommand = async ( input: ListDataflowEndpointGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dataflowEndpointGroup"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dataflowEndpointGroup"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -589,15 +597,15 @@ export const serializeAws_restJson1ListGroundStationsCommand = async ( input: ListGroundStationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/groundstation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/groundstation"; const query: any = { ...(input.satelliteId !== undefined && { satelliteId: input.satelliteId }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -614,14 +622,14 @@ export const serializeAws_restJson1ListMissionProfilesCommand = async ( input: ListMissionProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/missionprofile"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/missionprofile"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -638,14 +646,14 @@ export const serializeAws_restJson1ListSatellitesCommand = async ( input: ListSatellitesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/satellite"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/satellite"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -662,8 +670,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -674,7 +683,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -690,10 +698,11 @@ export const serializeAws_restJson1ReserveContactCommand = async ( input: ReserveContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/contact"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/contact"; let body: any; body = JSON.stringify({ ...(input.endTime !== undefined && @@ -707,7 +716,6 @@ export const serializeAws_restJson1ReserveContactCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -723,10 +731,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -741,7 +750,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -757,8 +765,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -772,7 +781,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -789,10 +797,12 @@ export const serializeAws_restJson1UpdateConfigCommand = async ( input: UpdateConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/config/{configType}/{configId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/config/{configType}/{configId}"; if (input.configId !== undefined) { const labelValue: string = input.configId; if (labelValue.length <= 0) { @@ -817,7 +827,6 @@ export const serializeAws_restJson1UpdateConfigCommand = async ( input.configData !== null && { configData: serializeAws_restJson1ConfigTypeData(input.configData, context) }), ...(input.name !== undefined && input.name !== null && { name: input.name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -833,10 +842,12 @@ export const serializeAws_restJson1UpdateMissionProfileCommand = async ( input: UpdateMissionProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/missionprofile/{missionProfileId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/missionprofile/{missionProfileId}"; if (input.missionProfileId !== undefined) { const labelValue: string = input.missionProfileId; if (labelValue.length <= 0) { @@ -868,7 +879,6 @@ export const serializeAws_restJson1UpdateMissionProfileCommand = async ( ...(input.trackingConfigArn !== undefined && input.trackingConfigArn !== null && { trackingConfigArn: input.trackingConfigArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-guardduty/protocols/Aws_restJson1.ts b/clients/client-guardduty/protocols/Aws_restJson1.ts index f2247d256a335..e9725ad0d1a42 100644 --- a/clients/client-guardduty/protocols/Aws_restJson1.ts +++ b/clients/client-guardduty/protocols/Aws_restJson1.ts @@ -223,10 +223,12 @@ export const serializeAws_restJson1AcceptInvitationCommand = async ( input: AcceptInvitationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/master"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/master"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -241,7 +243,6 @@ export const serializeAws_restJson1AcceptInvitationCommand = async ( ...(input.InvitationId !== undefined && input.InvitationId !== null && { invitationId: input.InvitationId }), ...(input.MasterId !== undefined && input.MasterId !== null && { masterId: input.MasterId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -257,10 +258,12 @@ export const serializeAws_restJson1ArchiveFindingsCommand = async ( input: ArchiveFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/findings/archive"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings/archive"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -275,7 +278,6 @@ export const serializeAws_restJson1ArchiveFindingsCommand = async ( ...(input.FindingIds !== undefined && input.FindingIds !== null && { findingIds: serializeAws_restJson1FindingIds(input.FindingIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -291,10 +293,11 @@ export const serializeAws_restJson1CreateDetectorCommand = async ( input: CreateDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector"; let body: any; body = JSON.stringify({ clientToken: input.ClientToken ?? generateIdempotencyToken(), @@ -307,7 +310,6 @@ export const serializeAws_restJson1CreateDetectorCommand = async ( input.FindingPublishingFrequency !== null && { findingPublishingFrequency: input.FindingPublishingFrequency }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -323,10 +325,12 @@ export const serializeAws_restJson1CreateFilterCommand = async ( input: CreateFilterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/filter"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/filter"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -349,7 +353,6 @@ export const serializeAws_restJson1CreateFilterCommand = async ( ...(input.Rank !== undefined && input.Rank !== null && { rank: input.Rank }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -365,10 +368,12 @@ export const serializeAws_restJson1CreateIPSetCommand = async ( input: CreateIPSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/ipset"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/ipset"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -387,7 +392,6 @@ export const serializeAws_restJson1CreateIPSetCommand = async ( ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -403,10 +407,12 @@ export const serializeAws_restJson1CreateMembersCommand = async ( input: CreateMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/member"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -423,7 +429,6 @@ export const serializeAws_restJson1CreateMembersCommand = async ( accountDetails: serializeAws_restJson1AccountDetails(input.AccountDetails, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -439,10 +444,13 @@ export const serializeAws_restJson1CreatePublishingDestinationCommand = async ( input: CreatePublishingDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/publishingDestination"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/publishingDestination"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -462,7 +470,6 @@ export const serializeAws_restJson1CreatePublishingDestinationCommand = async ( ...(input.DestinationType !== undefined && input.DestinationType !== null && { destinationType: input.DestinationType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -478,10 +485,12 @@ export const serializeAws_restJson1CreateSampleFindingsCommand = async ( input: CreateSampleFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/findings/create"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings/create"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -496,7 +505,6 @@ export const serializeAws_restJson1CreateSampleFindingsCommand = async ( ...(input.FindingTypes !== undefined && input.FindingTypes !== null && { findingTypes: serializeAws_restJson1FindingTypes(input.FindingTypes, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -512,10 +520,12 @@ export const serializeAws_restJson1CreateThreatIntelSetCommand = async ( input: CreateThreatIntelSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/threatintelset"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/threatintelset"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -534,7 +544,6 @@ export const serializeAws_restJson1CreateThreatIntelSetCommand = async ( ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -550,16 +559,16 @@ export const serializeAws_restJson1DeclineInvitationsCommand = async ( input: DeclineInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitation/decline"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitation/decline"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && input.AccountIds !== null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -575,8 +584,9 @@ export const serializeAws_restJson1DeleteDetectorCommand = async ( input: DeleteDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -587,7 +597,6 @@ export const serializeAws_restJson1DeleteDetectorCommand = async ( throw new Error("No value provided for input HTTP label: DetectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -603,8 +612,11 @@ export const serializeAws_restJson1DeleteFilterCommand = async ( input: DeleteFilterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/filter/{FilterName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/filter/{FilterName}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -624,7 +636,6 @@ export const serializeAws_restJson1DeleteFilterCommand = async ( throw new Error("No value provided for input HTTP label: FilterName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -640,16 +651,16 @@ export const serializeAws_restJson1DeleteInvitationsCommand = async ( input: DeleteInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitation/delete"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitation/delete"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && input.AccountIds !== null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -665,8 +676,10 @@ export const serializeAws_restJson1DeleteIPSetCommand = async ( input: DeleteIPSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/ipset/{IpSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/ipset/{IpSetId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -686,7 +699,6 @@ export const serializeAws_restJson1DeleteIPSetCommand = async ( throw new Error("No value provided for input HTTP label: IpSetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -702,10 +714,12 @@ export const serializeAws_restJson1DeleteMembersCommand = async ( input: DeleteMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/member/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member/delete"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -720,7 +734,6 @@ export const serializeAws_restJson1DeleteMembersCommand = async ( ...(input.AccountIds !== undefined && input.AccountIds !== null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -736,8 +749,11 @@ export const serializeAws_restJson1DeletePublishingDestinationCommand = async ( input: DeletePublishingDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/publishingDestination/{DestinationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/publishingDestination/{DestinationId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -757,7 +773,6 @@ export const serializeAws_restJson1DeletePublishingDestinationCommand = async ( throw new Error("No value provided for input HTTP label: DestinationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -773,8 +788,11 @@ export const serializeAws_restJson1DeleteThreatIntelSetCommand = async ( input: DeleteThreatIntelSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -794,7 +812,6 @@ export const serializeAws_restJson1DeleteThreatIntelSetCommand = async ( throw new Error("No value provided for input HTTP label: ThreatIntelSetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -810,8 +827,10 @@ export const serializeAws_restJson1DescribeOrganizationConfigurationCommand = as input: DescribeOrganizationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/admin"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/admin"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -822,7 +841,6 @@ export const serializeAws_restJson1DescribeOrganizationConfigurationCommand = as throw new Error("No value provided for input HTTP label: DetectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -838,8 +856,11 @@ export const serializeAws_restJson1DescribePublishingDestinationCommand = async input: DescribePublishingDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/publishingDestination/{DestinationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/publishingDestination/{DestinationId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -859,7 +880,6 @@ export const serializeAws_restJson1DescribePublishingDestinationCommand = async throw new Error("No value provided for input HTTP label: DestinationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -875,16 +895,16 @@ export const serializeAws_restJson1DisableOrganizationAdminAccountCommand = asyn input: DisableOrganizationAdminAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/admin/disable"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/admin/disable"; let body: any; body = JSON.stringify({ ...(input.AdminAccountId !== undefined && input.AdminAccountId !== null && { adminAccountId: input.AdminAccountId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -900,8 +920,11 @@ export const serializeAws_restJson1DisassociateFromMasterAccountCommand = async input: DisassociateFromMasterAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/master/disassociate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/master/disassociate"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -912,7 +935,6 @@ export const serializeAws_restJson1DisassociateFromMasterAccountCommand = async throw new Error("No value provided for input HTTP label: DetectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -928,10 +950,13 @@ export const serializeAws_restJson1DisassociateMembersCommand = async ( input: DisassociateMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/member/disassociate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/member/disassociate"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -946,7 +971,6 @@ export const serializeAws_restJson1DisassociateMembersCommand = async ( ...(input.AccountIds !== undefined && input.AccountIds !== null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -962,16 +986,16 @@ export const serializeAws_restJson1EnableOrganizationAdminAccountCommand = async input: EnableOrganizationAdminAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/admin/enable"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/admin/enable"; let body: any; body = JSON.stringify({ ...(input.AdminAccountId !== undefined && input.AdminAccountId !== null && { adminAccountId: input.AdminAccountId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -987,8 +1011,9 @@ export const serializeAws_restJson1GetDetectorCommand = async ( input: GetDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -999,7 +1024,6 @@ export const serializeAws_restJson1GetDetectorCommand = async ( throw new Error("No value provided for input HTTP label: DetectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1015,8 +1039,11 @@ export const serializeAws_restJson1GetFilterCommand = async ( input: GetFilterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/filter/{FilterName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/filter/{FilterName}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1036,7 +1063,6 @@ export const serializeAws_restJson1GetFilterCommand = async ( throw new Error("No value provided for input HTTP label: FilterName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1052,10 +1078,12 @@ export const serializeAws_restJson1GetFindingsCommand = async ( input: GetFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/findings/get"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings/get"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1072,7 +1100,6 @@ export const serializeAws_restJson1GetFindingsCommand = async ( ...(input.SortCriteria !== undefined && input.SortCriteria !== null && { sortCriteria: serializeAws_restJson1SortCriteria(input.SortCriteria, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1088,10 +1115,13 @@ export const serializeAws_restJson1GetFindingsStatisticsCommand = async ( input: GetFindingsStatisticsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/findings/statistics"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/findings/statistics"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1112,7 +1142,6 @@ export const serializeAws_restJson1GetFindingsStatisticsCommand = async ( findingStatisticTypes: serializeAws_restJson1FindingStatisticTypes(input.FindingStatisticTypes, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1128,13 +1157,13 @@ export const serializeAws_restJson1GetInvitationsCountCommand = async ( input: GetInvitationsCountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitation/count"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitation/count"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1150,8 +1179,10 @@ export const serializeAws_restJson1GetIPSetCommand = async ( input: GetIPSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/ipset/{IpSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/ipset/{IpSetId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1171,7 +1202,6 @@ export const serializeAws_restJson1GetIPSetCommand = async ( throw new Error("No value provided for input HTTP label: IpSetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1187,8 +1217,10 @@ export const serializeAws_restJson1GetMasterAccountCommand = async ( input: GetMasterAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/master"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/master"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1199,7 +1231,6 @@ export const serializeAws_restJson1GetMasterAccountCommand = async ( throw new Error("No value provided for input HTTP label: DetectorId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1215,10 +1246,13 @@ export const serializeAws_restJson1GetMemberDetectorsCommand = async ( input: GetMemberDetectorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/member/detector/get"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/member/detector/get"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1233,7 +1267,6 @@ export const serializeAws_restJson1GetMemberDetectorsCommand = async ( ...(input.AccountIds !== undefined && input.AccountIds !== null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1249,10 +1282,12 @@ export const serializeAws_restJson1GetMembersCommand = async ( input: GetMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/member/get"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member/get"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1267,7 +1302,6 @@ export const serializeAws_restJson1GetMembersCommand = async ( ...(input.AccountIds !== undefined && input.AccountIds !== null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1283,8 +1317,11 @@ export const serializeAws_restJson1GetThreatIntelSetCommand = async ( input: GetThreatIntelSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1304,7 +1341,6 @@ export const serializeAws_restJson1GetThreatIntelSetCommand = async ( throw new Error("No value provided for input HTTP label: ThreatIntelSetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1320,10 +1356,12 @@ export const serializeAws_restJson1GetUsageStatisticsCommand = async ( input: GetUsageStatisticsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/usage/statistics"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/usage/statistics"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1345,7 +1383,6 @@ export const serializeAws_restJson1GetUsageStatisticsCommand = async ( ...(input.UsageStatisticType !== undefined && input.UsageStatisticType !== null && { usageStatisticsType: input.UsageStatisticType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1361,10 +1398,12 @@ export const serializeAws_restJson1InviteMembersCommand = async ( input: InviteMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/member/invite"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member/invite"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1382,7 +1421,6 @@ export const serializeAws_restJson1InviteMembersCommand = async ( input.DisableEmailNotification !== null && { disableEmailNotification: input.DisableEmailNotification }), ...(input.Message !== undefined && input.Message !== null && { message: input.Message }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1398,14 +1436,14 @@ export const serializeAws_restJson1ListDetectorsCommand = async ( input: ListDetectorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1422,8 +1460,10 @@ export const serializeAws_restJson1ListFiltersCommand = async ( input: ListFiltersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/filter"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/filter"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1438,7 +1478,6 @@ export const serializeAws_restJson1ListFiltersCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1455,10 +1494,12 @@ export const serializeAws_restJson1ListFindingsCommand = async ( input: ListFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/findings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1479,7 +1520,6 @@ export const serializeAws_restJson1ListFindingsCommand = async ( ...(input.SortCriteria !== undefined && input.SortCriteria !== null && { sortCriteria: serializeAws_restJson1SortCriteria(input.SortCriteria, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1495,14 +1535,14 @@ export const serializeAws_restJson1ListInvitationsCommand = async ( input: ListInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/invitation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitation"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1519,8 +1559,10 @@ export const serializeAws_restJson1ListIPSetsCommand = async ( input: ListIPSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/ipset"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/ipset"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1535,7 +1577,6 @@ export const serializeAws_restJson1ListIPSetsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1552,8 +1593,10 @@ export const serializeAws_restJson1ListMembersCommand = async ( input: ListMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/member"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1569,7 +1612,6 @@ export const serializeAws_restJson1ListMembersCommand = async ( ...(input.OnlyAssociated !== undefined && { onlyAssociated: input.OnlyAssociated }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1586,14 +1628,14 @@ export const serializeAws_restJson1ListOrganizationAdminAccountsCommand = async input: ListOrganizationAdminAccountsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/admin"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/admin"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1610,8 +1652,11 @@ export const serializeAws_restJson1ListPublishingDestinationsCommand = async ( input: ListPublishingDestinationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/publishingDestination"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/publishingDestination"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1626,7 +1671,6 @@ export const serializeAws_restJson1ListPublishingDestinationsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1643,8 +1687,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1655,7 +1700,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1671,8 +1715,10 @@ export const serializeAws_restJson1ListThreatIntelSetsCommand = async ( input: ListThreatIntelSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector/{DetectorId}/threatintelset"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/threatintelset"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1687,7 +1733,6 @@ export const serializeAws_restJson1ListThreatIntelSetsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1704,10 +1749,12 @@ export const serializeAws_restJson1StartMonitoringMembersCommand = async ( input: StartMonitoringMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/member/start"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member/start"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1722,7 +1769,6 @@ export const serializeAws_restJson1StartMonitoringMembersCommand = async ( ...(input.AccountIds !== undefined && input.AccountIds !== null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1738,10 +1784,12 @@ export const serializeAws_restJson1StopMonitoringMembersCommand = async ( input: StopMonitoringMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/member/stop"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member/stop"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1756,7 +1804,6 @@ export const serializeAws_restJson1StopMonitoringMembersCommand = async ( ...(input.AccountIds !== undefined && input.AccountIds !== null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1772,10 +1819,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1789,7 +1837,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1805,10 +1852,12 @@ export const serializeAws_restJson1UnarchiveFindingsCommand = async ( input: UnarchiveFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/findings/unarchive"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings/unarchive"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1823,7 +1872,6 @@ export const serializeAws_restJson1UnarchiveFindingsCommand = async ( ...(input.FindingIds !== undefined && input.FindingIds !== null && { findingIds: serializeAws_restJson1FindingIds(input.FindingIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1839,8 +1887,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1854,7 +1903,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1871,10 +1919,11 @@ export const serializeAws_restJson1UpdateDetectorCommand = async ( input: UpdateDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1894,7 +1943,6 @@ export const serializeAws_restJson1UpdateDetectorCommand = async ( ...(input.FindingPublishingFrequency !== undefined && input.FindingPublishingFrequency !== null && { findingPublishingFrequency: input.FindingPublishingFrequency }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1910,10 +1958,13 @@ export const serializeAws_restJson1UpdateFilterCommand = async ( input: UpdateFilterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/filter/{FilterName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/filter/{FilterName}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1942,7 +1993,6 @@ export const serializeAws_restJson1UpdateFilterCommand = async ( }), ...(input.Rank !== undefined && input.Rank !== null && { rank: input.Rank }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1958,10 +2008,12 @@ export const serializeAws_restJson1UpdateFindingsFeedbackCommand = async ( input: UpdateFindingsFeedbackCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/findings/feedback"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings/feedback"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -1978,7 +2030,6 @@ export const serializeAws_restJson1UpdateFindingsFeedbackCommand = async ( ...(input.FindingIds !== undefined && input.FindingIds !== null && { findingIds: serializeAws_restJson1FindingIds(input.FindingIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1994,10 +2045,12 @@ export const serializeAws_restJson1UpdateIPSetCommand = async ( input: UpdateIPSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/ipset/{IpSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/ipset/{IpSetId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -2022,7 +2075,6 @@ export const serializeAws_restJson1UpdateIPSetCommand = async ( ...(input.Location !== undefined && input.Location !== null && { location: input.Location }), ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2038,10 +2090,13 @@ export const serializeAws_restJson1UpdateMemberDetectorsCommand = async ( input: UpdateMemberDetectorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/member/detector/update"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/member/detector/update"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -2060,7 +2115,6 @@ export const serializeAws_restJson1UpdateMemberDetectorsCommand = async ( dataSources: serializeAws_restJson1DataSourceConfigurations(input.DataSources, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2076,10 +2130,12 @@ export const serializeAws_restJson1UpdateOrganizationConfigurationCommand = asyn input: UpdateOrganizationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/admin"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/admin"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -2097,7 +2153,6 @@ export const serializeAws_restJson1UpdateOrganizationConfigurationCommand = asyn dataSources: serializeAws_restJson1OrganizationDataSourceConfigurations(input.DataSources, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2113,10 +2168,13 @@ export const serializeAws_restJson1UpdatePublishingDestinationCommand = async ( input: UpdatePublishingDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/publishingDestination/{DestinationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/publishingDestination/{DestinationId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -2142,7 +2200,6 @@ export const serializeAws_restJson1UpdatePublishingDestinationCommand = async ( destinationProperties: serializeAws_restJson1DestinationProperties(input.DestinationProperties, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2158,10 +2215,13 @@ export const serializeAws_restJson1UpdateThreatIntelSetCommand = async ( input: UpdateThreatIntelSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}"; if (input.DetectorId !== undefined) { const labelValue: string = input.DetectorId; if (labelValue.length <= 0) { @@ -2186,7 +2246,6 @@ export const serializeAws_restJson1UpdateThreatIntelSetCommand = async ( ...(input.Location !== undefined && input.Location !== null && { location: input.Location }), ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-honeycode/protocols/Aws_restJson1.ts b/clients/client-honeycode/protocols/Aws_restJson1.ts index 797aa34724a08..6720da3d5978d 100644 --- a/clients/client-honeycode/protocols/Aws_restJson1.ts +++ b/clients/client-honeycode/protocols/Aws_restJson1.ts @@ -86,10 +86,13 @@ export const serializeAws_restJson1BatchCreateTableRowsCommand = async ( input: BatchCreateTableRowsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workbooks/{workbookId}/tables/{tableId}/rows/batchcreate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workbooks/{workbookId}/tables/{tableId}/rows/batchcreate"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -117,7 +120,6 @@ export const serializeAws_restJson1BatchCreateTableRowsCommand = async ( rowsToCreate: serializeAws_restJson1CreateRowDataList(input.rowsToCreate, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -133,10 +135,13 @@ export const serializeAws_restJson1BatchDeleteTableRowsCommand = async ( input: BatchDeleteTableRowsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workbooks/{workbookId}/tables/{tableId}/rows/batchdelete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workbooks/{workbookId}/tables/{tableId}/rows/batchdelete"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -162,7 +167,6 @@ export const serializeAws_restJson1BatchDeleteTableRowsCommand = async ( ...(input.rowIds !== undefined && input.rowIds !== null && { rowIds: serializeAws_restJson1RowIdList(input.rowIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -178,10 +182,13 @@ export const serializeAws_restJson1BatchUpdateTableRowsCommand = async ( input: BatchUpdateTableRowsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workbooks/{workbookId}/tables/{tableId}/rows/batchupdate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workbooks/{workbookId}/tables/{tableId}/rows/batchupdate"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -209,7 +216,6 @@ export const serializeAws_restJson1BatchUpdateTableRowsCommand = async ( rowsToUpdate: serializeAws_restJson1UpdateRowDataList(input.rowsToUpdate, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -225,10 +231,13 @@ export const serializeAws_restJson1BatchUpsertTableRowsCommand = async ( input: BatchUpsertTableRowsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workbooks/{workbookId}/tables/{tableId}/rows/batchupsert"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workbooks/{workbookId}/tables/{tableId}/rows/batchupsert"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -256,7 +265,6 @@ export const serializeAws_restJson1BatchUpsertTableRowsCommand = async ( rowsToUpsert: serializeAws_restJson1UpsertRowDataList(input.rowsToUpsert, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -272,8 +280,11 @@ export const serializeAws_restJson1DescribeTableDataImportJobCommand = async ( input: DescribeTableDataImportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workbooks/{workbookId}/tables/{tableId}/import/{jobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workbooks/{workbookId}/tables/{tableId}/import/{jobId}"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -302,7 +313,6 @@ export const serializeAws_restJson1DescribeTableDataImportJobCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -318,10 +328,11 @@ export const serializeAws_restJson1GetScreenDataCommand = async ( input: GetScreenDataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/screendata"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/screendata"; let body: any; body = JSON.stringify({ ...(input.appId !== undefined && input.appId !== null && { appId: input.appId }), @@ -332,7 +343,6 @@ export const serializeAws_restJson1GetScreenDataCommand = async ( input.variables !== null && { variables: serializeAws_restJson1VariableValueMap(input.variables, context) }), ...(input.workbookId !== undefined && input.workbookId !== null && { workbookId: input.workbookId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -348,10 +358,13 @@ export const serializeAws_restJson1InvokeScreenAutomationCommand = async ( input: InvokeScreenAutomationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workbooks/{workbookId}/apps/{appId}/screens/{screenId}/automations/{screenAutomationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workbooks/{workbookId}/apps/{appId}/screens/{screenId}/automations/{screenAutomationId}"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -396,7 +409,6 @@ export const serializeAws_restJson1InvokeScreenAutomationCommand = async ( ...(input.variables !== undefined && input.variables !== null && { variables: serializeAws_restJson1VariableValueMap(input.variables, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -412,8 +424,11 @@ export const serializeAws_restJson1ListTableColumnsCommand = async ( input: ListTableColumnsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workbooks/{workbookId}/tables/{tableId}/columns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workbooks/{workbookId}/tables/{tableId}/columns"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -436,7 +451,6 @@ export const serializeAws_restJson1ListTableColumnsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -453,10 +467,13 @@ export const serializeAws_restJson1ListTableRowsCommand = async ( input: ListTableRowsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workbooks/{workbookId}/tables/{tableId}/rows/list"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workbooks/{workbookId}/tables/{tableId}/rows/list"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -482,7 +499,6 @@ export const serializeAws_restJson1ListTableRowsCommand = async ( ...(input.rowIds !== undefined && input.rowIds !== null && { rowIds: serializeAws_restJson1RowIdList(input.rowIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -498,8 +514,10 @@ export const serializeAws_restJson1ListTablesCommand = async ( input: ListTablesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workbooks/{workbookId}/tables"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workbooks/{workbookId}/tables"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -514,7 +532,6 @@ export const serializeAws_restJson1ListTablesCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -531,10 +548,13 @@ export const serializeAws_restJson1QueryTableRowsCommand = async ( input: QueryTableRowsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workbooks/{workbookId}/tables/{tableId}/rows/query"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workbooks/{workbookId}/tables/{tableId}/rows/query"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -560,7 +580,6 @@ export const serializeAws_restJson1QueryTableRowsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -576,10 +595,13 @@ export const serializeAws_restJson1StartTableDataImportJobCommand = async ( input: StartTableDataImportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workbooks/{workbookId}/tables/{destinationTableId}/import"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workbooks/{workbookId}/tables/{destinationTableId}/import"; if (input.workbookId !== undefined) { const labelValue: string = input.workbookId; if (labelValue.length <= 0) { @@ -610,7 +632,6 @@ export const serializeAws_restJson1StartTableDataImportJobCommand = async ( importOptions: serializeAws_restJson1ImportOptions(input.importOptions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-imagebuilder/protocols/Aws_restJson1.ts b/clients/client-imagebuilder/protocols/Aws_restJson1.ts index 5d555443c723b..19a8fcd29a24e 100644 --- a/clients/client-imagebuilder/protocols/Aws_restJson1.ts +++ b/clients/client-imagebuilder/protocols/Aws_restJson1.ts @@ -199,17 +199,17 @@ export const serializeAws_restJson1CancelImageCreationCommand = async ( input: CancelImageCreationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CancelImageCreation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CancelImageCreation"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), ...(input.imageBuildVersionArn !== undefined && input.imageBuildVersionArn !== null && { imageBuildVersionArn: input.imageBuildVersionArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -225,10 +225,11 @@ export const serializeAws_restJson1CreateComponentCommand = async ( input: CreateComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateComponent"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateComponent"; let body: any; body = JSON.stringify({ ...(input.changeDescription !== undefined && @@ -248,7 +249,6 @@ export const serializeAws_restJson1CreateComponentCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), ...(input.uri !== undefined && input.uri !== null && { uri: input.uri }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -264,10 +264,11 @@ export const serializeAws_restJson1CreateContainerRecipeCommand = async ( input: CreateContainerRecipeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateContainerRecipe"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateContainerRecipe"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -302,7 +303,6 @@ export const serializeAws_restJson1CreateContainerRecipeCommand = async ( ...(input.workingDirectory !== undefined && input.workingDirectory !== null && { workingDirectory: input.workingDirectory }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -318,10 +318,12 @@ export const serializeAws_restJson1CreateDistributionConfigurationCommand = asyn input: CreateDistributionConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateDistributionConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateDistributionConfiguration"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -333,7 +335,6 @@ export const serializeAws_restJson1CreateDistributionConfigurationCommand = asyn ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -349,10 +350,11 @@ export const serializeAws_restJson1CreateImageCommand = async ( input: CreateImageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateImage"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateImage"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -378,7 +380,6 @@ export const serializeAws_restJson1CreateImageCommand = async ( }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -394,10 +395,11 @@ export const serializeAws_restJson1CreateImagePipelineCommand = async ( input: CreateImagePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateImagePipeline"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateImagePipeline"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -428,7 +430,6 @@ export const serializeAws_restJson1CreateImagePipelineCommand = async ( ...(input.status !== undefined && input.status !== null && { status: input.status }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -444,10 +445,11 @@ export const serializeAws_restJson1CreateImageRecipeCommand = async ( input: CreateImageRecipeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateImageRecipe"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateImageRecipe"; let body: any; body = JSON.stringify({ ...(input.blockDeviceMappings !== undefined && @@ -468,7 +470,6 @@ export const serializeAws_restJson1CreateImageRecipeCommand = async ( ...(input.workingDirectory !== undefined && input.workingDirectory !== null && { workingDirectory: input.workingDirectory }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -484,10 +485,12 @@ export const serializeAws_restJson1CreateInfrastructureConfigurationCommand = as input: CreateInfrastructureConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateInfrastructureConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateInfrastructureConfiguration"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -516,7 +519,6 @@ export const serializeAws_restJson1CreateInfrastructureConfigurationCommand = as ...(input.terminateInstanceOnFailure !== undefined && input.terminateInstanceOnFailure !== null && { terminateInstanceOnFailure: input.terminateInstanceOnFailure }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -532,13 +534,13 @@ export const serializeAws_restJson1DeleteComponentCommand = async ( input: DeleteComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/DeleteComponent"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteComponent"; const query: any = { ...(input.componentBuildVersionArn !== undefined && { componentBuildVersionArn: input.componentBuildVersionArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -555,13 +557,13 @@ export const serializeAws_restJson1DeleteContainerRecipeCommand = async ( input: DeleteContainerRecipeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/DeleteContainerRecipe"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteContainerRecipe"; const query: any = { ...(input.containerRecipeArn !== undefined && { containerRecipeArn: input.containerRecipeArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -578,15 +580,16 @@ export const serializeAws_restJson1DeleteDistributionConfigurationCommand = asyn input: DeleteDistributionConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/DeleteDistributionConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteDistributionConfiguration"; const query: any = { ...(input.distributionConfigurationArn !== undefined && { distributionConfigurationArn: input.distributionConfigurationArn, }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -603,13 +606,13 @@ export const serializeAws_restJson1DeleteImageCommand = async ( input: DeleteImageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/DeleteImage"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteImage"; const query: any = { ...(input.imageBuildVersionArn !== undefined && { imageBuildVersionArn: input.imageBuildVersionArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -626,13 +629,13 @@ export const serializeAws_restJson1DeleteImagePipelineCommand = async ( input: DeleteImagePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/DeleteImagePipeline"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteImagePipeline"; const query: any = { ...(input.imagePipelineArn !== undefined && { imagePipelineArn: input.imagePipelineArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -649,13 +652,13 @@ export const serializeAws_restJson1DeleteImageRecipeCommand = async ( input: DeleteImageRecipeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/DeleteImageRecipe"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteImageRecipe"; const query: any = { ...(input.imageRecipeArn !== undefined && { imageRecipeArn: input.imageRecipeArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -672,15 +675,16 @@ export const serializeAws_restJson1DeleteInfrastructureConfigurationCommand = as input: DeleteInfrastructureConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/DeleteInfrastructureConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteInfrastructureConfiguration"; const query: any = { ...(input.infrastructureConfigurationArn !== undefined && { infrastructureConfigurationArn: input.infrastructureConfigurationArn, }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -697,13 +701,13 @@ export const serializeAws_restJson1GetComponentCommand = async ( input: GetComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetComponent"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetComponent"; const query: any = { ...(input.componentBuildVersionArn !== undefined && { componentBuildVersionArn: input.componentBuildVersionArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -720,13 +724,13 @@ export const serializeAws_restJson1GetComponentPolicyCommand = async ( input: GetComponentPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetComponentPolicy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetComponentPolicy"; const query: any = { ...(input.componentArn !== undefined && { componentArn: input.componentArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -743,13 +747,13 @@ export const serializeAws_restJson1GetContainerRecipeCommand = async ( input: GetContainerRecipeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetContainerRecipe"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetContainerRecipe"; const query: any = { ...(input.containerRecipeArn !== undefined && { containerRecipeArn: input.containerRecipeArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -766,13 +770,14 @@ export const serializeAws_restJson1GetContainerRecipePolicyCommand = async ( input: GetContainerRecipePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetContainerRecipePolicy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetContainerRecipePolicy"; const query: any = { ...(input.containerRecipeArn !== undefined && { containerRecipeArn: input.containerRecipeArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -789,15 +794,16 @@ export const serializeAws_restJson1GetDistributionConfigurationCommand = async ( input: GetDistributionConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetDistributionConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetDistributionConfiguration"; const query: any = { ...(input.distributionConfigurationArn !== undefined && { distributionConfigurationArn: input.distributionConfigurationArn, }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -814,13 +820,13 @@ export const serializeAws_restJson1GetImageCommand = async ( input: GetImageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetImage"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetImage"; const query: any = { ...(input.imageBuildVersionArn !== undefined && { imageBuildVersionArn: input.imageBuildVersionArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -837,13 +843,13 @@ export const serializeAws_restJson1GetImagePipelineCommand = async ( input: GetImagePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetImagePipeline"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetImagePipeline"; const query: any = { ...(input.imagePipelineArn !== undefined && { imagePipelineArn: input.imagePipelineArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -860,13 +866,13 @@ export const serializeAws_restJson1GetImagePolicyCommand = async ( input: GetImagePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetImagePolicy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetImagePolicy"; const query: any = { ...(input.imageArn !== undefined && { imageArn: input.imageArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -883,13 +889,13 @@ export const serializeAws_restJson1GetImageRecipeCommand = async ( input: GetImageRecipeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetImageRecipe"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetImageRecipe"; const query: any = { ...(input.imageRecipeArn !== undefined && { imageRecipeArn: input.imageRecipeArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -906,13 +912,13 @@ export const serializeAws_restJson1GetImageRecipePolicyCommand = async ( input: GetImageRecipePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetImageRecipePolicy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetImageRecipePolicy"; const query: any = { ...(input.imageRecipeArn !== undefined && { imageRecipeArn: input.imageRecipeArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -929,15 +935,16 @@ export const serializeAws_restJson1GetInfrastructureConfigurationCommand = async input: GetInfrastructureConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/GetInfrastructureConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetInfrastructureConfiguration"; const query: any = { ...(input.infrastructureConfigurationArn !== undefined && { infrastructureConfigurationArn: input.infrastructureConfigurationArn, }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -954,10 +961,11 @@ export const serializeAws_restJson1ImportComponentCommand = async ( input: ImportComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ImportComponent"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ImportComponent"; let body: any; body = JSON.stringify({ ...(input.changeDescription !== undefined && @@ -975,7 +983,6 @@ export const serializeAws_restJson1ImportComponentCommand = async ( ...(input.type !== undefined && input.type !== null && { type: input.type }), ...(input.uri !== undefined && input.uri !== null && { uri: input.uri }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -991,10 +998,12 @@ export const serializeAws_restJson1ListComponentBuildVersionsCommand = async ( input: ListComponentBuildVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListComponentBuildVersions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListComponentBuildVersions"; let body: any; body = JSON.stringify({ ...(input.componentVersionArn !== undefined && @@ -1002,7 +1011,6 @@ export const serializeAws_restJson1ListComponentBuildVersionsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1018,10 +1026,11 @@ export const serializeAws_restJson1ListComponentsCommand = async ( input: ListComponentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListComponents"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListComponents"; let body: any; body = JSON.stringify({ ...(input.byName !== undefined && input.byName !== null && { byName: input.byName }), @@ -1031,7 +1040,6 @@ export const serializeAws_restJson1ListComponentsCommand = async ( ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), ...(input.owner !== undefined && input.owner !== null && { owner: input.owner }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1047,10 +1055,11 @@ export const serializeAws_restJson1ListContainerRecipesCommand = async ( input: ListContainerRecipesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListContainerRecipes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListContainerRecipes"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1059,7 +1068,6 @@ export const serializeAws_restJson1ListContainerRecipesCommand = async ( ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), ...(input.owner !== undefined && input.owner !== null && { owner: input.owner }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1075,10 +1083,12 @@ export const serializeAws_restJson1ListDistributionConfigurationsCommand = async input: ListDistributionConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListDistributionConfigurations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListDistributionConfigurations"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1086,7 +1096,6 @@ export const serializeAws_restJson1ListDistributionConfigurationsCommand = async ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1102,10 +1111,11 @@ export const serializeAws_restJson1ListImageBuildVersionsCommand = async ( input: ListImageBuildVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListImageBuildVersions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListImageBuildVersions"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1115,7 +1125,6 @@ export const serializeAws_restJson1ListImageBuildVersionsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1131,10 +1140,11 @@ export const serializeAws_restJson1ListImagePackagesCommand = async ( input: ListImagePackagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListImagePackages"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListImagePackages"; let body: any; body = JSON.stringify({ ...(input.imageBuildVersionArn !== undefined && @@ -1142,7 +1152,6 @@ export const serializeAws_restJson1ListImagePackagesCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1158,10 +1167,11 @@ export const serializeAws_restJson1ListImagePipelineImagesCommand = async ( input: ListImagePipelineImagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListImagePipelineImages"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListImagePipelineImages"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1171,7 +1181,6 @@ export const serializeAws_restJson1ListImagePipelineImagesCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1187,10 +1196,11 @@ export const serializeAws_restJson1ListImagePipelinesCommand = async ( input: ListImagePipelinesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListImagePipelines"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListImagePipelines"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1198,7 +1208,6 @@ export const serializeAws_restJson1ListImagePipelinesCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1214,10 +1223,11 @@ export const serializeAws_restJson1ListImageRecipesCommand = async ( input: ListImageRecipesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListImageRecipes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListImageRecipes"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1226,7 +1236,6 @@ export const serializeAws_restJson1ListImageRecipesCommand = async ( ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), ...(input.owner !== undefined && input.owner !== null && { owner: input.owner }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1242,10 +1251,11 @@ export const serializeAws_restJson1ListImagesCommand = async ( input: ListImagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListImages"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListImages"; let body: any; body = JSON.stringify({ ...(input.byName !== undefined && input.byName !== null && { byName: input.byName }), @@ -1257,7 +1267,6 @@ export const serializeAws_restJson1ListImagesCommand = async ( ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), ...(input.owner !== undefined && input.owner !== null && { owner: input.owner }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1273,10 +1282,12 @@ export const serializeAws_restJson1ListInfrastructureConfigurationsCommand = asy input: ListInfrastructureConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListInfrastructureConfigurations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListInfrastructureConfigurations"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1284,7 +1295,6 @@ export const serializeAws_restJson1ListInfrastructureConfigurationsCommand = asy ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1300,8 +1310,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1312,7 +1323,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1328,16 +1338,16 @@ export const serializeAws_restJson1PutComponentPolicyCommand = async ( input: PutComponentPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/PutComponentPolicy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PutComponentPolicy"; let body: any; body = JSON.stringify({ ...(input.componentArn !== undefined && input.componentArn !== null && { componentArn: input.componentArn }), ...(input.policy !== undefined && input.policy !== null && { policy: input.policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1353,17 +1363,18 @@ export const serializeAws_restJson1PutContainerRecipePolicyCommand = async ( input: PutContainerRecipePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/PutContainerRecipePolicy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PutContainerRecipePolicy"; let body: any; body = JSON.stringify({ ...(input.containerRecipeArn !== undefined && input.containerRecipeArn !== null && { containerRecipeArn: input.containerRecipeArn }), ...(input.policy !== undefined && input.policy !== null && { policy: input.policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1379,16 +1390,16 @@ export const serializeAws_restJson1PutImagePolicyCommand = async ( input: PutImagePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/PutImagePolicy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PutImagePolicy"; let body: any; body = JSON.stringify({ ...(input.imageArn !== undefined && input.imageArn !== null && { imageArn: input.imageArn }), ...(input.policy !== undefined && input.policy !== null && { policy: input.policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1404,17 +1415,17 @@ export const serializeAws_restJson1PutImageRecipePolicyCommand = async ( input: PutImageRecipePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/PutImageRecipePolicy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PutImageRecipePolicy"; let body: any; body = JSON.stringify({ ...(input.imageRecipeArn !== undefined && input.imageRecipeArn !== null && { imageRecipeArn: input.imageRecipeArn }), ...(input.policy !== undefined && input.policy !== null && { policy: input.policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1430,17 +1441,18 @@ export const serializeAws_restJson1StartImagePipelineExecutionCommand = async ( input: StartImagePipelineExecutionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/StartImagePipelineExecution"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StartImagePipelineExecution"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), ...(input.imagePipelineArn !== undefined && input.imagePipelineArn !== null && { imagePipelineArn: input.imagePipelineArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1456,10 +1468,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1473,7 +1486,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1489,8 +1501,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1504,7 +1517,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1521,10 +1533,12 @@ export const serializeAws_restJson1UpdateDistributionConfigurationCommand = asyn input: UpdateDistributionConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateDistributionConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateDistributionConfiguration"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -1538,7 +1552,6 @@ export const serializeAws_restJson1UpdateDistributionConfigurationCommand = asyn distributions: serializeAws_restJson1DistributionList(input.distributions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1554,10 +1567,11 @@ export const serializeAws_restJson1UpdateImagePipelineCommand = async ( input: UpdateImagePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateImagePipeline"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateImagePipeline"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -1588,7 +1602,6 @@ export const serializeAws_restJson1UpdateImagePipelineCommand = async ( input.schedule !== null && { schedule: serializeAws_restJson1Schedule(input.schedule, context) }), ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1604,10 +1617,12 @@ export const serializeAws_restJson1UpdateInfrastructureConfigurationCommand = as input: UpdateInfrastructureConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateInfrastructureConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateInfrastructureConfiguration"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -1638,7 +1653,6 @@ export const serializeAws_restJson1UpdateInfrastructureConfigurationCommand = as ...(input.terminateInstanceOnFailure !== undefined && input.terminateInstanceOnFailure !== null && { terminateInstanceOnFailure: input.terminateInstanceOnFailure }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iot-1click-devices-service/protocols/Aws_restJson1.ts b/clients/client-iot-1click-devices-service/protocols/Aws_restJson1.ts index 89516ceec3052..c49979b30df50 100644 --- a/clients/client-iot-1click-devices-service/protocols/Aws_restJson1.ts +++ b/clients/client-iot-1click-devices-service/protocols/Aws_restJson1.ts @@ -57,8 +57,9 @@ export const serializeAws_restJson1ClaimDevicesByClaimCodeCommand = async ( input: ClaimDevicesByClaimCodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/claims/{ClaimCode}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/claims/{ClaimCode}"; if (input.ClaimCode !== undefined) { const labelValue: string = input.ClaimCode; if (labelValue.length <= 0) { @@ -69,7 +70,6 @@ export const serializeAws_restJson1ClaimDevicesByClaimCodeCommand = async ( throw new Error("No value provided for input HTTP label: ClaimCode."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -85,8 +85,9 @@ export const serializeAws_restJson1DescribeDeviceCommand = async ( input: DescribeDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/devices/{DeviceId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/devices/{DeviceId}"; if (input.DeviceId !== undefined) { const labelValue: string = input.DeviceId; if (labelValue.length <= 0) { @@ -97,7 +98,6 @@ export const serializeAws_restJson1DescribeDeviceCommand = async ( throw new Error("No value provided for input HTTP label: DeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -113,10 +113,12 @@ export const serializeAws_restJson1FinalizeDeviceClaimCommand = async ( input: FinalizeDeviceClaimCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/devices/{DeviceId}/finalize-claim"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/devices/{DeviceId}/finalize-claim"; if (input.DeviceId !== undefined) { const labelValue: string = input.DeviceId; if (labelValue.length <= 0) { @@ -131,7 +133,6 @@ export const serializeAws_restJson1FinalizeDeviceClaimCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -147,8 +148,10 @@ export const serializeAws_restJson1GetDeviceMethodsCommand = async ( input: GetDeviceMethodsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/devices/{DeviceId}/methods"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/devices/{DeviceId}/methods"; if (input.DeviceId !== undefined) { const labelValue: string = input.DeviceId; if (labelValue.length <= 0) { @@ -159,7 +162,6 @@ export const serializeAws_restJson1GetDeviceMethodsCommand = async ( throw new Error("No value provided for input HTTP label: DeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -175,8 +177,10 @@ export const serializeAws_restJson1InitiateDeviceClaimCommand = async ( input: InitiateDeviceClaimCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/devices/{DeviceId}/initiate-claim"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/devices/{DeviceId}/initiate-claim"; if (input.DeviceId !== undefined) { const labelValue: string = input.DeviceId; if (labelValue.length <= 0) { @@ -187,7 +191,6 @@ export const serializeAws_restJson1InitiateDeviceClaimCommand = async ( throw new Error("No value provided for input HTTP label: DeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -203,10 +206,12 @@ export const serializeAws_restJson1InvokeDeviceMethodCommand = async ( input: InvokeDeviceMethodCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/devices/{DeviceId}/methods"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/devices/{DeviceId}/methods"; if (input.DeviceId !== undefined) { const labelValue: string = input.DeviceId; if (labelValue.length <= 0) { @@ -223,7 +228,6 @@ export const serializeAws_restJson1InvokeDeviceMethodCommand = async ( ...(input.DeviceMethodParameters !== undefined && input.DeviceMethodParameters !== null && { deviceMethodParameters: input.DeviceMethodParameters }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -239,8 +243,10 @@ export const serializeAws_restJson1ListDeviceEventsCommand = async ( input: ListDeviceEventsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/devices/{DeviceId}/events"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/devices/{DeviceId}/events"; if (input.DeviceId !== undefined) { const labelValue: string = input.DeviceId; if (labelValue.length <= 0) { @@ -261,7 +267,6 @@ export const serializeAws_restJson1ListDeviceEventsCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -278,15 +283,15 @@ export const serializeAws_restJson1ListDevicesCommand = async ( input: ListDevicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/devices"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/devices"; const query: any = { ...(input.DeviceType !== undefined && { deviceType: input.DeviceType }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -303,8 +308,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -315,7 +321,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -331,10 +336,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -349,7 +355,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -365,8 +370,10 @@ export const serializeAws_restJson1UnclaimDeviceCommand = async ( input: UnclaimDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/devices/{DeviceId}/unclaim"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/devices/{DeviceId}/unclaim"; if (input.DeviceId !== undefined) { const labelValue: string = input.DeviceId; if (labelValue.length <= 0) { @@ -377,7 +384,6 @@ export const serializeAws_restJson1UnclaimDeviceCommand = async ( throw new Error("No value provided for input HTTP label: DeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -393,8 +399,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -408,7 +415,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -425,10 +431,12 @@ export const serializeAws_restJson1UpdateDeviceStateCommand = async ( input: UpdateDeviceStateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/devices/{DeviceId}/state"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/devices/{DeviceId}/state"; if (input.DeviceId !== undefined) { const labelValue: string = input.DeviceId; if (labelValue.length <= 0) { @@ -442,7 +450,6 @@ export const serializeAws_restJson1UpdateDeviceStateCommand = async ( body = JSON.stringify({ ...(input.Enabled !== undefined && input.Enabled !== null && { enabled: input.Enabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iot-1click-projects/protocols/Aws_restJson1.ts b/clients/client-iot-1click-projects/protocols/Aws_restJson1.ts index 05b07fc1310d6..9995de5581184 100644 --- a/clients/client-iot-1click-projects/protocols/Aws_restJson1.ts +++ b/clients/client-iot-1click-projects/protocols/Aws_restJson1.ts @@ -56,10 +56,13 @@ export const serializeAws_restJson1AssociateDeviceWithPlacementCommand = async ( input: AssociateDeviceWithPlacementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects/{projectName}/placements/{placementName}/devices/{deviceTemplateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/projects/{projectName}/placements/{placementName}/devices/{deviceTemplateName}"; if (input.projectName !== undefined) { const labelValue: string = input.projectName; if (labelValue.length <= 0) { @@ -91,7 +94,6 @@ export const serializeAws_restJson1AssociateDeviceWithPlacementCommand = async ( body = JSON.stringify({ ...(input.deviceId !== undefined && input.deviceId !== null && { deviceId: input.deviceId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -107,10 +109,12 @@ export const serializeAws_restJson1CreatePlacementCommand = async ( input: CreatePlacementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects/{projectName}/placements"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectName}/placements"; if (input.projectName !== undefined) { const labelValue: string = input.projectName; if (labelValue.length <= 0) { @@ -128,7 +132,6 @@ export const serializeAws_restJson1CreatePlacementCommand = async ( }), ...(input.placementName !== undefined && input.placementName !== null && { placementName: input.placementName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -144,10 +147,11 @@ export const serializeAws_restJson1CreateProjectCommand = async ( input: CreateProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects"; let body: any; body = JSON.stringify({ ...(input.description !== undefined && input.description !== null && { description: input.description }), @@ -158,7 +162,6 @@ export const serializeAws_restJson1CreateProjectCommand = async ( ...(input.projectName !== undefined && input.projectName !== null && { projectName: input.projectName }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -174,8 +177,11 @@ export const serializeAws_restJson1DeletePlacementCommand = async ( input: DeletePlacementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectName}/placements/{placementName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/projects/{projectName}/placements/{placementName}"; if (input.placementName !== undefined) { const labelValue: string = input.placementName; if (labelValue.length <= 0) { @@ -195,7 +201,6 @@ export const serializeAws_restJson1DeletePlacementCommand = async ( throw new Error("No value provided for input HTTP label: projectName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -211,8 +216,9 @@ export const serializeAws_restJson1DeleteProjectCommand = async ( input: DeleteProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectName}"; if (input.projectName !== undefined) { const labelValue: string = input.projectName; if (labelValue.length <= 0) { @@ -223,7 +229,6 @@ export const serializeAws_restJson1DeleteProjectCommand = async ( throw new Error("No value provided for input HTTP label: projectName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -239,8 +244,11 @@ export const serializeAws_restJson1DescribePlacementCommand = async ( input: DescribePlacementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectName}/placements/{placementName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/projects/{projectName}/placements/{placementName}"; if (input.placementName !== undefined) { const labelValue: string = input.placementName; if (labelValue.length <= 0) { @@ -260,7 +268,6 @@ export const serializeAws_restJson1DescribePlacementCommand = async ( throw new Error("No value provided for input HTTP label: projectName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -276,8 +283,9 @@ export const serializeAws_restJson1DescribeProjectCommand = async ( input: DescribeProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectName}"; if (input.projectName !== undefined) { const labelValue: string = input.projectName; if (labelValue.length <= 0) { @@ -288,7 +296,6 @@ export const serializeAws_restJson1DescribeProjectCommand = async ( throw new Error("No value provided for input HTTP label: projectName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -304,8 +311,11 @@ export const serializeAws_restJson1DisassociateDeviceFromPlacementCommand = asyn input: DisassociateDeviceFromPlacementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectName}/placements/{placementName}/devices/{deviceTemplateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/projects/{projectName}/placements/{placementName}/devices/{deviceTemplateName}"; if (input.projectName !== undefined) { const labelValue: string = input.projectName; if (labelValue.length <= 0) { @@ -334,7 +344,6 @@ export const serializeAws_restJson1DisassociateDeviceFromPlacementCommand = asyn throw new Error("No value provided for input HTTP label: deviceTemplateName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -350,8 +359,11 @@ export const serializeAws_restJson1GetDevicesInPlacementCommand = async ( input: GetDevicesInPlacementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectName}/placements/{placementName}/devices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/projects/{projectName}/placements/{placementName}/devices"; if (input.projectName !== undefined) { const labelValue: string = input.projectName; if (labelValue.length <= 0) { @@ -371,7 +383,6 @@ export const serializeAws_restJson1GetDevicesInPlacementCommand = async ( throw new Error("No value provided for input HTTP label: placementName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -387,8 +398,10 @@ export const serializeAws_restJson1ListPlacementsCommand = async ( input: ListPlacementsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectName}/placements"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectName}/placements"; if (input.projectName !== undefined) { const labelValue: string = input.projectName; if (labelValue.length <= 0) { @@ -403,7 +416,6 @@ export const serializeAws_restJson1ListPlacementsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -420,14 +432,14 @@ export const serializeAws_restJson1ListProjectsCommand = async ( input: ListProjectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -444,8 +456,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -456,7 +469,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -472,10 +484,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -489,7 +502,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -505,8 +517,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -520,7 +533,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -537,10 +549,13 @@ export const serializeAws_restJson1UpdatePlacementCommand = async ( input: UpdatePlacementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects/{projectName}/placements/{placementName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/projects/{projectName}/placements/{placementName}"; if (input.placementName !== undefined) { const labelValue: string = input.placementName; if (labelValue.length <= 0) { @@ -566,7 +581,6 @@ export const serializeAws_restJson1UpdatePlacementCommand = async ( attributes: serializeAws_restJson1PlacementAttributeMap(input.attributes, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -582,10 +596,11 @@ export const serializeAws_restJson1UpdateProjectCommand = async ( input: UpdateProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects/{projectName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectName}"; if (input.projectName !== undefined) { const labelValue: string = input.projectName; if (labelValue.length <= 0) { @@ -603,7 +618,6 @@ export const serializeAws_restJson1UpdateProjectCommand = async ( placementTemplate: serializeAws_restJson1PlacementTemplate(input.placementTemplate, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iot-data-plane/protocols/Aws_restJson1.ts b/clients/client-iot-data-plane/protocols/Aws_restJson1.ts index c56577ee4dfe9..5e77017f90beb 100644 --- a/clients/client-iot-data-plane/protocols/Aws_restJson1.ts +++ b/clients/client-iot-data-plane/protocols/Aws_restJson1.ts @@ -36,8 +36,10 @@ export const serializeAws_restJson1DeleteThingShadowCommand = async ( input: DeleteThingShadowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}/shadow"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -51,7 +53,6 @@ export const serializeAws_restJson1DeleteThingShadowCommand = async ( ...(input.shadowName !== undefined && { name: input.shadowName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -68,8 +69,10 @@ export const serializeAws_restJson1GetThingShadowCommand = async ( input: GetThingShadowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}/shadow"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -83,7 +86,6 @@ export const serializeAws_restJson1GetThingShadowCommand = async ( ...(input.shadowName !== undefined && { name: input.shadowName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -100,8 +102,11 @@ export const serializeAws_restJson1ListNamedShadowsForThingCommand = async ( input: ListNamedShadowsForThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/api/things/shadow/ListNamedShadowsForThing/{thingName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/things/shadow/ListNamedShadowsForThing/{thingName}"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -116,7 +121,6 @@ export const serializeAws_restJson1ListNamedShadowsForThingCommand = async ( ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -133,10 +137,11 @@ export const serializeAws_restJson1PublishCommand = async ( input: PublishCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", }; - let resolvedPath = "/topics/{topic}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/topics/{topic}"; if (input.topic !== undefined) { const labelValue: string = input.topic; if (labelValue.length <= 0) { @@ -153,7 +158,6 @@ export const serializeAws_restJson1PublishCommand = async ( if (input.payload !== undefined) { body = input.payload; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -170,10 +174,12 @@ export const serializeAws_restJson1UpdateThingShadowCommand = async ( input: UpdateThingShadowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", }; - let resolvedPath = "/things/{thingName}/shadow"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -190,7 +196,6 @@ export const serializeAws_restJson1UpdateThingShadowCommand = async ( if (input.payload !== undefined) { body = input.payload; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iot-events-data/protocols/Aws_restJson1.ts b/clients/client-iot-events-data/protocols/Aws_restJson1.ts index 2aa7f96128459..d096897a56372 100644 --- a/clients/client-iot-events-data/protocols/Aws_restJson1.ts +++ b/clients/client-iot-events-data/protocols/Aws_restJson1.ts @@ -73,10 +73,11 @@ export const serializeAws_restJson1BatchAcknowledgeAlarmCommand = async ( input: BatchAcknowledgeAlarmCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/alarms/acknowledge"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/acknowledge"; let body: any; body = JSON.stringify({ ...(input.acknowledgeActionRequests !== undefined && @@ -87,7 +88,6 @@ export const serializeAws_restJson1BatchAcknowledgeAlarmCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -103,10 +103,11 @@ export const serializeAws_restJson1BatchDisableAlarmCommand = async ( input: BatchDisableAlarmCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/alarms/disable"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/disable"; let body: any; body = JSON.stringify({ ...(input.disableActionRequests !== undefined && @@ -114,7 +115,6 @@ export const serializeAws_restJson1BatchDisableAlarmCommand = async ( disableActionRequests: serializeAws_restJson1DisableAlarmActionRequests(input.disableActionRequests, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -130,10 +130,11 @@ export const serializeAws_restJson1BatchEnableAlarmCommand = async ( input: BatchEnableAlarmCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/alarms/enable"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/enable"; let body: any; body = JSON.stringify({ ...(input.enableActionRequests !== undefined && @@ -141,7 +142,6 @@ export const serializeAws_restJson1BatchEnableAlarmCommand = async ( enableActionRequests: serializeAws_restJson1EnableAlarmActionRequests(input.enableActionRequests, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -157,16 +157,16 @@ export const serializeAws_restJson1BatchPutMessageCommand = async ( input: BatchPutMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/inputs/messages"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/inputs/messages"; let body: any; body = JSON.stringify({ ...(input.messages !== undefined && input.messages !== null && { messages: serializeAws_restJson1Messages(input.messages, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -182,10 +182,11 @@ export const serializeAws_restJson1BatchResetAlarmCommand = async ( input: BatchResetAlarmCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/alarms/reset"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/reset"; let body: any; body = JSON.stringify({ ...(input.resetActionRequests !== undefined && @@ -193,7 +194,6 @@ export const serializeAws_restJson1BatchResetAlarmCommand = async ( resetActionRequests: serializeAws_restJson1ResetAlarmActionRequests(input.resetActionRequests, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -209,10 +209,11 @@ export const serializeAws_restJson1BatchSnoozeAlarmCommand = async ( input: BatchSnoozeAlarmCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/alarms/snooze"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/snooze"; let body: any; body = JSON.stringify({ ...(input.snoozeActionRequests !== undefined && @@ -220,7 +221,6 @@ export const serializeAws_restJson1BatchSnoozeAlarmCommand = async ( snoozeActionRequests: serializeAws_restJson1SnoozeAlarmActionRequests(input.snoozeActionRequests, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -236,10 +236,11 @@ export const serializeAws_restJson1BatchUpdateDetectorCommand = async ( input: BatchUpdateDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detectors"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detectors"; let body: any; body = JSON.stringify({ ...(input.detectors !== undefined && @@ -247,7 +248,6 @@ export const serializeAws_restJson1BatchUpdateDetectorCommand = async ( detectors: serializeAws_restJson1UpdateDetectorRequests(input.detectors, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -263,8 +263,10 @@ export const serializeAws_restJson1DescribeAlarmCommand = async ( input: DescribeAlarmCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/alarms/{alarmModelName}/keyValues"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/{alarmModelName}/keyValues"; if (input.alarmModelName !== undefined) { const labelValue: string = input.alarmModelName; if (labelValue.length <= 0) { @@ -278,7 +280,6 @@ export const serializeAws_restJson1DescribeAlarmCommand = async ( ...(input.keyValue !== undefined && { keyValue: input.keyValue }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -295,8 +296,10 @@ export const serializeAws_restJson1DescribeDetectorCommand = async ( input: DescribeDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detectors/{detectorModelName}/keyValues"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detectors/{detectorModelName}/keyValues"; if (input.detectorModelName !== undefined) { const labelValue: string = input.detectorModelName; if (labelValue.length <= 0) { @@ -310,7 +313,6 @@ export const serializeAws_restJson1DescribeDetectorCommand = async ( ...(input.keyValue !== undefined && { keyValue: input.keyValue }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -327,8 +329,9 @@ export const serializeAws_restJson1ListAlarmsCommand = async ( input: ListAlarmsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/alarms/{alarmModelName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/{alarmModelName}"; if (input.alarmModelName !== undefined) { const labelValue: string = input.alarmModelName; if (labelValue.length <= 0) { @@ -343,7 +346,6 @@ export const serializeAws_restJson1ListAlarmsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -360,8 +362,10 @@ export const serializeAws_restJson1ListDetectorsCommand = async ( input: ListDetectorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detectors/{detectorModelName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detectors/{detectorModelName}"; if (input.detectorModelName !== undefined) { const labelValue: string = input.detectorModelName; if (labelValue.length <= 0) { @@ -377,7 +381,6 @@ export const serializeAws_restJson1ListDetectorsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iot-events/protocols/Aws_restJson1.ts b/clients/client-iot-events/protocols/Aws_restJson1.ts index 9d2531865df74..16e1dc1d6d507 100644 --- a/clients/client-iot-events/protocols/Aws_restJson1.ts +++ b/clients/client-iot-events/protocols/Aws_restJson1.ts @@ -149,10 +149,11 @@ export const serializeAws_restJson1CreateAlarmModelCommand = async ( input: CreateAlarmModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/alarm-models"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarm-models"; let body: any; body = JSON.stringify({ ...(input.alarmCapabilities !== undefined && @@ -178,7 +179,6 @@ export const serializeAws_restJson1CreateAlarmModelCommand = async ( ...(input.severity !== undefined && input.severity !== null && { severity: input.severity }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -194,10 +194,11 @@ export const serializeAws_restJson1CreateDetectorModelCommand = async ( input: CreateDetectorModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector-models"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector-models"; let body: any; body = JSON.stringify({ ...(input.detectorModelDefinition !== undefined && @@ -214,7 +215,6 @@ export const serializeAws_restJson1CreateDetectorModelCommand = async ( ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -230,10 +230,11 @@ export const serializeAws_restJson1CreateInputCommand = async ( input: CreateInputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/inputs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/inputs"; let body: any; body = JSON.stringify({ ...(input.inputDefinition !== undefined && @@ -245,7 +246,6 @@ export const serializeAws_restJson1CreateInputCommand = async ( ...(input.inputName !== undefined && input.inputName !== null && { inputName: input.inputName }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -261,8 +261,10 @@ export const serializeAws_restJson1DeleteAlarmModelCommand = async ( input: DeleteAlarmModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/alarm-models/{alarmModelName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarm-models/{alarmModelName}"; if (input.alarmModelName !== undefined) { const labelValue: string = input.alarmModelName; if (labelValue.length <= 0) { @@ -273,7 +275,6 @@ export const serializeAws_restJson1DeleteAlarmModelCommand = async ( throw new Error("No value provided for input HTTP label: alarmModelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -289,8 +290,10 @@ export const serializeAws_restJson1DeleteDetectorModelCommand = async ( input: DeleteDetectorModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector-models/{detectorModelName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector-models/{detectorModelName}"; if (input.detectorModelName !== undefined) { const labelValue: string = input.detectorModelName; if (labelValue.length <= 0) { @@ -301,7 +304,6 @@ export const serializeAws_restJson1DeleteDetectorModelCommand = async ( throw new Error("No value provided for input HTTP label: detectorModelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -317,8 +319,9 @@ export const serializeAws_restJson1DeleteInputCommand = async ( input: DeleteInputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/inputs/{inputName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/inputs/{inputName}"; if (input.inputName !== undefined) { const labelValue: string = input.inputName; if (labelValue.length <= 0) { @@ -329,7 +332,6 @@ export const serializeAws_restJson1DeleteInputCommand = async ( throw new Error("No value provided for input HTTP label: inputName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -345,8 +347,10 @@ export const serializeAws_restJson1DescribeAlarmModelCommand = async ( input: DescribeAlarmModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/alarm-models/{alarmModelName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarm-models/{alarmModelName}"; if (input.alarmModelName !== undefined) { const labelValue: string = input.alarmModelName; if (labelValue.length <= 0) { @@ -360,7 +364,6 @@ export const serializeAws_restJson1DescribeAlarmModelCommand = async ( ...(input.alarmModelVersion !== undefined && { version: input.alarmModelVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -377,8 +380,10 @@ export const serializeAws_restJson1DescribeDetectorModelCommand = async ( input: DescribeDetectorModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector-models/{detectorModelName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector-models/{detectorModelName}"; if (input.detectorModelName !== undefined) { const labelValue: string = input.detectorModelName; if (labelValue.length <= 0) { @@ -392,7 +397,6 @@ export const serializeAws_restJson1DescribeDetectorModelCommand = async ( ...(input.detectorModelVersion !== undefined && { version: input.detectorModelVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -409,8 +413,10 @@ export const serializeAws_restJson1DescribeDetectorModelAnalysisCommand = async input: DescribeDetectorModelAnalysisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/analysis/detector-models/{analysisId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analysis/detector-models/{analysisId}"; if (input.analysisId !== undefined) { const labelValue: string = input.analysisId; if (labelValue.length <= 0) { @@ -421,7 +427,6 @@ export const serializeAws_restJson1DescribeDetectorModelAnalysisCommand = async throw new Error("No value provided for input HTTP label: analysisId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -437,8 +442,9 @@ export const serializeAws_restJson1DescribeInputCommand = async ( input: DescribeInputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/inputs/{inputName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/inputs/{inputName}"; if (input.inputName !== undefined) { const labelValue: string = input.inputName; if (labelValue.length <= 0) { @@ -449,7 +455,6 @@ export const serializeAws_restJson1DescribeInputCommand = async ( throw new Error("No value provided for input HTTP label: inputName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -465,13 +470,13 @@ export const serializeAws_restJson1DescribeLoggingOptionsCommand = async ( input: DescribeLoggingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/logging"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/logging"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -487,8 +492,11 @@ export const serializeAws_restJson1GetDetectorModelAnalysisResultsCommand = asyn input: GetDetectorModelAnalysisResultsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/analysis/detector-models/{analysisId}/results"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/analysis/detector-models/{analysisId}/results"; if (input.analysisId !== undefined) { const labelValue: string = input.analysisId; if (labelValue.length <= 0) { @@ -503,7 +511,6 @@ export const serializeAws_restJson1GetDetectorModelAnalysisResultsCommand = asyn ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -520,14 +527,14 @@ export const serializeAws_restJson1ListAlarmModelsCommand = async ( input: ListAlarmModelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/alarm-models"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarm-models"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -544,8 +551,10 @@ export const serializeAws_restJson1ListAlarmModelVersionsCommand = async ( input: ListAlarmModelVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/alarm-models/{alarmModelName}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarm-models/{alarmModelName}/versions"; if (input.alarmModelName !== undefined) { const labelValue: string = input.alarmModelName; if (labelValue.length <= 0) { @@ -560,7 +569,6 @@ export const serializeAws_restJson1ListAlarmModelVersionsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -577,14 +585,14 @@ export const serializeAws_restJson1ListDetectorModelsCommand = async ( input: ListDetectorModelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector-models"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector-models"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -601,8 +609,11 @@ export const serializeAws_restJson1ListDetectorModelVersionsCommand = async ( input: ListDetectorModelVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detector-models/{detectorModelName}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detector-models/{detectorModelName}/versions"; if (input.detectorModelName !== undefined) { const labelValue: string = input.detectorModelName; if (labelValue.length <= 0) { @@ -617,7 +628,6 @@ export const serializeAws_restJson1ListDetectorModelVersionsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -634,10 +644,11 @@ export const serializeAws_restJson1ListInputRoutingsCommand = async ( input: ListInputRoutingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/input-routings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/input-routings"; let body: any; body = JSON.stringify({ ...(input.inputIdentifier !== undefined && @@ -647,7 +658,6 @@ export const serializeAws_restJson1ListInputRoutingsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -663,14 +673,14 @@ export const serializeAws_restJson1ListInputsCommand = async ( input: ListInputsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/inputs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/inputs"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -687,13 +697,13 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -710,10 +720,11 @@ export const serializeAws_restJson1PutLoggingOptionsCommand = async ( input: PutLoggingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/logging"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/logging"; let body: any; body = JSON.stringify({ ...(input.loggingOptions !== undefined && @@ -721,7 +732,6 @@ export const serializeAws_restJson1PutLoggingOptionsCommand = async ( loggingOptions: serializeAws_restJson1LoggingOptions(input.loggingOptions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -737,10 +747,12 @@ export const serializeAws_restJson1StartDetectorModelAnalysisCommand = async ( input: StartDetectorModelAnalysisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/analysis/detector-models"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analysis/detector-models"; let body: any; body = JSON.stringify({ ...(input.detectorModelDefinition !== undefined && @@ -748,7 +760,6 @@ export const serializeAws_restJson1StartDetectorModelAnalysisCommand = async ( detectorModelDefinition: serializeAws_restJson1DetectorModelDefinition(input.detectorModelDefinition, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -764,10 +775,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; @@ -775,7 +787,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -792,14 +803,14 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -816,10 +827,12 @@ export const serializeAws_restJson1UpdateAlarmModelCommand = async ( input: UpdateAlarmModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/alarm-models/{alarmModelName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/alarm-models/{alarmModelName}"; if (input.alarmModelName !== undefined) { const labelValue: string = input.alarmModelName; if (labelValue.length <= 0) { @@ -850,7 +863,6 @@ export const serializeAws_restJson1UpdateAlarmModelCommand = async ( ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), ...(input.severity !== undefined && input.severity !== null && { severity: input.severity }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -866,10 +878,12 @@ export const serializeAws_restJson1UpdateDetectorModelCommand = async ( input: UpdateDetectorModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detector-models/{detectorModelName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detector-models/{detectorModelName}"; if (input.detectorModelName !== undefined) { const labelValue: string = input.detectorModelName; if (labelValue.length <= 0) { @@ -891,7 +905,6 @@ export const serializeAws_restJson1UpdateDetectorModelCommand = async ( input.evaluationMethod !== null && { evaluationMethod: input.evaluationMethod }), ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -907,10 +920,11 @@ export const serializeAws_restJson1UpdateInputCommand = async ( input: UpdateInputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/inputs/{inputName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/inputs/{inputName}"; if (input.inputName !== undefined) { const labelValue: string = input.inputName; if (labelValue.length <= 0) { @@ -929,7 +943,6 @@ export const serializeAws_restJson1UpdateInputCommand = async ( ...(input.inputDescription !== undefined && input.inputDescription !== null && { inputDescription: input.inputDescription }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iot-jobs-data-plane/protocols/Aws_restJson1.ts b/clients/client-iot-jobs-data-plane/protocols/Aws_restJson1.ts index cbe28daeca028..ec3b11590e89c 100644 --- a/clients/client-iot-jobs-data-plane/protocols/Aws_restJson1.ts +++ b/clients/client-iot-jobs-data-plane/protocols/Aws_restJson1.ts @@ -41,8 +41,10 @@ export const serializeAws_restJson1DescribeJobExecutionCommand = async ( input: DescribeJobExecutionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}/jobs/{jobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -66,7 +68,6 @@ export const serializeAws_restJson1DescribeJobExecutionCommand = async ( ...(input.executionNumber !== undefined && { executionNumber: input.executionNumber.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -83,8 +84,9 @@ export const serializeAws_restJson1GetPendingJobExecutionsCommand = async ( input: GetPendingJobExecutionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -95,7 +97,6 @@ export const serializeAws_restJson1GetPendingJobExecutionsCommand = async ( throw new Error("No value provided for input HTTP label: thingName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -111,10 +112,12 @@ export const serializeAws_restJson1StartNextPendingJobExecutionCommand = async ( input: StartNextPendingJobExecutionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/things/{thingName}/jobs/$next"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/$next"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -133,7 +136,6 @@ export const serializeAws_restJson1StartNextPendingJobExecutionCommand = async ( ...(input.stepTimeoutInMinutes !== undefined && input.stepTimeoutInMinutes !== null && { stepTimeoutInMinutes: input.stepTimeoutInMinutes }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -149,10 +151,12 @@ export const serializeAws_restJson1UpdateJobExecutionCommand = async ( input: UpdateJobExecutionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/things/{thingName}/jobs/{jobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -189,7 +193,6 @@ export const serializeAws_restJson1UpdateJobExecutionCommand = async ( ...(input.stepTimeoutInMinutes !== undefined && input.stepTimeoutInMinutes !== null && { stepTimeoutInMinutes: input.stepTimeoutInMinutes }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iot-wireless/protocols/Aws_restJson1.ts b/clients/client-iot-wireless/protocols/Aws_restJson1.ts index af6b2dfddcf82..6ebde54170d1f 100644 --- a/clients/client-iot-wireless/protocols/Aws_restJson1.ts +++ b/clients/client-iot-wireless/protocols/Aws_restJson1.ts @@ -252,10 +252,11 @@ export const serializeAws_restJson1AssociateAwsAccountWithPartnerAccountCommand input: AssociateAwsAccountWithPartnerAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/partner-accounts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/partner-accounts"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -264,7 +265,6 @@ export const serializeAws_restJson1AssociateAwsAccountWithPartnerAccountCommand ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -280,10 +280,12 @@ export const serializeAws_restJson1AssociateWirelessDeviceWithThingCommand = asy input: AssociateWirelessDeviceWithThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/wireless-devices/{Id}/thing"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-devices/{Id}/thing"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -297,7 +299,6 @@ export const serializeAws_restJson1AssociateWirelessDeviceWithThingCommand = asy body = JSON.stringify({ ...(input.ThingArn !== undefined && input.ThingArn !== null && { ThingArn: input.ThingArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -313,10 +314,12 @@ export const serializeAws_restJson1AssociateWirelessGatewayWithCertificateComman input: AssociateWirelessGatewayWithCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/wireless-gateways/{Id}/certificate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Id}/certificate"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -331,7 +334,6 @@ export const serializeAws_restJson1AssociateWirelessGatewayWithCertificateComman ...(input.IotCertificateId !== undefined && input.IotCertificateId !== null && { IotCertificateId: input.IotCertificateId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -347,10 +349,12 @@ export const serializeAws_restJson1AssociateWirelessGatewayWithThingCommand = as input: AssociateWirelessGatewayWithThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/wireless-gateways/{Id}/thing"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Id}/thing"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -364,7 +368,6 @@ export const serializeAws_restJson1AssociateWirelessGatewayWithThingCommand = as body = JSON.stringify({ ...(input.ThingArn !== undefined && input.ThingArn !== null && { ThingArn: input.ThingArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -380,10 +383,11 @@ export const serializeAws_restJson1CreateDestinationCommand = async ( input: CreateDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/destinations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/destinations"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -396,7 +400,6 @@ export const serializeAws_restJson1CreateDestinationCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -412,10 +415,11 @@ export const serializeAws_restJson1CreateDeviceProfileCommand = async ( input: CreateDeviceProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/device-profiles"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/device-profiles"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -425,7 +429,6 @@ export const serializeAws_restJson1CreateDeviceProfileCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -441,10 +444,11 @@ export const serializeAws_restJson1CreateServiceProfileCommand = async ( input: CreateServiceProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/service-profiles"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/service-profiles"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -454,7 +458,6 @@ export const serializeAws_restJson1CreateServiceProfileCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -470,10 +473,11 @@ export const serializeAws_restJson1CreateWirelessDeviceCommand = async ( input: CreateWirelessDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/wireless-devices"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-devices"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -487,7 +491,6 @@ export const serializeAws_restJson1CreateWirelessDeviceCommand = async ( input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -503,10 +506,11 @@ export const serializeAws_restJson1CreateWirelessGatewayCommand = async ( input: CreateWirelessGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/wireless-gateways"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -517,7 +521,6 @@ export const serializeAws_restJson1CreateWirelessGatewayCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -533,10 +536,12 @@ export const serializeAws_restJson1CreateWirelessGatewayTaskCommand = async ( input: CreateWirelessGatewayTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/wireless-gateways/{Id}/tasks"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Id}/tasks"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -553,7 +558,6 @@ export const serializeAws_restJson1CreateWirelessGatewayTaskCommand = async ( WirelessGatewayTaskDefinitionId: input.WirelessGatewayTaskDefinitionId, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -569,10 +573,12 @@ export const serializeAws_restJson1CreateWirelessGatewayTaskDefinitionCommand = input: CreateWirelessGatewayTaskDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/wireless-gateway-task-definitions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateway-task-definitions"; let body: any; body = JSON.stringify({ ...(input.AutoCreateTasks !== undefined && @@ -586,7 +592,6 @@ export const serializeAws_restJson1CreateWirelessGatewayTaskDefinitionCommand = Update: serializeAws_restJson1UpdateWirelessGatewayTaskCreate(input.Update, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -602,8 +607,9 @@ export const serializeAws_restJson1DeleteDestinationCommand = async ( input: DeleteDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/destinations/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/destinations/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -614,7 +620,6 @@ export const serializeAws_restJson1DeleteDestinationCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -630,8 +635,9 @@ export const serializeAws_restJson1DeleteDeviceProfileCommand = async ( input: DeleteDeviceProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/device-profiles/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/device-profiles/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -642,7 +648,6 @@ export const serializeAws_restJson1DeleteDeviceProfileCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -658,8 +663,9 @@ export const serializeAws_restJson1DeleteServiceProfileCommand = async ( input: DeleteServiceProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/service-profiles/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/service-profiles/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -670,7 +676,6 @@ export const serializeAws_restJson1DeleteServiceProfileCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -686,8 +691,9 @@ export const serializeAws_restJson1DeleteWirelessDeviceCommand = async ( input: DeleteWirelessDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-devices/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-devices/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -698,7 +704,6 @@ export const serializeAws_restJson1DeleteWirelessDeviceCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -714,8 +719,9 @@ export const serializeAws_restJson1DeleteWirelessGatewayCommand = async ( input: DeleteWirelessGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateways/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -726,7 +732,6 @@ export const serializeAws_restJson1DeleteWirelessGatewayCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -742,8 +747,10 @@ export const serializeAws_restJson1DeleteWirelessGatewayTaskCommand = async ( input: DeleteWirelessGatewayTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateways/{Id}/tasks"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Id}/tasks"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -754,7 +761,6 @@ export const serializeAws_restJson1DeleteWirelessGatewayTaskCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -770,8 +776,10 @@ export const serializeAws_restJson1DeleteWirelessGatewayTaskDefinitionCommand = input: DeleteWirelessGatewayTaskDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateway-task-definitions/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateway-task-definitions/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -782,7 +790,6 @@ export const serializeAws_restJson1DeleteWirelessGatewayTaskDefinitionCommand = throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -798,8 +805,10 @@ export const serializeAws_restJson1DisassociateAwsAccountFromPartnerAccountComma input: DisassociateAwsAccountFromPartnerAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/partner-accounts/{PartnerAccountId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/partner-accounts/{PartnerAccountId}"; if (input.PartnerAccountId !== undefined) { const labelValue: string = input.PartnerAccountId; if (labelValue.length <= 0) { @@ -813,7 +822,6 @@ export const serializeAws_restJson1DisassociateAwsAccountFromPartnerAccountComma ...(input.PartnerType !== undefined && { partnerType: input.PartnerType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -830,8 +838,10 @@ export const serializeAws_restJson1DisassociateWirelessDeviceFromThingCommand = input: DisassociateWirelessDeviceFromThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-devices/{Id}/thing"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-devices/{Id}/thing"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -842,7 +852,6 @@ export const serializeAws_restJson1DisassociateWirelessDeviceFromThingCommand = throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -858,8 +867,10 @@ export const serializeAws_restJson1DisassociateWirelessGatewayFromCertificateCom input: DisassociateWirelessGatewayFromCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateways/{Id}/certificate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Id}/certificate"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -870,7 +881,6 @@ export const serializeAws_restJson1DisassociateWirelessGatewayFromCertificateCom throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -886,8 +896,10 @@ export const serializeAws_restJson1DisassociateWirelessGatewayFromThingCommand = input: DisassociateWirelessGatewayFromThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateways/{Id}/thing"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Id}/thing"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -898,7 +910,6 @@ export const serializeAws_restJson1DisassociateWirelessGatewayFromThingCommand = throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -914,8 +925,9 @@ export const serializeAws_restJson1GetDestinationCommand = async ( input: GetDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/destinations/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/destinations/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -926,7 +938,6 @@ export const serializeAws_restJson1GetDestinationCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -942,8 +953,9 @@ export const serializeAws_restJson1GetDeviceProfileCommand = async ( input: GetDeviceProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/device-profiles/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/device-profiles/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -954,7 +966,6 @@ export const serializeAws_restJson1GetDeviceProfileCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -970,13 +981,13 @@ export const serializeAws_restJson1GetLogLevelsByResourceTypesCommand = async ( input: GetLogLevelsByResourceTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/log-levels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/log-levels"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -992,8 +1003,10 @@ export const serializeAws_restJson1GetPartnerAccountCommand = async ( input: GetPartnerAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/partner-accounts/{PartnerAccountId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/partner-accounts/{PartnerAccountId}"; if (input.PartnerAccountId !== undefined) { const labelValue: string = input.PartnerAccountId; if (labelValue.length <= 0) { @@ -1007,7 +1020,6 @@ export const serializeAws_restJson1GetPartnerAccountCommand = async ( ...(input.PartnerType !== undefined && { partnerType: input.PartnerType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1024,8 +1036,10 @@ export const serializeAws_restJson1GetResourceLogLevelCommand = async ( input: GetResourceLogLevelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/log-levels/{ResourceIdentifier}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/log-levels/{ResourceIdentifier}"; if (input.ResourceIdentifier !== undefined) { const labelValue: string = input.ResourceIdentifier; if (labelValue.length <= 0) { @@ -1039,7 +1053,6 @@ export const serializeAws_restJson1GetResourceLogLevelCommand = async ( ...(input.ResourceType !== undefined && { resourceType: input.ResourceType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1056,13 +1069,13 @@ export const serializeAws_restJson1GetServiceEndpointCommand = async ( input: GetServiceEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/service-endpoint"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/service-endpoint"; const query: any = { ...(input.ServiceType !== undefined && { serviceType: input.ServiceType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1079,8 +1092,9 @@ export const serializeAws_restJson1GetServiceProfileCommand = async ( input: GetServiceProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/service-profiles/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/service-profiles/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1091,7 +1105,6 @@ export const serializeAws_restJson1GetServiceProfileCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1107,8 +1120,10 @@ export const serializeAws_restJson1GetWirelessDeviceCommand = async ( input: GetWirelessDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-devices/{Identifier}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-devices/{Identifier}"; if (input.Identifier !== undefined) { const labelValue: string = input.Identifier; if (labelValue.length <= 0) { @@ -1122,7 +1137,6 @@ export const serializeAws_restJson1GetWirelessDeviceCommand = async ( ...(input.IdentifierType !== undefined && { identifierType: input.IdentifierType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1139,8 +1153,11 @@ export const serializeAws_restJson1GetWirelessDeviceStatisticsCommand = async ( input: GetWirelessDeviceStatisticsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-devices/{WirelessDeviceId}/statistics"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/wireless-devices/{WirelessDeviceId}/statistics"; if (input.WirelessDeviceId !== undefined) { const labelValue: string = input.WirelessDeviceId; if (labelValue.length <= 0) { @@ -1151,7 +1168,6 @@ export const serializeAws_restJson1GetWirelessDeviceStatisticsCommand = async ( throw new Error("No value provided for input HTTP label: WirelessDeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1167,8 +1183,10 @@ export const serializeAws_restJson1GetWirelessGatewayCommand = async ( input: GetWirelessGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateways/{Identifier}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Identifier}"; if (input.Identifier !== undefined) { const labelValue: string = input.Identifier; if (labelValue.length <= 0) { @@ -1182,7 +1200,6 @@ export const serializeAws_restJson1GetWirelessGatewayCommand = async ( ...(input.IdentifierType !== undefined && { identifierType: input.IdentifierType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1199,8 +1216,10 @@ export const serializeAws_restJson1GetWirelessGatewayCertificateCommand = async input: GetWirelessGatewayCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateways/{Id}/certificate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Id}/certificate"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1211,7 +1230,6 @@ export const serializeAws_restJson1GetWirelessGatewayCertificateCommand = async throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1227,8 +1245,11 @@ export const serializeAws_restJson1GetWirelessGatewayFirmwareInformationCommand input: GetWirelessGatewayFirmwareInformationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateways/{Id}/firmware-information"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/wireless-gateways/{Id}/firmware-information"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1239,7 +1260,6 @@ export const serializeAws_restJson1GetWirelessGatewayFirmwareInformationCommand throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1255,8 +1275,11 @@ export const serializeAws_restJson1GetWirelessGatewayStatisticsCommand = async ( input: GetWirelessGatewayStatisticsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateways/{WirelessGatewayId}/statistics"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/wireless-gateways/{WirelessGatewayId}/statistics"; if (input.WirelessGatewayId !== undefined) { const labelValue: string = input.WirelessGatewayId; if (labelValue.length <= 0) { @@ -1267,7 +1290,6 @@ export const serializeAws_restJson1GetWirelessGatewayStatisticsCommand = async ( throw new Error("No value provided for input HTTP label: WirelessGatewayId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1283,8 +1305,10 @@ export const serializeAws_restJson1GetWirelessGatewayTaskCommand = async ( input: GetWirelessGatewayTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateways/{Id}/tasks"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Id}/tasks"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1295,7 +1319,6 @@ export const serializeAws_restJson1GetWirelessGatewayTaskCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1311,8 +1334,10 @@ export const serializeAws_restJson1GetWirelessGatewayTaskDefinitionCommand = asy input: GetWirelessGatewayTaskDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateway-task-definitions/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateway-task-definitions/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1323,7 +1348,6 @@ export const serializeAws_restJson1GetWirelessGatewayTaskDefinitionCommand = asy throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1339,14 +1363,14 @@ export const serializeAws_restJson1ListDestinationsCommand = async ( input: ListDestinationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/destinations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/destinations"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1363,14 +1387,14 @@ export const serializeAws_restJson1ListDeviceProfilesCommand = async ( input: ListDeviceProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/device-profiles"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/device-profiles"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1387,14 +1411,14 @@ export const serializeAws_restJson1ListPartnerAccountsCommand = async ( input: ListPartnerAccountsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/partner-accounts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/partner-accounts"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1411,14 +1435,14 @@ export const serializeAws_restJson1ListServiceProfilesCommand = async ( input: ListServiceProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/service-profiles"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/service-profiles"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1435,13 +1459,13 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.ResourceArn !== undefined && { resourceArn: input.ResourceArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1458,8 +1482,9 @@ export const serializeAws_restJson1ListWirelessDevicesCommand = async ( input: ListWirelessDevicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-devices"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-devices"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), @@ -1469,7 +1494,6 @@ export const serializeAws_restJson1ListWirelessDevicesCommand = async ( ...(input.WirelessDeviceType !== undefined && { wirelessDeviceType: input.WirelessDeviceType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1486,14 +1510,14 @@ export const serializeAws_restJson1ListWirelessGatewaysCommand = async ( input: ListWirelessGatewaysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateways"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1510,15 +1534,16 @@ export const serializeAws_restJson1ListWirelessGatewayTaskDefinitionsCommand = a input: ListWirelessGatewayTaskDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-gateway-task-definitions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateway-task-definitions"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.TaskDefinitionType !== undefined && { taskDefinitionType: input.TaskDefinitionType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1535,10 +1560,12 @@ export const serializeAws_restJson1PutResourceLogLevelCommand = async ( input: PutResourceLogLevelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/log-levels/{ResourceIdentifier}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/log-levels/{ResourceIdentifier}"; if (input.ResourceIdentifier !== undefined) { const labelValue: string = input.ResourceIdentifier; if (labelValue.length <= 0) { @@ -1555,7 +1582,6 @@ export const serializeAws_restJson1PutResourceLogLevelCommand = async ( body = JSON.stringify({ ...(input.LogLevel !== undefined && input.LogLevel !== null && { LogLevel: input.LogLevel }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1572,13 +1598,13 @@ export const serializeAws_restJson1ResetAllResourceLogLevelsCommand = async ( input: ResetAllResourceLogLevelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/log-levels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/log-levels"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1594,8 +1620,10 @@ export const serializeAws_restJson1ResetResourceLogLevelCommand = async ( input: ResetResourceLogLevelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/log-levels/{ResourceIdentifier}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/log-levels/{ResourceIdentifier}"; if (input.ResourceIdentifier !== undefined) { const labelValue: string = input.ResourceIdentifier; if (labelValue.length <= 0) { @@ -1609,7 +1637,6 @@ export const serializeAws_restJson1ResetResourceLogLevelCommand = async ( ...(input.ResourceType !== undefined && { resourceType: input.ResourceType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1626,10 +1653,12 @@ export const serializeAws_restJson1SendDataToWirelessDeviceCommand = async ( input: SendDataToWirelessDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/wireless-devices/{Id}/data"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-devices/{Id}/data"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1648,7 +1677,6 @@ export const serializeAws_restJson1SendDataToWirelessDeviceCommand = async ( WirelessMetadata: serializeAws_restJson1WirelessMetadata(input.WirelessMetadata, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1664,10 +1692,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.ResourceArn !== undefined && { resourceArn: input.ResourceArn }), }; @@ -1676,7 +1705,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1693,8 +1721,10 @@ export const serializeAws_restJson1TestWirelessDeviceCommand = async ( input: TestWirelessDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/wireless-devices/{Id}/test"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-devices/{Id}/test"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1705,7 +1735,6 @@ export const serializeAws_restJson1TestWirelessDeviceCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1721,14 +1750,14 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.ResourceArn !== undefined && { resourceArn: input.ResourceArn }), ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1745,10 +1774,11 @@ export const serializeAws_restJson1UpdateDestinationCommand = async ( input: UpdateDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/destinations/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/destinations/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1766,7 +1796,6 @@ export const serializeAws_restJson1UpdateDestinationCommand = async ( input.ExpressionType !== null && { ExpressionType: input.ExpressionType }), ...(input.RoleArn !== undefined && input.RoleArn !== null && { RoleArn: input.RoleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1782,10 +1811,11 @@ export const serializeAws_restJson1UpdateLogLevelsByResourceTypesCommand = async input: UpdateLogLevelsByResourceTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/log-levels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/log-levels"; let body: any; body = JSON.stringify({ ...(input.DefaultLogLevel !== undefined && @@ -1805,7 +1835,6 @@ export const serializeAws_restJson1UpdateLogLevelsByResourceTypesCommand = async ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1821,10 +1850,12 @@ export const serializeAws_restJson1UpdatePartnerAccountCommand = async ( input: UpdatePartnerAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/partner-accounts/{PartnerAccountId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/partner-accounts/{PartnerAccountId}"; if (input.PartnerAccountId !== undefined) { const labelValue: string = input.PartnerAccountId; if (labelValue.length <= 0) { @@ -1842,7 +1873,6 @@ export const serializeAws_restJson1UpdatePartnerAccountCommand = async ( ...(input.Sidewalk !== undefined && input.Sidewalk !== null && { Sidewalk: serializeAws_restJson1SidewalkUpdateAccount(input.Sidewalk, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1859,10 +1889,11 @@ export const serializeAws_restJson1UpdateWirelessDeviceCommand = async ( input: UpdateWirelessDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/wireless-devices/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-devices/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1881,7 +1912,6 @@ export const serializeAws_restJson1UpdateWirelessDeviceCommand = async ( input.LoRaWAN !== null && { LoRaWAN: serializeAws_restJson1LoRaWANUpdateDevice(input.LoRaWAN, context) }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1897,10 +1927,11 @@ export const serializeAws_restJson1UpdateWirelessGatewayCommand = async ( input: UpdateWirelessGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/wireless-gateways/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/wireless-gateways/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1921,7 +1952,6 @@ export const serializeAws_restJson1UpdateWirelessGatewayCommand = async ( ...(input.NetIdFilters !== undefined && input.NetIdFilters !== null && { NetIdFilters: serializeAws_restJson1NetIdFilters(input.NetIdFilters, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iot/protocols/Aws_restJson1.ts b/clients/client-iot/protocols/Aws_restJson1.ts index d176f63926c4e..e7277d0d14d09 100644 --- a/clients/client-iot/protocols/Aws_restJson1.ts +++ b/clients/client-iot/protocols/Aws_restJson1.ts @@ -864,8 +864,11 @@ export const serializeAws_restJson1AcceptCertificateTransferCommand = async ( input: AcceptCertificateTransferCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accept-certificate-transfer/{certificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accept-certificate-transfer/{certificateId}"; if (input.certificateId !== undefined) { const labelValue: string = input.certificateId; if (labelValue.length <= 0) { @@ -879,7 +882,6 @@ export const serializeAws_restJson1AcceptCertificateTransferCommand = async ( ...(input.setAsActive !== undefined && { setAsActive: input.setAsActive.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -896,10 +898,12 @@ export const serializeAws_restJson1AddThingToBillingGroupCommand = async ( input: AddThingToBillingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/billing-groups/addThingToBillingGroup"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/billing-groups/addThingToBillingGroup"; let body: any; body = JSON.stringify({ ...(input.billingGroupArn !== undefined && @@ -909,7 +913,6 @@ export const serializeAws_restJson1AddThingToBillingGroupCommand = async ( ...(input.thingArn !== undefined && input.thingArn !== null && { thingArn: input.thingArn }), ...(input.thingName !== undefined && input.thingName !== null && { thingName: input.thingName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -925,10 +928,12 @@ export const serializeAws_restJson1AddThingToThingGroupCommand = async ( input: AddThingToThingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/thing-groups/addThingToThingGroup"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-groups/addThingToThingGroup"; let body: any; body = JSON.stringify({ ...(input.overrideDynamicGroups !== undefined && @@ -939,7 +944,6 @@ export const serializeAws_restJson1AddThingToThingGroupCommand = async ( input.thingGroupName !== null && { thingGroupName: input.thingGroupName }), ...(input.thingName !== undefined && input.thingName !== null && { thingName: input.thingName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -955,10 +959,11 @@ export const serializeAws_restJson1AssociateTargetsWithJobCommand = async ( input: AssociateTargetsWithJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/jobs/{jobId}/targets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}/targets"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -977,7 +982,6 @@ export const serializeAws_restJson1AssociateTargetsWithJobCommand = async ( ...(input.targets !== undefined && input.targets !== null && { targets: serializeAws_restJson1JobTargets(input.targets, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -994,10 +998,12 @@ export const serializeAws_restJson1AttachPolicyCommand = async ( input: AttachPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/target-policies/{policyName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/target-policies/{policyName}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -1011,7 +1017,6 @@ export const serializeAws_restJson1AttachPolicyCommand = async ( body = JSON.stringify({ ...(input.target !== undefined && input.target !== null && { target: input.target }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1027,10 +1032,12 @@ export const serializeAws_restJson1AttachPrincipalPolicyCommand = async ( input: AttachPrincipalPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.principal) && { "x-amzn-iot-principal": input.principal! }), }; - let resolvedPath = "/principal-policies/{policyName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/principal-policies/{policyName}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -1041,7 +1048,6 @@ export const serializeAws_restJson1AttachPrincipalPolicyCommand = async ( throw new Error("No value provided for input HTTP label: policyName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1057,8 +1063,11 @@ export const serializeAws_restJson1AttachSecurityProfileCommand = async ( input: AttachSecurityProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/security-profiles/{securityProfileName}/targets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/security-profiles/{securityProfileName}/targets"; if (input.securityProfileName !== undefined) { const labelValue: string = input.securityProfileName; if (labelValue.length <= 0) { @@ -1072,7 +1081,6 @@ export const serializeAws_restJson1AttachSecurityProfileCommand = async ( ...(input.securityProfileTargetArn !== undefined && { securityProfileTargetArn: input.securityProfileTargetArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1089,10 +1097,12 @@ export const serializeAws_restJson1AttachThingPrincipalCommand = async ( input: AttachThingPrincipalCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.principal) && { "x-amzn-principal": input.principal! }), }; - let resolvedPath = "/things/{thingName}/principals"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/principals"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -1103,7 +1113,6 @@ export const serializeAws_restJson1AttachThingPrincipalCommand = async ( throw new Error("No value provided for input HTTP label: thingName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1119,8 +1128,11 @@ export const serializeAws_restJson1CancelAuditMitigationActionsTaskCommand = asy input: CancelAuditMitigationActionsTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/mitigationactions/tasks/{taskId}/cancel"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/audit/mitigationactions/tasks/{taskId}/cancel"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -1131,7 +1143,6 @@ export const serializeAws_restJson1CancelAuditMitigationActionsTaskCommand = asy throw new Error("No value provided for input HTTP label: taskId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1147,8 +1158,10 @@ export const serializeAws_restJson1CancelAuditTaskCommand = async ( input: CancelAuditTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/tasks/{taskId}/cancel"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/tasks/{taskId}/cancel"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -1159,7 +1172,6 @@ export const serializeAws_restJson1CancelAuditTaskCommand = async ( throw new Error("No value provided for input HTTP label: taskId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1175,8 +1187,11 @@ export const serializeAws_restJson1CancelCertificateTransferCommand = async ( input: CancelCertificateTransferCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/cancel-certificate-transfer/{certificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/cancel-certificate-transfer/{certificateId}"; if (input.certificateId !== undefined) { const labelValue: string = input.certificateId; if (labelValue.length <= 0) { @@ -1187,7 +1202,6 @@ export const serializeAws_restJson1CancelCertificateTransferCommand = async ( throw new Error("No value provided for input HTTP label: certificateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1203,8 +1217,11 @@ export const serializeAws_restJson1CancelDetectMitigationActionsTaskCommand = as input: CancelDetectMitigationActionsTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detect/mitigationactions/tasks/{taskId}/cancel"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/detect/mitigationactions/tasks/{taskId}/cancel"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -1215,7 +1232,6 @@ export const serializeAws_restJson1CancelDetectMitigationActionsTaskCommand = as throw new Error("No value provided for input HTTP label: taskId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1231,10 +1247,11 @@ export const serializeAws_restJson1CancelJobCommand = async ( input: CancelJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/jobs/{jobId}/cancel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}/cancel"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -1252,7 +1269,6 @@ export const serializeAws_restJson1CancelJobCommand = async ( ...(input.comment !== undefined && input.comment !== null && { comment: input.comment }), ...(input.reasonCode !== undefined && input.reasonCode !== null && { reasonCode: input.reasonCode }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1269,10 +1285,12 @@ export const serializeAws_restJson1CancelJobExecutionCommand = async ( input: CancelJobExecutionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/things/{thingName}/jobs/{jobId}/cancel"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/{jobId}/cancel"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -1303,7 +1321,6 @@ export const serializeAws_restJson1CancelJobExecutionCommand = async ( statusDetails: serializeAws_restJson1DetailsMap(input.statusDetails, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1320,13 +1337,13 @@ export const serializeAws_restJson1ClearDefaultAuthorizerCommand = async ( input: ClearDefaultAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/default-authorizer"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/default-authorizer"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1342,8 +1359,10 @@ export const serializeAws_restJson1ConfirmTopicRuleDestinationCommand = async ( input: ConfirmTopicRuleDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/confirmdestination/{confirmationToken+}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/confirmdestination/{confirmationToken+}"; if (input.confirmationToken !== undefined) { const labelValue: string = input.confirmationToken; if (labelValue.length <= 0) { @@ -1360,7 +1379,6 @@ export const serializeAws_restJson1ConfirmTopicRuleDestinationCommand = async ( throw new Error("No value provided for input HTTP label: confirmationToken."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1376,10 +1394,12 @@ export const serializeAws_restJson1CreateAuditSuppressionCommand = async ( input: CreateAuditSuppressionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/suppressions/create"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/suppressions/create"; let body: any; body = JSON.stringify({ ...(input.checkName !== undefined && input.checkName !== null && { checkName: input.checkName }), @@ -1394,7 +1414,6 @@ export const serializeAws_restJson1CreateAuditSuppressionCommand = async ( ...(input.suppressIndefinitely !== undefined && input.suppressIndefinitely !== null && { suppressIndefinitely: input.suppressIndefinitely }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1410,10 +1429,12 @@ export const serializeAws_restJson1CreateAuthorizerCommand = async ( input: CreateAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/authorizer/{authorizerName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/authorizer/{authorizerName}"; if (input.authorizerName !== undefined) { const labelValue: string = input.authorizerName; if (labelValue.length <= 0) { @@ -1438,7 +1459,6 @@ export const serializeAws_restJson1CreateAuthorizerCommand = async ( tokenSigningPublicKeys: serializeAws_restJson1PublicKeyMap(input.tokenSigningPublicKeys, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1454,10 +1474,12 @@ export const serializeAws_restJson1CreateBillingGroupCommand = async ( input: CreateBillingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/billing-groups/{billingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/billing-groups/{billingGroupName}"; if (input.billingGroupName !== undefined) { const labelValue: string = input.billingGroupName; if (labelValue.length <= 0) { @@ -1476,7 +1498,6 @@ export const serializeAws_restJson1CreateBillingGroupCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1492,10 +1513,11 @@ export const serializeAws_restJson1CreateCertificateFromCsrCommand = async ( input: CreateCertificateFromCsrCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/certificates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/certificates"; const query: any = { ...(input.setAsActive !== undefined && { setAsActive: input.setAsActive.toString() }), }; @@ -1504,7 +1526,6 @@ export const serializeAws_restJson1CreateCertificateFromCsrCommand = async ( ...(input.certificateSigningRequest !== undefined && input.certificateSigningRequest !== null && { certificateSigningRequest: input.certificateSigningRequest }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1521,10 +1542,12 @@ export const serializeAws_restJson1CreateCustomMetricCommand = async ( input: CreateCustomMetricCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/custom-metric/{metricName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-metric/{metricName}"; if (input.metricName !== undefined) { const labelValue: string = input.metricName; if (labelValue.length <= 0) { @@ -1542,7 +1565,6 @@ export const serializeAws_restJson1CreateCustomMetricCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1558,10 +1580,11 @@ export const serializeAws_restJson1CreateDimensionCommand = async ( input: CreateDimensionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/dimensions/{name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dimensions/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1582,7 +1605,6 @@ export const serializeAws_restJson1CreateDimensionCommand = async ( input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1598,10 +1620,13 @@ export const serializeAws_restJson1CreateDomainConfigurationCommand = async ( input: CreateDomainConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domainConfigurations/{domainConfigurationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domainConfigurations/{domainConfigurationName}"; if (input.domainConfigurationName !== undefined) { const labelValue: string = input.domainConfigurationName; if (labelValue.length <= 0) { @@ -1628,7 +1653,6 @@ export const serializeAws_restJson1CreateDomainConfigurationCommand = async ( ...(input.validationCertificateArn !== undefined && input.validationCertificateArn !== null && { validationCertificateArn: input.validationCertificateArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1644,10 +1668,12 @@ export const serializeAws_restJson1CreateDynamicThingGroupCommand = async ( input: CreateDynamicThingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/dynamic-thing-groups/{thingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dynamic-thing-groups/{thingGroupName}"; if (input.thingGroupName !== undefined) { const labelValue: string = input.thingGroupName; if (labelValue.length <= 0) { @@ -1669,7 +1695,6 @@ export const serializeAws_restJson1CreateDynamicThingGroupCommand = async ( thingGroupProperties: serializeAws_restJson1ThingGroupProperties(input.thingGroupProperties, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1685,10 +1710,11 @@ export const serializeAws_restJson1CreateJobCommand = async ( input: CreateJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/jobs/{jobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -1731,7 +1757,6 @@ export const serializeAws_restJson1CreateJobCommand = async ( timeoutConfig: serializeAws_restJson1TimeoutConfig(input.timeoutConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1747,10 +1772,12 @@ export const serializeAws_restJson1CreateJobTemplateCommand = async ( input: CreateJobTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/job-templates/{jobTemplateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/job-templates/{jobTemplateId}"; if (input.jobTemplateId !== undefined) { const labelValue: string = input.jobTemplateId; if (labelValue.length <= 0) { @@ -1787,7 +1814,6 @@ export const serializeAws_restJson1CreateJobTemplateCommand = async ( timeoutConfig: serializeAws_restJson1TimeoutConfig(input.timeoutConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1803,13 +1829,13 @@ export const serializeAws_restJson1CreateKeysAndCertificateCommand = async ( input: CreateKeysAndCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/keys-and-certificate"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/keys-and-certificate"; const query: any = { ...(input.setAsActive !== undefined && { setAsActive: input.setAsActive.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1826,10 +1852,12 @@ export const serializeAws_restJson1CreateMitigationActionCommand = async ( input: CreateMitigationActionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/mitigationactions/actions/{actionName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/mitigationactions/actions/{actionName}"; if (input.actionName !== undefined) { const labelValue: string = input.actionName; if (labelValue.length <= 0) { @@ -1849,7 +1877,6 @@ export const serializeAws_restJson1CreateMitigationActionCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1865,10 +1892,12 @@ export const serializeAws_restJson1CreateOTAUpdateCommand = async ( input: CreateOTAUpdateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/otaUpdates/{otaUpdateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/otaUpdates/{otaUpdateId}"; if (input.otaUpdateId !== undefined) { const labelValue: string = input.otaUpdateId; if (labelValue.length <= 0) { @@ -1919,7 +1948,6 @@ export const serializeAws_restJson1CreateOTAUpdateCommand = async ( ...(input.targets !== undefined && input.targets !== null && { targets: serializeAws_restJson1Targets(input.targets, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1935,10 +1963,11 @@ export const serializeAws_restJson1CreatePolicyCommand = async ( input: CreatePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/policies/{policyName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{policyName}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -1955,7 +1984,6 @@ export const serializeAws_restJson1CreatePolicyCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1971,10 +1999,12 @@ export const serializeAws_restJson1CreatePolicyVersionCommand = async ( input: CreatePolicyVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/policies/{policyName}/version"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{policyName}/version"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -1992,7 +2022,6 @@ export const serializeAws_restJson1CreatePolicyVersionCommand = async ( ...(input.policyDocument !== undefined && input.policyDocument !== null && { policyDocument: input.policyDocument }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2009,8 +2038,11 @@ export const serializeAws_restJson1CreateProvisioningClaimCommand = async ( input: CreateProvisioningClaimCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/provisioning-templates/{templateName}/provisioning-claim"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/provisioning-templates/{templateName}/provisioning-claim"; if (input.templateName !== undefined) { const labelValue: string = input.templateName; if (labelValue.length <= 0) { @@ -2021,7 +2053,6 @@ export const serializeAws_restJson1CreateProvisioningClaimCommand = async ( throw new Error("No value provided for input HTTP label: templateName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2037,10 +2068,11 @@ export const serializeAws_restJson1CreateProvisioningTemplateCommand = async ( input: CreateProvisioningTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/provisioning-templates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/provisioning-templates"; let body: any; body = JSON.stringify({ ...(input.description !== undefined && input.description !== null && { description: input.description }), @@ -2056,7 +2088,6 @@ export const serializeAws_restJson1CreateProvisioningTemplateCommand = async ( ...(input.templateBody !== undefined && input.templateBody !== null && { templateBody: input.templateBody }), ...(input.templateName !== undefined && input.templateName !== null && { templateName: input.templateName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2072,10 +2103,13 @@ export const serializeAws_restJson1CreateProvisioningTemplateVersionCommand = as input: CreateProvisioningTemplateVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/provisioning-templates/{templateName}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/provisioning-templates/{templateName}/versions"; if (input.templateName !== undefined) { const labelValue: string = input.templateName; if (labelValue.length <= 0) { @@ -2092,7 +2126,6 @@ export const serializeAws_restJson1CreateProvisioningTemplateVersionCommand = as body = JSON.stringify({ ...(input.templateBody !== undefined && input.templateBody !== null && { templateBody: input.templateBody }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2109,10 +2142,12 @@ export const serializeAws_restJson1CreateRoleAliasCommand = async ( input: CreateRoleAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/role-aliases/{roleAlias}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/role-aliases/{roleAlias}"; if (input.roleAlias !== undefined) { const labelValue: string = input.roleAlias; if (labelValue.length <= 0) { @@ -2130,7 +2165,6 @@ export const serializeAws_restJson1CreateRoleAliasCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2146,10 +2180,13 @@ export const serializeAws_restJson1CreateScheduledAuditCommand = async ( input: CreateScheduledAuditCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/scheduledaudits/{scheduledAuditName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/audit/scheduledaudits/{scheduledAuditName}"; if (input.scheduledAuditName !== undefined) { const labelValue: string = input.scheduledAuditName; if (labelValue.length <= 0) { @@ -2171,7 +2208,6 @@ export const serializeAws_restJson1CreateScheduledAuditCommand = async ( targetCheckNames: serializeAws_restJson1TargetAuditCheckNames(input.targetCheckNames, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2187,10 +2223,12 @@ export const serializeAws_restJson1CreateSecurityProfileCommand = async ( input: CreateSecurityProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/security-profiles/{securityProfileName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/security-profiles/{securityProfileName}"; if (input.securityProfileName !== undefined) { const labelValue: string = input.securityProfileName; if (labelValue.length <= 0) { @@ -2225,7 +2263,6 @@ export const serializeAws_restJson1CreateSecurityProfileCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2241,10 +2278,11 @@ export const serializeAws_restJson1CreateStreamCommand = async ( input: CreateStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/streams/{streamId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/streams/{streamId}"; if (input.streamId !== undefined) { const labelValue: string = input.streamId; if (labelValue.length <= 0) { @@ -2263,7 +2301,6 @@ export const serializeAws_restJson1CreateStreamCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2279,10 +2316,11 @@ export const serializeAws_restJson1CreateThingCommand = async ( input: CreateThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/things/{thingName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -2302,7 +2340,6 @@ export const serializeAws_restJson1CreateThingCommand = async ( input.billingGroupName !== null && { billingGroupName: input.billingGroupName }), ...(input.thingTypeName !== undefined && input.thingTypeName !== null && { thingTypeName: input.thingTypeName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2318,10 +2355,12 @@ export const serializeAws_restJson1CreateThingGroupCommand = async ( input: CreateThingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/thing-groups/{thingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-groups/{thingGroupName}"; if (input.thingGroupName !== undefined) { const labelValue: string = input.thingGroupName; if (labelValue.length <= 0) { @@ -2342,7 +2381,6 @@ export const serializeAws_restJson1CreateThingGroupCommand = async ( thingGroupProperties: serializeAws_restJson1ThingGroupProperties(input.thingGroupProperties, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2358,10 +2396,12 @@ export const serializeAws_restJson1CreateThingTypeCommand = async ( input: CreateThingTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/thing-types/{thingTypeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-types/{thingTypeName}"; if (input.thingTypeName !== undefined) { const labelValue: string = input.thingTypeName; if (labelValue.length <= 0) { @@ -2380,7 +2420,6 @@ export const serializeAws_restJson1CreateThingTypeCommand = async ( thingTypeProperties: serializeAws_restJson1ThingTypeProperties(input.thingTypeProperties, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2396,11 +2435,12 @@ export const serializeAws_restJson1CreateTopicRuleCommand = async ( input: CreateTopicRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.tags) && { "x-amz-tagging": input.tags! }), }; - let resolvedPath = "/rules/{ruleName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/rules/{ruleName}"; if (input.ruleName !== undefined) { const labelValue: string = input.ruleName; if (labelValue.length <= 0) { @@ -2418,7 +2458,6 @@ export const serializeAws_restJson1CreateTopicRuleCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2434,10 +2473,11 @@ export const serializeAws_restJson1CreateTopicRuleDestinationCommand = async ( input: CreateTopicRuleDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/destinations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/destinations"; let body: any; body = JSON.stringify({ ...(input.destinationConfiguration !== undefined && @@ -2448,7 +2488,6 @@ export const serializeAws_restJson1CreateTopicRuleDestinationCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2464,13 +2503,13 @@ export const serializeAws_restJson1DeleteAccountAuditConfigurationCommand = asyn input: DeleteAccountAuditConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/configuration"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/configuration"; const query: any = { ...(input.deleteScheduledAudits !== undefined && { deleteScheduledAudits: input.deleteScheduledAudits.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2487,10 +2526,12 @@ export const serializeAws_restJson1DeleteAuditSuppressionCommand = async ( input: DeleteAuditSuppressionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/suppressions/delete"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/suppressions/delete"; let body: any; body = JSON.stringify({ ...(input.checkName !== undefined && input.checkName !== null && { checkName: input.checkName }), @@ -2499,7 +2540,6 @@ export const serializeAws_restJson1DeleteAuditSuppressionCommand = async ( resourceIdentifier: serializeAws_restJson1ResourceIdentifier(input.resourceIdentifier, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2515,8 +2555,10 @@ export const serializeAws_restJson1DeleteAuthorizerCommand = async ( input: DeleteAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/authorizer/{authorizerName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/authorizer/{authorizerName}"; if (input.authorizerName !== undefined) { const labelValue: string = input.authorizerName; if (labelValue.length <= 0) { @@ -2527,7 +2569,6 @@ export const serializeAws_restJson1DeleteAuthorizerCommand = async ( throw new Error("No value provided for input HTTP label: authorizerName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2543,8 +2584,10 @@ export const serializeAws_restJson1DeleteBillingGroupCommand = async ( input: DeleteBillingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/billing-groups/{billingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/billing-groups/{billingGroupName}"; if (input.billingGroupName !== undefined) { const labelValue: string = input.billingGroupName; if (labelValue.length <= 0) { @@ -2558,7 +2601,6 @@ export const serializeAws_restJson1DeleteBillingGroupCommand = async ( ...(input.expectedVersion !== undefined && { expectedVersion: input.expectedVersion.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2575,8 +2617,10 @@ export const serializeAws_restJson1DeleteCACertificateCommand = async ( input: DeleteCACertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/cacertificate/{certificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cacertificate/{certificateId}"; if (input.certificateId !== undefined) { const labelValue: string = input.certificateId; if (labelValue.length <= 0) { @@ -2587,7 +2631,6 @@ export const serializeAws_restJson1DeleteCACertificateCommand = async ( throw new Error("No value provided for input HTTP label: certificateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2603,8 +2646,10 @@ export const serializeAws_restJson1DeleteCertificateCommand = async ( input: DeleteCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/certificates/{certificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/certificates/{certificateId}"; if (input.certificateId !== undefined) { const labelValue: string = input.certificateId; if (labelValue.length <= 0) { @@ -2618,7 +2663,6 @@ export const serializeAws_restJson1DeleteCertificateCommand = async ( ...(input.forceDelete !== undefined && { forceDelete: input.forceDelete.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2635,8 +2679,10 @@ export const serializeAws_restJson1DeleteCustomMetricCommand = async ( input: DeleteCustomMetricCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/custom-metric/{metricName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-metric/{metricName}"; if (input.metricName !== undefined) { const labelValue: string = input.metricName; if (labelValue.length <= 0) { @@ -2647,7 +2693,6 @@ export const serializeAws_restJson1DeleteCustomMetricCommand = async ( throw new Error("No value provided for input HTTP label: metricName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2663,8 +2708,9 @@ export const serializeAws_restJson1DeleteDimensionCommand = async ( input: DeleteDimensionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dimensions/{name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dimensions/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -2675,7 +2721,6 @@ export const serializeAws_restJson1DeleteDimensionCommand = async ( throw new Error("No value provided for input HTTP label: name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2691,8 +2736,11 @@ export const serializeAws_restJson1DeleteDomainConfigurationCommand = async ( input: DeleteDomainConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domainConfigurations/{domainConfigurationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domainConfigurations/{domainConfigurationName}"; if (input.domainConfigurationName !== undefined) { const labelValue: string = input.domainConfigurationName; if (labelValue.length <= 0) { @@ -2703,7 +2751,6 @@ export const serializeAws_restJson1DeleteDomainConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: domainConfigurationName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2719,8 +2766,10 @@ export const serializeAws_restJson1DeleteDynamicThingGroupCommand = async ( input: DeleteDynamicThingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dynamic-thing-groups/{thingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dynamic-thing-groups/{thingGroupName}"; if (input.thingGroupName !== undefined) { const labelValue: string = input.thingGroupName; if (labelValue.length <= 0) { @@ -2734,7 +2783,6 @@ export const serializeAws_restJson1DeleteDynamicThingGroupCommand = async ( ...(input.expectedVersion !== undefined && { expectedVersion: input.expectedVersion.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2751,8 +2799,9 @@ export const serializeAws_restJson1DeleteJobCommand = async ( input: DeleteJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{jobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -2767,7 +2816,6 @@ export const serializeAws_restJson1DeleteJobCommand = async ( ...(input.namespaceId !== undefined && { namespaceId: input.namespaceId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2784,8 +2832,11 @@ export const serializeAws_restJson1DeleteJobExecutionCommand = async ( input: DeleteJobExecutionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}/jobs/{jobId}/executionNumber/{executionNumber}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/things/{thingName}/jobs/{jobId}/executionNumber/{executionNumber}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -2818,7 +2869,6 @@ export const serializeAws_restJson1DeleteJobExecutionCommand = async ( ...(input.namespaceId !== undefined && { namespaceId: input.namespaceId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2835,8 +2885,10 @@ export const serializeAws_restJson1DeleteJobTemplateCommand = async ( input: DeleteJobTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/job-templates/{jobTemplateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/job-templates/{jobTemplateId}"; if (input.jobTemplateId !== undefined) { const labelValue: string = input.jobTemplateId; if (labelValue.length <= 0) { @@ -2847,7 +2899,6 @@ export const serializeAws_restJson1DeleteJobTemplateCommand = async ( throw new Error("No value provided for input HTTP label: jobTemplateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2863,8 +2914,10 @@ export const serializeAws_restJson1DeleteMitigationActionCommand = async ( input: DeleteMitigationActionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/mitigationactions/actions/{actionName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/mitigationactions/actions/{actionName}"; if (input.actionName !== undefined) { const labelValue: string = input.actionName; if (labelValue.length <= 0) { @@ -2875,7 +2928,6 @@ export const serializeAws_restJson1DeleteMitigationActionCommand = async ( throw new Error("No value provided for input HTTP label: actionName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2891,8 +2943,10 @@ export const serializeAws_restJson1DeleteOTAUpdateCommand = async ( input: DeleteOTAUpdateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/otaUpdates/{otaUpdateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/otaUpdates/{otaUpdateId}"; if (input.otaUpdateId !== undefined) { const labelValue: string = input.otaUpdateId; if (labelValue.length <= 0) { @@ -2907,7 +2961,6 @@ export const serializeAws_restJson1DeleteOTAUpdateCommand = async ( ...(input.forceDeleteAWSJob !== undefined && { forceDeleteAWSJob: input.forceDeleteAWSJob.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2924,8 +2977,9 @@ export const serializeAws_restJson1DeletePolicyCommand = async ( input: DeletePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policies/{policyName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{policyName}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -2936,7 +2990,6 @@ export const serializeAws_restJson1DeletePolicyCommand = async ( throw new Error("No value provided for input HTTP label: policyName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2952,8 +3005,11 @@ export const serializeAws_restJson1DeletePolicyVersionCommand = async ( input: DeletePolicyVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policies/{policyName}/version/{policyVersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/policies/{policyName}/version/{policyVersionId}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -2973,7 +3029,6 @@ export const serializeAws_restJson1DeletePolicyVersionCommand = async ( throw new Error("No value provided for input HTTP label: policyVersionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2989,8 +3044,10 @@ export const serializeAws_restJson1DeleteProvisioningTemplateCommand = async ( input: DeleteProvisioningTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/provisioning-templates/{templateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/provisioning-templates/{templateName}"; if (input.templateName !== undefined) { const labelValue: string = input.templateName; if (labelValue.length <= 0) { @@ -3001,7 +3058,6 @@ export const serializeAws_restJson1DeleteProvisioningTemplateCommand = async ( throw new Error("No value provided for input HTTP label: templateName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3017,8 +3073,11 @@ export const serializeAws_restJson1DeleteProvisioningTemplateVersionCommand = as input: DeleteProvisioningTemplateVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/provisioning-templates/{templateName}/versions/{versionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/provisioning-templates/{templateName}/versions/{versionId}"; if (input.templateName !== undefined) { const labelValue: string = input.templateName; if (labelValue.length <= 0) { @@ -3038,7 +3097,6 @@ export const serializeAws_restJson1DeleteProvisioningTemplateVersionCommand = as throw new Error("No value provided for input HTTP label: versionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3054,13 +3112,13 @@ export const serializeAws_restJson1DeleteRegistrationCodeCommand = async ( input: DeleteRegistrationCodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/registrationcode"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/registrationcode"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3076,8 +3134,10 @@ export const serializeAws_restJson1DeleteRoleAliasCommand = async ( input: DeleteRoleAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/role-aliases/{roleAlias}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/role-aliases/{roleAlias}"; if (input.roleAlias !== undefined) { const labelValue: string = input.roleAlias; if (labelValue.length <= 0) { @@ -3088,7 +3148,6 @@ export const serializeAws_restJson1DeleteRoleAliasCommand = async ( throw new Error("No value provided for input HTTP label: roleAlias."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3104,8 +3163,11 @@ export const serializeAws_restJson1DeleteScheduledAuditCommand = async ( input: DeleteScheduledAuditCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/scheduledaudits/{scheduledAuditName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/audit/scheduledaudits/{scheduledAuditName}"; if (input.scheduledAuditName !== undefined) { const labelValue: string = input.scheduledAuditName; if (labelValue.length <= 0) { @@ -3116,7 +3178,6 @@ export const serializeAws_restJson1DeleteScheduledAuditCommand = async ( throw new Error("No value provided for input HTTP label: scheduledAuditName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3132,8 +3193,10 @@ export const serializeAws_restJson1DeleteSecurityProfileCommand = async ( input: DeleteSecurityProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/security-profiles/{securityProfileName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/security-profiles/{securityProfileName}"; if (input.securityProfileName !== undefined) { const labelValue: string = input.securityProfileName; if (labelValue.length <= 0) { @@ -3147,7 +3210,6 @@ export const serializeAws_restJson1DeleteSecurityProfileCommand = async ( ...(input.expectedVersion !== undefined && { expectedVersion: input.expectedVersion.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3164,8 +3226,9 @@ export const serializeAws_restJson1DeleteStreamCommand = async ( input: DeleteStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/streams/{streamId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/streams/{streamId}"; if (input.streamId !== undefined) { const labelValue: string = input.streamId; if (labelValue.length <= 0) { @@ -3176,7 +3239,6 @@ export const serializeAws_restJson1DeleteStreamCommand = async ( throw new Error("No value provided for input HTTP label: streamId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3192,8 +3254,9 @@ export const serializeAws_restJson1DeleteThingCommand = async ( input: DeleteThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -3207,7 +3270,6 @@ export const serializeAws_restJson1DeleteThingCommand = async ( ...(input.expectedVersion !== undefined && { expectedVersion: input.expectedVersion.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3224,8 +3286,10 @@ export const serializeAws_restJson1DeleteThingGroupCommand = async ( input: DeleteThingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-groups/{thingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-groups/{thingGroupName}"; if (input.thingGroupName !== undefined) { const labelValue: string = input.thingGroupName; if (labelValue.length <= 0) { @@ -3239,7 +3303,6 @@ export const serializeAws_restJson1DeleteThingGroupCommand = async ( ...(input.expectedVersion !== undefined && { expectedVersion: input.expectedVersion.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3256,8 +3319,10 @@ export const serializeAws_restJson1DeleteThingTypeCommand = async ( input: DeleteThingTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-types/{thingTypeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-types/{thingTypeName}"; if (input.thingTypeName !== undefined) { const labelValue: string = input.thingTypeName; if (labelValue.length <= 0) { @@ -3268,7 +3333,6 @@ export const serializeAws_restJson1DeleteThingTypeCommand = async ( throw new Error("No value provided for input HTTP label: thingTypeName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3284,8 +3348,9 @@ export const serializeAws_restJson1DeleteTopicRuleCommand = async ( input: DeleteTopicRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/rules/{ruleName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/rules/{ruleName}"; if (input.ruleName !== undefined) { const labelValue: string = input.ruleName; if (labelValue.length <= 0) { @@ -3296,7 +3361,6 @@ export const serializeAws_restJson1DeleteTopicRuleCommand = async ( throw new Error("No value provided for input HTTP label: ruleName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3312,8 +3376,9 @@ export const serializeAws_restJson1DeleteTopicRuleDestinationCommand = async ( input: DeleteTopicRuleDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/destinations/{arn+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/destinations/{arn+}"; if (input.arn !== undefined) { const labelValue: string = input.arn; if (labelValue.length <= 0) { @@ -3330,7 +3395,6 @@ export const serializeAws_restJson1DeleteTopicRuleDestinationCommand = async ( throw new Error("No value provided for input HTTP label: arn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3346,14 +3410,14 @@ export const serializeAws_restJson1DeleteV2LoggingLevelCommand = async ( input: DeleteV2LoggingLevelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2LoggingLevel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2LoggingLevel"; const query: any = { ...(input.targetType !== undefined && { targetType: input.targetType }), ...(input.targetName !== undefined && { targetName: input.targetName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3370,10 +3434,12 @@ export const serializeAws_restJson1DeprecateThingTypeCommand = async ( input: DeprecateThingTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/thing-types/{thingTypeName}/deprecate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-types/{thingTypeName}/deprecate"; if (input.thingTypeName !== undefined) { const labelValue: string = input.thingTypeName; if (labelValue.length <= 0) { @@ -3387,7 +3453,6 @@ export const serializeAws_restJson1DeprecateThingTypeCommand = async ( body = JSON.stringify({ ...(input.undoDeprecate !== undefined && input.undoDeprecate !== null && { undoDeprecate: input.undoDeprecate }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3403,13 +3468,13 @@ export const serializeAws_restJson1DescribeAccountAuditConfigurationCommand = as input: DescribeAccountAuditConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/configuration"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/configuration"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3425,8 +3490,10 @@ export const serializeAws_restJson1DescribeAuditFindingCommand = async ( input: DescribeAuditFindingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/findings/{findingId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/findings/{findingId}"; if (input.findingId !== undefined) { const labelValue: string = input.findingId; if (labelValue.length <= 0) { @@ -3437,7 +3504,6 @@ export const serializeAws_restJson1DescribeAuditFindingCommand = async ( throw new Error("No value provided for input HTTP label: findingId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3453,8 +3519,10 @@ export const serializeAws_restJson1DescribeAuditMitigationActionsTaskCommand = a input: DescribeAuditMitigationActionsTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/mitigationactions/tasks/{taskId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/mitigationactions/tasks/{taskId}"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -3465,7 +3533,6 @@ export const serializeAws_restJson1DescribeAuditMitigationActionsTaskCommand = a throw new Error("No value provided for input HTTP label: taskId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3481,10 +3548,12 @@ export const serializeAws_restJson1DescribeAuditSuppressionCommand = async ( input: DescribeAuditSuppressionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/suppressions/describe"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/suppressions/describe"; let body: any; body = JSON.stringify({ ...(input.checkName !== undefined && input.checkName !== null && { checkName: input.checkName }), @@ -3493,7 +3562,6 @@ export const serializeAws_restJson1DescribeAuditSuppressionCommand = async ( resourceIdentifier: serializeAws_restJson1ResourceIdentifier(input.resourceIdentifier, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3509,8 +3577,9 @@ export const serializeAws_restJson1DescribeAuditTaskCommand = async ( input: DescribeAuditTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/tasks/{taskId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/tasks/{taskId}"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -3521,7 +3590,6 @@ export const serializeAws_restJson1DescribeAuditTaskCommand = async ( throw new Error("No value provided for input HTTP label: taskId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3537,8 +3605,10 @@ export const serializeAws_restJson1DescribeAuthorizerCommand = async ( input: DescribeAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/authorizer/{authorizerName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/authorizer/{authorizerName}"; if (input.authorizerName !== undefined) { const labelValue: string = input.authorizerName; if (labelValue.length <= 0) { @@ -3549,7 +3619,6 @@ export const serializeAws_restJson1DescribeAuthorizerCommand = async ( throw new Error("No value provided for input HTTP label: authorizerName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3565,8 +3634,10 @@ export const serializeAws_restJson1DescribeBillingGroupCommand = async ( input: DescribeBillingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/billing-groups/{billingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/billing-groups/{billingGroupName}"; if (input.billingGroupName !== undefined) { const labelValue: string = input.billingGroupName; if (labelValue.length <= 0) { @@ -3577,7 +3648,6 @@ export const serializeAws_restJson1DescribeBillingGroupCommand = async ( throw new Error("No value provided for input HTTP label: billingGroupName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3593,8 +3663,10 @@ export const serializeAws_restJson1DescribeCACertificateCommand = async ( input: DescribeCACertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/cacertificate/{certificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cacertificate/{certificateId}"; if (input.certificateId !== undefined) { const labelValue: string = input.certificateId; if (labelValue.length <= 0) { @@ -3605,7 +3677,6 @@ export const serializeAws_restJson1DescribeCACertificateCommand = async ( throw new Error("No value provided for input HTTP label: certificateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3621,8 +3692,10 @@ export const serializeAws_restJson1DescribeCertificateCommand = async ( input: DescribeCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/certificates/{certificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/certificates/{certificateId}"; if (input.certificateId !== undefined) { const labelValue: string = input.certificateId; if (labelValue.length <= 0) { @@ -3633,7 +3706,6 @@ export const serializeAws_restJson1DescribeCertificateCommand = async ( throw new Error("No value provided for input HTTP label: certificateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3649,8 +3721,10 @@ export const serializeAws_restJson1DescribeCustomMetricCommand = async ( input: DescribeCustomMetricCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/custom-metric/{metricName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-metric/{metricName}"; if (input.metricName !== undefined) { const labelValue: string = input.metricName; if (labelValue.length <= 0) { @@ -3661,7 +3735,6 @@ export const serializeAws_restJson1DescribeCustomMetricCommand = async ( throw new Error("No value provided for input HTTP label: metricName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3677,13 +3750,13 @@ export const serializeAws_restJson1DescribeDefaultAuthorizerCommand = async ( input: DescribeDefaultAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/default-authorizer"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/default-authorizer"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3699,8 +3772,10 @@ export const serializeAws_restJson1DescribeDetectMitigationActionsTaskCommand = input: DescribeDetectMitigationActionsTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detect/mitigationactions/tasks/{taskId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detect/mitigationactions/tasks/{taskId}"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -3711,7 +3786,6 @@ export const serializeAws_restJson1DescribeDetectMitigationActionsTaskCommand = throw new Error("No value provided for input HTTP label: taskId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3727,8 +3801,9 @@ export const serializeAws_restJson1DescribeDimensionCommand = async ( input: DescribeDimensionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dimensions/{name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dimensions/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -3739,7 +3814,6 @@ export const serializeAws_restJson1DescribeDimensionCommand = async ( throw new Error("No value provided for input HTTP label: name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3755,8 +3829,11 @@ export const serializeAws_restJson1DescribeDomainConfigurationCommand = async ( input: DescribeDomainConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domainConfigurations/{domainConfigurationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domainConfigurations/{domainConfigurationName}"; if (input.domainConfigurationName !== undefined) { const labelValue: string = input.domainConfigurationName; if (labelValue.length <= 0) { @@ -3767,7 +3844,6 @@ export const serializeAws_restJson1DescribeDomainConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: domainConfigurationName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3783,13 +3859,13 @@ export const serializeAws_restJson1DescribeEndpointCommand = async ( input: DescribeEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/endpoint"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/endpoint"; const query: any = { ...(input.endpointType !== undefined && { endpointType: input.endpointType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3806,13 +3882,13 @@ export const serializeAws_restJson1DescribeEventConfigurationsCommand = async ( input: DescribeEventConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/event-configurations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/event-configurations"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3828,8 +3904,9 @@ export const serializeAws_restJson1DescribeIndexCommand = async ( input: DescribeIndexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/indices/{indexName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/indices/{indexName}"; if (input.indexName !== undefined) { const labelValue: string = input.indexName; if (labelValue.length <= 0) { @@ -3840,7 +3917,6 @@ export const serializeAws_restJson1DescribeIndexCommand = async ( throw new Error("No value provided for input HTTP label: indexName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3856,8 +3932,9 @@ export const serializeAws_restJson1DescribeJobCommand = async ( input: DescribeJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{jobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -3868,7 +3945,6 @@ export const serializeAws_restJson1DescribeJobCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3884,8 +3960,10 @@ export const serializeAws_restJson1DescribeJobExecutionCommand = async ( input: DescribeJobExecutionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}/jobs/{jobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -3908,7 +3986,6 @@ export const serializeAws_restJson1DescribeJobExecutionCommand = async ( ...(input.executionNumber !== undefined && { executionNumber: input.executionNumber.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3925,8 +4002,10 @@ export const serializeAws_restJson1DescribeJobTemplateCommand = async ( input: DescribeJobTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/job-templates/{jobTemplateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/job-templates/{jobTemplateId}"; if (input.jobTemplateId !== undefined) { const labelValue: string = input.jobTemplateId; if (labelValue.length <= 0) { @@ -3937,7 +4016,6 @@ export const serializeAws_restJson1DescribeJobTemplateCommand = async ( throw new Error("No value provided for input HTTP label: jobTemplateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3953,8 +4031,10 @@ export const serializeAws_restJson1DescribeMitigationActionCommand = async ( input: DescribeMitigationActionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/mitigationactions/actions/{actionName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/mitigationactions/actions/{actionName}"; if (input.actionName !== undefined) { const labelValue: string = input.actionName; if (labelValue.length <= 0) { @@ -3965,7 +4045,6 @@ export const serializeAws_restJson1DescribeMitigationActionCommand = async ( throw new Error("No value provided for input HTTP label: actionName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3981,8 +4060,10 @@ export const serializeAws_restJson1DescribeProvisioningTemplateCommand = async ( input: DescribeProvisioningTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/provisioning-templates/{templateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/provisioning-templates/{templateName}"; if (input.templateName !== undefined) { const labelValue: string = input.templateName; if (labelValue.length <= 0) { @@ -3993,7 +4074,6 @@ export const serializeAws_restJson1DescribeProvisioningTemplateCommand = async ( throw new Error("No value provided for input HTTP label: templateName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4009,8 +4089,11 @@ export const serializeAws_restJson1DescribeProvisioningTemplateVersionCommand = input: DescribeProvisioningTemplateVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/provisioning-templates/{templateName}/versions/{versionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/provisioning-templates/{templateName}/versions/{versionId}"; if (input.templateName !== undefined) { const labelValue: string = input.templateName; if (labelValue.length <= 0) { @@ -4030,7 +4113,6 @@ export const serializeAws_restJson1DescribeProvisioningTemplateVersionCommand = throw new Error("No value provided for input HTTP label: versionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4046,8 +4128,10 @@ export const serializeAws_restJson1DescribeRoleAliasCommand = async ( input: DescribeRoleAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/role-aliases/{roleAlias}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/role-aliases/{roleAlias}"; if (input.roleAlias !== undefined) { const labelValue: string = input.roleAlias; if (labelValue.length <= 0) { @@ -4058,7 +4142,6 @@ export const serializeAws_restJson1DescribeRoleAliasCommand = async ( throw new Error("No value provided for input HTTP label: roleAlias."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4074,8 +4157,11 @@ export const serializeAws_restJson1DescribeScheduledAuditCommand = async ( input: DescribeScheduledAuditCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/scheduledaudits/{scheduledAuditName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/audit/scheduledaudits/{scheduledAuditName}"; if (input.scheduledAuditName !== undefined) { const labelValue: string = input.scheduledAuditName; if (labelValue.length <= 0) { @@ -4086,7 +4172,6 @@ export const serializeAws_restJson1DescribeScheduledAuditCommand = async ( throw new Error("No value provided for input HTTP label: scheduledAuditName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4102,8 +4187,10 @@ export const serializeAws_restJson1DescribeSecurityProfileCommand = async ( input: DescribeSecurityProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/security-profiles/{securityProfileName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/security-profiles/{securityProfileName}"; if (input.securityProfileName !== undefined) { const labelValue: string = input.securityProfileName; if (labelValue.length <= 0) { @@ -4114,7 +4201,6 @@ export const serializeAws_restJson1DescribeSecurityProfileCommand = async ( throw new Error("No value provided for input HTTP label: securityProfileName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4130,8 +4216,9 @@ export const serializeAws_restJson1DescribeStreamCommand = async ( input: DescribeStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/streams/{streamId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/streams/{streamId}"; if (input.streamId !== undefined) { const labelValue: string = input.streamId; if (labelValue.length <= 0) { @@ -4142,7 +4229,6 @@ export const serializeAws_restJson1DescribeStreamCommand = async ( throw new Error("No value provided for input HTTP label: streamId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4158,8 +4244,9 @@ export const serializeAws_restJson1DescribeThingCommand = async ( input: DescribeThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -4170,7 +4257,6 @@ export const serializeAws_restJson1DescribeThingCommand = async ( throw new Error("No value provided for input HTTP label: thingName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4186,8 +4272,10 @@ export const serializeAws_restJson1DescribeThingGroupCommand = async ( input: DescribeThingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-groups/{thingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-groups/{thingGroupName}"; if (input.thingGroupName !== undefined) { const labelValue: string = input.thingGroupName; if (labelValue.length <= 0) { @@ -4198,7 +4286,6 @@ export const serializeAws_restJson1DescribeThingGroupCommand = async ( throw new Error("No value provided for input HTTP label: thingGroupName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4214,8 +4301,10 @@ export const serializeAws_restJson1DescribeThingRegistrationTaskCommand = async input: DescribeThingRegistrationTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-registration-tasks/{taskId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-registration-tasks/{taskId}"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -4226,7 +4315,6 @@ export const serializeAws_restJson1DescribeThingRegistrationTaskCommand = async throw new Error("No value provided for input HTTP label: taskId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4242,8 +4330,10 @@ export const serializeAws_restJson1DescribeThingTypeCommand = async ( input: DescribeThingTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-types/{thingTypeName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-types/{thingTypeName}"; if (input.thingTypeName !== undefined) { const labelValue: string = input.thingTypeName; if (labelValue.length <= 0) { @@ -4254,7 +4344,6 @@ export const serializeAws_restJson1DescribeThingTypeCommand = async ( throw new Error("No value provided for input HTTP label: thingTypeName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4270,10 +4359,12 @@ export const serializeAws_restJson1DetachPolicyCommand = async ( input: DetachPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/target-policies/{policyName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/target-policies/{policyName}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -4287,7 +4378,6 @@ export const serializeAws_restJson1DetachPolicyCommand = async ( body = JSON.stringify({ ...(input.target !== undefined && input.target !== null && { target: input.target }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4303,10 +4393,12 @@ export const serializeAws_restJson1DetachPrincipalPolicyCommand = async ( input: DetachPrincipalPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.principal) && { "x-amzn-iot-principal": input.principal! }), }; - let resolvedPath = "/principal-policies/{policyName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/principal-policies/{policyName}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -4317,7 +4409,6 @@ export const serializeAws_restJson1DetachPrincipalPolicyCommand = async ( throw new Error("No value provided for input HTTP label: policyName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4333,8 +4424,11 @@ export const serializeAws_restJson1DetachSecurityProfileCommand = async ( input: DetachSecurityProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/security-profiles/{securityProfileName}/targets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/security-profiles/{securityProfileName}/targets"; if (input.securityProfileName !== undefined) { const labelValue: string = input.securityProfileName; if (labelValue.length <= 0) { @@ -4348,7 +4442,6 @@ export const serializeAws_restJson1DetachSecurityProfileCommand = async ( ...(input.securityProfileTargetArn !== undefined && { securityProfileTargetArn: input.securityProfileTargetArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4365,10 +4458,12 @@ export const serializeAws_restJson1DetachThingPrincipalCommand = async ( input: DetachThingPrincipalCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.principal) && { "x-amzn-principal": input.principal! }), }; - let resolvedPath = "/things/{thingName}/principals"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/principals"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -4379,7 +4474,6 @@ export const serializeAws_restJson1DetachThingPrincipalCommand = async ( throw new Error("No value provided for input HTTP label: thingName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4395,8 +4489,10 @@ export const serializeAws_restJson1DisableTopicRuleCommand = async ( input: DisableTopicRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/rules/{ruleName}/disable"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/rules/{ruleName}/disable"; if (input.ruleName !== undefined) { const labelValue: string = input.ruleName; if (labelValue.length <= 0) { @@ -4407,7 +4503,6 @@ export const serializeAws_restJson1DisableTopicRuleCommand = async ( throw new Error("No value provided for input HTTP label: ruleName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4423,8 +4518,9 @@ export const serializeAws_restJson1EnableTopicRuleCommand = async ( input: EnableTopicRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/rules/{ruleName}/enable"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/rules/{ruleName}/enable"; if (input.ruleName !== undefined) { const labelValue: string = input.ruleName; if (labelValue.length <= 0) { @@ -4435,7 +4531,6 @@ export const serializeAws_restJson1EnableTopicRuleCommand = async ( throw new Error("No value provided for input HTTP label: ruleName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4451,15 +4546,16 @@ export const serializeAws_restJson1GetBehaviorModelTrainingSummariesCommand = as input: GetBehaviorModelTrainingSummariesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/behavior-model-training/summaries"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/behavior-model-training/summaries"; const query: any = { ...(input.securityProfileName !== undefined && { securityProfileName: input.securityProfileName }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4476,10 +4572,11 @@ export const serializeAws_restJson1GetCardinalityCommand = async ( input: GetCardinalityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/indices/cardinality"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/indices/cardinality"; let body: any; body = JSON.stringify({ ...(input.aggregationField !== undefined && @@ -4488,7 +4585,6 @@ export const serializeAws_restJson1GetCardinalityCommand = async ( ...(input.queryString !== undefined && input.queryString !== null && { queryString: input.queryString }), ...(input.queryVersion !== undefined && input.queryVersion !== null && { queryVersion: input.queryVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4504,10 +4600,11 @@ export const serializeAws_restJson1GetEffectivePoliciesCommand = async ( input: GetEffectivePoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/effective-policies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/effective-policies"; const query: any = { ...(input.thingName !== undefined && { thingName: input.thingName }), }; @@ -4517,7 +4614,6 @@ export const serializeAws_restJson1GetEffectivePoliciesCommand = async ( input.cognitoIdentityPoolId !== null && { cognitoIdentityPoolId: input.cognitoIdentityPoolId }), ...(input.principal !== undefined && input.principal !== null && { principal: input.principal }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4534,13 +4630,13 @@ export const serializeAws_restJson1GetIndexingConfigurationCommand = async ( input: GetIndexingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/indexing/config"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/indexing/config"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4556,8 +4652,10 @@ export const serializeAws_restJson1GetJobDocumentCommand = async ( input: GetJobDocumentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{jobId}/job-document"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}/job-document"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -4568,7 +4666,6 @@ export const serializeAws_restJson1GetJobDocumentCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4584,13 +4681,13 @@ export const serializeAws_restJson1GetLoggingOptionsCommand = async ( input: GetLoggingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/loggingOptions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/loggingOptions"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4606,8 +4703,10 @@ export const serializeAws_restJson1GetOTAUpdateCommand = async ( input: GetOTAUpdateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/otaUpdates/{otaUpdateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/otaUpdates/{otaUpdateId}"; if (input.otaUpdateId !== undefined) { const labelValue: string = input.otaUpdateId; if (labelValue.length <= 0) { @@ -4618,7 +4717,6 @@ export const serializeAws_restJson1GetOTAUpdateCommand = async ( throw new Error("No value provided for input HTTP label: otaUpdateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4634,10 +4732,11 @@ export const serializeAws_restJson1GetPercentilesCommand = async ( input: GetPercentilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/indices/percentiles"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/indices/percentiles"; let body: any; body = JSON.stringify({ ...(input.aggregationField !== undefined && @@ -4648,7 +4747,6 @@ export const serializeAws_restJson1GetPercentilesCommand = async ( ...(input.queryString !== undefined && input.queryString !== null && { queryString: input.queryString }), ...(input.queryVersion !== undefined && input.queryVersion !== null && { queryVersion: input.queryVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4664,8 +4762,9 @@ export const serializeAws_restJson1GetPolicyCommand = async ( input: GetPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policies/{policyName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{policyName}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -4676,7 +4775,6 @@ export const serializeAws_restJson1GetPolicyCommand = async ( throw new Error("No value provided for input HTTP label: policyName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4692,8 +4790,11 @@ export const serializeAws_restJson1GetPolicyVersionCommand = async ( input: GetPolicyVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policies/{policyName}/version/{policyVersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/policies/{policyName}/version/{policyVersionId}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -4713,7 +4814,6 @@ export const serializeAws_restJson1GetPolicyVersionCommand = async ( throw new Error("No value provided for input HTTP label: policyVersionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4729,13 +4829,13 @@ export const serializeAws_restJson1GetRegistrationCodeCommand = async ( input: GetRegistrationCodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/registrationcode"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/registrationcode"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4751,10 +4851,11 @@ export const serializeAws_restJson1GetStatisticsCommand = async ( input: GetStatisticsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/indices/statistics"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/indices/statistics"; let body: any; body = JSON.stringify({ ...(input.aggregationField !== undefined && @@ -4763,7 +4864,6 @@ export const serializeAws_restJson1GetStatisticsCommand = async ( ...(input.queryString !== undefined && input.queryString !== null && { queryString: input.queryString }), ...(input.queryVersion !== undefined && input.queryVersion !== null && { queryVersion: input.queryVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4779,8 +4879,9 @@ export const serializeAws_restJson1GetTopicRuleCommand = async ( input: GetTopicRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/rules/{ruleName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/rules/{ruleName}"; if (input.ruleName !== undefined) { const labelValue: string = input.ruleName; if (labelValue.length <= 0) { @@ -4791,7 +4892,6 @@ export const serializeAws_restJson1GetTopicRuleCommand = async ( throw new Error("No value provided for input HTTP label: ruleName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4807,8 +4907,9 @@ export const serializeAws_restJson1GetTopicRuleDestinationCommand = async ( input: GetTopicRuleDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/destinations/{arn+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/destinations/{arn+}"; if (input.arn !== undefined) { const labelValue: string = input.arn; if (labelValue.length <= 0) { @@ -4825,7 +4926,6 @@ export const serializeAws_restJson1GetTopicRuleDestinationCommand = async ( throw new Error("No value provided for input HTTP label: arn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4841,13 +4941,13 @@ export const serializeAws_restJson1GetV2LoggingOptionsCommand = async ( input: GetV2LoggingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2LoggingOptions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2LoggingOptions"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4863,8 +4963,9 @@ export const serializeAws_restJson1ListActiveViolationsCommand = async ( input: ListActiveViolationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/active-violations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/active-violations"; const query: any = { ...(input.thingName !== undefined && { thingName: input.thingName }), ...(input.securityProfileName !== undefined && { securityProfileName: input.securityProfileName }), @@ -4874,7 +4975,6 @@ export const serializeAws_restJson1ListActiveViolationsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4891,8 +4991,10 @@ export const serializeAws_restJson1ListAttachedPoliciesCommand = async ( input: ListAttachedPoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/attached-policies/{target}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/attached-policies/{target}"; if (input.target !== undefined) { const labelValue: string = input.target; if (labelValue.length <= 0) { @@ -4908,7 +5010,6 @@ export const serializeAws_restJson1ListAttachedPoliciesCommand = async ( ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4925,10 +5026,11 @@ export const serializeAws_restJson1ListAuditFindingsCommand = async ( input: ListAuditFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/findings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/findings"; let body: any; body = JSON.stringify({ ...(input.checkName !== undefined && input.checkName !== null && { checkName: input.checkName }), @@ -4946,7 +5048,6 @@ export const serializeAws_restJson1ListAuditFindingsCommand = async ( input.startTime !== null && { startTime: Math.round(input.startTime.getTime() / 1000) }), ...(input.taskId !== undefined && input.taskId !== null && { taskId: input.taskId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4962,8 +5063,10 @@ export const serializeAws_restJson1ListAuditMitigationActionsExecutionsCommand = input: ListAuditMitigationActionsExecutionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/mitigationactions/executions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/mitigationactions/executions"; const query: any = { ...(input.taskId !== undefined && { taskId: input.taskId }), ...(input.actionStatus !== undefined && { actionStatus: input.actionStatus }), @@ -4972,7 +5075,6 @@ export const serializeAws_restJson1ListAuditMitigationActionsExecutionsCommand = ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4989,8 +5091,10 @@ export const serializeAws_restJson1ListAuditMitigationActionsTasksCommand = asyn input: ListAuditMitigationActionsTasksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/mitigationactions/tasks"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/mitigationactions/tasks"; const query: any = { ...(input.auditTaskId !== undefined && { auditTaskId: input.auditTaskId }), ...(input.findingId !== undefined && { findingId: input.findingId }), @@ -5001,7 +5105,6 @@ export const serializeAws_restJson1ListAuditMitigationActionsTasksCommand = asyn ...(input.endTime !== undefined && { endTime: (input.endTime.toISOString().split(".")[0] + "Z").toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5018,10 +5121,11 @@ export const serializeAws_restJson1ListAuditSuppressionsCommand = async ( input: ListAuditSuppressionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/suppressions/list"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/suppressions/list"; let body: any; body = JSON.stringify({ ...(input.ascendingOrder !== undefined && @@ -5034,7 +5138,6 @@ export const serializeAws_restJson1ListAuditSuppressionsCommand = async ( resourceIdentifier: serializeAws_restJson1ResourceIdentifier(input.resourceIdentifier, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5050,8 +5153,9 @@ export const serializeAws_restJson1ListAuditTasksCommand = async ( input: ListAuditTasksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/tasks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/tasks"; const query: any = { ...(input.startTime !== undefined && { startTime: (input.startTime.toISOString().split(".")[0] + "Z").toString() }), ...(input.endTime !== undefined && { endTime: (input.endTime.toISOString().split(".")[0] + "Z").toString() }), @@ -5061,7 +5165,6 @@ export const serializeAws_restJson1ListAuditTasksCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5078,8 +5181,9 @@ export const serializeAws_restJson1ListAuthorizersCommand = async ( input: ListAuthorizersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/authorizers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/authorizers"; const query: any = { ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), ...(input.marker !== undefined && { marker: input.marker }), @@ -5087,7 +5191,6 @@ export const serializeAws_restJson1ListAuthorizersCommand = async ( ...(input.status !== undefined && { status: input.status }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5104,15 +5207,15 @@ export const serializeAws_restJson1ListBillingGroupsCommand = async ( input: ListBillingGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/billing-groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/billing-groups"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.namePrefixFilter !== undefined && { namePrefixFilter: input.namePrefixFilter }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5129,15 +5232,15 @@ export const serializeAws_restJson1ListCACertificatesCommand = async ( input: ListCACertificatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/cacertificates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cacertificates"; const query: any = { ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), ...(input.marker !== undefined && { marker: input.marker }), ...(input.ascendingOrder !== undefined && { isAscendingOrder: input.ascendingOrder.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5154,15 +5257,15 @@ export const serializeAws_restJson1ListCertificatesCommand = async ( input: ListCertificatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/certificates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/certificates"; const query: any = { ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), ...(input.marker !== undefined && { marker: input.marker }), ...(input.ascendingOrder !== undefined && { isAscendingOrder: input.ascendingOrder.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5179,8 +5282,10 @@ export const serializeAws_restJson1ListCertificatesByCACommand = async ( input: ListCertificatesByCACommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/certificates-by-ca/{caCertificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/certificates-by-ca/{caCertificateId}"; if (input.caCertificateId !== undefined) { const labelValue: string = input.caCertificateId; if (labelValue.length <= 0) { @@ -5196,7 +5301,6 @@ export const serializeAws_restJson1ListCertificatesByCACommand = async ( ...(input.ascendingOrder !== undefined && { isAscendingOrder: input.ascendingOrder.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5213,14 +5317,14 @@ export const serializeAws_restJson1ListCustomMetricsCommand = async ( input: ListCustomMetricsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/custom-metrics"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-metrics"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5237,8 +5341,10 @@ export const serializeAws_restJson1ListDetectMitigationActionsExecutionsCommand input: ListDetectMitigationActionsExecutionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detect/mitigationactions/executions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detect/mitigationactions/executions"; const query: any = { ...(input.taskId !== undefined && { taskId: input.taskId }), ...(input.violationId !== undefined && { violationId: input.violationId }), @@ -5249,7 +5355,6 @@ export const serializeAws_restJson1ListDetectMitigationActionsExecutionsCommand ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5266,8 +5371,10 @@ export const serializeAws_restJson1ListDetectMitigationActionsTasksCommand = asy input: ListDetectMitigationActionsTasksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/detect/mitigationactions/tasks"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detect/mitigationactions/tasks"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), @@ -5275,7 +5382,6 @@ export const serializeAws_restJson1ListDetectMitigationActionsTasksCommand = asy ...(input.endTime !== undefined && { endTime: (input.endTime.toISOString().split(".")[0] + "Z").toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5292,14 +5398,14 @@ export const serializeAws_restJson1ListDimensionsCommand = async ( input: ListDimensionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dimensions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dimensions"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5316,15 +5422,15 @@ export const serializeAws_restJson1ListDomainConfigurationsCommand = async ( input: ListDomainConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/domainConfigurations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/domainConfigurations"; const query: any = { ...(input.marker !== undefined && { marker: input.marker }), ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), ...(input.serviceType !== undefined && { serviceType: input.serviceType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5341,14 +5447,14 @@ export const serializeAws_restJson1ListIndicesCommand = async ( input: ListIndicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/indices"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/indices"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5365,8 +5471,9 @@ export const serializeAws_restJson1ListJobExecutionsForJobCommand = async ( input: ListJobExecutionsForJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{jobId}/things"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}/things"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -5382,7 +5489,6 @@ export const serializeAws_restJson1ListJobExecutionsForJobCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5399,8 +5505,9 @@ export const serializeAws_restJson1ListJobExecutionsForThingCommand = async ( input: ListJobExecutionsForThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -5417,7 +5524,6 @@ export const serializeAws_restJson1ListJobExecutionsForThingCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5434,8 +5540,9 @@ export const serializeAws_restJson1ListJobsCommand = async ( input: ListJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs"; const query: any = { ...(input.status !== undefined && { status: input.status }), ...(input.targetSelection !== undefined && { targetSelection: input.targetSelection }), @@ -5446,7 +5553,6 @@ export const serializeAws_restJson1ListJobsCommand = async ( ...(input.namespaceId !== undefined && { namespaceId: input.namespaceId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5463,14 +5569,14 @@ export const serializeAws_restJson1ListJobTemplatesCommand = async ( input: ListJobTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/job-templates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/job-templates"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5487,15 +5593,16 @@ export const serializeAws_restJson1ListMitigationActionsCommand = async ( input: ListMitigationActionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/mitigationactions/actions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/mitigationactions/actions"; const query: any = { ...(input.actionType !== undefined && { actionType: input.actionType }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5512,15 +5619,15 @@ export const serializeAws_restJson1ListOTAUpdatesCommand = async ( input: ListOTAUpdatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/otaUpdates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/otaUpdates"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.otaUpdateStatus !== undefined && { otaUpdateStatus: input.otaUpdateStatus }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5537,15 +5644,15 @@ export const serializeAws_restJson1ListOutgoingCertificatesCommand = async ( input: ListOutgoingCertificatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/certificates-out-going"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/certificates-out-going"; const query: any = { ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), ...(input.marker !== undefined && { marker: input.marker }), ...(input.ascendingOrder !== undefined && { isAscendingOrder: input.ascendingOrder.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5562,15 +5669,15 @@ export const serializeAws_restJson1ListPoliciesCommand = async ( input: ListPoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies"; const query: any = { ...(input.marker !== undefined && { marker: input.marker }), ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), ...(input.ascendingOrder !== undefined && { isAscendingOrder: input.ascendingOrder.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5587,17 +5694,17 @@ export const serializeAws_restJson1ListPolicyPrincipalsCommand = async ( input: ListPolicyPrincipalsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.policyName) && { "x-amzn-iot-policy": input.policyName! }), }; - let resolvedPath = "/policy-principals"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy-principals"; const query: any = { ...(input.marker !== undefined && { marker: input.marker }), ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), ...(input.ascendingOrder !== undefined && { isAscendingOrder: input.ascendingOrder.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5614,8 +5721,10 @@ export const serializeAws_restJson1ListPolicyVersionsCommand = async ( input: ListPolicyVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policies/{policyName}/version"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policies/{policyName}/version"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -5626,7 +5735,6 @@ export const serializeAws_restJson1ListPolicyVersionsCommand = async ( throw new Error("No value provided for input HTTP label: policyName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5642,17 +5750,17 @@ export const serializeAws_restJson1ListPrincipalPoliciesCommand = async ( input: ListPrincipalPoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.principal) && { "x-amzn-iot-principal": input.principal! }), }; - let resolvedPath = "/principal-policies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/principal-policies"; const query: any = { ...(input.marker !== undefined && { marker: input.marker }), ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), ...(input.ascendingOrder !== undefined && { isAscendingOrder: input.ascendingOrder.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5669,16 +5777,16 @@ export const serializeAws_restJson1ListPrincipalThingsCommand = async ( input: ListPrincipalThingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.principal) && { "x-amzn-principal": input.principal! }), }; - let resolvedPath = "/principals/things"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/principals/things"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5695,14 +5803,14 @@ export const serializeAws_restJson1ListProvisioningTemplatesCommand = async ( input: ListProvisioningTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/provisioning-templates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/provisioning-templates"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5719,8 +5827,11 @@ export const serializeAws_restJson1ListProvisioningTemplateVersionsCommand = asy input: ListProvisioningTemplateVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/provisioning-templates/{templateName}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/provisioning-templates/{templateName}/versions"; if (input.templateName !== undefined) { const labelValue: string = input.templateName; if (labelValue.length <= 0) { @@ -5735,7 +5846,6 @@ export const serializeAws_restJson1ListProvisioningTemplateVersionsCommand = asy ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5752,15 +5862,15 @@ export const serializeAws_restJson1ListRoleAliasesCommand = async ( input: ListRoleAliasesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/role-aliases"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/role-aliases"; const query: any = { ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), ...(input.marker !== undefined && { marker: input.marker }), ...(input.ascendingOrder !== undefined && { isAscendingOrder: input.ascendingOrder.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5777,14 +5887,14 @@ export const serializeAws_restJson1ListScheduledAuditsCommand = async ( input: ListScheduledAuditsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/audit/scheduledaudits"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/scheduledaudits"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5801,8 +5911,9 @@ export const serializeAws_restJson1ListSecurityProfilesCommand = async ( input: ListSecurityProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/security-profiles"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/security-profiles"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -5810,7 +5921,6 @@ export const serializeAws_restJson1ListSecurityProfilesCommand = async ( ...(input.metricName !== undefined && { metricName: input.metricName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5827,8 +5937,10 @@ export const serializeAws_restJson1ListSecurityProfilesForTargetCommand = async input: ListSecurityProfilesForTargetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/security-profiles-for-target"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/security-profiles-for-target"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -5836,7 +5948,6 @@ export const serializeAws_restJson1ListSecurityProfilesForTargetCommand = async ...(input.securityProfileTargetArn !== undefined && { securityProfileTargetArn: input.securityProfileTargetArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5853,15 +5964,15 @@ export const serializeAws_restJson1ListStreamsCommand = async ( input: ListStreamsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/streams"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/streams"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.ascendingOrder !== undefined && { isAscendingOrder: input.ascendingOrder.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5878,14 +5989,14 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5902,8 +6013,10 @@ export const serializeAws_restJson1ListTargetsForPolicyCommand = async ( input: ListTargetsForPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policy-targets/{policyName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy-targets/{policyName}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -5918,7 +6031,6 @@ export const serializeAws_restJson1ListTargetsForPolicyCommand = async ( ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5935,8 +6047,11 @@ export const serializeAws_restJson1ListTargetsForSecurityProfileCommand = async input: ListTargetsForSecurityProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/security-profiles/{securityProfileName}/targets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/security-profiles/{securityProfileName}/targets"; if (input.securityProfileName !== undefined) { const labelValue: string = input.securityProfileName; if (labelValue.length <= 0) { @@ -5951,7 +6066,6 @@ export const serializeAws_restJson1ListTargetsForSecurityProfileCommand = async ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5968,8 +6082,9 @@ export const serializeAws_restJson1ListThingGroupsCommand = async ( input: ListThingGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-groups"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -5978,7 +6093,6 @@ export const serializeAws_restJson1ListThingGroupsCommand = async ( ...(input.recursive !== undefined && { recursive: input.recursive.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5995,8 +6109,10 @@ export const serializeAws_restJson1ListThingGroupsForThingCommand = async ( input: ListThingGroupsForThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}/thing-groups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/thing-groups"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -6011,7 +6127,6 @@ export const serializeAws_restJson1ListThingGroupsForThingCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6028,8 +6143,10 @@ export const serializeAws_restJson1ListThingPrincipalsCommand = async ( input: ListThingPrincipalsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things/{thingName}/principals"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/principals"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -6044,7 +6161,6 @@ export const serializeAws_restJson1ListThingPrincipalsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6061,8 +6177,11 @@ export const serializeAws_restJson1ListThingRegistrationTaskReportsCommand = asy input: ListThingRegistrationTaskReportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-registration-tasks/{taskId}/reports"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/thing-registration-tasks/{taskId}/reports"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -6078,7 +6197,6 @@ export const serializeAws_restJson1ListThingRegistrationTaskReportsCommand = asy ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6095,15 +6213,16 @@ export const serializeAws_restJson1ListThingRegistrationTasksCommand = async ( input: ListThingRegistrationTasksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-registration-tasks"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-registration-tasks"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.status !== undefined && { status: input.status }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6120,8 +6239,9 @@ export const serializeAws_restJson1ListThingsCommand = async ( input: ListThingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/things"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -6133,7 +6253,6 @@ export const serializeAws_restJson1ListThingsCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6150,8 +6269,10 @@ export const serializeAws_restJson1ListThingsInBillingGroupCommand = async ( input: ListThingsInBillingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/billing-groups/{billingGroupName}/things"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/billing-groups/{billingGroupName}/things"; if (input.billingGroupName !== undefined) { const labelValue: string = input.billingGroupName; if (labelValue.length <= 0) { @@ -6166,7 +6287,6 @@ export const serializeAws_restJson1ListThingsInBillingGroupCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6183,8 +6303,10 @@ export const serializeAws_restJson1ListThingsInThingGroupCommand = async ( input: ListThingsInThingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-groups/{thingGroupName}/things"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-groups/{thingGroupName}/things"; if (input.thingGroupName !== undefined) { const labelValue: string = input.thingGroupName; if (labelValue.length <= 0) { @@ -6200,7 +6322,6 @@ export const serializeAws_restJson1ListThingsInThingGroupCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6217,15 +6338,15 @@ export const serializeAws_restJson1ListThingTypesCommand = async ( input: ListThingTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-types"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-types"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.thingTypeName !== undefined && { thingTypeName: input.thingTypeName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6242,14 +6363,14 @@ export const serializeAws_restJson1ListTopicRuleDestinationsCommand = async ( input: ListTopicRuleDestinationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/destinations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/destinations"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6266,8 +6387,9 @@ export const serializeAws_restJson1ListTopicRulesCommand = async ( input: ListTopicRulesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/rules"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/rules"; const query: any = { ...(input.topic !== undefined && { topic: input.topic }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -6275,7 +6397,6 @@ export const serializeAws_restJson1ListTopicRulesCommand = async ( ...(input.ruleDisabled !== undefined && { ruleDisabled: input.ruleDisabled.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6292,15 +6413,15 @@ export const serializeAws_restJson1ListV2LoggingLevelsCommand = async ( input: ListV2LoggingLevelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2LoggingLevel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2LoggingLevel"; const query: any = { ...(input.targetType !== undefined && { targetType: input.targetType }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6317,8 +6438,9 @@ export const serializeAws_restJson1ListViolationEventsCommand = async ( input: ListViolationEventsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/violation-events"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/violation-events"; const query: any = { ...(input.startTime !== undefined && { startTime: (input.startTime.toISOString().split(".")[0] + "Z").toString() }), ...(input.endTime !== undefined && { endTime: (input.endTime.toISOString().split(".")[0] + "Z").toString() }), @@ -6330,7 +6452,6 @@ export const serializeAws_restJson1ListViolationEventsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6347,10 +6468,11 @@ export const serializeAws_restJson1RegisterCACertificateCommand = async ( input: RegisterCACertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/cacertificate"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cacertificate"; const query: any = { ...(input.setAsActive !== undefined && { setAsActive: input.setAsActive.toString() }), ...(input.allowAutoRegistration !== undefined && { allowAutoRegistration: input.allowAutoRegistration.toString() }), @@ -6367,7 +6489,6 @@ export const serializeAws_restJson1RegisterCACertificateCommand = async ( ...(input.verificationCertificate !== undefined && input.verificationCertificate !== null && { verificationCertificate: input.verificationCertificate }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6384,10 +6505,11 @@ export const serializeAws_restJson1RegisterCertificateCommand = async ( input: RegisterCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/certificate/register"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/certificate/register"; const query: any = { ...(input.setAsActive !== undefined && { setAsActive: input.setAsActive.toString() }), }; @@ -6399,7 +6521,6 @@ export const serializeAws_restJson1RegisterCertificateCommand = async ( input.certificatePem !== null && { certificatePem: input.certificatePem }), ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6416,17 +6537,18 @@ export const serializeAws_restJson1RegisterCertificateWithoutCACommand = async ( input: RegisterCertificateWithoutCACommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/certificate/register-no-ca"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/certificate/register-no-ca"; let body: any; body = JSON.stringify({ ...(input.certificatePem !== undefined && input.certificatePem !== null && { certificatePem: input.certificatePem }), ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6442,17 +6564,17 @@ export const serializeAws_restJson1RegisterThingCommand = async ( input: RegisterThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/things"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things"; let body: any; body = JSON.stringify({ ...(input.parameters !== undefined && input.parameters !== null && { parameters: serializeAws_restJson1Parameters(input.parameters, context) }), ...(input.templateBody !== undefined && input.templateBody !== null && { templateBody: input.templateBody }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6468,10 +6590,13 @@ export const serializeAws_restJson1RejectCertificateTransferCommand = async ( input: RejectCertificateTransferCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/reject-certificate-transfer/{certificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/reject-certificate-transfer/{certificateId}"; if (input.certificateId !== undefined) { const labelValue: string = input.certificateId; if (labelValue.length <= 0) { @@ -6485,7 +6610,6 @@ export const serializeAws_restJson1RejectCertificateTransferCommand = async ( body = JSON.stringify({ ...(input.rejectReason !== undefined && input.rejectReason !== null && { rejectReason: input.rejectReason }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6501,10 +6625,13 @@ export const serializeAws_restJson1RemoveThingFromBillingGroupCommand = async ( input: RemoveThingFromBillingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/billing-groups/removeThingFromBillingGroup"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/billing-groups/removeThingFromBillingGroup"; let body: any; body = JSON.stringify({ ...(input.billingGroupArn !== undefined && @@ -6514,7 +6641,6 @@ export const serializeAws_restJson1RemoveThingFromBillingGroupCommand = async ( ...(input.thingArn !== undefined && input.thingArn !== null && { thingArn: input.thingArn }), ...(input.thingName !== undefined && input.thingName !== null && { thingName: input.thingName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6530,10 +6656,12 @@ export const serializeAws_restJson1RemoveThingFromThingGroupCommand = async ( input: RemoveThingFromThingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/thing-groups/removeThingFromThingGroup"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-groups/removeThingFromThingGroup"; let body: any; body = JSON.stringify({ ...(input.thingArn !== undefined && input.thingArn !== null && { thingArn: input.thingArn }), @@ -6542,7 +6670,6 @@ export const serializeAws_restJson1RemoveThingFromThingGroupCommand = async ( input.thingGroupName !== null && { thingGroupName: input.thingGroupName }), ...(input.thingName !== undefined && input.thingName !== null && { thingName: input.thingName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6558,10 +6685,11 @@ export const serializeAws_restJson1ReplaceTopicRuleCommand = async ( input: ReplaceTopicRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/rules/{ruleName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/rules/{ruleName}"; if (input.ruleName !== undefined) { const labelValue: string = input.ruleName; if (labelValue.length <= 0) { @@ -6579,7 +6707,6 @@ export const serializeAws_restJson1ReplaceTopicRuleCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6595,10 +6722,11 @@ export const serializeAws_restJson1SearchIndexCommand = async ( input: SearchIndexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/indices/search"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/indices/search"; let body: any; body = JSON.stringify({ ...(input.indexName !== undefined && input.indexName !== null && { indexName: input.indexName }), @@ -6607,7 +6735,6 @@ export const serializeAws_restJson1SearchIndexCommand = async ( ...(input.queryString !== undefined && input.queryString !== null && { queryString: input.queryString }), ...(input.queryVersion !== undefined && input.queryVersion !== null && { queryVersion: input.queryVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6623,16 +6750,16 @@ export const serializeAws_restJson1SetDefaultAuthorizerCommand = async ( input: SetDefaultAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/default-authorizer"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/default-authorizer"; let body: any; body = JSON.stringify({ ...(input.authorizerName !== undefined && input.authorizerName !== null && { authorizerName: input.authorizerName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6648,8 +6775,11 @@ export const serializeAws_restJson1SetDefaultPolicyVersionCommand = async ( input: SetDefaultPolicyVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policies/{policyName}/version/{policyVersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/policies/{policyName}/version/{policyVersionId}"; if (input.policyName !== undefined) { const labelValue: string = input.policyName; if (labelValue.length <= 0) { @@ -6669,7 +6799,6 @@ export const serializeAws_restJson1SetDefaultPolicyVersionCommand = async ( throw new Error("No value provided for input HTTP label: policyVersionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6685,10 +6814,11 @@ export const serializeAws_restJson1SetLoggingOptionsCommand = async ( input: SetLoggingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/loggingOptions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/loggingOptions"; let body: any; if (input.loggingOptionsPayload !== undefined) { body = serializeAws_restJson1LoggingOptionsPayload(input.loggingOptionsPayload, context); @@ -6697,7 +6827,6 @@ export const serializeAws_restJson1SetLoggingOptionsCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6713,17 +6842,17 @@ export const serializeAws_restJson1SetV2LoggingLevelCommand = async ( input: SetV2LoggingLevelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2LoggingLevel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2LoggingLevel"; let body: any; body = JSON.stringify({ ...(input.logLevel !== undefined && input.logLevel !== null && { logLevel: input.logLevel }), ...(input.logTarget !== undefined && input.logTarget !== null && { logTarget: serializeAws_restJson1LogTarget(input.logTarget, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6739,10 +6868,11 @@ export const serializeAws_restJson1SetV2LoggingOptionsCommand = async ( input: SetV2LoggingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2LoggingOptions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2LoggingOptions"; let body: any; body = JSON.stringify({ ...(input.defaultLogLevel !== undefined && @@ -6751,7 +6881,6 @@ export const serializeAws_restJson1SetV2LoggingOptionsCommand = async ( input.disableAllLogs !== null && { disableAllLogs: input.disableAllLogs }), ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6767,10 +6896,12 @@ export const serializeAws_restJson1StartAuditMitigationActionsTaskCommand = asyn input: StartAuditMitigationActionsTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/mitigationactions/tasks/{taskId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/mitigationactions/tasks/{taskId}"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -6795,7 +6926,6 @@ export const serializeAws_restJson1StartAuditMitigationActionsTaskCommand = asyn target: serializeAws_restJson1AuditMitigationActionsTaskTarget(input.target, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6811,10 +6941,12 @@ export const serializeAws_restJson1StartDetectMitigationActionsTaskCommand = asy input: StartDetectMitigationActionsTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/detect/mitigationactions/tasks/{taskId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/detect/mitigationactions/tasks/{taskId}"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -6847,7 +6979,6 @@ export const serializeAws_restJson1StartDetectMitigationActionsTaskCommand = asy ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6863,10 +6994,11 @@ export const serializeAws_restJson1StartOnDemandAuditTaskCommand = async ( input: StartOnDemandAuditTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/tasks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/tasks"; let body: any; body = JSON.stringify({ ...(input.targetCheckNames !== undefined && @@ -6874,7 +7006,6 @@ export const serializeAws_restJson1StartOnDemandAuditTaskCommand = async ( targetCheckNames: serializeAws_restJson1TargetAuditCheckNames(input.targetCheckNames, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6890,10 +7021,12 @@ export const serializeAws_restJson1StartThingRegistrationTaskCommand = async ( input: StartThingRegistrationTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/thing-registration-tasks"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-registration-tasks"; let body: any; body = JSON.stringify({ ...(input.inputFileBucket !== undefined && @@ -6902,7 +7035,6 @@ export const serializeAws_restJson1StartThingRegistrationTaskCommand = async ( ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), ...(input.templateBody !== undefined && input.templateBody !== null && { templateBody: input.templateBody }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6918,8 +7050,10 @@ export const serializeAws_restJson1StopThingRegistrationTaskCommand = async ( input: StopThingRegistrationTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/thing-registration-tasks/{taskId}/cancel"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-registration-tasks/{taskId}/cancel"; if (input.taskId !== undefined) { const labelValue: string = input.taskId; if (labelValue.length <= 0) { @@ -6930,7 +7064,6 @@ export const serializeAws_restJson1StopThingRegistrationTaskCommand = async ( throw new Error("No value provided for input HTTP label: taskId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6946,17 +7079,17 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; let body: any; body = JSON.stringify({ ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -6972,10 +7105,11 @@ export const serializeAws_restJson1TestAuthorizationCommand = async ( input: TestAuthorizationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/test-authorization"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/test-authorization"; const query: any = { ...(input.clientId !== undefined && { clientId: input.clientId }), }; @@ -6995,7 +7129,6 @@ export const serializeAws_restJson1TestAuthorizationCommand = async ( }), ...(input.principal !== undefined && input.principal !== null && { principal: input.principal }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7012,10 +7145,12 @@ export const serializeAws_restJson1TestInvokeAuthorizerCommand = async ( input: TestInvokeAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/authorizer/{authorizerName}/test"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/authorizer/{authorizerName}/test"; if (input.authorizerName !== undefined) { const labelValue: string = input.authorizerName; if (labelValue.length <= 0) { @@ -7037,7 +7172,6 @@ export const serializeAws_restJson1TestInvokeAuthorizerCommand = async ( ...(input.tokenSignature !== undefined && input.tokenSignature !== null && { tokenSignature: input.tokenSignature }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7053,10 +7187,12 @@ export const serializeAws_restJson1TransferCertificateCommand = async ( input: TransferCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/transfer-certificate/{certificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/transfer-certificate/{certificateId}"; if (input.certificateId !== undefined) { const labelValue: string = input.certificateId; if (labelValue.length <= 0) { @@ -7074,7 +7210,6 @@ export const serializeAws_restJson1TransferCertificateCommand = async ( ...(input.transferMessage !== undefined && input.transferMessage !== null && { transferMessage: input.transferMessage }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7091,17 +7226,17 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/untag"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/untag"; let body: any; body = JSON.stringify({ ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), ...(input.tagKeys !== undefined && input.tagKeys !== null && { tagKeys: serializeAws_restJson1TagKeyList(input.tagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7117,10 +7252,11 @@ export const serializeAws_restJson1UpdateAccountAuditConfigurationCommand = asyn input: UpdateAccountAuditConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/configuration"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/configuration"; let body: any; body = JSON.stringify({ ...(input.auditCheckConfigurations !== undefined && @@ -7139,7 +7275,6 @@ export const serializeAws_restJson1UpdateAccountAuditConfigurationCommand = asyn }), ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7155,10 +7290,12 @@ export const serializeAws_restJson1UpdateAuditSuppressionCommand = async ( input: UpdateAuditSuppressionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/suppressions/update"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/audit/suppressions/update"; let body: any; body = JSON.stringify({ ...(input.checkName !== undefined && input.checkName !== null && { checkName: input.checkName }), @@ -7172,7 +7309,6 @@ export const serializeAws_restJson1UpdateAuditSuppressionCommand = async ( ...(input.suppressIndefinitely !== undefined && input.suppressIndefinitely !== null && { suppressIndefinitely: input.suppressIndefinitely }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7188,10 +7324,12 @@ export const serializeAws_restJson1UpdateAuthorizerCommand = async ( input: UpdateAuthorizerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/authorizer/{authorizerName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/authorizer/{authorizerName}"; if (input.authorizerName !== undefined) { const labelValue: string = input.authorizerName; if (labelValue.length <= 0) { @@ -7212,7 +7350,6 @@ export const serializeAws_restJson1UpdateAuthorizerCommand = async ( tokenSigningPublicKeys: serializeAws_restJson1PublicKeyMap(input.tokenSigningPublicKeys, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7228,10 +7365,12 @@ export const serializeAws_restJson1UpdateBillingGroupCommand = async ( input: UpdateBillingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/billing-groups/{billingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/billing-groups/{billingGroupName}"; if (input.billingGroupName !== undefined) { const labelValue: string = input.billingGroupName; if (labelValue.length <= 0) { @@ -7250,7 +7389,6 @@ export const serializeAws_restJson1UpdateBillingGroupCommand = async ( ...(input.expectedVersion !== undefined && input.expectedVersion !== null && { expectedVersion: input.expectedVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7266,10 +7404,12 @@ export const serializeAws_restJson1UpdateCACertificateCommand = async ( input: UpdateCACertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/cacertificate/{certificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cacertificate/{certificateId}"; if (input.certificateId !== undefined) { const labelValue: string = input.certificateId; if (labelValue.length <= 0) { @@ -7294,7 +7434,6 @@ export const serializeAws_restJson1UpdateCACertificateCommand = async ( ...(input.removeAutoRegistration !== undefined && input.removeAutoRegistration !== null && { removeAutoRegistration: input.removeAutoRegistration }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7311,8 +7450,10 @@ export const serializeAws_restJson1UpdateCertificateCommand = async ( input: UpdateCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/certificates/{certificateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/certificates/{certificateId}"; if (input.certificateId !== undefined) { const labelValue: string = input.certificateId; if (labelValue.length <= 0) { @@ -7326,7 +7467,6 @@ export const serializeAws_restJson1UpdateCertificateCommand = async ( ...(input.newStatus !== undefined && { newStatus: input.newStatus }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7343,10 +7483,12 @@ export const serializeAws_restJson1UpdateCustomMetricCommand = async ( input: UpdateCustomMetricCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/custom-metric/{metricName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-metric/{metricName}"; if (input.metricName !== undefined) { const labelValue: string = input.metricName; if (labelValue.length <= 0) { @@ -7360,7 +7502,6 @@ export const serializeAws_restJson1UpdateCustomMetricCommand = async ( body = JSON.stringify({ ...(input.displayName !== undefined && input.displayName !== null && { displayName: input.displayName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7376,10 +7517,11 @@ export const serializeAws_restJson1UpdateDimensionCommand = async ( input: UpdateDimensionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/dimensions/{name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dimensions/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -7396,7 +7538,6 @@ export const serializeAws_restJson1UpdateDimensionCommand = async ( stringValues: serializeAws_restJson1DimensionStringValues(input.stringValues, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7412,10 +7553,13 @@ export const serializeAws_restJson1UpdateDomainConfigurationCommand = async ( input: UpdateDomainConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/domainConfigurations/{domainConfigurationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/domainConfigurations/{domainConfigurationName}"; if (input.domainConfigurationName !== undefined) { const labelValue: string = input.domainConfigurationName; if (labelValue.length <= 0) { @@ -7436,7 +7580,6 @@ export const serializeAws_restJson1UpdateDomainConfigurationCommand = async ( ...(input.removeAuthorizerConfig !== undefined && input.removeAuthorizerConfig !== null && { removeAuthorizerConfig: input.removeAuthorizerConfig }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7452,10 +7595,12 @@ export const serializeAws_restJson1UpdateDynamicThingGroupCommand = async ( input: UpdateDynamicThingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/dynamic-thing-groups/{thingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dynamic-thing-groups/{thingGroupName}"; if (input.thingGroupName !== undefined) { const labelValue: string = input.thingGroupName; if (labelValue.length <= 0) { @@ -7477,7 +7622,6 @@ export const serializeAws_restJson1UpdateDynamicThingGroupCommand = async ( thingGroupProperties: serializeAws_restJson1ThingGroupProperties(input.thingGroupProperties, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7493,10 +7637,11 @@ export const serializeAws_restJson1UpdateEventConfigurationsCommand = async ( input: UpdateEventConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/event-configurations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/event-configurations"; let body: any; body = JSON.stringify({ ...(input.eventConfigurations !== undefined && @@ -7504,7 +7649,6 @@ export const serializeAws_restJson1UpdateEventConfigurationsCommand = async ( eventConfigurations: serializeAws_restJson1EventConfigurations(input.eventConfigurations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7520,10 +7664,11 @@ export const serializeAws_restJson1UpdateIndexingConfigurationCommand = async ( input: UpdateIndexingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/indexing/config"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/indexing/config"; let body: any; body = JSON.stringify({ ...(input.thingGroupIndexingConfiguration !== undefined && @@ -7541,7 +7686,6 @@ export const serializeAws_restJson1UpdateIndexingConfigurationCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7557,10 +7701,11 @@ export const serializeAws_restJson1UpdateJobCommand = async ( input: UpdateJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/jobs/{jobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -7594,7 +7739,6 @@ export const serializeAws_restJson1UpdateJobCommand = async ( timeoutConfig: serializeAws_restJson1TimeoutConfig(input.timeoutConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7611,10 +7755,12 @@ export const serializeAws_restJson1UpdateMitigationActionCommand = async ( input: UpdateMitigationActionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/mitigationactions/actions/{actionName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/mitigationactions/actions/{actionName}"; if (input.actionName !== undefined) { const labelValue: string = input.actionName; if (labelValue.length <= 0) { @@ -7632,7 +7778,6 @@ export const serializeAws_restJson1UpdateMitigationActionCommand = async ( }), ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7648,10 +7793,12 @@ export const serializeAws_restJson1UpdateProvisioningTemplateCommand = async ( input: UpdateProvisioningTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/provisioning-templates/{templateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/provisioning-templates/{templateName}"; if (input.templateName !== undefined) { const labelValue: string = input.templateName; if (labelValue.length <= 0) { @@ -7676,7 +7823,6 @@ export const serializeAws_restJson1UpdateProvisioningTemplateCommand = async ( ...(input.removePreProvisioningHook !== undefined && input.removePreProvisioningHook !== null && { removePreProvisioningHook: input.removePreProvisioningHook }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7692,10 +7838,12 @@ export const serializeAws_restJson1UpdateRoleAliasCommand = async ( input: UpdateRoleAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/role-aliases/{roleAlias}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/role-aliases/{roleAlias}"; if (input.roleAlias !== undefined) { const labelValue: string = input.roleAlias; if (labelValue.length <= 0) { @@ -7711,7 +7859,6 @@ export const serializeAws_restJson1UpdateRoleAliasCommand = async ( input.credentialDurationSeconds !== null && { credentialDurationSeconds: input.credentialDurationSeconds }), ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7727,10 +7874,13 @@ export const serializeAws_restJson1UpdateScheduledAuditCommand = async ( input: UpdateScheduledAuditCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/audit/scheduledaudits/{scheduledAuditName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/audit/scheduledaudits/{scheduledAuditName}"; if (input.scheduledAuditName !== undefined) { const labelValue: string = input.scheduledAuditName; if (labelValue.length <= 0) { @@ -7750,7 +7900,6 @@ export const serializeAws_restJson1UpdateScheduledAuditCommand = async ( targetCheckNames: serializeAws_restJson1TargetAuditCheckNames(input.targetCheckNames, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7766,10 +7915,12 @@ export const serializeAws_restJson1UpdateSecurityProfileCommand = async ( input: UpdateSecurityProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/security-profiles/{securityProfileName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/security-profiles/{securityProfileName}"; if (input.securityProfileName !== undefined) { const labelValue: string = input.securityProfileName; if (labelValue.length <= 0) { @@ -7813,7 +7964,6 @@ export const serializeAws_restJson1UpdateSecurityProfileCommand = async ( ...(input.securityProfileDescription !== undefined && input.securityProfileDescription !== null && { securityProfileDescription: input.securityProfileDescription }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7830,10 +7980,11 @@ export const serializeAws_restJson1UpdateStreamCommand = async ( input: UpdateStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/streams/{streamId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/streams/{streamId}"; if (input.streamId !== undefined) { const labelValue: string = input.streamId; if (labelValue.length <= 0) { @@ -7850,7 +8001,6 @@ export const serializeAws_restJson1UpdateStreamCommand = async ( input.files !== null && { files: serializeAws_restJson1StreamFiles(input.files, context) }), ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7866,10 +8016,11 @@ export const serializeAws_restJson1UpdateThingCommand = async ( input: UpdateThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/things/{thingName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}"; if (input.thingName !== undefined) { const labelValue: string = input.thingName; if (labelValue.length <= 0) { @@ -7891,7 +8042,6 @@ export const serializeAws_restJson1UpdateThingCommand = async ( input.removeThingType !== null && { removeThingType: input.removeThingType }), ...(input.thingTypeName !== undefined && input.thingTypeName !== null && { thingTypeName: input.thingTypeName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7907,10 +8057,12 @@ export const serializeAws_restJson1UpdateThingGroupCommand = async ( input: UpdateThingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/thing-groups/{thingGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-groups/{thingGroupName}"; if (input.thingGroupName !== undefined) { const labelValue: string = input.thingGroupName; if (labelValue.length <= 0) { @@ -7929,7 +8081,6 @@ export const serializeAws_restJson1UpdateThingGroupCommand = async ( thingGroupProperties: serializeAws_restJson1ThingGroupProperties(input.thingGroupProperties, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7945,10 +8096,12 @@ export const serializeAws_restJson1UpdateThingGroupsForThingCommand = async ( input: UpdateThingGroupsForThingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/thing-groups/updateThingGroupsForThing"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/thing-groups/updateThingGroupsForThing"; let body: any; body = JSON.stringify({ ...(input.overrideDynamicGroups !== undefined && @@ -7963,7 +8116,6 @@ export const serializeAws_restJson1UpdateThingGroupsForThingCommand = async ( }), ...(input.thingName !== undefined && input.thingName !== null && { thingName: input.thingName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -7979,16 +8131,16 @@ export const serializeAws_restJson1UpdateTopicRuleDestinationCommand = async ( input: UpdateTopicRuleDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/destinations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/destinations"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -8004,16 +8156,17 @@ export const serializeAws_restJson1ValidateSecurityProfileBehaviorsCommand = asy input: ValidateSecurityProfileBehaviorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/security-profile-behaviors/validate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/security-profile-behaviors/validate"; let body: any; body = JSON.stringify({ ...(input.behaviors !== undefined && input.behaviors !== null && { behaviors: serializeAws_restJson1Behaviors(input.behaviors, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iotanalytics/protocols/Aws_restJson1.ts b/clients/client-iotanalytics/protocols/Aws_restJson1.ts index 9315254d9c376..7bfdddce60866 100644 --- a/clients/client-iotanalytics/protocols/Aws_restJson1.ts +++ b/clients/client-iotanalytics/protocols/Aws_restJson1.ts @@ -161,17 +161,17 @@ export const serializeAws_restJson1BatchPutMessageCommand = async ( input: BatchPutMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/messages/batch"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/messages/batch"; let body: any; body = JSON.stringify({ ...(input.channelName !== undefined && input.channelName !== null && { channelName: input.channelName }), ...(input.messages !== undefined && input.messages !== null && { messages: serializeAws_restJson1Messages(input.messages, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -187,8 +187,11 @@ export const serializeAws_restJson1CancelPipelineReprocessingCommand = async ( input: CancelPipelineReprocessingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/pipelines/{pipelineName}/reprocessing/{reprocessingId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/pipelines/{pipelineName}/reprocessing/{reprocessingId}"; if (input.pipelineName !== undefined) { const labelValue: string = input.pipelineName; if (labelValue.length <= 0) { @@ -208,7 +211,6 @@ export const serializeAws_restJson1CancelPipelineReprocessingCommand = async ( throw new Error("No value provided for input HTTP label: reprocessingId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -224,10 +226,11 @@ export const serializeAws_restJson1CreateChannelCommand = async ( input: CreateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; let body: any; body = JSON.stringify({ ...(input.channelName !== undefined && input.channelName !== null && { channelName: input.channelName }), @@ -242,7 +245,6 @@ export const serializeAws_restJson1CreateChannelCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -258,10 +260,11 @@ export const serializeAws_restJson1CreateDatasetCommand = async ( input: CreateDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datasets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets"; let body: any; body = JSON.stringify({ ...(input.actions !== undefined && @@ -288,7 +291,6 @@ export const serializeAws_restJson1CreateDatasetCommand = async ( versioningConfiguration: serializeAws_restJson1VersioningConfiguration(input.versioningConfiguration, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -304,10 +306,12 @@ export const serializeAws_restJson1CreateDatasetContentCommand = async ( input: CreateDatasetContentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datasets/{datasetName}/content"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{datasetName}/content"; if (input.datasetName !== undefined) { const labelValue: string = input.datasetName; if (labelValue.length <= 0) { @@ -321,7 +325,6 @@ export const serializeAws_restJson1CreateDatasetContentCommand = async ( body = JSON.stringify({ ...(input.versionId !== undefined && input.versionId !== null && { versionId: input.versionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -337,10 +340,11 @@ export const serializeAws_restJson1CreateDatastoreCommand = async ( input: CreateDatastoreCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datastores"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datastores"; let body: any; body = JSON.stringify({ ...(input.datastoreName !== undefined && input.datastoreName !== null && { datastoreName: input.datastoreName }), @@ -363,7 +367,6 @@ export const serializeAws_restJson1CreateDatastoreCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -379,10 +382,11 @@ export const serializeAws_restJson1CreatePipelineCommand = async ( input: CreatePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/pipelines"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/pipelines"; let body: any; body = JSON.stringify({ ...(input.pipelineActivities !== undefined && @@ -393,7 +397,6 @@ export const serializeAws_restJson1CreatePipelineCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -409,8 +412,9 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( input: DeleteChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels/{channelName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{channelName}"; if (input.channelName !== undefined) { const labelValue: string = input.channelName; if (labelValue.length <= 0) { @@ -421,7 +425,6 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( throw new Error("No value provided for input HTTP label: channelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -437,8 +440,9 @@ export const serializeAws_restJson1DeleteDatasetCommand = async ( input: DeleteDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datasets/{datasetName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{datasetName}"; if (input.datasetName !== undefined) { const labelValue: string = input.datasetName; if (labelValue.length <= 0) { @@ -449,7 +453,6 @@ export const serializeAws_restJson1DeleteDatasetCommand = async ( throw new Error("No value provided for input HTTP label: datasetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -465,8 +468,10 @@ export const serializeAws_restJson1DeleteDatasetContentCommand = async ( input: DeleteDatasetContentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datasets/{datasetName}/content"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{datasetName}/content"; if (input.datasetName !== undefined) { const labelValue: string = input.datasetName; if (labelValue.length <= 0) { @@ -480,7 +485,6 @@ export const serializeAws_restJson1DeleteDatasetContentCommand = async ( ...(input.versionId !== undefined && { versionId: input.versionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -497,8 +501,10 @@ export const serializeAws_restJson1DeleteDatastoreCommand = async ( input: DeleteDatastoreCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datastores/{datastoreName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datastores/{datastoreName}"; if (input.datastoreName !== undefined) { const labelValue: string = input.datastoreName; if (labelValue.length <= 0) { @@ -509,7 +515,6 @@ export const serializeAws_restJson1DeleteDatastoreCommand = async ( throw new Error("No value provided for input HTTP label: datastoreName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -525,8 +530,10 @@ export const serializeAws_restJson1DeletePipelineCommand = async ( input: DeletePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/pipelines/{pipelineName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/pipelines/{pipelineName}"; if (input.pipelineName !== undefined) { const labelValue: string = input.pipelineName; if (labelValue.length <= 0) { @@ -537,7 +544,6 @@ export const serializeAws_restJson1DeletePipelineCommand = async ( throw new Error("No value provided for input HTTP label: pipelineName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -553,8 +559,9 @@ export const serializeAws_restJson1DescribeChannelCommand = async ( input: DescribeChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels/{channelName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{channelName}"; if (input.channelName !== undefined) { const labelValue: string = input.channelName; if (labelValue.length <= 0) { @@ -568,7 +575,6 @@ export const serializeAws_restJson1DescribeChannelCommand = async ( ...(input.includeStatistics !== undefined && { includeStatistics: input.includeStatistics.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -585,8 +591,9 @@ export const serializeAws_restJson1DescribeDatasetCommand = async ( input: DescribeDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datasets/{datasetName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{datasetName}"; if (input.datasetName !== undefined) { const labelValue: string = input.datasetName; if (labelValue.length <= 0) { @@ -597,7 +604,6 @@ export const serializeAws_restJson1DescribeDatasetCommand = async ( throw new Error("No value provided for input HTTP label: datasetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -613,8 +619,10 @@ export const serializeAws_restJson1DescribeDatastoreCommand = async ( input: DescribeDatastoreCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datastores/{datastoreName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datastores/{datastoreName}"; if (input.datastoreName !== undefined) { const labelValue: string = input.datastoreName; if (labelValue.length <= 0) { @@ -628,7 +636,6 @@ export const serializeAws_restJson1DescribeDatastoreCommand = async ( ...(input.includeStatistics !== undefined && { includeStatistics: input.includeStatistics.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -645,13 +652,13 @@ export const serializeAws_restJson1DescribeLoggingOptionsCommand = async ( input: DescribeLoggingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/logging"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/logging"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -667,8 +674,10 @@ export const serializeAws_restJson1DescribePipelineCommand = async ( input: DescribePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/pipelines/{pipelineName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/pipelines/{pipelineName}"; if (input.pipelineName !== undefined) { const labelValue: string = input.pipelineName; if (labelValue.length <= 0) { @@ -679,7 +688,6 @@ export const serializeAws_restJson1DescribePipelineCommand = async ( throw new Error("No value provided for input HTTP label: pipelineName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -695,8 +703,10 @@ export const serializeAws_restJson1GetDatasetContentCommand = async ( input: GetDatasetContentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datasets/{datasetName}/content"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{datasetName}/content"; if (input.datasetName !== undefined) { const labelValue: string = input.datasetName; if (labelValue.length <= 0) { @@ -710,7 +720,6 @@ export const serializeAws_restJson1GetDatasetContentCommand = async ( ...(input.versionId !== undefined && { versionId: input.versionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -727,14 +736,14 @@ export const serializeAws_restJson1ListChannelsCommand = async ( input: ListChannelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -751,8 +760,10 @@ export const serializeAws_restJson1ListDatasetContentsCommand = async ( input: ListDatasetContentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datasets/{datasetName}/contents"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{datasetName}/contents"; if (input.datasetName !== undefined) { const labelValue: string = input.datasetName; if (labelValue.length <= 0) { @@ -773,7 +784,6 @@ export const serializeAws_restJson1ListDatasetContentsCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -790,14 +800,14 @@ export const serializeAws_restJson1ListDatasetsCommand = async ( input: ListDatasetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datasets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -814,14 +824,14 @@ export const serializeAws_restJson1ListDatastoresCommand = async ( input: ListDatastoresCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/datastores"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datastores"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -838,14 +848,14 @@ export const serializeAws_restJson1ListPipelinesCommand = async ( input: ListPipelinesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/pipelines"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/pipelines"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -862,13 +872,13 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -885,10 +895,11 @@ export const serializeAws_restJson1PutLoggingOptionsCommand = async ( input: PutLoggingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/logging"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/logging"; let body: any; body = JSON.stringify({ ...(input.loggingOptions !== undefined && @@ -896,7 +907,6 @@ export const serializeAws_restJson1PutLoggingOptionsCommand = async ( loggingOptions: serializeAws_restJson1LoggingOptions(input.loggingOptions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -912,10 +922,11 @@ export const serializeAws_restJson1RunPipelineActivityCommand = async ( input: RunPipelineActivityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/pipelineactivities/run"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/pipelineactivities/run"; let body: any; body = JSON.stringify({ ...(input.payloads !== undefined && @@ -925,7 +936,6 @@ export const serializeAws_restJson1RunPipelineActivityCommand = async ( pipelineActivity: serializeAws_restJson1PipelineActivity(input.pipelineActivity, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -941,8 +951,10 @@ export const serializeAws_restJson1SampleChannelDataCommand = async ( input: SampleChannelDataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels/{channelName}/sample"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{channelName}/sample"; if (input.channelName !== undefined) { const labelValue: string = input.channelName; if (labelValue.length <= 0) { @@ -958,7 +970,6 @@ export const serializeAws_restJson1SampleChannelDataCommand = async ( ...(input.endTime !== undefined && { endTime: (input.endTime.toISOString().split(".")[0] + "Z").toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -975,10 +986,12 @@ export const serializeAws_restJson1StartPipelineReprocessingCommand = async ( input: StartPipelineReprocessingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/pipelines/{pipelineName}/reprocessing"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/pipelines/{pipelineName}/reprocessing"; if (input.pipelineName !== undefined) { const labelValue: string = input.pipelineName; if (labelValue.length <= 0) { @@ -999,7 +1012,6 @@ export const serializeAws_restJson1StartPipelineReprocessingCommand = async ( ...(input.startTime !== undefined && input.startTime !== null && { startTime: Math.round(input.startTime.getTime() / 1000) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1015,10 +1027,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; @@ -1027,7 +1040,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1044,14 +1056,14 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1068,10 +1080,11 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( input: UpdateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channels/{channelName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{channelName}"; if (input.channelName !== undefined) { const labelValue: string = input.channelName; if (labelValue.length <= 0) { @@ -1092,7 +1105,6 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( retentionPeriod: serializeAws_restJson1RetentionPeriod(input.retentionPeriod, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1108,10 +1120,11 @@ export const serializeAws_restJson1UpdateDatasetCommand = async ( input: UpdateDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datasets/{datasetName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasets/{datasetName}"; if (input.datasetName !== undefined) { const labelValue: string = input.datasetName; if (labelValue.length <= 0) { @@ -1144,7 +1157,6 @@ export const serializeAws_restJson1UpdateDatasetCommand = async ( versioningConfiguration: serializeAws_restJson1VersioningConfiguration(input.versioningConfiguration, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1160,10 +1172,12 @@ export const serializeAws_restJson1UpdateDatastoreCommand = async ( input: UpdateDatastoreCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datastores/{datastoreName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datastores/{datastoreName}"; if (input.datastoreName !== undefined) { const labelValue: string = input.datastoreName; if (labelValue.length <= 0) { @@ -1188,7 +1202,6 @@ export const serializeAws_restJson1UpdateDatastoreCommand = async ( retentionPeriod: serializeAws_restJson1RetentionPeriod(input.retentionPeriod, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1204,10 +1217,12 @@ export const serializeAws_restJson1UpdatePipelineCommand = async ( input: UpdatePipelineCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/pipelines/{pipelineName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/pipelines/{pipelineName}"; if (input.pipelineName !== undefined) { const labelValue: string = input.pipelineName; if (labelValue.length <= 0) { @@ -1224,7 +1239,6 @@ export const serializeAws_restJson1UpdatePipelineCommand = async ( pipelineActivities: serializeAws_restJson1PipelineActivities(input.pipelineActivities, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iotdeviceadvisor/protocols/Aws_restJson1.ts b/clients/client-iotdeviceadvisor/protocols/Aws_restJson1.ts index 61fa07adf4958..d0a6c19e383c8 100644 --- a/clients/client-iotdeviceadvisor/protocols/Aws_restJson1.ts +++ b/clients/client-iotdeviceadvisor/protocols/Aws_restJson1.ts @@ -59,10 +59,11 @@ export const serializeAws_restJson1CreateSuiteDefinitionCommand = async ( input: CreateSuiteDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/suiteDefinitions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/suiteDefinitions"; let body: any; body = JSON.stringify({ ...(input.suiteDefinitionConfiguration !== undefined && @@ -74,7 +75,6 @@ export const serializeAws_restJson1CreateSuiteDefinitionCommand = async ( }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -90,8 +90,10 @@ export const serializeAws_restJson1DeleteSuiteDefinitionCommand = async ( input: DeleteSuiteDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/suiteDefinitions/{suiteDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/suiteDefinitions/{suiteDefinitionId}"; if (input.suiteDefinitionId !== undefined) { const labelValue: string = input.suiteDefinitionId; if (labelValue.length <= 0) { @@ -102,7 +104,6 @@ export const serializeAws_restJson1DeleteSuiteDefinitionCommand = async ( throw new Error("No value provided for input HTTP label: suiteDefinitionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -118,8 +119,10 @@ export const serializeAws_restJson1GetSuiteDefinitionCommand = async ( input: GetSuiteDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/suiteDefinitions/{suiteDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/suiteDefinitions/{suiteDefinitionId}"; if (input.suiteDefinitionId !== undefined) { const labelValue: string = input.suiteDefinitionId; if (labelValue.length <= 0) { @@ -133,7 +136,6 @@ export const serializeAws_restJson1GetSuiteDefinitionCommand = async ( ...(input.suiteDefinitionVersion !== undefined && { suiteDefinitionVersion: input.suiteDefinitionVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -150,8 +152,11 @@ export const serializeAws_restJson1GetSuiteRunCommand = async ( input: GetSuiteRunCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/suiteDefinitions/{suiteDefinitionId}/suiteRuns/{suiteRunId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/suiteDefinitions/{suiteDefinitionId}/suiteRuns/{suiteRunId}"; if (input.suiteDefinitionId !== undefined) { const labelValue: string = input.suiteDefinitionId; if (labelValue.length <= 0) { @@ -171,7 +176,6 @@ export const serializeAws_restJson1GetSuiteRunCommand = async ( throw new Error("No value provided for input HTTP label: suiteRunId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -187,8 +191,11 @@ export const serializeAws_restJson1GetSuiteRunReportCommand = async ( input: GetSuiteRunReportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/suiteDefinitions/{suiteDefinitionId}/suiteRuns/{suiteRunId}/report"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/suiteDefinitions/{suiteDefinitionId}/suiteRuns/{suiteRunId}/report"; if (input.suiteDefinitionId !== undefined) { const labelValue: string = input.suiteDefinitionId; if (labelValue.length <= 0) { @@ -208,7 +215,6 @@ export const serializeAws_restJson1GetSuiteRunReportCommand = async ( throw new Error("No value provided for input HTTP label: suiteRunId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -224,14 +230,14 @@ export const serializeAws_restJson1ListSuiteDefinitionsCommand = async ( input: ListSuiteDefinitionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/suiteDefinitions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/suiteDefinitions"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -248,8 +254,9 @@ export const serializeAws_restJson1ListSuiteRunsCommand = async ( input: ListSuiteRunsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/suiteRuns"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/suiteRuns"; const query: any = { ...(input.suiteDefinitionId !== undefined && { suiteDefinitionId: input.suiteDefinitionId }), ...(input.suiteDefinitionVersion !== undefined && { suiteDefinitionVersion: input.suiteDefinitionVersion }), @@ -257,7 +264,6 @@ export const serializeAws_restJson1ListSuiteRunsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -274,8 +280,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -286,7 +293,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -302,10 +308,13 @@ export const serializeAws_restJson1StartSuiteRunCommand = async ( input: StartSuiteRunCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/suiteDefinitions/{suiteDefinitionId}/suiteRuns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/suiteDefinitions/{suiteDefinitionId}/suiteRuns"; if (input.suiteDefinitionId !== undefined) { const labelValue: string = input.suiteDefinitionId; if (labelValue.length <= 0) { @@ -325,7 +334,6 @@ export const serializeAws_restJson1StartSuiteRunCommand = async ( }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -341,8 +349,11 @@ export const serializeAws_restJson1StopSuiteRunCommand = async ( input: StopSuiteRunCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/suiteDefinitions/{suiteDefinitionId}/suiteRuns/{suiteRunId}/stop"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/suiteDefinitions/{suiteDefinitionId}/suiteRuns/{suiteRunId}/stop"; if (input.suiteDefinitionId !== undefined) { const labelValue: string = input.suiteDefinitionId; if (labelValue.length <= 0) { @@ -362,7 +373,6 @@ export const serializeAws_restJson1StopSuiteRunCommand = async ( throw new Error("No value provided for input HTTP label: suiteRunId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -378,10 +388,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -395,7 +406,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -411,8 +421,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -426,7 +437,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -443,10 +453,12 @@ export const serializeAws_restJson1UpdateSuiteDefinitionCommand = async ( input: UpdateSuiteDefinitionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/suiteDefinitions/{suiteDefinitionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/suiteDefinitions/{suiteDefinitionId}"; if (input.suiteDefinitionId !== undefined) { const labelValue: string = input.suiteDefinitionId; if (labelValue.length <= 0) { @@ -466,7 +478,6 @@ export const serializeAws_restJson1UpdateSuiteDefinitionCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iotfleethub/protocols/Aws_restJson1.ts b/clients/client-iotfleethub/protocols/Aws_restJson1.ts index b36bc49d9cc06..3c95b70962197 100644 --- a/clients/client-iotfleethub/protocols/Aws_restJson1.ts +++ b/clients/client-iotfleethub/protocols/Aws_restJson1.ts @@ -40,10 +40,11 @@ export const serializeAws_restJson1CreateApplicationCommand = async ( input: CreateApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications"; let body: any; body = JSON.stringify({ ...(input.applicationDescription !== undefined && @@ -54,7 +55,6 @@ export const serializeAws_restJson1CreateApplicationCommand = async ( ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -70,8 +70,10 @@ export const serializeAws_restJson1DeleteApplicationCommand = async ( input: DeleteApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{applicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{applicationId}"; if (input.applicationId !== undefined) { const labelValue: string = input.applicationId; if (labelValue.length <= 0) { @@ -85,7 +87,6 @@ export const serializeAws_restJson1DeleteApplicationCommand = async ( ...(input.clientToken !== undefined && { clientToken: input.clientToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -102,8 +103,10 @@ export const serializeAws_restJson1DescribeApplicationCommand = async ( input: DescribeApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{applicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{applicationId}"; if (input.applicationId !== undefined) { const labelValue: string = input.applicationId; if (labelValue.length <= 0) { @@ -114,7 +117,6 @@ export const serializeAws_restJson1DescribeApplicationCommand = async ( throw new Error("No value provided for input HTTP label: applicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -130,13 +132,13 @@ export const serializeAws_restJson1ListApplicationsCommand = async ( input: ListApplicationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -153,8 +155,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -165,7 +168,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -181,10 +183,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -198,7 +201,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -214,8 +216,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -229,7 +232,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -246,10 +248,12 @@ export const serializeAws_restJson1UpdateApplicationCommand = async ( input: UpdateApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{applicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{applicationId}"; if (input.applicationId !== undefined) { const labelValue: string = input.applicationId; if (labelValue.length <= 0) { @@ -267,7 +271,6 @@ export const serializeAws_restJson1UpdateApplicationCommand = async ( input.applicationName !== null && { applicationName: input.applicationName }), clientToken: input.clientToken ?? generateIdempotencyToken(), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-iotsitewise/protocols/Aws_restJson1.ts b/clients/client-iotsitewise/protocols/Aws_restJson1.ts index 73ec1a83eec88..fa37323b95324 100644 --- a/clients/client-iotsitewise/protocols/Aws_restJson1.ts +++ b/clients/client-iotsitewise/protocols/Aws_restJson1.ts @@ -212,10 +212,12 @@ export const serializeAws_restJson1AssociateAssetsCommand = async ( input: AssociateAssetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assets/{assetId}/associate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{assetId}/associate"; if (input.assetId !== undefined) { const labelValue: string = input.assetId; if (labelValue.length <= 0) { @@ -238,7 +240,6 @@ export const serializeAws_restJson1AssociateAssetsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -254,10 +255,12 @@ export const serializeAws_restJson1BatchAssociateProjectAssetsCommand = async ( input: BatchAssociateProjectAssetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects/{projectId}/assets/associate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectId}/assets/associate"; if (input.projectId !== undefined) { const labelValue: string = input.projectId; if (labelValue.length <= 0) { @@ -280,7 +283,6 @@ export const serializeAws_restJson1BatchAssociateProjectAssetsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -296,10 +298,12 @@ export const serializeAws_restJson1BatchDisassociateProjectAssetsCommand = async input: BatchDisassociateProjectAssetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects/{projectId}/assets/disassociate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectId}/assets/disassociate"; if (input.projectId !== undefined) { const labelValue: string = input.projectId; if (labelValue.length <= 0) { @@ -322,7 +326,6 @@ export const serializeAws_restJson1BatchDisassociateProjectAssetsCommand = async throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -338,10 +341,11 @@ export const serializeAws_restJson1BatchPutAssetPropertyValueCommand = async ( input: BatchPutAssetPropertyValueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/properties"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/properties"; let body: any; body = JSON.stringify({ ...(input.entries !== undefined && @@ -356,7 +360,6 @@ export const serializeAws_restJson1BatchPutAssetPropertyValueCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -372,10 +375,11 @@ export const serializeAws_restJson1CreateAccessPolicyCommand = async ( input: CreateAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/access-policies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-policies"; let body: any; body = JSON.stringify({ ...(input.accessPolicyIdentity !== undefined && @@ -398,7 +402,6 @@ export const serializeAws_restJson1CreateAccessPolicyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -414,10 +417,11 @@ export const serializeAws_restJson1CreateAssetCommand = async ( input: CreateAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets"; let body: any; body = JSON.stringify({ ...(input.assetModelId !== undefined && input.assetModelId !== null && { assetModelId: input.assetModelId }), @@ -432,7 +436,6 @@ export const serializeAws_restJson1CreateAssetCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -448,10 +451,11 @@ export const serializeAws_restJson1CreateAssetModelCommand = async ( input: CreateAssetModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/asset-models"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/asset-models"; let body: any; body = JSON.stringify({ ...(input.assetModelCompositeModels !== undefined && @@ -486,7 +490,6 @@ export const serializeAws_restJson1CreateAssetModelCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -502,10 +505,11 @@ export const serializeAws_restJson1CreateDashboardCommand = async ( input: CreateDashboardCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/dashboards"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dashboards"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -524,7 +528,6 @@ export const serializeAws_restJson1CreateDashboardCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -540,10 +543,11 @@ export const serializeAws_restJson1CreateGatewayCommand = async ( input: CreateGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/20200301/gateways"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/20200301/gateways"; let body: any; body = JSON.stringify({ ...(input.gatewayName !== undefined && input.gatewayName !== null && { gatewayName: input.gatewayName }), @@ -560,7 +564,6 @@ export const serializeAws_restJson1CreateGatewayCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -576,10 +579,11 @@ export const serializeAws_restJson1CreatePortalCommand = async ( input: CreatePortalCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/portals"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/portals"; let body: any; body = JSON.stringify({ ...(input.alarms !== undefined && @@ -608,7 +612,6 @@ export const serializeAws_restJson1CreatePortalCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -624,10 +627,11 @@ export const serializeAws_restJson1CreateProjectCommand = async ( input: CreateProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -644,7 +648,6 @@ export const serializeAws_restJson1CreateProjectCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -660,8 +663,10 @@ export const serializeAws_restJson1DeleteAccessPolicyCommand = async ( input: DeleteAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/access-policies/{accessPolicyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-policies/{accessPolicyId}"; if (input.accessPolicyId !== undefined) { const labelValue: string = input.accessPolicyId; if (labelValue.length <= 0) { @@ -682,7 +687,6 @@ export const serializeAws_restJson1DeleteAccessPolicyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -699,8 +703,9 @@ export const serializeAws_restJson1DeleteAssetCommand = async ( input: DeleteAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assets/{assetId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{assetId}"; if (input.assetId !== undefined) { const labelValue: string = input.assetId; if (labelValue.length <= 0) { @@ -721,7 +726,6 @@ export const serializeAws_restJson1DeleteAssetCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -738,8 +742,10 @@ export const serializeAws_restJson1DeleteAssetModelCommand = async ( input: DeleteAssetModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/asset-models/{assetModelId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/asset-models/{assetModelId}"; if (input.assetModelId !== undefined) { const labelValue: string = input.assetModelId; if (labelValue.length <= 0) { @@ -760,7 +766,6 @@ export const serializeAws_restJson1DeleteAssetModelCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -777,8 +782,10 @@ export const serializeAws_restJson1DeleteDashboardCommand = async ( input: DeleteDashboardCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dashboards/{dashboardId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dashboards/{dashboardId}"; if (input.dashboardId !== undefined) { const labelValue: string = input.dashboardId; if (labelValue.length <= 0) { @@ -799,7 +806,6 @@ export const serializeAws_restJson1DeleteDashboardCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -816,8 +822,10 @@ export const serializeAws_restJson1DeleteGatewayCommand = async ( input: DeleteGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/20200301/gateways/{gatewayId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/20200301/gateways/{gatewayId}"; if (input.gatewayId !== undefined) { const labelValue: string = input.gatewayId; if (labelValue.length <= 0) { @@ -835,7 +843,6 @@ export const serializeAws_restJson1DeleteGatewayCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -851,8 +858,9 @@ export const serializeAws_restJson1DeletePortalCommand = async ( input: DeletePortalCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/portals/{portalId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/portals/{portalId}"; if (input.portalId !== undefined) { const labelValue: string = input.portalId; if (labelValue.length <= 0) { @@ -873,7 +881,6 @@ export const serializeAws_restJson1DeletePortalCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -890,8 +897,9 @@ export const serializeAws_restJson1DeleteProjectCommand = async ( input: DeleteProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectId}"; if (input.projectId !== undefined) { const labelValue: string = input.projectId; if (labelValue.length <= 0) { @@ -912,7 +920,6 @@ export const serializeAws_restJson1DeleteProjectCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -929,8 +936,10 @@ export const serializeAws_restJson1DescribeAccessPolicyCommand = async ( input: DescribeAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/access-policies/{accessPolicyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-policies/{accessPolicyId}"; if (input.accessPolicyId !== undefined) { const labelValue: string = input.accessPolicyId; if (labelValue.length <= 0) { @@ -948,7 +957,6 @@ export const serializeAws_restJson1DescribeAccessPolicyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -964,8 +972,9 @@ export const serializeAws_restJson1DescribeAssetCommand = async ( input: DescribeAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assets/{assetId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{assetId}"; if (input.assetId !== undefined) { const labelValue: string = input.assetId; if (labelValue.length <= 0) { @@ -983,7 +992,6 @@ export const serializeAws_restJson1DescribeAssetCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -999,8 +1007,10 @@ export const serializeAws_restJson1DescribeAssetModelCommand = async ( input: DescribeAssetModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/asset-models/{assetModelId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/asset-models/{assetModelId}"; if (input.assetModelId !== undefined) { const labelValue: string = input.assetModelId; if (labelValue.length <= 0) { @@ -1018,7 +1028,6 @@ export const serializeAws_restJson1DescribeAssetModelCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1034,8 +1043,10 @@ export const serializeAws_restJson1DescribeAssetPropertyCommand = async ( input: DescribeAssetPropertyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assets/{assetId}/properties/{propertyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{assetId}/properties/{propertyId}"; if (input.assetId !== undefined) { const labelValue: string = input.assetId; if (labelValue.length <= 0) { @@ -1062,7 +1073,6 @@ export const serializeAws_restJson1DescribeAssetPropertyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1078,8 +1088,10 @@ export const serializeAws_restJson1DescribeDashboardCommand = async ( input: DescribeDashboardCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dashboards/{dashboardId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dashboards/{dashboardId}"; if (input.dashboardId !== undefined) { const labelValue: string = input.dashboardId; if (labelValue.length <= 0) { @@ -1097,7 +1109,6 @@ export const serializeAws_restJson1DescribeDashboardCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1113,13 +1124,14 @@ export const serializeAws_restJson1DescribeDefaultEncryptionConfigurationCommand input: DescribeDefaultEncryptionConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/configuration/account/encryption"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/configuration/account/encryption"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1135,8 +1147,10 @@ export const serializeAws_restJson1DescribeGatewayCommand = async ( input: DescribeGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/20200301/gateways/{gatewayId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/20200301/gateways/{gatewayId}"; if (input.gatewayId !== undefined) { const labelValue: string = input.gatewayId; if (labelValue.length <= 0) { @@ -1154,7 +1168,6 @@ export const serializeAws_restJson1DescribeGatewayCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1170,8 +1183,11 @@ export const serializeAws_restJson1DescribeGatewayCapabilityConfigurationCommand input: DescribeGatewayCapabilityConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/20200301/gateways/{gatewayId}/capability/{capabilityNamespace}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/20200301/gateways/{gatewayId}/capability/{capabilityNamespace}"; if (input.gatewayId !== undefined) { const labelValue: string = input.gatewayId; if (labelValue.length <= 0) { @@ -1198,7 +1214,6 @@ export const serializeAws_restJson1DescribeGatewayCapabilityConfigurationCommand throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1214,10 +1229,11 @@ export const serializeAws_restJson1DescribeLoggingOptionsCommand = async ( input: DescribeLoggingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/logging"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/logging"; let body: any; body = ""; let { hostname: resolvedHostname } = await context.endpoint(); @@ -1227,7 +1243,6 @@ export const serializeAws_restJson1DescribeLoggingOptionsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1243,8 +1258,9 @@ export const serializeAws_restJson1DescribePortalCommand = async ( input: DescribePortalCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/portals/{portalId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/portals/{portalId}"; if (input.portalId !== undefined) { const labelValue: string = input.portalId; if (labelValue.length <= 0) { @@ -1262,7 +1278,6 @@ export const serializeAws_restJson1DescribePortalCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1278,8 +1293,9 @@ export const serializeAws_restJson1DescribeProjectCommand = async ( input: DescribeProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectId}"; if (input.projectId !== undefined) { const labelValue: string = input.projectId; if (labelValue.length <= 0) { @@ -1297,7 +1313,6 @@ export const serializeAws_restJson1DescribeProjectCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1313,10 +1328,12 @@ export const serializeAws_restJson1DisassociateAssetsCommand = async ( input: DisassociateAssetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assets/{assetId}/disassociate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{assetId}/disassociate"; if (input.assetId !== undefined) { const labelValue: string = input.assetId; if (labelValue.length <= 0) { @@ -1339,7 +1356,6 @@ export const serializeAws_restJson1DisassociateAssetsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1355,8 +1371,9 @@ export const serializeAws_restJson1GetAssetPropertyAggregatesCommand = async ( input: GetAssetPropertyAggregatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/properties/aggregates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/properties/aggregates"; const query: any = { ...(input.assetId !== undefined && { assetId: input.assetId }), ...(input.propertyId !== undefined && { propertyId: input.propertyId }), @@ -1378,7 +1395,6 @@ export const serializeAws_restJson1GetAssetPropertyAggregatesCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1395,8 +1411,9 @@ export const serializeAws_restJson1GetAssetPropertyValueCommand = async ( input: GetAssetPropertyValueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/properties/latest"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/properties/latest"; const query: any = { ...(input.assetId !== undefined && { assetId: input.assetId }), ...(input.propertyId !== undefined && { propertyId: input.propertyId }), @@ -1410,7 +1427,6 @@ export const serializeAws_restJson1GetAssetPropertyValueCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1427,8 +1443,9 @@ export const serializeAws_restJson1GetAssetPropertyValueHistoryCommand = async ( input: GetAssetPropertyValueHistoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/properties/history"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/properties/history"; const query: any = { ...(input.assetId !== undefined && { assetId: input.assetId }), ...(input.propertyId !== undefined && { propertyId: input.propertyId }), @@ -1448,7 +1465,6 @@ export const serializeAws_restJson1GetAssetPropertyValueHistoryCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1465,8 +1481,9 @@ export const serializeAws_restJson1GetInterpolatedAssetPropertyValuesCommand = a input: GetInterpolatedAssetPropertyValuesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/properties/interpolated"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/properties/interpolated"; const query: any = { ...(input.assetId !== undefined && { assetId: input.assetId }), ...(input.propertyId !== undefined && { propertyId: input.propertyId }), @@ -1491,7 +1508,6 @@ export const serializeAws_restJson1GetInterpolatedAssetPropertyValuesCommand = a throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1508,8 +1524,9 @@ export const serializeAws_restJson1ListAccessPoliciesCommand = async ( input: ListAccessPoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/access-policies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-policies"; const query: any = { ...(input.identityType !== undefined && { identityType: input.identityType }), ...(input.identityId !== undefined && { identityId: input.identityId }), @@ -1527,7 +1544,6 @@ export const serializeAws_restJson1ListAccessPoliciesCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1544,8 +1560,9 @@ export const serializeAws_restJson1ListAssetModelsCommand = async ( input: ListAssetModelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/asset-models"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/asset-models"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -1558,7 +1575,6 @@ export const serializeAws_restJson1ListAssetModelsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1575,8 +1591,10 @@ export const serializeAws_restJson1ListAssetRelationshipsCommand = async ( input: ListAssetRelationshipsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assets/{assetId}/assetRelationships"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{assetId}/assetRelationships"; if (input.assetId !== undefined) { const labelValue: string = input.assetId; if (labelValue.length <= 0) { @@ -1599,7 +1617,6 @@ export const serializeAws_restJson1ListAssetRelationshipsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1616,8 +1633,9 @@ export const serializeAws_restJson1ListAssetsCommand = async ( input: ListAssetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -1632,7 +1650,6 @@ export const serializeAws_restJson1ListAssetsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1649,8 +1666,10 @@ export const serializeAws_restJson1ListAssociatedAssetsCommand = async ( input: ListAssociatedAssetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assets/{assetId}/hierarchies"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{assetId}/hierarchies"; if (input.assetId !== undefined) { const labelValue: string = input.assetId; if (labelValue.length <= 0) { @@ -1674,7 +1693,6 @@ export const serializeAws_restJson1ListAssociatedAssetsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1691,8 +1709,9 @@ export const serializeAws_restJson1ListDashboardsCommand = async ( input: ListDashboardsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/dashboards"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dashboards"; const query: any = { ...(input.projectId !== undefined && { projectId: input.projectId }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), @@ -1706,7 +1725,6 @@ export const serializeAws_restJson1ListDashboardsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1723,8 +1741,9 @@ export const serializeAws_restJson1ListGatewaysCommand = async ( input: ListGatewaysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/20200301/gateways"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/20200301/gateways"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -1737,7 +1756,6 @@ export const serializeAws_restJson1ListGatewaysCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1754,8 +1772,9 @@ export const serializeAws_restJson1ListPortalsCommand = async ( input: ListPortalsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/portals"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/portals"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -1768,7 +1787,6 @@ export const serializeAws_restJson1ListPortalsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1785,8 +1803,10 @@ export const serializeAws_restJson1ListProjectAssetsCommand = async ( input: ListProjectAssetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectId}/assets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectId}/assets"; if (input.projectId !== undefined) { const labelValue: string = input.projectId; if (labelValue.length <= 0) { @@ -1808,7 +1828,6 @@ export const serializeAws_restJson1ListProjectAssetsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1825,8 +1844,9 @@ export const serializeAws_restJson1ListProjectsCommand = async ( input: ListProjectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects"; const query: any = { ...(input.portalId !== undefined && { portalId: input.portalId }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), @@ -1840,7 +1860,6 @@ export const serializeAws_restJson1ListProjectsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1857,13 +1876,13 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1880,17 +1899,18 @@ export const serializeAws_restJson1PutDefaultEncryptionConfigurationCommand = as input: PutDefaultEncryptionConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/configuration/account/encryption"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/configuration/account/encryption"; let body: any; body = JSON.stringify({ ...(input.encryptionType !== undefined && input.encryptionType !== null && { encryptionType: input.encryptionType }), ...(input.kmsKeyId !== undefined && input.kmsKeyId !== null && { kmsKeyId: input.kmsKeyId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1906,10 +1926,11 @@ export const serializeAws_restJson1PutLoggingOptionsCommand = async ( input: PutLoggingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/logging"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/logging"; let body: any; body = JSON.stringify({ ...(input.loggingOptions !== undefined && @@ -1924,7 +1945,6 @@ export const serializeAws_restJson1PutLoggingOptionsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1940,10 +1960,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; @@ -1951,7 +1972,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1968,14 +1988,14 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1992,10 +2012,12 @@ export const serializeAws_restJson1UpdateAccessPolicyCommand = async ( input: UpdateAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/access-policies/{accessPolicyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-policies/{accessPolicyId}"; if (input.accessPolicyId !== undefined) { const labelValue: string = input.accessPolicyId; if (labelValue.length <= 0) { @@ -2026,7 +2048,6 @@ export const serializeAws_restJson1UpdateAccessPolicyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2042,10 +2063,11 @@ export const serializeAws_restJson1UpdateAssetCommand = async ( input: UpdateAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assets/{assetId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{assetId}"; if (input.assetId !== undefined) { const labelValue: string = input.assetId; if (labelValue.length <= 0) { @@ -2067,7 +2089,6 @@ export const serializeAws_restJson1UpdateAssetCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2083,10 +2104,12 @@ export const serializeAws_restJson1UpdateAssetModelCommand = async ( input: UpdateAssetModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/asset-models/{assetModelId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/asset-models/{assetModelId}"; if (input.assetModelId !== undefined) { const labelValue: string = input.assetModelId; if (labelValue.length <= 0) { @@ -2126,7 +2149,6 @@ export const serializeAws_restJson1UpdateAssetModelCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2142,10 +2164,12 @@ export const serializeAws_restJson1UpdateAssetPropertyCommand = async ( input: UpdateAssetPropertyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assets/{assetId}/properties/{propertyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{assetId}/properties/{propertyId}"; if (input.assetId !== undefined) { const labelValue: string = input.assetId; if (labelValue.length <= 0) { @@ -2178,7 +2202,6 @@ export const serializeAws_restJson1UpdateAssetPropertyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2194,10 +2217,12 @@ export const serializeAws_restJson1UpdateDashboardCommand = async ( input: UpdateDashboardCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/dashboards/{dashboardId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dashboards/{dashboardId}"; if (input.dashboardId !== undefined) { const labelValue: string = input.dashboardId; if (labelValue.length <= 0) { @@ -2223,7 +2248,6 @@ export const serializeAws_restJson1UpdateDashboardCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2239,10 +2263,12 @@ export const serializeAws_restJson1UpdateGatewayCommand = async ( input: UpdateGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/20200301/gateways/{gatewayId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/20200301/gateways/{gatewayId}"; if (input.gatewayId !== undefined) { const labelValue: string = input.gatewayId; if (labelValue.length <= 0) { @@ -2263,7 +2289,6 @@ export const serializeAws_restJson1UpdateGatewayCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2279,10 +2304,12 @@ export const serializeAws_restJson1UpdateGatewayCapabilityConfigurationCommand = input: UpdateGatewayCapabilityConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/20200301/gateways/{gatewayId}/capability"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/20200301/gateways/{gatewayId}/capability"; if (input.gatewayId !== undefined) { const labelValue: string = input.gatewayId; if (labelValue.length <= 0) { @@ -2306,7 +2333,6 @@ export const serializeAws_restJson1UpdateGatewayCapabilityConfigurationCommand = throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2322,10 +2348,11 @@ export const serializeAws_restJson1UpdatePortalCommand = async ( input: UpdatePortalCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/portals/{portalId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/portals/{portalId}"; if (input.portalId !== undefined) { const labelValue: string = input.portalId; if (labelValue.length <= 0) { @@ -2360,7 +2387,6 @@ export const serializeAws_restJson1UpdatePortalCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2376,10 +2402,11 @@ export const serializeAws_restJson1UpdateProjectCommand = async ( input: UpdateProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/projects/{projectId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectId}"; if (input.projectId !== undefined) { const labelValue: string = input.projectId; if (labelValue.length <= 0) { @@ -2403,7 +2430,6 @@ export const serializeAws_restJson1UpdateProjectCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, diff --git a/clients/client-ivs/protocols/Aws_restJson1.ts b/clients/client-ivs/protocols/Aws_restJson1.ts index 95140a5f39423..ddddf845ebd23 100644 --- a/clients/client-ivs/protocols/Aws_restJson1.ts +++ b/clients/client-ivs/protocols/Aws_restJson1.ts @@ -92,16 +92,16 @@ export const serializeAws_restJson1BatchGetChannelCommand = async ( input: BatchGetChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/BatchGetChannel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BatchGetChannel"; let body: any; body = JSON.stringify({ ...(input.arns !== undefined && input.arns !== null && { arns: serializeAws_restJson1ChannelArnList(input.arns, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -117,16 +117,16 @@ export const serializeAws_restJson1BatchGetStreamKeyCommand = async ( input: BatchGetStreamKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/BatchGetStreamKey"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BatchGetStreamKey"; let body: any; body = JSON.stringify({ ...(input.arns !== undefined && input.arns !== null && { arns: serializeAws_restJson1StreamKeyArnList(input.arns, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -142,10 +142,11 @@ export const serializeAws_restJson1CreateChannelCommand = async ( input: CreateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateChannel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateChannel"; let body: any; body = JSON.stringify({ ...(input.authorized !== undefined && input.authorized !== null && { authorized: input.authorized }), @@ -156,7 +157,6 @@ export const serializeAws_restJson1CreateChannelCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -172,10 +172,12 @@ export const serializeAws_restJson1CreateRecordingConfigurationCommand = async ( input: CreateRecordingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateRecordingConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateRecordingConfiguration"; let body: any; body = JSON.stringify({ ...(input.destinationConfiguration !== undefined && @@ -188,7 +190,6 @@ export const serializeAws_restJson1CreateRecordingConfigurationCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -204,16 +205,16 @@ export const serializeAws_restJson1CreateStreamKeyCommand = async ( input: CreateStreamKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateStreamKey"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateStreamKey"; let body: any; body = JSON.stringify({ ...(input.channelArn !== undefined && input.channelArn !== null && { channelArn: input.channelArn }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -229,15 +230,15 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( input: DeleteChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteChannel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteChannel"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -253,15 +254,15 @@ export const serializeAws_restJson1DeletePlaybackKeyPairCommand = async ( input: DeletePlaybackKeyPairCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeletePlaybackKeyPair"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeletePlaybackKeyPair"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -277,15 +278,16 @@ export const serializeAws_restJson1DeleteRecordingConfigurationCommand = async ( input: DeleteRecordingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteRecordingConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteRecordingConfiguration"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -301,15 +303,15 @@ export const serializeAws_restJson1DeleteStreamKeyCommand = async ( input: DeleteStreamKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteStreamKey"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteStreamKey"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -325,15 +327,15 @@ export const serializeAws_restJson1GetChannelCommand = async ( input: GetChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetChannel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetChannel"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -349,15 +351,15 @@ export const serializeAws_restJson1GetPlaybackKeyPairCommand = async ( input: GetPlaybackKeyPairCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetPlaybackKeyPair"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetPlaybackKeyPair"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -373,15 +375,16 @@ export const serializeAws_restJson1GetRecordingConfigurationCommand = async ( input: GetRecordingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetRecordingConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetRecordingConfiguration"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -397,15 +400,15 @@ export const serializeAws_restJson1GetStreamCommand = async ( input: GetStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetStream"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetStream"; let body: any; body = JSON.stringify({ ...(input.channelArn !== undefined && input.channelArn !== null && { channelArn: input.channelArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -421,15 +424,15 @@ export const serializeAws_restJson1GetStreamKeyCommand = async ( input: GetStreamKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetStreamKey"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetStreamKey"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -445,10 +448,11 @@ export const serializeAws_restJson1ImportPlaybackKeyPairCommand = async ( input: ImportPlaybackKeyPairCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ImportPlaybackKeyPair"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ImportPlaybackKeyPair"; let body: any; body = JSON.stringify({ ...(input.name !== undefined && input.name !== null && { name: input.name }), @@ -456,7 +460,6 @@ export const serializeAws_restJson1ImportPlaybackKeyPairCommand = async ( input.publicKeyMaterial !== null && { publicKeyMaterial: input.publicKeyMaterial }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -472,10 +475,11 @@ export const serializeAws_restJson1ListChannelsCommand = async ( input: ListChannelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListChannels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListChannels"; let body: any; body = JSON.stringify({ ...(input.filterByName !== undefined && input.filterByName !== null && { filterByName: input.filterByName }), @@ -486,7 +490,6 @@ export const serializeAws_restJson1ListChannelsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -502,16 +505,16 @@ export const serializeAws_restJson1ListPlaybackKeyPairsCommand = async ( input: ListPlaybackKeyPairsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListPlaybackKeyPairs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListPlaybackKeyPairs"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -527,16 +530,17 @@ export const serializeAws_restJson1ListRecordingConfigurationsCommand = async ( input: ListRecordingConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListRecordingConfigurations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListRecordingConfigurations"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -552,17 +556,17 @@ export const serializeAws_restJson1ListStreamKeysCommand = async ( input: ListStreamKeysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListStreamKeys"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListStreamKeys"; let body: any; body = JSON.stringify({ ...(input.channelArn !== undefined && input.channelArn !== null && { channelArn: input.channelArn }), ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -578,16 +582,16 @@ export const serializeAws_restJson1ListStreamsCommand = async ( input: ListStreamsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListStreams"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListStreams"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -603,10 +607,11 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -621,7 +626,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -637,16 +641,16 @@ export const serializeAws_restJson1PutMetadataCommand = async ( input: PutMetadataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/PutMetadata"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PutMetadata"; let body: any; body = JSON.stringify({ ...(input.channelArn !== undefined && input.channelArn !== null && { channelArn: input.channelArn }), ...(input.metadata !== undefined && input.metadata !== null && { metadata: input.metadata }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -662,15 +666,15 @@ export const serializeAws_restJson1StopStreamCommand = async ( input: StopStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/StopStream"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StopStream"; let body: any; body = JSON.stringify({ ...(input.channelArn !== undefined && input.channelArn !== null && { channelArn: input.channelArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -686,10 +690,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -703,7 +708,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -719,8 +723,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -734,7 +739,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -751,10 +755,11 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( input: UpdateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateChannel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateChannel"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), @@ -765,7 +770,6 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( input.recordingConfigurationArn !== null && { recordingConfigurationArn: input.recordingConfigurationArn }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-kafka/protocols/Aws_restJson1.ts b/clients/client-kafka/protocols/Aws_restJson1.ts index 4c19b0414cc18..2f0bdbf8be775 100644 --- a/clients/client-kafka/protocols/Aws_restJson1.ts +++ b/clients/client-kafka/protocols/Aws_restJson1.ts @@ -148,10 +148,12 @@ export const serializeAws_restJson1BatchAssociateScramSecretCommand = async ( input: BatchAssociateScramSecretCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/clusters/{ClusterArn}/scram-secrets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/scram-secrets"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -168,7 +170,6 @@ export const serializeAws_restJson1BatchAssociateScramSecretCommand = async ( secretArnList: serializeAws_restJson1__listOf__string(input.SecretArnList, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -184,10 +185,12 @@ export const serializeAws_restJson1BatchDisassociateScramSecretCommand = async ( input: BatchDisassociateScramSecretCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/clusters/{ClusterArn}/scram-secrets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/scram-secrets"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -204,7 +207,6 @@ export const serializeAws_restJson1BatchDisassociateScramSecretCommand = async ( secretArnList: serializeAws_restJson1__listOf__string(input.SecretArnList, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -220,10 +222,11 @@ export const serializeAws_restJson1CreateClusterCommand = async ( input: CreateClusterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/clusters"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters"; let body: any; body = JSON.stringify({ ...(input.BrokerNodeGroupInfo !== undefined && @@ -257,7 +260,6 @@ export const serializeAws_restJson1CreateClusterCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -273,10 +275,11 @@ export const serializeAws_restJson1CreateConfigurationCommand = async ( input: CreateConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/configurations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { description: input.Description }), @@ -288,7 +291,6 @@ export const serializeAws_restJson1CreateConfigurationCommand = async ( ...(input.ServerProperties !== undefined && input.ServerProperties !== null && { serverProperties: context.base64Encoder(input.ServerProperties) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -304,8 +306,10 @@ export const serializeAws_restJson1DeleteClusterCommand = async ( input: DeleteClusterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/clusters/{ClusterArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -319,7 +323,6 @@ export const serializeAws_restJson1DeleteClusterCommand = async ( ...(input.CurrentVersion !== undefined && { currentVersion: input.CurrentVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -336,8 +339,9 @@ export const serializeAws_restJson1DeleteConfigurationCommand = async ( input: DeleteConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/configurations/{Arn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{Arn}"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -348,7 +352,6 @@ export const serializeAws_restJson1DeleteConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: Arn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -364,8 +367,10 @@ export const serializeAws_restJson1DescribeClusterCommand = async ( input: DescribeClusterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/clusters/{ClusterArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -376,7 +381,6 @@ export const serializeAws_restJson1DescribeClusterCommand = async ( throw new Error("No value provided for input HTTP label: ClusterArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -392,8 +396,10 @@ export const serializeAws_restJson1DescribeClusterOperationCommand = async ( input: DescribeClusterOperationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/operations/{ClusterOperationArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/operations/{ClusterOperationArn}"; if (input.ClusterOperationArn !== undefined) { const labelValue: string = input.ClusterOperationArn; if (labelValue.length <= 0) { @@ -404,7 +410,6 @@ export const serializeAws_restJson1DescribeClusterOperationCommand = async ( throw new Error("No value provided for input HTTP label: ClusterOperationArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -420,8 +425,9 @@ export const serializeAws_restJson1DescribeConfigurationCommand = async ( input: DescribeConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/configurations/{Arn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{Arn}"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -432,7 +438,6 @@ export const serializeAws_restJson1DescribeConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: Arn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -448,8 +453,11 @@ export const serializeAws_restJson1DescribeConfigurationRevisionCommand = async input: DescribeConfigurationRevisionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/configurations/{Arn}/revisions/{Revision}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/configurations/{Arn}/revisions/{Revision}"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -469,7 +477,6 @@ export const serializeAws_restJson1DescribeConfigurationRevisionCommand = async throw new Error("No value provided for input HTTP label: Revision."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -485,8 +492,11 @@ export const serializeAws_restJson1GetBootstrapBrokersCommand = async ( input: GetBootstrapBrokersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/clusters/{ClusterArn}/bootstrap-brokers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/clusters/{ClusterArn}/bootstrap-brokers"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -497,7 +507,6 @@ export const serializeAws_restJson1GetBootstrapBrokersCommand = async ( throw new Error("No value provided for input HTTP label: ClusterArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -513,13 +522,14 @@ export const serializeAws_restJson1GetCompatibleKafkaVersionsCommand = async ( input: GetCompatibleKafkaVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/compatible-kafka-versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/compatible-kafka-versions"; const query: any = { ...(input.ClusterArn !== undefined && { clusterArn: input.ClusterArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -536,8 +546,10 @@ export const serializeAws_restJson1ListClusterOperationsCommand = async ( input: ListClusterOperationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/clusters/{ClusterArn}/operations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/operations"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -552,7 +564,6 @@ export const serializeAws_restJson1ListClusterOperationsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -569,15 +580,15 @@ export const serializeAws_restJson1ListClustersCommand = async ( input: ListClustersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/clusters"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters"; const query: any = { ...(input.ClusterNameFilter !== undefined && { clusterNameFilter: input.ClusterNameFilter }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -594,8 +605,10 @@ export const serializeAws_restJson1ListConfigurationRevisionsCommand = async ( input: ListConfigurationRevisionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/configurations/{Arn}/revisions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{Arn}/revisions"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -610,7 +623,6 @@ export const serializeAws_restJson1ListConfigurationRevisionsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -627,14 +639,14 @@ export const serializeAws_restJson1ListConfigurationsCommand = async ( input: ListConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/configurations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -651,14 +663,14 @@ export const serializeAws_restJson1ListKafkaVersionsCommand = async ( input: ListKafkaVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/kafka-versions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/kafka-versions"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -675,8 +687,10 @@ export const serializeAws_restJson1ListNodesCommand = async ( input: ListNodesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/clusters/{ClusterArn}/nodes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/nodes"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -691,7 +705,6 @@ export const serializeAws_restJson1ListNodesCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -708,8 +721,10 @@ export const serializeAws_restJson1ListScramSecretsCommand = async ( input: ListScramSecretsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/clusters/{ClusterArn}/scram-secrets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/scram-secrets"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -724,7 +739,6 @@ export const serializeAws_restJson1ListScramSecretsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -741,8 +755,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -753,7 +768,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -769,10 +783,12 @@ export const serializeAws_restJson1RebootBrokerCommand = async ( input: RebootBrokerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/clusters/{ClusterArn}/reboot-broker"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/reboot-broker"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -787,7 +803,6 @@ export const serializeAws_restJson1RebootBrokerCommand = async ( ...(input.BrokerIds !== undefined && input.BrokerIds !== null && { brokerIds: serializeAws_restJson1__listOf__string(input.BrokerIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -803,10 +818,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -821,7 +837,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -837,8 +852,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -852,7 +868,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -869,10 +884,12 @@ export const serializeAws_restJson1UpdateBrokerCountCommand = async ( input: UpdateBrokerCountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/clusters/{ClusterArn}/nodes/count"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/nodes/count"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -889,7 +906,6 @@ export const serializeAws_restJson1UpdateBrokerCountCommand = async ( ...(input.TargetNumberOfBrokerNodes !== undefined && input.TargetNumberOfBrokerNodes !== null && { targetNumberOfBrokerNodes: input.TargetNumberOfBrokerNodes }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -905,10 +921,12 @@ export const serializeAws_restJson1UpdateBrokerStorageCommand = async ( input: UpdateBrokerStorageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/clusters/{ClusterArn}/nodes/storage"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/nodes/storage"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -930,7 +948,6 @@ export const serializeAws_restJson1UpdateBrokerStorageCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -946,10 +963,12 @@ export const serializeAws_restJson1UpdateBrokerTypeCommand = async ( input: UpdateBrokerTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/clusters/{ClusterArn}/nodes/type"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/nodes/type"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -966,7 +985,6 @@ export const serializeAws_restJson1UpdateBrokerTypeCommand = async ( ...(input.TargetInstanceType !== undefined && input.TargetInstanceType !== null && { targetInstanceType: input.TargetInstanceType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -982,10 +1000,12 @@ export const serializeAws_restJson1UpdateClusterConfigurationCommand = async ( input: UpdateClusterConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/clusters/{ClusterArn}/configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/configuration"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -1004,7 +1024,6 @@ export const serializeAws_restJson1UpdateClusterConfigurationCommand = async ( ...(input.CurrentVersion !== undefined && input.CurrentVersion !== null && { currentVersion: input.CurrentVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1020,10 +1039,12 @@ export const serializeAws_restJson1UpdateClusterKafkaVersionCommand = async ( input: UpdateClusterKafkaVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/clusters/{ClusterArn}/version"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/version"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -1044,7 +1065,6 @@ export const serializeAws_restJson1UpdateClusterKafkaVersionCommand = async ( ...(input.TargetKafkaVersion !== undefined && input.TargetKafkaVersion !== null && { targetKafkaVersion: input.TargetKafkaVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1060,10 +1080,11 @@ export const serializeAws_restJson1UpdateConfigurationCommand = async ( input: UpdateConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/configurations/{Arn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{Arn}"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -1079,7 +1100,6 @@ export const serializeAws_restJson1UpdateConfigurationCommand = async ( ...(input.ServerProperties !== undefined && input.ServerProperties !== null && { serverProperties: context.base64Encoder(input.ServerProperties) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1095,10 +1115,12 @@ export const serializeAws_restJson1UpdateMonitoringCommand = async ( input: UpdateMonitoringCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/clusters/{ClusterArn}/monitoring"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/clusters/{ClusterArn}/monitoring"; if (input.ClusterArn !== undefined) { const labelValue: string = input.ClusterArn; if (labelValue.length <= 0) { @@ -1121,7 +1143,6 @@ export const serializeAws_restJson1UpdateMonitoringCommand = async ( openMonitoring: serializeAws_restJson1OpenMonitoringInfo(input.OpenMonitoring, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-kinesis-video-archived-media/protocols/Aws_restJson1.ts b/clients/client-kinesis-video-archived-media/protocols/Aws_restJson1.ts index 9265f46f7977b..8ca4ecc828348 100644 --- a/clients/client-kinesis-video-archived-media/protocols/Aws_restJson1.ts +++ b/clients/client-kinesis-video-archived-media/protocols/Aws_restJson1.ts @@ -49,10 +49,11 @@ export const serializeAws_restJson1GetClipCommand = async ( input: GetClipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getClip"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getClip"; let body: any; body = JSON.stringify({ ...(input.ClipFragmentSelector !== undefined && @@ -62,7 +63,6 @@ export const serializeAws_restJson1GetClipCommand = async ( ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -78,10 +78,12 @@ export const serializeAws_restJson1GetDASHStreamingSessionURLCommand = async ( input: GetDASHStreamingSessionURLCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getDASHStreamingSessionURL"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getDASHStreamingSessionURL"; let body: any; body = JSON.stringify({ ...(input.DASHFragmentSelector !== undefined && @@ -99,7 +101,6 @@ export const serializeAws_restJson1GetDASHStreamingSessionURLCommand = async ( ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -115,10 +116,12 @@ export const serializeAws_restJson1GetHLSStreamingSessionURLCommand = async ( input: GetHLSStreamingSessionURLCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getHLSStreamingSessionURL"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getHLSStreamingSessionURL"; let body: any; body = JSON.stringify({ ...(input.ContainerFormat !== undefined && @@ -140,7 +143,6 @@ export const serializeAws_restJson1GetHLSStreamingSessionURLCommand = async ( ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -156,10 +158,11 @@ export const serializeAws_restJson1GetMediaForFragmentListCommand = async ( input: GetMediaForFragmentListCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getMediaForFragmentList"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getMediaForFragmentList"; let body: any; body = JSON.stringify({ ...(input.Fragments !== undefined && @@ -167,7 +170,6 @@ export const serializeAws_restJson1GetMediaForFragmentListCommand = async ( ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -183,10 +185,11 @@ export const serializeAws_restJson1ListFragmentsCommand = async ( input: ListFragmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listFragments"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listFragments"; let body: any; body = JSON.stringify({ ...(input.FragmentSelector !== undefined && @@ -198,7 +201,6 @@ export const serializeAws_restJson1ListFragmentsCommand = async ( ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-kinesis-video-media/protocols/Aws_restJson1.ts b/clients/client-kinesis-video-media/protocols/Aws_restJson1.ts index 468c46f908e9e..180d2e1020684 100644 --- a/clients/client-kinesis-video-media/protocols/Aws_restJson1.ts +++ b/clients/client-kinesis-video-media/protocols/Aws_restJson1.ts @@ -21,10 +21,11 @@ export const serializeAws_restJson1GetMediaCommand = async ( input: GetMediaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getMedia"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getMedia"; let body: any; body = JSON.stringify({ ...(input.StartSelector !== undefined && @@ -34,7 +35,6 @@ export const serializeAws_restJson1GetMediaCommand = async ( ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-kinesis-video-signaling/protocols/Aws_restJson1.ts b/clients/client-kinesis-video-signaling/protocols/Aws_restJson1.ts index a737d0c8af532..e9c96f6b0f7a0 100644 --- a/clients/client-kinesis-video-signaling/protocols/Aws_restJson1.ts +++ b/clients/client-kinesis-video-signaling/protocols/Aws_restJson1.ts @@ -29,10 +29,12 @@ export const serializeAws_restJson1GetIceServerConfigCommand = async ( input: GetIceServerConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/get-ice-server-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/get-ice-server-config"; let body: any; body = JSON.stringify({ ...(input.ChannelARN !== undefined && input.ChannelARN !== null && { ChannelARN: input.ChannelARN }), @@ -40,7 +42,6 @@ export const serializeAws_restJson1GetIceServerConfigCommand = async ( ...(input.Service !== undefined && input.Service !== null && { Service: input.Service }), ...(input.Username !== undefined && input.Username !== null && { Username: input.Username }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -56,10 +57,12 @@ export const serializeAws_restJson1SendAlexaOfferToMasterCommand = async ( input: SendAlexaOfferToMasterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/send-alexa-offer-to-master"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/send-alexa-offer-to-master"; let body: any; body = JSON.stringify({ ...(input.ChannelARN !== undefined && input.ChannelARN !== null && { ChannelARN: input.ChannelARN }), @@ -68,7 +71,6 @@ export const serializeAws_restJson1SendAlexaOfferToMasterCommand = async ( ...(input.SenderClientId !== undefined && input.SenderClientId !== null && { SenderClientId: input.SenderClientId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-kinesis-video/protocols/Aws_restJson1.ts b/clients/client-kinesis-video/protocols/Aws_restJson1.ts index 8ebb96bf4a261..ca29c9bf2be7d 100644 --- a/clients/client-kinesis-video/protocols/Aws_restJson1.ts +++ b/clients/client-kinesis-video/protocols/Aws_restJson1.ts @@ -82,10 +82,11 @@ export const serializeAws_restJson1CreateSignalingChannelCommand = async ( input: CreateSignalingChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createSignalingChannel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createSignalingChannel"; let body: any; body = JSON.stringify({ ...(input.ChannelName !== undefined && input.ChannelName !== null && { ChannelName: input.ChannelName }), @@ -100,7 +101,6 @@ export const serializeAws_restJson1CreateSignalingChannelCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagOnCreateList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -116,10 +116,11 @@ export const serializeAws_restJson1CreateStreamCommand = async ( input: CreateStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createStream"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createStream"; let body: any; body = JSON.stringify({ ...(input.DataRetentionInHours !== undefined && @@ -131,7 +132,6 @@ export const serializeAws_restJson1CreateStreamCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1ResourceTags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -147,17 +147,17 @@ export const serializeAws_restJson1DeleteSignalingChannelCommand = async ( input: DeleteSignalingChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteSignalingChannel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteSignalingChannel"; let body: any; body = JSON.stringify({ ...(input.ChannelARN !== undefined && input.ChannelARN !== null && { ChannelARN: input.ChannelARN }), ...(input.CurrentVersion !== undefined && input.CurrentVersion !== null && { CurrentVersion: input.CurrentVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -173,17 +173,17 @@ export const serializeAws_restJson1DeleteStreamCommand = async ( input: DeleteStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteStream"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteStream"; let body: any; body = JSON.stringify({ ...(input.CurrentVersion !== undefined && input.CurrentVersion !== null && { CurrentVersion: input.CurrentVersion }), ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -199,16 +199,17 @@ export const serializeAws_restJson1DescribeSignalingChannelCommand = async ( input: DescribeSignalingChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeSignalingChannel"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeSignalingChannel"; let body: any; body = JSON.stringify({ ...(input.ChannelARN !== undefined && input.ChannelARN !== null && { ChannelARN: input.ChannelARN }), ...(input.ChannelName !== undefined && input.ChannelName !== null && { ChannelName: input.ChannelName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -224,16 +225,16 @@ export const serializeAws_restJson1DescribeStreamCommand = async ( input: DescribeStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeStream"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeStream"; let body: any; body = JSON.stringify({ ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -249,17 +250,17 @@ export const serializeAws_restJson1GetDataEndpointCommand = async ( input: GetDataEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getDataEndpoint"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getDataEndpoint"; let body: any; body = JSON.stringify({ ...(input.APIName !== undefined && input.APIName !== null && { APIName: input.APIName }), ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -275,10 +276,12 @@ export const serializeAws_restJson1GetSignalingChannelEndpointCommand = async ( input: GetSignalingChannelEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getSignalingChannelEndpoint"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getSignalingChannelEndpoint"; let body: any; body = JSON.stringify({ ...(input.ChannelARN !== undefined && input.ChannelARN !== null && { ChannelARN: input.ChannelARN }), @@ -290,7 +293,6 @@ export const serializeAws_restJson1GetSignalingChannelEndpointCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -306,10 +308,11 @@ export const serializeAws_restJson1ListSignalingChannelsCommand = async ( input: ListSignalingChannelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listSignalingChannels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listSignalingChannels"; let body: any; body = JSON.stringify({ ...(input.ChannelNameCondition !== undefined && @@ -319,7 +322,6 @@ export const serializeAws_restJson1ListSignalingChannelsCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -335,10 +337,11 @@ export const serializeAws_restJson1ListStreamsCommand = async ( input: ListStreamsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listStreams"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listStreams"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -348,7 +351,6 @@ export const serializeAws_restJson1ListStreamsCommand = async ( StreamNameCondition: serializeAws_restJson1StreamNameCondition(input.StreamNameCondition, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -364,16 +366,16 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListTagsForResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListTagsForResource"; let body: any; body = JSON.stringify({ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.ResourceARN !== undefined && input.ResourceARN !== null && { ResourceARN: input.ResourceARN }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -389,17 +391,17 @@ export const serializeAws_restJson1ListTagsForStreamCommand = async ( input: ListTagsForStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listTagsForStream"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listTagsForStream"; let body: any; body = JSON.stringify({ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -415,17 +417,17 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/TagResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TagResource"; let body: any; body = JSON.stringify({ ...(input.ResourceARN !== undefined && input.ResourceARN !== null && { ResourceARN: input.ResourceARN }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -441,10 +443,11 @@ export const serializeAws_restJson1TagStreamCommand = async ( input: TagStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tagStream"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tagStream"; let body: any; body = JSON.stringify({ ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), @@ -452,7 +455,6 @@ export const serializeAws_restJson1TagStreamCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1ResourceTags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -468,17 +470,17 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UntagResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UntagResource"; let body: any; body = JSON.stringify({ ...(input.ResourceARN !== undefined && input.ResourceARN !== null && { ResourceARN: input.ResourceARN }), ...(input.TagKeyList !== undefined && input.TagKeyList !== null && { TagKeyList: serializeAws_restJson1TagKeyList(input.TagKeyList, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -494,10 +496,11 @@ export const serializeAws_restJson1UntagStreamCommand = async ( input: UntagStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/untagStream"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/untagStream"; let body: any; body = JSON.stringify({ ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), @@ -505,7 +508,6 @@ export const serializeAws_restJson1UntagStreamCommand = async ( ...(input.TagKeyList !== undefined && input.TagKeyList !== null && { TagKeyList: serializeAws_restJson1TagKeyList(input.TagKeyList, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -521,10 +523,11 @@ export const serializeAws_restJson1UpdateDataRetentionCommand = async ( input: UpdateDataRetentionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateDataRetention"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateDataRetention"; let body: any; body = JSON.stringify({ ...(input.CurrentVersion !== undefined && @@ -535,7 +538,6 @@ export const serializeAws_restJson1UpdateDataRetentionCommand = async ( ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -551,10 +553,11 @@ export const serializeAws_restJson1UpdateSignalingChannelCommand = async ( input: UpdateSignalingChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateSignalingChannel"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateSignalingChannel"; let body: any; body = JSON.stringify({ ...(input.ChannelARN !== undefined && input.ChannelARN !== null && { ChannelARN: input.ChannelARN }), @@ -568,7 +571,6 @@ export const serializeAws_restJson1UpdateSignalingChannelCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -584,10 +586,11 @@ export const serializeAws_restJson1UpdateStreamCommand = async ( input: UpdateStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateStream"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateStream"; let body: any; body = JSON.stringify({ ...(input.CurrentVersion !== undefined && @@ -597,7 +600,6 @@ export const serializeAws_restJson1UpdateStreamCommand = async ( ...(input.StreamARN !== undefined && input.StreamARN !== null && { StreamARN: input.StreamARN }), ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-lambda/protocols/Aws_restJson1.ts b/clients/client-lambda/protocols/Aws_restJson1.ts index 219b8be1e791c..99c6188bf2f69 100644 --- a/clients/client-lambda/protocols/Aws_restJson1.ts +++ b/clients/client-lambda/protocols/Aws_restJson1.ts @@ -254,10 +254,13 @@ export const serializeAws_restJson1AddLayerVersionPermissionCommand = async ( input: AddLayerVersionPermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}/policy"; if (input.LayerName !== undefined) { const labelValue: string = input.LayerName; if (labelValue.length <= 0) { @@ -287,7 +290,6 @@ export const serializeAws_restJson1AddLayerVersionPermissionCommand = async ( ...(input.Principal !== undefined && input.Principal !== null && { Principal: input.Principal }), ...(input.StatementId !== undefined && input.StatementId !== null && { StatementId: input.StatementId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -304,10 +306,13 @@ export const serializeAws_restJson1AddPermissionCommand = async ( input: AddPermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/policy"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -331,7 +336,6 @@ export const serializeAws_restJson1AddPermissionCommand = async ( ...(input.SourceArn !== undefined && input.SourceArn !== null && { SourceArn: input.SourceArn }), ...(input.StatementId !== undefined && input.StatementId !== null && { StatementId: input.StatementId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -348,10 +352,13 @@ export const serializeAws_restJson1CreateAliasCommand = async ( input: CreateAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/aliases"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/aliases"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -372,7 +379,6 @@ export const serializeAws_restJson1CreateAliasCommand = async ( RoutingConfig: serializeAws_restJson1AliasRoutingConfiguration(input.RoutingConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -388,10 +394,12 @@ export const serializeAws_restJson1CreateCodeSigningConfigCommand = async ( input: CreateCodeSigningConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2020-04-22/code-signing-configs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-04-22/code-signing-configs"; let body: any; body = JSON.stringify({ ...(input.AllowedPublishers !== undefined && @@ -404,7 +412,6 @@ export const serializeAws_restJson1CreateCodeSigningConfigCommand = async ( }), ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -420,10 +427,12 @@ export const serializeAws_restJson1CreateEventSourceMappingCommand = async ( input: CreateEventSourceMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-03-31/event-source-mappings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-03-31/event-source-mappings"; let body: any; body = JSON.stringify({ ...(input.BatchSize !== undefined && input.BatchSize !== null && { BatchSize: input.BatchSize }), @@ -475,7 +484,6 @@ export const serializeAws_restJson1CreateEventSourceMappingCommand = async ( ...(input.TumblingWindowInSeconds !== undefined && input.TumblingWindowInSeconds !== null && { TumblingWindowInSeconds: input.TumblingWindowInSeconds }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -491,10 +499,11 @@ export const serializeAws_restJson1CreateFunctionCommand = async ( input: CreateFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-03-31/functions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-03-31/functions"; let body: any; body = JSON.stringify({ ...(input.Code !== undefined && @@ -533,7 +542,6 @@ export const serializeAws_restJson1CreateFunctionCommand = async ( ...(input.VpcConfig !== undefined && input.VpcConfig !== null && { VpcConfig: serializeAws_restJson1VpcConfig(input.VpcConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -549,8 +557,11 @@ export const serializeAws_restJson1DeleteAliasCommand = async ( input: DeleteAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/aliases/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/aliases/{Name}"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -570,7 +581,6 @@ export const serializeAws_restJson1DeleteAliasCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -586,8 +596,11 @@ export const serializeAws_restJson1DeleteCodeSigningConfigCommand = async ( input: DeleteCodeSigningConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}"; if (input.CodeSigningConfigArn !== undefined) { const labelValue: string = input.CodeSigningConfigArn; if (labelValue.length <= 0) { @@ -598,7 +611,6 @@ export const serializeAws_restJson1DeleteCodeSigningConfigCommand = async ( throw new Error("No value provided for input HTTP label: CodeSigningConfigArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -614,8 +626,10 @@ export const serializeAws_restJson1DeleteEventSourceMappingCommand = async ( input: DeleteEventSourceMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/event-source-mappings/{UUID}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-03-31/event-source-mappings/{UUID}"; if (input.UUID !== undefined) { const labelValue: string = input.UUID; if (labelValue.length <= 0) { @@ -626,7 +640,6 @@ export const serializeAws_restJson1DeleteEventSourceMappingCommand = async ( throw new Error("No value provided for input HTTP label: UUID."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -642,8 +655,10 @@ export const serializeAws_restJson1DeleteFunctionCommand = async ( input: DeleteFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/functions/{FunctionName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-03-31/functions/{FunctionName}"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -657,7 +672,6 @@ export const serializeAws_restJson1DeleteFunctionCommand = async ( ...(input.Qualifier !== undefined && { Qualifier: input.Qualifier }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -674,8 +688,11 @@ export const serializeAws_restJson1DeleteFunctionCodeSigningConfigCommand = asyn input: DeleteFunctionCodeSigningConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-06-30/functions/{FunctionName}/code-signing-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-06-30/functions/{FunctionName}/code-signing-config"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -686,7 +703,6 @@ export const serializeAws_restJson1DeleteFunctionCodeSigningConfigCommand = asyn throw new Error("No value provided for input HTTP label: FunctionName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -702,8 +718,11 @@ export const serializeAws_restJson1DeleteFunctionConcurrencyCommand = async ( input: DeleteFunctionConcurrencyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-10-31/functions/{FunctionName}/concurrency"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2017-10-31/functions/{FunctionName}/concurrency"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -714,7 +733,6 @@ export const serializeAws_restJson1DeleteFunctionConcurrencyCommand = async ( throw new Error("No value provided for input HTTP label: FunctionName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -730,8 +748,11 @@ export const serializeAws_restJson1DeleteFunctionEventInvokeConfigCommand = asyn input: DeleteFunctionEventInvokeConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2019-09-25/functions/{FunctionName}/event-invoke-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2019-09-25/functions/{FunctionName}/event-invoke-config"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -745,7 +766,6 @@ export const serializeAws_restJson1DeleteFunctionEventInvokeConfigCommand = asyn ...(input.Qualifier !== undefined && { Qualifier: input.Qualifier }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -762,8 +782,11 @@ export const serializeAws_restJson1DeleteLayerVersionCommand = async ( input: DeleteLayerVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}"; if (input.LayerName !== undefined) { const labelValue: string = input.LayerName; if (labelValue.length <= 0) { @@ -783,7 +806,6 @@ export const serializeAws_restJson1DeleteLayerVersionCommand = async ( throw new Error("No value provided for input HTTP label: VersionNumber."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -799,8 +821,11 @@ export const serializeAws_restJson1DeleteProvisionedConcurrencyConfigCommand = a input: DeleteProvisionedConcurrencyConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -814,7 +839,6 @@ export const serializeAws_restJson1DeleteProvisionedConcurrencyConfigCommand = a ...(input.Qualifier !== undefined && { Qualifier: input.Qualifier }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -831,13 +855,14 @@ export const serializeAws_restJson1GetAccountSettingsCommand = async ( input: GetAccountSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2016-08-19/account-settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2016-08-19/account-settings"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -853,8 +878,11 @@ export const serializeAws_restJson1GetAliasCommand = async ( input: GetAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/aliases/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/aliases/{Name}"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -874,7 +902,6 @@ export const serializeAws_restJson1GetAliasCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -890,8 +917,11 @@ export const serializeAws_restJson1GetCodeSigningConfigCommand = async ( input: GetCodeSigningConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}"; if (input.CodeSigningConfigArn !== undefined) { const labelValue: string = input.CodeSigningConfigArn; if (labelValue.length <= 0) { @@ -902,7 +932,6 @@ export const serializeAws_restJson1GetCodeSigningConfigCommand = async ( throw new Error("No value provided for input HTTP label: CodeSigningConfigArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -918,8 +947,10 @@ export const serializeAws_restJson1GetEventSourceMappingCommand = async ( input: GetEventSourceMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/event-source-mappings/{UUID}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-03-31/event-source-mappings/{UUID}"; if (input.UUID !== undefined) { const labelValue: string = input.UUID; if (labelValue.length <= 0) { @@ -930,7 +961,6 @@ export const serializeAws_restJson1GetEventSourceMappingCommand = async ( throw new Error("No value provided for input HTTP label: UUID."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -946,8 +976,10 @@ export const serializeAws_restJson1GetFunctionCommand = async ( input: GetFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/functions/{FunctionName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-03-31/functions/{FunctionName}"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -961,7 +993,6 @@ export const serializeAws_restJson1GetFunctionCommand = async ( ...(input.Qualifier !== undefined && { Qualifier: input.Qualifier }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -978,8 +1009,11 @@ export const serializeAws_restJson1GetFunctionCodeSigningConfigCommand = async ( input: GetFunctionCodeSigningConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-06-30/functions/{FunctionName}/code-signing-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-06-30/functions/{FunctionName}/code-signing-config"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -990,7 +1024,6 @@ export const serializeAws_restJson1GetFunctionCodeSigningConfigCommand = async ( throw new Error("No value provided for input HTTP label: FunctionName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1006,8 +1039,11 @@ export const serializeAws_restJson1GetFunctionConcurrencyCommand = async ( input: GetFunctionConcurrencyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2019-09-30/functions/{FunctionName}/concurrency"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2019-09-30/functions/{FunctionName}/concurrency"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1018,7 +1054,6 @@ export const serializeAws_restJson1GetFunctionConcurrencyCommand = async ( throw new Error("No value provided for input HTTP label: FunctionName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1034,8 +1069,11 @@ export const serializeAws_restJson1GetFunctionConfigurationCommand = async ( input: GetFunctionConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/configuration"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1049,7 +1087,6 @@ export const serializeAws_restJson1GetFunctionConfigurationCommand = async ( ...(input.Qualifier !== undefined && { Qualifier: input.Qualifier }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1066,8 +1103,11 @@ export const serializeAws_restJson1GetFunctionEventInvokeConfigCommand = async ( input: GetFunctionEventInvokeConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2019-09-25/functions/{FunctionName}/event-invoke-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2019-09-25/functions/{FunctionName}/event-invoke-config"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1081,7 +1121,6 @@ export const serializeAws_restJson1GetFunctionEventInvokeConfigCommand = async ( ...(input.Qualifier !== undefined && { Qualifier: input.Qualifier }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1098,8 +1137,11 @@ export const serializeAws_restJson1GetLayerVersionCommand = async ( input: GetLayerVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}"; if (input.LayerName !== undefined) { const labelValue: string = input.LayerName; if (labelValue.length <= 0) { @@ -1119,7 +1161,6 @@ export const serializeAws_restJson1GetLayerVersionCommand = async ( throw new Error("No value provided for input HTTP label: VersionNumber."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1135,14 +1176,14 @@ export const serializeAws_restJson1GetLayerVersionByArnCommand = async ( input: GetLayerVersionByArnCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2018-10-31/layers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2018-10-31/layers"; const query: any = { find: "LayerVersion", ...(input.Arn !== undefined && { Arn: input.Arn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1159,8 +1200,11 @@ export const serializeAws_restJson1GetLayerVersionPolicyCommand = async ( input: GetLayerVersionPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}/policy"; if (input.LayerName !== undefined) { const labelValue: string = input.LayerName; if (labelValue.length <= 0) { @@ -1180,7 +1224,6 @@ export const serializeAws_restJson1GetLayerVersionPolicyCommand = async ( throw new Error("No value provided for input HTTP label: VersionNumber."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1196,8 +1239,11 @@ export const serializeAws_restJson1GetPolicyCommand = async ( input: GetPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/policy"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1211,7 +1257,6 @@ export const serializeAws_restJson1GetPolicyCommand = async ( ...(input.Qualifier !== undefined && { Qualifier: input.Qualifier }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1228,8 +1273,11 @@ export const serializeAws_restJson1GetProvisionedConcurrencyConfigCommand = asyn input: GetProvisionedConcurrencyConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1243,7 +1291,6 @@ export const serializeAws_restJson1GetProvisionedConcurrencyConfigCommand = asyn ...(input.Qualifier !== undefined && { Qualifier: input.Qualifier }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1260,13 +1307,16 @@ export const serializeAws_restJson1InvokeCommand = async ( input: InvokeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.InvocationType) && { "x-amz-invocation-type": input.InvocationType! }), ...(isSerializableHeaderValue(input.LogType) && { "x-amz-log-type": input.LogType! }), ...(isSerializableHeaderValue(input.ClientContext) && { "x-amz-client-context": input.ClientContext! }), }; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/invocations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/invocations"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1283,7 +1333,6 @@ export const serializeAws_restJson1InvokeCommand = async ( if (input.Payload !== undefined) { body = input.Payload; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1300,10 +1349,13 @@ export const serializeAws_restJson1InvokeAsyncCommand = async ( input: InvokeAsyncCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", }; - let resolvedPath = "/2014-11-13/functions/{FunctionName}/invoke-async"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2014-11-13/functions/{FunctionName}/invoke-async"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1317,7 +1369,6 @@ export const serializeAws_restJson1InvokeAsyncCommand = async ( if (input.InvokeArgs !== undefined) { body = input.InvokeArgs; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1333,8 +1384,11 @@ export const serializeAws_restJson1ListAliasesCommand = async ( input: ListAliasesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/aliases"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/aliases"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1350,7 +1404,6 @@ export const serializeAws_restJson1ListAliasesCommand = async ( ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1367,14 +1420,15 @@ export const serializeAws_restJson1ListCodeSigningConfigsCommand = async ( input: ListCodeSigningConfigsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-04-22/code-signing-configs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-04-22/code-signing-configs"; const query: any = { ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1391,8 +1445,10 @@ export const serializeAws_restJson1ListEventSourceMappingsCommand = async ( input: ListEventSourceMappingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/event-source-mappings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-03-31/event-source-mappings"; const query: any = { ...(input.EventSourceArn !== undefined && { EventSourceArn: input.EventSourceArn }), ...(input.FunctionName !== undefined && { FunctionName: input.FunctionName }), @@ -1400,7 +1456,6 @@ export const serializeAws_restJson1ListEventSourceMappingsCommand = async ( ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1417,8 +1472,11 @@ export const serializeAws_restJson1ListFunctionEventInvokeConfigsCommand = async input: ListFunctionEventInvokeConfigsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2019-09-25/functions/{FunctionName}/event-invoke-config/list"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2019-09-25/functions/{FunctionName}/event-invoke-config/list"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1433,7 +1491,6 @@ export const serializeAws_restJson1ListFunctionEventInvokeConfigsCommand = async ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1450,8 +1507,9 @@ export const serializeAws_restJson1ListFunctionsCommand = async ( input: ListFunctionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/functions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-03-31/functions"; const query: any = { ...(input.MasterRegion !== undefined && { MasterRegion: input.MasterRegion }), ...(input.FunctionVersion !== undefined && { FunctionVersion: input.FunctionVersion }), @@ -1459,7 +1517,6 @@ export const serializeAws_restJson1ListFunctionsCommand = async ( ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1476,8 +1533,11 @@ export const serializeAws_restJson1ListFunctionsByCodeSigningConfigCommand = asy input: ListFunctionsByCodeSigningConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}/functions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}/functions"; if (input.CodeSigningConfigArn !== undefined) { const labelValue: string = input.CodeSigningConfigArn; if (labelValue.length <= 0) { @@ -1492,7 +1552,6 @@ export const serializeAws_restJson1ListFunctionsByCodeSigningConfigCommand = asy ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1509,15 +1568,15 @@ export const serializeAws_restJson1ListLayersCommand = async ( input: ListLayersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2018-10-31/layers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2018-10-31/layers"; const query: any = { ...(input.CompatibleRuntime !== undefined && { CompatibleRuntime: input.CompatibleRuntime }), ...(input.Marker !== undefined && { Marker: input.Marker }), ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1534,8 +1593,10 @@ export const serializeAws_restJson1ListLayerVersionsCommand = async ( input: ListLayerVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2018-10-31/layers/{LayerName}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2018-10-31/layers/{LayerName}/versions"; if (input.LayerName !== undefined) { const labelValue: string = input.LayerName; if (labelValue.length <= 0) { @@ -1551,7 +1612,6 @@ export const serializeAws_restJson1ListLayerVersionsCommand = async ( ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1568,8 +1628,11 @@ export const serializeAws_restJson1ListProvisionedConcurrencyConfigsCommand = as input: ListProvisionedConcurrencyConfigsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1585,7 +1648,6 @@ export const serializeAws_restJson1ListProvisionedConcurrencyConfigsCommand = as ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1602,8 +1664,10 @@ export const serializeAws_restJson1ListTagsCommand = async ( input: ListTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-03-31/tags/{Resource}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-03-31/tags/{Resource}"; if (input.Resource !== undefined) { const labelValue: string = input.Resource; if (labelValue.length <= 0) { @@ -1614,7 +1678,6 @@ export const serializeAws_restJson1ListTagsCommand = async ( throw new Error("No value provided for input HTTP label: Resource."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1630,8 +1693,11 @@ export const serializeAws_restJson1ListVersionsByFunctionCommand = async ( input: ListVersionsByFunctionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/versions"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1646,7 +1712,6 @@ export const serializeAws_restJson1ListVersionsByFunctionCommand = async ( ...(input.MaxItems !== undefined && { MaxItems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1663,10 +1728,12 @@ export const serializeAws_restJson1PublishLayerVersionCommand = async ( input: PublishLayerVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2018-10-31/layers/{LayerName}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2018-10-31/layers/{LayerName}/versions"; if (input.LayerName !== undefined) { const labelValue: string = input.LayerName; if (labelValue.length <= 0) { @@ -1687,7 +1754,6 @@ export const serializeAws_restJson1PublishLayerVersionCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.LicenseInfo !== undefined && input.LicenseInfo !== null && { LicenseInfo: input.LicenseInfo }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1703,10 +1769,13 @@ export const serializeAws_restJson1PublishVersionCommand = async ( input: PublishVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/versions"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1722,7 +1791,6 @@ export const serializeAws_restJson1PublishVersionCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.RevisionId !== undefined && input.RevisionId !== null && { RevisionId: input.RevisionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1738,10 +1806,13 @@ export const serializeAws_restJson1PutFunctionCodeSigningConfigCommand = async ( input: PutFunctionCodeSigningConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2020-06-30/functions/{FunctionName}/code-signing-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-06-30/functions/{FunctionName}/code-signing-config"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1756,7 +1827,6 @@ export const serializeAws_restJson1PutFunctionCodeSigningConfigCommand = async ( ...(input.CodeSigningConfigArn !== undefined && input.CodeSigningConfigArn !== null && { CodeSigningConfigArn: input.CodeSigningConfigArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1772,10 +1842,13 @@ export const serializeAws_restJson1PutFunctionConcurrencyCommand = async ( input: PutFunctionConcurrencyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-10-31/functions/{FunctionName}/concurrency"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2017-10-31/functions/{FunctionName}/concurrency"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1792,7 +1865,6 @@ export const serializeAws_restJson1PutFunctionConcurrencyCommand = async ( ReservedConcurrentExecutions: input.ReservedConcurrentExecutions, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1808,10 +1880,13 @@ export const serializeAws_restJson1PutFunctionEventInvokeConfigCommand = async ( input: PutFunctionEventInvokeConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2019-09-25/functions/{FunctionName}/event-invoke-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2019-09-25/functions/{FunctionName}/event-invoke-config"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1835,7 +1910,6 @@ export const serializeAws_restJson1PutFunctionEventInvokeConfigCommand = async ( ...(input.MaximumRetryAttempts !== undefined && input.MaximumRetryAttempts !== null && { MaximumRetryAttempts: input.MaximumRetryAttempts }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1852,10 +1926,13 @@ export const serializeAws_restJson1PutProvisionedConcurrencyConfigCommand = asyn input: PutProvisionedConcurrencyConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2019-09-30/functions/{FunctionName}/provisioned-concurrency"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1875,7 +1952,6 @@ export const serializeAws_restJson1PutProvisionedConcurrencyConfigCommand = asyn ProvisionedConcurrentExecutions: input.ProvisionedConcurrentExecutions, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1892,8 +1968,11 @@ export const serializeAws_restJson1RemoveLayerVersionPermissionCommand = async ( input: RemoveLayerVersionPermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}/policy/{StatementId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2018-10-31/layers/{LayerName}/versions/{VersionNumber}/policy/{StatementId}"; if (input.LayerName !== undefined) { const labelValue: string = input.LayerName; if (labelValue.length <= 0) { @@ -1925,7 +2004,6 @@ export const serializeAws_restJson1RemoveLayerVersionPermissionCommand = async ( ...(input.RevisionId !== undefined && { RevisionId: input.RevisionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1942,8 +2020,11 @@ export const serializeAws_restJson1RemovePermissionCommand = async ( input: RemovePermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/policy/{StatementId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/policy/{StatementId}"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -1967,7 +2048,6 @@ export const serializeAws_restJson1RemovePermissionCommand = async ( ...(input.RevisionId !== undefined && { RevisionId: input.RevisionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1984,10 +2064,12 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-03-31/tags/{Resource}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-03-31/tags/{Resource}"; if (input.Resource !== undefined) { const labelValue: string = input.Resource; if (labelValue.length <= 0) { @@ -2001,7 +2083,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2017,8 +2098,10 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-03-31/tags/{Resource}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-03-31/tags/{Resource}"; if (input.Resource !== undefined) { const labelValue: string = input.Resource; if (labelValue.length <= 0) { @@ -2032,7 +2115,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2049,10 +2131,13 @@ export const serializeAws_restJson1UpdateAliasCommand = async ( input: UpdateAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/aliases/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/aliases/{Name}"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -2082,7 +2167,6 @@ export const serializeAws_restJson1UpdateAliasCommand = async ( RoutingConfig: serializeAws_restJson1AliasRoutingConfiguration(input.RoutingConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2098,10 +2182,13 @@ export const serializeAws_restJson1UpdateCodeSigningConfigCommand = async ( input: UpdateCodeSigningConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-04-22/code-signing-configs/{CodeSigningConfigArn}"; if (input.CodeSigningConfigArn !== undefined) { const labelValue: string = input.CodeSigningConfigArn; if (labelValue.length <= 0) { @@ -2123,7 +2210,6 @@ export const serializeAws_restJson1UpdateCodeSigningConfigCommand = async ( }), ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2139,10 +2225,12 @@ export const serializeAws_restJson1UpdateEventSourceMappingCommand = async ( input: UpdateEventSourceMappingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-03-31/event-source-mappings/{UUID}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-03-31/event-source-mappings/{UUID}"; if (input.UUID !== undefined) { const labelValue: string = input.UUID; if (labelValue.length <= 0) { @@ -2187,7 +2275,6 @@ export const serializeAws_restJson1UpdateEventSourceMappingCommand = async ( ...(input.TumblingWindowInSeconds !== undefined && input.TumblingWindowInSeconds !== null && { TumblingWindowInSeconds: input.TumblingWindowInSeconds }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2203,10 +2290,12 @@ export const serializeAws_restJson1UpdateFunctionCodeCommand = async ( input: UpdateFunctionCodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/code"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2015-03-31/functions/{FunctionName}/code"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -2228,7 +2317,6 @@ export const serializeAws_restJson1UpdateFunctionCodeCommand = async ( input.S3ObjectVersion !== null && { S3ObjectVersion: input.S3ObjectVersion }), ...(input.ZipFile !== undefined && input.ZipFile !== null && { ZipFile: context.base64Encoder(input.ZipFile) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2244,10 +2332,13 @@ export const serializeAws_restJson1UpdateFunctionConfigurationCommand = async ( input: UpdateFunctionConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2015-03-31/functions/{FunctionName}/configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2015-03-31/functions/{FunctionName}/configuration"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -2288,7 +2379,6 @@ export const serializeAws_restJson1UpdateFunctionConfigurationCommand = async ( ...(input.VpcConfig !== undefined && input.VpcConfig !== null && { VpcConfig: serializeAws_restJson1VpcConfig(input.VpcConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2304,10 +2394,13 @@ export const serializeAws_restJson1UpdateFunctionEventInvokeConfigCommand = asyn input: UpdateFunctionEventInvokeConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2019-09-25/functions/{FunctionName}/event-invoke-config"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2019-09-25/functions/{FunctionName}/event-invoke-config"; if (input.FunctionName !== undefined) { const labelValue: string = input.FunctionName; if (labelValue.length <= 0) { @@ -2331,7 +2424,6 @@ export const serializeAws_restJson1UpdateFunctionEventInvokeConfigCommand = asyn ...(input.MaximumRetryAttempts !== undefined && input.MaximumRetryAttempts !== null && { MaximumRetryAttempts: input.MaximumRetryAttempts }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-lex-model-building-service/protocols/Aws_restJson1.ts b/clients/client-lex-model-building-service/protocols/Aws_restJson1.ts index e785f862d8ba1..bf796f3c27ef0 100644 --- a/clients/client-lex-model-building-service/protocols/Aws_restJson1.ts +++ b/clients/client-lex-model-building-service/protocols/Aws_restJson1.ts @@ -130,10 +130,11 @@ export const serializeAws_restJson1CreateBotVersionCommand = async ( input: CreateBotVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{name}/versions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{name}/versions"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -147,7 +148,6 @@ export const serializeAws_restJson1CreateBotVersionCommand = async ( body = JSON.stringify({ ...(input.checksum !== undefined && input.checksum !== null && { checksum: input.checksum }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -163,10 +163,11 @@ export const serializeAws_restJson1CreateIntentVersionCommand = async ( input: CreateIntentVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/intents/{name}/versions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/intents/{name}/versions"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -180,7 +181,6 @@ export const serializeAws_restJson1CreateIntentVersionCommand = async ( body = JSON.stringify({ ...(input.checksum !== undefined && input.checksum !== null && { checksum: input.checksum }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -196,10 +196,12 @@ export const serializeAws_restJson1CreateSlotTypeVersionCommand = async ( input: CreateSlotTypeVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/slottypes/{name}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/slottypes/{name}/versions"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -213,7 +215,6 @@ export const serializeAws_restJson1CreateSlotTypeVersionCommand = async ( body = JSON.stringify({ ...(input.checksum !== undefined && input.checksum !== null && { checksum: input.checksum }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -229,8 +230,9 @@ export const serializeAws_restJson1DeleteBotCommand = async ( input: DeleteBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -241,7 +243,6 @@ export const serializeAws_restJson1DeleteBotCommand = async ( throw new Error("No value provided for input HTTP label: name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -257,8 +258,10 @@ export const serializeAws_restJson1DeleteBotAliasCommand = async ( input: DeleteBotAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botName}/aliases/{name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botName}/aliases/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -278,7 +281,6 @@ export const serializeAws_restJson1DeleteBotAliasCommand = async ( throw new Error("No value provided for input HTTP label: botName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -294,8 +296,11 @@ export const serializeAws_restJson1DeleteBotChannelAssociationCommand = async ( input: DeleteBotChannelAssociationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botName}/aliases/{botAlias}/channels/{name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botName}/aliases/{botAlias}/channels/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -324,7 +329,6 @@ export const serializeAws_restJson1DeleteBotChannelAssociationCommand = async ( throw new Error("No value provided for input HTTP label: botAlias."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -340,8 +344,10 @@ export const serializeAws_restJson1DeleteBotVersionCommand = async ( input: DeleteBotVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{name}/versions/{version}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{name}/versions/{version}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -361,7 +367,6 @@ export const serializeAws_restJson1DeleteBotVersionCommand = async ( throw new Error("No value provided for input HTTP label: version."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -377,8 +382,9 @@ export const serializeAws_restJson1DeleteIntentCommand = async ( input: DeleteIntentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/intents/{name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/intents/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -389,7 +395,6 @@ export const serializeAws_restJson1DeleteIntentCommand = async ( throw new Error("No value provided for input HTTP label: name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -405,8 +410,10 @@ export const serializeAws_restJson1DeleteIntentVersionCommand = async ( input: DeleteIntentVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/intents/{name}/versions/{version}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/intents/{name}/versions/{version}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -426,7 +433,6 @@ export const serializeAws_restJson1DeleteIntentVersionCommand = async ( throw new Error("No value provided for input HTTP label: version."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -442,8 +448,9 @@ export const serializeAws_restJson1DeleteSlotTypeCommand = async ( input: DeleteSlotTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/slottypes/{name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/slottypes/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -454,7 +461,6 @@ export const serializeAws_restJson1DeleteSlotTypeCommand = async ( throw new Error("No value provided for input HTTP label: name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -470,8 +476,10 @@ export const serializeAws_restJson1DeleteSlotTypeVersionCommand = async ( input: DeleteSlotTypeVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/slottypes/{name}/version/{version}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/slottypes/{name}/version/{version}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -491,7 +499,6 @@ export const serializeAws_restJson1DeleteSlotTypeVersionCommand = async ( throw new Error("No value provided for input HTTP label: version."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -507,8 +514,10 @@ export const serializeAws_restJson1DeleteUtterancesCommand = async ( input: DeleteUtterancesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botName}/utterances/{userId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botName}/utterances/{userId}"; if (input.botName !== undefined) { const labelValue: string = input.botName; if (labelValue.length <= 0) { @@ -528,7 +537,6 @@ export const serializeAws_restJson1DeleteUtterancesCommand = async ( throw new Error("No value provided for input HTTP label: userId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -544,8 +552,10 @@ export const serializeAws_restJson1GetBotCommand = async ( input: GetBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{name}/versions/{versionOrAlias}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{name}/versions/{versionOrAlias}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -565,7 +575,6 @@ export const serializeAws_restJson1GetBotCommand = async ( throw new Error("No value provided for input HTTP label: versionOrAlias."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -581,8 +590,10 @@ export const serializeAws_restJson1GetBotAliasCommand = async ( input: GetBotAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botName}/aliases/{name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botName}/aliases/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -602,7 +613,6 @@ export const serializeAws_restJson1GetBotAliasCommand = async ( throw new Error("No value provided for input HTTP label: botName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -618,8 +628,9 @@ export const serializeAws_restJson1GetBotAliasesCommand = async ( input: GetBotAliasesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botName}/aliases"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botName}/aliases"; if (input.botName !== undefined) { const labelValue: string = input.botName; if (labelValue.length <= 0) { @@ -635,7 +646,6 @@ export const serializeAws_restJson1GetBotAliasesCommand = async ( ...(input.nameContains !== undefined && { nameContains: input.nameContains }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -652,8 +662,11 @@ export const serializeAws_restJson1GetBotChannelAssociationCommand = async ( input: GetBotChannelAssociationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botName}/aliases/{botAlias}/channels/{name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botName}/aliases/{botAlias}/channels/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -682,7 +695,6 @@ export const serializeAws_restJson1GetBotChannelAssociationCommand = async ( throw new Error("No value provided for input HTTP label: botAlias."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -698,8 +710,11 @@ export const serializeAws_restJson1GetBotChannelAssociationsCommand = async ( input: GetBotChannelAssociationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botName}/aliases/{botAlias}/channels"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botName}/aliases/{botAlias}/channels"; if (input.botName !== undefined) { const labelValue: string = input.botName; if (labelValue.length <= 0) { @@ -724,7 +739,6 @@ export const serializeAws_restJson1GetBotChannelAssociationsCommand = async ( ...(input.nameContains !== undefined && { nameContains: input.nameContains }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -741,15 +755,15 @@ export const serializeAws_restJson1GetBotsCommand = async ( input: GetBotsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nameContains !== undefined && { nameContains: input.nameContains }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -766,8 +780,9 @@ export const serializeAws_restJson1GetBotVersionsCommand = async ( input: GetBotVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{name}/versions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{name}/versions"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -782,7 +797,6 @@ export const serializeAws_restJson1GetBotVersionsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -799,8 +813,10 @@ export const serializeAws_restJson1GetBuiltinIntentCommand = async ( input: GetBuiltinIntentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/builtins/intents/{signature}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/builtins/intents/{signature}"; if (input.signature !== undefined) { const labelValue: string = input.signature; if (labelValue.length <= 0) { @@ -811,7 +827,6 @@ export const serializeAws_restJson1GetBuiltinIntentCommand = async ( throw new Error("No value provided for input HTTP label: signature."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -827,8 +842,9 @@ export const serializeAws_restJson1GetBuiltinIntentsCommand = async ( input: GetBuiltinIntentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/builtins/intents"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/builtins/intents"; const query: any = { ...(input.locale !== undefined && { locale: input.locale }), ...(input.signatureContains !== undefined && { signatureContains: input.signatureContains }), @@ -836,7 +852,6 @@ export const serializeAws_restJson1GetBuiltinIntentsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -853,8 +868,9 @@ export const serializeAws_restJson1GetBuiltinSlotTypesCommand = async ( input: GetBuiltinSlotTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/builtins/slottypes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/builtins/slottypes"; const query: any = { ...(input.locale !== undefined && { locale: input.locale }), ...(input.signatureContains !== undefined && { signatureContains: input.signatureContains }), @@ -862,7 +878,6 @@ export const serializeAws_restJson1GetBuiltinSlotTypesCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -879,8 +894,9 @@ export const serializeAws_restJson1GetExportCommand = async ( input: GetExportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/exports"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/exports"; const query: any = { ...(input.name !== undefined && { name: input.name }), ...(input.version !== undefined && { version: input.version }), @@ -888,7 +904,6 @@ export const serializeAws_restJson1GetExportCommand = async ( ...(input.exportType !== undefined && { exportType: input.exportType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -905,8 +920,9 @@ export const serializeAws_restJson1GetImportCommand = async ( input: GetImportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/imports/{importId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/imports/{importId}"; if (input.importId !== undefined) { const labelValue: string = input.importId; if (labelValue.length <= 0) { @@ -917,7 +933,6 @@ export const serializeAws_restJson1GetImportCommand = async ( throw new Error("No value provided for input HTTP label: importId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -933,8 +948,10 @@ export const serializeAws_restJson1GetIntentCommand = async ( input: GetIntentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/intents/{name}/versions/{version}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/intents/{name}/versions/{version}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -954,7 +971,6 @@ export const serializeAws_restJson1GetIntentCommand = async ( throw new Error("No value provided for input HTTP label: version."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -970,15 +986,15 @@ export const serializeAws_restJson1GetIntentsCommand = async ( input: GetIntentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/intents"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/intents"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nameContains !== undefined && { nameContains: input.nameContains }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -995,8 +1011,9 @@ export const serializeAws_restJson1GetIntentVersionsCommand = async ( input: GetIntentVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/intents/{name}/versions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/intents/{name}/versions"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1011,7 +1028,6 @@ export const serializeAws_restJson1GetIntentVersionsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1028,8 +1044,10 @@ export const serializeAws_restJson1GetSlotTypeCommand = async ( input: GetSlotTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/slottypes/{name}/versions/{version}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/slottypes/{name}/versions/{version}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1049,7 +1067,6 @@ export const serializeAws_restJson1GetSlotTypeCommand = async ( throw new Error("No value provided for input HTTP label: version."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1065,15 +1082,15 @@ export const serializeAws_restJson1GetSlotTypesCommand = async ( input: GetSlotTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/slottypes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/slottypes"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nameContains !== undefined && { nameContains: input.nameContains }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1090,8 +1107,10 @@ export const serializeAws_restJson1GetSlotTypeVersionsCommand = async ( input: GetSlotTypeVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/slottypes/{name}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/slottypes/{name}/versions"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1106,7 +1125,6 @@ export const serializeAws_restJson1GetSlotTypeVersionsCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1123,8 +1141,10 @@ export const serializeAws_restJson1GetUtterancesViewCommand = async ( input: GetUtterancesViewCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botName}/utterances"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botName}/utterances"; if (input.botName !== undefined) { const labelValue: string = input.botName; if (labelValue.length <= 0) { @@ -1140,7 +1160,6 @@ export const serializeAws_restJson1GetUtterancesViewCommand = async ( ...(input.statusType !== undefined && { status_type: input.statusType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1157,8 +1176,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1169,7 +1189,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1185,10 +1204,12 @@ export const serializeAws_restJson1PutBotCommand = async ( input: PutBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{name}/versions/$LATEST"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{name}/versions/$LATEST"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1231,7 +1252,6 @@ export const serializeAws_restJson1PutBotCommand = async ( input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), ...(input.voiceId !== undefined && input.voiceId !== null && { voiceId: input.voiceId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1247,10 +1267,12 @@ export const serializeAws_restJson1PutBotAliasCommand = async ( input: PutBotAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botName}/aliases/{name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botName}/aliases/{name}"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1281,7 +1303,6 @@ export const serializeAws_restJson1PutBotAliasCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1297,10 +1318,12 @@ export const serializeAws_restJson1PutIntentCommand = async ( input: PutIntentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/intents/{name}/versions/$LATEST"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/intents/{name}/versions/$LATEST"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1360,7 +1383,6 @@ export const serializeAws_restJson1PutIntentCommand = async ( ...(input.slots !== undefined && input.slots !== null && { slots: serializeAws_restJson1SlotList(input.slots, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1376,10 +1398,12 @@ export const serializeAws_restJson1PutSlotTypeCommand = async ( input: PutSlotTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/slottypes/{name}/versions/$LATEST"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/slottypes/{name}/versions/$LATEST"; if (input.name !== undefined) { const labelValue: string = input.name; if (labelValue.length <= 0) { @@ -1407,7 +1431,6 @@ export const serializeAws_restJson1PutSlotTypeCommand = async ( ...(input.valueSelectionStrategy !== undefined && input.valueSelectionStrategy !== null && { valueSelectionStrategy: input.valueSelectionStrategy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1423,10 +1446,11 @@ export const serializeAws_restJson1StartImportCommand = async ( input: StartImportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/imports"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/imports"; let body: any; body = JSON.stringify({ ...(input.mergeStrategy !== undefined && input.mergeStrategy !== null && { mergeStrategy: input.mergeStrategy }), @@ -1435,7 +1459,6 @@ export const serializeAws_restJson1StartImportCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1451,10 +1474,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1469,7 +1493,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1485,8 +1508,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1500,7 +1524,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-lex-models-v2/protocols/Aws_restJson1.ts b/clients/client-lex-models-v2/protocols/Aws_restJson1.ts index 417a8cc807d06..b765749ce8a04 100644 --- a/clients/client-lex-models-v2/protocols/Aws_restJson1.ts +++ b/clients/client-lex-models-v2/protocols/Aws_restJson1.ts @@ -188,8 +188,11 @@ export const serializeAws_restJson1BuildBotLocaleCommand = async ( input: BuildBotLocaleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -218,7 +221,6 @@ export const serializeAws_restJson1BuildBotLocaleCommand = async ( throw new Error("No value provided for input HTTP label: localeId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -234,10 +236,11 @@ export const serializeAws_restJson1CreateBotCommand = async ( input: CreateBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots"; let body: any; body = JSON.stringify({ ...(input.botName !== undefined && input.botName !== null && { botName: input.botName }), @@ -254,7 +257,6 @@ export const serializeAws_restJson1CreateBotCommand = async ( testBotAliasTags: serializeAws_restJson1TagMap(input.testBotAliasTags, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -270,10 +272,11 @@ export const serializeAws_restJson1CreateBotAliasCommand = async ( input: CreateBotAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botaliases"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}/botaliases"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -305,7 +308,6 @@ export const serializeAws_restJson1CreateBotAliasCommand = async ( }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -321,10 +323,13 @@ export const serializeAws_restJson1CreateBotLocaleCommand = async ( input: CreateBotLocaleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -356,7 +361,6 @@ export const serializeAws_restJson1CreateBotLocaleCommand = async ( voiceSettings: serializeAws_restJson1VoiceSettings(input.voiceSettings, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -372,10 +376,12 @@ export const serializeAws_restJson1CreateBotVersionCommand = async ( input: CreateBotVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}/botversions"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -396,7 +402,6 @@ export const serializeAws_restJson1CreateBotVersionCommand = async ( }), ...(input.description !== undefined && input.description !== null && { description: input.description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -412,10 +417,11 @@ export const serializeAws_restJson1CreateExportCommand = async ( input: CreateExportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/exports"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/exports"; let body: any; body = JSON.stringify({ ...(input.fileFormat !== undefined && input.fileFormat !== null && { fileFormat: input.fileFormat }), @@ -425,7 +431,6 @@ export const serializeAws_restJson1CreateExportCommand = async ( resourceSpecification: serializeAws_restJson1ExportResourceSpecification(input.resourceSpecification, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -441,10 +446,13 @@ export const serializeAws_restJson1CreateIntentCommand = async ( input: CreateIntentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -514,7 +522,6 @@ export const serializeAws_restJson1CreateIntentCommand = async ( sampleUtterances: serializeAws_restJson1SampleUtterancesList(input.sampleUtterances, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -530,10 +537,11 @@ export const serializeAws_restJson1CreateResourcePolicyCommand = async ( input: CreateResourcePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/policy/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -547,7 +555,6 @@ export const serializeAws_restJson1CreateResourcePolicyCommand = async ( body = JSON.stringify({ ...(input.policy !== undefined && input.policy !== null && { policy: input.policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -563,10 +570,12 @@ export const serializeAws_restJson1CreateResourcePolicyStatementCommand = async input: CreateResourcePolicyStatementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/policy/{resourceArn}/statements"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy/{resourceArn}/statements"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -590,7 +599,6 @@ export const serializeAws_restJson1CreateResourcePolicyStatementCommand = async input.principal !== null && { principal: serializeAws_restJson1PrincipalList(input.principal, context) }), ...(input.statementId !== undefined && input.statementId !== null && { statementId: input.statementId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -607,10 +615,13 @@ export const serializeAws_restJson1CreateSlotCommand = async ( input: CreateSlotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -668,7 +679,6 @@ export const serializeAws_restJson1CreateSlotCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -684,10 +694,13 @@ export const serializeAws_restJson1CreateSlotTypeCommand = async ( input: CreateSlotTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -730,7 +743,6 @@ export const serializeAws_restJson1CreateSlotTypeCommand = async ( valueSelectionSetting: serializeAws_restJson1SlotValueSelectionSetting(input.valueSelectionSetting, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -746,13 +758,13 @@ export const serializeAws_restJson1CreateUploadUrlCommand = async ( input: CreateUploadUrlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createuploadurl"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createuploadurl"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -768,8 +780,9 @@ export const serializeAws_restJson1DeleteBotCommand = async ( input: DeleteBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -785,7 +798,6 @@ export const serializeAws_restJson1DeleteBotCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -802,8 +814,10 @@ export const serializeAws_restJson1DeleteBotAliasCommand = async ( input: DeleteBotAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botaliases/{botAliasId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}/botaliases/{botAliasId}"; if (input.botAliasId !== undefined) { const labelValue: string = input.botAliasId; if (labelValue.length <= 0) { @@ -828,7 +842,6 @@ export const serializeAws_restJson1DeleteBotAliasCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -845,8 +858,11 @@ export const serializeAws_restJson1DeleteBotLocaleCommand = async ( input: DeleteBotLocaleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -875,7 +891,6 @@ export const serializeAws_restJson1DeleteBotLocaleCommand = async ( throw new Error("No value provided for input HTTP label: localeId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -891,8 +906,10 @@ export const serializeAws_restJson1DeleteBotVersionCommand = async ( input: DeleteBotVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}/botversions/{botVersion}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -917,7 +934,6 @@ export const serializeAws_restJson1DeleteBotVersionCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -934,8 +950,9 @@ export const serializeAws_restJson1DeleteExportCommand = async ( input: DeleteExportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/exports/{exportId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/exports/{exportId}"; if (input.exportId !== undefined) { const labelValue: string = input.exportId; if (labelValue.length <= 0) { @@ -946,7 +963,6 @@ export const serializeAws_restJson1DeleteExportCommand = async ( throw new Error("No value provided for input HTTP label: exportId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -962,8 +978,9 @@ export const serializeAws_restJson1DeleteImportCommand = async ( input: DeleteImportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/imports/{importId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/imports/{importId}"; if (input.importId !== undefined) { const labelValue: string = input.importId; if (labelValue.length <= 0) { @@ -974,7 +991,6 @@ export const serializeAws_restJson1DeleteImportCommand = async ( throw new Error("No value provided for input HTTP label: importId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -990,8 +1006,11 @@ export const serializeAws_restJson1DeleteIntentCommand = async ( input: DeleteIntentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}"; if (input.intentId !== undefined) { const labelValue: string = input.intentId; if (labelValue.length <= 0) { @@ -1029,7 +1048,6 @@ export const serializeAws_restJson1DeleteIntentCommand = async ( throw new Error("No value provided for input HTTP label: localeId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1045,8 +1063,9 @@ export const serializeAws_restJson1DeleteResourcePolicyCommand = async ( input: DeleteResourcePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policy/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1060,7 +1079,6 @@ export const serializeAws_restJson1DeleteResourcePolicyCommand = async ( ...(input.expectedRevisionId !== undefined && { expectedRevisionId: input.expectedRevisionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1077,8 +1095,11 @@ export const serializeAws_restJson1DeleteResourcePolicyStatementCommand = async input: DeleteResourcePolicyStatementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policy/{resourceArn}/statements/{statementId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/policy/{resourceArn}/statements/{statementId}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1101,7 +1122,6 @@ export const serializeAws_restJson1DeleteResourcePolicyStatementCommand = async ...(input.expectedRevisionId !== undefined && { expectedRevisionId: input.expectedRevisionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1118,8 +1138,11 @@ export const serializeAws_restJson1DeleteSlotCommand = async ( input: DeleteSlotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/{slotId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/{slotId}"; if (input.slotId !== undefined) { const labelValue: string = input.slotId; if (labelValue.length <= 0) { @@ -1166,7 +1189,6 @@ export const serializeAws_restJson1DeleteSlotCommand = async ( throw new Error("No value provided for input HTTP label: intentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1182,8 +1204,11 @@ export const serializeAws_restJson1DeleteSlotTypeCommand = async ( input: DeleteSlotTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/{slotTypeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/{slotTypeId}"; if (input.slotTypeId !== undefined) { const labelValue: string = input.slotTypeId; if (labelValue.length <= 0) { @@ -1226,7 +1251,6 @@ export const serializeAws_restJson1DeleteSlotTypeCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1243,8 +1267,9 @@ export const serializeAws_restJson1DescribeBotCommand = async ( input: DescribeBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -1255,7 +1280,6 @@ export const serializeAws_restJson1DescribeBotCommand = async ( throw new Error("No value provided for input HTTP label: botId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1271,8 +1295,10 @@ export const serializeAws_restJson1DescribeBotAliasCommand = async ( input: DescribeBotAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botaliases/{botAliasId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}/botaliases/{botAliasId}"; if (input.botAliasId !== undefined) { const labelValue: string = input.botAliasId; if (labelValue.length <= 0) { @@ -1292,7 +1318,6 @@ export const serializeAws_restJson1DescribeBotAliasCommand = async ( throw new Error("No value provided for input HTTP label: botId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1308,8 +1333,11 @@ export const serializeAws_restJson1DescribeBotLocaleCommand = async ( input: DescribeBotLocaleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -1338,7 +1366,6 @@ export const serializeAws_restJson1DescribeBotLocaleCommand = async ( throw new Error("No value provided for input HTTP label: localeId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1354,8 +1381,10 @@ export const serializeAws_restJson1DescribeBotVersionCommand = async ( input: DescribeBotVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}/botversions/{botVersion}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -1375,7 +1404,6 @@ export const serializeAws_restJson1DescribeBotVersionCommand = async ( throw new Error("No value provided for input HTTP label: botVersion."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1391,8 +1419,9 @@ export const serializeAws_restJson1DescribeExportCommand = async ( input: DescribeExportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/exports/{exportId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/exports/{exportId}"; if (input.exportId !== undefined) { const labelValue: string = input.exportId; if (labelValue.length <= 0) { @@ -1403,7 +1432,6 @@ export const serializeAws_restJson1DescribeExportCommand = async ( throw new Error("No value provided for input HTTP label: exportId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1419,8 +1447,9 @@ export const serializeAws_restJson1DescribeImportCommand = async ( input: DescribeImportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/imports/{importId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/imports/{importId}"; if (input.importId !== undefined) { const labelValue: string = input.importId; if (labelValue.length <= 0) { @@ -1431,7 +1460,6 @@ export const serializeAws_restJson1DescribeImportCommand = async ( throw new Error("No value provided for input HTTP label: importId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1447,8 +1475,11 @@ export const serializeAws_restJson1DescribeIntentCommand = async ( input: DescribeIntentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}"; if (input.intentId !== undefined) { const labelValue: string = input.intentId; if (labelValue.length <= 0) { @@ -1486,7 +1517,6 @@ export const serializeAws_restJson1DescribeIntentCommand = async ( throw new Error("No value provided for input HTTP label: localeId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1502,8 +1532,9 @@ export const serializeAws_restJson1DescribeResourcePolicyCommand = async ( input: DescribeResourcePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/policy/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1514,7 +1545,6 @@ export const serializeAws_restJson1DescribeResourcePolicyCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1530,8 +1560,11 @@ export const serializeAws_restJson1DescribeSlotCommand = async ( input: DescribeSlotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/{slotId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/{slotId}"; if (input.slotId !== undefined) { const labelValue: string = input.slotId; if (labelValue.length <= 0) { @@ -1578,7 +1611,6 @@ export const serializeAws_restJson1DescribeSlotCommand = async ( throw new Error("No value provided for input HTTP label: intentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1594,8 +1626,11 @@ export const serializeAws_restJson1DescribeSlotTypeCommand = async ( input: DescribeSlotTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/{slotTypeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/{slotTypeId}"; if (input.slotTypeId !== undefined) { const labelValue: string = input.slotTypeId; if (labelValue.length <= 0) { @@ -1633,7 +1668,6 @@ export const serializeAws_restJson1DescribeSlotTypeCommand = async ( throw new Error("No value provided for input HTTP label: localeId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1649,10 +1683,11 @@ export const serializeAws_restJson1ListBotAliasesCommand = async ( input: ListBotAliasesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botaliases"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}/botaliases"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -1667,7 +1702,6 @@ export const serializeAws_restJson1ListBotAliasesCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1683,10 +1717,13 @@ export const serializeAws_restJson1ListBotLocalesCommand = async ( input: ListBotLocalesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -1714,7 +1751,6 @@ export const serializeAws_restJson1ListBotLocalesCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: serializeAws_restJson1BotLocaleSortBy(input.sortBy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1730,10 +1766,11 @@ export const serializeAws_restJson1ListBotsCommand = async ( input: ListBotsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1743,7 +1780,6 @@ export const serializeAws_restJson1ListBotsCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: serializeAws_restJson1BotSortBy(input.sortBy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1759,10 +1795,12 @@ export const serializeAws_restJson1ListBotVersionsCommand = async ( input: ListBotVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}/botversions"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -1779,7 +1817,6 @@ export const serializeAws_restJson1ListBotVersionsCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: serializeAws_restJson1BotVersionSortBy(input.sortBy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1795,10 +1832,12 @@ export const serializeAws_restJson1ListBuiltInIntentsCommand = async ( input: ListBuiltInIntentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/builtins/locales/{localeId}/intents"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/builtins/locales/{localeId}/intents"; if (input.localeId !== undefined) { const labelValue: string = input.localeId; if (labelValue.length <= 0) { @@ -1815,7 +1854,6 @@ export const serializeAws_restJson1ListBuiltInIntentsCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: serializeAws_restJson1BuiltInIntentSortBy(input.sortBy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1831,10 +1869,12 @@ export const serializeAws_restJson1ListBuiltInSlotTypesCommand = async ( input: ListBuiltInSlotTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/builtins/locales/{localeId}/slottypes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/builtins/locales/{localeId}/slottypes"; if (input.localeId !== undefined) { const labelValue: string = input.localeId; if (labelValue.length <= 0) { @@ -1851,7 +1891,6 @@ export const serializeAws_restJson1ListBuiltInSlotTypesCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: serializeAws_restJson1BuiltInSlotTypeSortBy(input.sortBy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1867,10 +1906,11 @@ export const serializeAws_restJson1ListExportsCommand = async ( input: ListExportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/exports"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/exports"; let body: any; body = JSON.stringify({ ...(input.botId !== undefined && input.botId !== null && { botId: input.botId }), @@ -1882,7 +1922,6 @@ export const serializeAws_restJson1ListExportsCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: serializeAws_restJson1ExportSortBy(input.sortBy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1898,10 +1937,11 @@ export const serializeAws_restJson1ListImportsCommand = async ( input: ListImportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/imports"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/imports"; let body: any; body = JSON.stringify({ ...(input.botId !== undefined && input.botId !== null && { botId: input.botId }), @@ -1913,7 +1953,6 @@ export const serializeAws_restJson1ListImportsCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: serializeAws_restJson1ImportSortBy(input.sortBy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1929,10 +1968,13 @@ export const serializeAws_restJson1ListIntentsCommand = async ( input: ListIntentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -1969,7 +2011,6 @@ export const serializeAws_restJson1ListIntentsCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: serializeAws_restJson1IntentSortBy(input.sortBy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1985,10 +2026,13 @@ export const serializeAws_restJson1ListSlotsCommand = async ( input: ListSlotsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -2034,7 +2078,6 @@ export const serializeAws_restJson1ListSlotsCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: serializeAws_restJson1SlotSortBy(input.sortBy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2050,10 +2093,13 @@ export const serializeAws_restJson1ListSlotTypesCommand = async ( input: ListSlotTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -2090,7 +2136,6 @@ export const serializeAws_restJson1ListSlotTypesCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: serializeAws_restJson1SlotTypeSortBy(input.sortBy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2106,8 +2151,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceARN}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceARN}"; if (input.resourceARN !== undefined) { const labelValue: string = input.resourceARN; if (labelValue.length <= 0) { @@ -2118,7 +2164,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceARN."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2134,10 +2179,11 @@ export const serializeAws_restJson1StartImportCommand = async ( input: StartImportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/imports"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/imports"; let body: any; body = JSON.stringify({ ...(input.filePassword !== undefined && input.filePassword !== null && { filePassword: input.filePassword }), @@ -2148,7 +2194,6 @@ export const serializeAws_restJson1StartImportCommand = async ( resourceSpecification: serializeAws_restJson1ImportResourceSpecification(input.resourceSpecification, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2164,10 +2209,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceARN}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceARN}"; if (input.resourceARN !== undefined) { const labelValue: string = input.resourceARN; if (labelValue.length <= 0) { @@ -2181,7 +2227,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2197,8 +2242,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceARN}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceARN}"; if (input.resourceARN !== undefined) { const labelValue: string = input.resourceARN; if (labelValue.length <= 0) { @@ -2212,7 +2258,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2229,10 +2274,11 @@ export const serializeAws_restJson1UpdateBotCommand = async ( input: UpdateBotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -2252,7 +2298,6 @@ export const serializeAws_restJson1UpdateBotCommand = async ( input.idleSessionTTLInSeconds !== null && { idleSessionTTLInSeconds: input.idleSessionTTLInSeconds }), ...(input.roleArn !== undefined && input.roleArn !== null && { roleArn: input.roleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2268,10 +2313,12 @@ export const serializeAws_restJson1UpdateBotAliasCommand = async ( input: UpdateBotAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botaliases/{botAliasId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bots/{botId}/botaliases/{botAliasId}"; if (input.botAliasId !== undefined) { const labelValue: string = input.botAliasId; if (labelValue.length <= 0) { @@ -2311,7 +2358,6 @@ export const serializeAws_restJson1UpdateBotAliasCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2327,10 +2373,13 @@ export const serializeAws_restJson1UpdateBotLocaleCommand = async ( input: UpdateBotLocaleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -2370,7 +2419,6 @@ export const serializeAws_restJson1UpdateBotLocaleCommand = async ( voiceSettings: serializeAws_restJson1VoiceSettings(input.voiceSettings, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2386,10 +2434,11 @@ export const serializeAws_restJson1UpdateExportCommand = async ( input: UpdateExportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/exports/{exportId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/exports/{exportId}"; if (input.exportId !== undefined) { const labelValue: string = input.exportId; if (labelValue.length <= 0) { @@ -2403,7 +2452,6 @@ export const serializeAws_restJson1UpdateExportCommand = async ( body = JSON.stringify({ ...(input.filePassword !== undefined && input.filePassword !== null && { filePassword: input.filePassword }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2419,10 +2467,13 @@ export const serializeAws_restJson1UpdateIntentCommand = async ( input: UpdateIntentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}"; if (input.intentId !== undefined) { const labelValue: string = input.intentId; if (labelValue.length <= 0) { @@ -2505,7 +2556,6 @@ export const serializeAws_restJson1UpdateIntentCommand = async ( slotPriorities: serializeAws_restJson1SlotPrioritiesList(input.slotPriorities, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2521,10 +2571,11 @@ export const serializeAws_restJson1UpdateResourcePolicyCommand = async ( input: UpdateResourcePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/policy/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/policy/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -2541,7 +2592,6 @@ export const serializeAws_restJson1UpdateResourcePolicyCommand = async ( body = JSON.stringify({ ...(input.policy !== undefined && input.policy !== null && { policy: input.policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2558,10 +2608,13 @@ export const serializeAws_restJson1UpdateSlotCommand = async ( input: UpdateSlotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/{slotId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/{slotId}"; if (input.slotId !== undefined) { const labelValue: string = input.slotId; if (labelValue.length <= 0) { @@ -2628,7 +2681,6 @@ export const serializeAws_restJson1UpdateSlotCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2644,10 +2696,13 @@ export const serializeAws_restJson1UpdateSlotTypeCommand = async ( input: UpdateSlotTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/{slotTypeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/{slotTypeId}"; if (input.slotTypeId !== undefined) { const labelValue: string = input.slotTypeId; if (labelValue.length <= 0) { @@ -2699,7 +2754,6 @@ export const serializeAws_restJson1UpdateSlotTypeCommand = async ( valueSelectionSetting: serializeAws_restJson1SlotValueSelectionSetting(input.valueSelectionSetting, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-lex-runtime-service/protocols/Aws_restJson1.ts b/clients/client-lex-runtime-service/protocols/Aws_restJson1.ts index 8af3f9919d70a..f19eb830cafc6 100644 --- a/clients/client-lex-runtime-service/protocols/Aws_restJson1.ts +++ b/clients/client-lex-runtime-service/protocols/Aws_restJson1.ts @@ -46,8 +46,11 @@ export const serializeAws_restJson1DeleteSessionCommand = async ( input: DeleteSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bot/{botName}/alias/{botAlias}/user/{userId}/session"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bot/{botName}/alias/{botAlias}/user/{userId}/session"; if (input.botName !== undefined) { const labelValue: string = input.botName; if (labelValue.length <= 0) { @@ -76,7 +79,6 @@ export const serializeAws_restJson1DeleteSessionCommand = async ( throw new Error("No value provided for input HTTP label: userId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -92,8 +94,11 @@ export const serializeAws_restJson1GetSessionCommand = async ( input: GetSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bot/{botName}/alias/{botAlias}/user/{userId}/session"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bot/{botName}/alias/{botAlias}/user/{userId}/session"; if (input.botName !== undefined) { const labelValue: string = input.botName; if (labelValue.length <= 0) { @@ -125,7 +130,6 @@ export const serializeAws_restJson1GetSessionCommand = async ( ...(input.checkpointLabelFilter !== undefined && { checkpointLabelFilter: input.checkpointLabelFilter }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -142,6 +146,7 @@ export const serializeAws_restJson1PostContentCommand = async ( input: PostContentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", "x-amz-content-sha256": "UNSIGNED-PAYLOAD", @@ -161,7 +166,9 @@ export const serializeAws_restJson1PostContentCommand = async ( "x-amz-lex-active-contexts": Buffer.from(__LazyJsonString.fromObject(input.activeContexts!)).toString("base64"), }), }; - let resolvedPath = "/bot/{botName}/alias/{botAlias}/user/{userId}/content"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bot/{botName}/alias/{botAlias}/user/{userId}/content"; if (input.botName !== undefined) { const labelValue: string = input.botName; if (labelValue.length <= 0) { @@ -193,7 +200,6 @@ export const serializeAws_restJson1PostContentCommand = async ( if (input.inputStream !== undefined) { body = input.inputStream; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -209,10 +215,13 @@ export const serializeAws_restJson1PostTextCommand = async ( input: PostTextCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bot/{botName}/alias/{botAlias}/user/{userId}/text"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bot/{botName}/alias/{botAlias}/user/{userId}/text"; if (input.botName !== undefined) { const labelValue: string = input.botName; if (labelValue.length <= 0) { @@ -256,7 +265,6 @@ export const serializeAws_restJson1PostTextCommand = async ( sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -272,11 +280,14 @@ export const serializeAws_restJson1PutSessionCommand = async ( input: PutSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.accept) && { accept: input.accept! }), }; - let resolvedPath = "/bot/{botName}/alias/{botAlias}/user/{userId}/session"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bot/{botName}/alias/{botAlias}/user/{userId}/session"; if (input.botName !== undefined) { const labelValue: string = input.botName; if (labelValue.length <= 0) { @@ -321,7 +332,6 @@ export const serializeAws_restJson1PutSessionCommand = async ( sessionAttributes: serializeAws_restJson1StringMap(input.sessionAttributes, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-lex-runtime-v2/protocols/Aws_restJson1.ts b/clients/client-lex-runtime-v2/protocols/Aws_restJson1.ts index cb71f9f645df2..4be4b7e4f347f 100644 --- a/clients/client-lex-runtime-v2/protocols/Aws_restJson1.ts +++ b/clients/client-lex-runtime-v2/protocols/Aws_restJson1.ts @@ -63,8 +63,11 @@ export const serializeAws_restJson1DeleteSessionCommand = async ( input: DeleteSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -102,7 +105,6 @@ export const serializeAws_restJson1DeleteSessionCommand = async ( throw new Error("No value provided for input HTTP label: sessionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -118,8 +120,11 @@ export const serializeAws_restJson1GetSessionCommand = async ( input: GetSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -157,7 +162,6 @@ export const serializeAws_restJson1GetSessionCommand = async ( throw new Error("No value provided for input HTTP label: sessionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -173,11 +177,14 @@ export const serializeAws_restJson1PutSessionCommand = async ( input: PutSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.responseContentType) && { responsecontenttype: input.responseContentType! }), }; - let resolvedPath = "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -225,7 +232,6 @@ export const serializeAws_restJson1PutSessionCommand = async ( ...(input.sessionState !== undefined && input.sessionState !== null && { sessionState: serializeAws_restJson1SessionState(input.sessionState, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -241,10 +247,13 @@ export const serializeAws_restJson1RecognizeTextCommand = async ( input: RecognizeTextCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -291,7 +300,6 @@ export const serializeAws_restJson1RecognizeTextCommand = async ( input.sessionState !== null && { sessionState: serializeAws_restJson1SessionState(input.sessionState, context) }), ...(input.text !== undefined && input.text !== null && { text: input.text }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -307,6 +315,7 @@ export const serializeAws_restJson1RecognizeUtteranceCommand = async ( input: RecognizeUtteranceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", "x-amz-content-sha256": "UNSIGNED-PAYLOAD", @@ -319,7 +328,9 @@ export const serializeAws_restJson1RecognizeUtteranceCommand = async ( "response-content-type": input.responseContentType!, }), }; - let resolvedPath = "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -360,7 +371,6 @@ export const serializeAws_restJson1RecognizeUtteranceCommand = async ( if (input.inputStream !== undefined) { body = input.inputStream; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -376,12 +386,15 @@ export const serializeAws_restJson1StartConversationCommand = async ( input: StartConversationCommandInput, context: __SerdeContext & __EventStreamSerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.conversationMode) && { "x-amz-lex-conversation-mode": input.conversationMode!, }), }; - let resolvedPath = "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/conversation"; if (input.botId !== undefined) { const labelValue: string = input.botId; if (labelValue.length <= 0) { @@ -424,7 +437,6 @@ export const serializeAws_restJson1StartConversationCommand = async ( serializeAws_restJson1StartConversationRequestEventStream_event(event, context) ); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-location/protocols/Aws_restJson1.ts b/clients/client-location/protocols/Aws_restJson1.ts index f60439a4c7ea3..7933e5c462076 100644 --- a/clients/client-location/protocols/Aws_restJson1.ts +++ b/clients/client-location/protocols/Aws_restJson1.ts @@ -177,10 +177,13 @@ export const serializeAws_restJson1AssociateTrackerConsumerCommand = async ( input: AssociateTrackerConsumerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}/consumers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/tracking/v0/trackers/{TrackerName}/consumers"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -201,7 +204,6 @@ export const serializeAws_restJson1AssociateTrackerConsumerCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -217,10 +219,13 @@ export const serializeAws_restJson1BatchDeleteDevicePositionHistoryCommand = asy input: BatchDeleteDevicePositionHistoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}/delete-positions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/tracking/v0/trackers/{TrackerName}/delete-positions"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -242,7 +247,6 @@ export const serializeAws_restJson1BatchDeleteDevicePositionHistoryCommand = asy throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -258,10 +262,13 @@ export const serializeAws_restJson1BatchDeleteGeofenceCommand = async ( input: BatchDeleteGeofenceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/geofencing/v0/collections/{CollectionName}/delete-geofences"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/geofencing/v0/collections/{CollectionName}/delete-geofences"; if (input.CollectionName !== undefined) { const labelValue: string = input.CollectionName; if (labelValue.length <= 0) { @@ -283,7 +290,6 @@ export const serializeAws_restJson1BatchDeleteGeofenceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -299,10 +305,13 @@ export const serializeAws_restJson1BatchEvaluateGeofencesCommand = async ( input: BatchEvaluateGeofencesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/geofencing/v0/collections/{CollectionName}/positions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/geofencing/v0/collections/{CollectionName}/positions"; if (input.CollectionName !== undefined) { const labelValue: string = input.CollectionName; if (labelValue.length <= 0) { @@ -326,7 +335,6 @@ export const serializeAws_restJson1BatchEvaluateGeofencesCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -342,10 +350,13 @@ export const serializeAws_restJson1BatchGetDevicePositionCommand = async ( input: BatchGetDevicePositionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}/get-positions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/tracking/v0/trackers/{TrackerName}/get-positions"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -367,7 +378,6 @@ export const serializeAws_restJson1BatchGetDevicePositionCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -383,10 +393,13 @@ export const serializeAws_restJson1BatchPutGeofenceCommand = async ( input: BatchPutGeofenceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/geofencing/v0/collections/{CollectionName}/put-geofences"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/geofencing/v0/collections/{CollectionName}/put-geofences"; if (input.CollectionName !== undefined) { const labelValue: string = input.CollectionName; if (labelValue.length <= 0) { @@ -410,7 +423,6 @@ export const serializeAws_restJson1BatchPutGeofenceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -426,10 +438,13 @@ export const serializeAws_restJson1BatchUpdateDevicePositionCommand = async ( input: BatchUpdateDevicePositionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}/positions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/tracking/v0/trackers/{TrackerName}/positions"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -451,7 +466,6 @@ export const serializeAws_restJson1BatchUpdateDevicePositionCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -467,10 +481,13 @@ export const serializeAws_restJson1CalculateRouteCommand = async ( input: CalculateRouteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/routes/v0/calculators/{CalculatorName}/calculate/route"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/routes/v0/calculators/{CalculatorName}/calculate/route"; if (input.CalculatorName !== undefined) { const labelValue: string = input.CalculatorName; if (labelValue.length <= 0) { @@ -517,7 +534,6 @@ export const serializeAws_restJson1CalculateRouteCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -533,10 +549,12 @@ export const serializeAws_restJson1CreateGeofenceCollectionCommand = async ( input: CreateGeofenceCollectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/geofencing/v0/collections"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/geofencing/v0/collections"; let body: any; body = JSON.stringify({ ...(input.CollectionName !== undefined && @@ -555,7 +573,6 @@ export const serializeAws_restJson1CreateGeofenceCollectionCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -571,10 +588,11 @@ export const serializeAws_restJson1CreateMapCommand = async ( input: CreateMapCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/maps/v0/maps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/maps/v0/maps"; let body: any; body = JSON.stringify({ ...(input.Configuration !== undefined && @@ -593,7 +611,6 @@ export const serializeAws_restJson1CreateMapCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -609,10 +626,11 @@ export const serializeAws_restJson1CreatePlaceIndexCommand = async ( input: CreatePlaceIndexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/places/v0/indexes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/places/v0/indexes"; let body: any; body = JSON.stringify({ ...(input.DataSource !== undefined && input.DataSource !== null && { DataSource: input.DataSource }), @@ -632,7 +650,6 @@ export const serializeAws_restJson1CreatePlaceIndexCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -648,10 +665,11 @@ export const serializeAws_restJson1CreateRouteCalculatorCommand = async ( input: CreateRouteCalculatorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/routes/v0/calculators"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/routes/v0/calculators"; let body: any; body = JSON.stringify({ ...(input.CalculatorName !== undefined && @@ -668,7 +686,6 @@ export const serializeAws_restJson1CreateRouteCalculatorCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -684,10 +701,11 @@ export const serializeAws_restJson1CreateTrackerCommand = async ( input: CreateTrackerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tracking/v0/trackers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tracking/v0/trackers"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), @@ -705,7 +723,6 @@ export const serializeAws_restJson1CreateTrackerCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -721,8 +738,11 @@ export const serializeAws_restJson1DeleteGeofenceCollectionCommand = async ( input: DeleteGeofenceCollectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/geofencing/v0/collections/{CollectionName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/geofencing/v0/collections/{CollectionName}"; if (input.CollectionName !== undefined) { const labelValue: string = input.CollectionName; if (labelValue.length <= 0) { @@ -740,7 +760,6 @@ export const serializeAws_restJson1DeleteGeofenceCollectionCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -756,8 +775,9 @@ export const serializeAws_restJson1DeleteMapCommand = async ( input: DeleteMapCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/maps/v0/maps/{MapName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/maps/v0/maps/{MapName}"; if (input.MapName !== undefined) { const labelValue: string = input.MapName; if (labelValue.length <= 0) { @@ -775,7 +795,6 @@ export const serializeAws_restJson1DeleteMapCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -791,8 +810,10 @@ export const serializeAws_restJson1DeletePlaceIndexCommand = async ( input: DeletePlaceIndexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/places/v0/indexes/{IndexName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/places/v0/indexes/{IndexName}"; if (input.IndexName !== undefined) { const labelValue: string = input.IndexName; if (labelValue.length <= 0) { @@ -810,7 +831,6 @@ export const serializeAws_restJson1DeletePlaceIndexCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -826,8 +846,10 @@ export const serializeAws_restJson1DeleteRouteCalculatorCommand = async ( input: DeleteRouteCalculatorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/routes/v0/calculators/{CalculatorName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/routes/v0/calculators/{CalculatorName}"; if (input.CalculatorName !== undefined) { const labelValue: string = input.CalculatorName; if (labelValue.length <= 0) { @@ -845,7 +867,6 @@ export const serializeAws_restJson1DeleteRouteCalculatorCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -861,8 +882,10 @@ export const serializeAws_restJson1DeleteTrackerCommand = async ( input: DeleteTrackerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tracking/v0/trackers/{TrackerName}"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -880,7 +903,6 @@ export const serializeAws_restJson1DeleteTrackerCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -896,8 +918,11 @@ export const serializeAws_restJson1DescribeGeofenceCollectionCommand = async ( input: DescribeGeofenceCollectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/geofencing/v0/collections/{CollectionName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/geofencing/v0/collections/{CollectionName}"; if (input.CollectionName !== undefined) { const labelValue: string = input.CollectionName; if (labelValue.length <= 0) { @@ -915,7 +940,6 @@ export const serializeAws_restJson1DescribeGeofenceCollectionCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -931,8 +955,9 @@ export const serializeAws_restJson1DescribeMapCommand = async ( input: DescribeMapCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/maps/v0/maps/{MapName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/maps/v0/maps/{MapName}"; if (input.MapName !== undefined) { const labelValue: string = input.MapName; if (labelValue.length <= 0) { @@ -950,7 +975,6 @@ export const serializeAws_restJson1DescribeMapCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -966,8 +990,10 @@ export const serializeAws_restJson1DescribePlaceIndexCommand = async ( input: DescribePlaceIndexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/places/v0/indexes/{IndexName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/places/v0/indexes/{IndexName}"; if (input.IndexName !== undefined) { const labelValue: string = input.IndexName; if (labelValue.length <= 0) { @@ -985,7 +1011,6 @@ export const serializeAws_restJson1DescribePlaceIndexCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1001,8 +1026,10 @@ export const serializeAws_restJson1DescribeRouteCalculatorCommand = async ( input: DescribeRouteCalculatorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/routes/v0/calculators/{CalculatorName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/routes/v0/calculators/{CalculatorName}"; if (input.CalculatorName !== undefined) { const labelValue: string = input.CalculatorName; if (labelValue.length <= 0) { @@ -1020,7 +1047,6 @@ export const serializeAws_restJson1DescribeRouteCalculatorCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1036,8 +1062,10 @@ export const serializeAws_restJson1DescribeTrackerCommand = async ( input: DescribeTrackerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tracking/v0/trackers/{TrackerName}"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -1055,7 +1083,6 @@ export const serializeAws_restJson1DescribeTrackerCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1071,8 +1098,11 @@ export const serializeAws_restJson1DisassociateTrackerConsumerCommand = async ( input: DisassociateTrackerConsumerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}/consumers/{ConsumerArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/tracking/v0/trackers/{TrackerName}/consumers/{ConsumerArn}"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -1099,7 +1129,6 @@ export const serializeAws_restJson1DisassociateTrackerConsumerCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1115,8 +1144,11 @@ export const serializeAws_restJson1GetDevicePositionCommand = async ( input: GetDevicePositionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}/devices/{DeviceId}/positions/latest"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/tracking/v0/trackers/{TrackerName}/devices/{DeviceId}/positions/latest"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -1143,7 +1175,6 @@ export const serializeAws_restJson1GetDevicePositionCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1159,10 +1190,13 @@ export const serializeAws_restJson1GetDevicePositionHistoryCommand = async ( input: GetDevicePositionHistoryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}/devices/{DeviceId}/list-positions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/tracking/v0/trackers/{TrackerName}/devices/{DeviceId}/list-positions"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -1200,7 +1234,6 @@ export const serializeAws_restJson1GetDevicePositionHistoryCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1216,8 +1249,11 @@ export const serializeAws_restJson1GetGeofenceCommand = async ( input: GetGeofenceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/geofencing/v0/collections/{CollectionName}/geofences/{GeofenceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/geofencing/v0/collections/{CollectionName}/geofences/{GeofenceId}"; if (input.CollectionName !== undefined) { const labelValue: string = input.CollectionName; if (labelValue.length <= 0) { @@ -1244,7 +1280,6 @@ export const serializeAws_restJson1GetGeofenceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1260,8 +1295,11 @@ export const serializeAws_restJson1GetMapGlyphsCommand = async ( input: GetMapGlyphsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/maps/v0/maps/{MapName}/glyphs/{FontStack}/{FontUnicodeRange}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/maps/v0/maps/{MapName}/glyphs/{FontStack}/{FontUnicodeRange}"; if (input.MapName !== undefined) { const labelValue: string = input.MapName; if (labelValue.length <= 0) { @@ -1297,7 +1335,6 @@ export const serializeAws_restJson1GetMapGlyphsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1313,8 +1350,11 @@ export const serializeAws_restJson1GetMapSpritesCommand = async ( input: GetMapSpritesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/maps/v0/maps/{MapName}/sprites/{FileName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/maps/v0/maps/{MapName}/sprites/{FileName}"; if (input.MapName !== undefined) { const labelValue: string = input.MapName; if (labelValue.length <= 0) { @@ -1341,7 +1381,6 @@ export const serializeAws_restJson1GetMapSpritesCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1357,8 +1396,10 @@ export const serializeAws_restJson1GetMapStyleDescriptorCommand = async ( input: GetMapStyleDescriptorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/maps/v0/maps/{MapName}/style-descriptor"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/maps/v0/maps/{MapName}/style-descriptor"; if (input.MapName !== undefined) { const labelValue: string = input.MapName; if (labelValue.length <= 0) { @@ -1376,7 +1417,6 @@ export const serializeAws_restJson1GetMapStyleDescriptorCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1392,8 +1432,10 @@ export const serializeAws_restJson1GetMapTileCommand = async ( input: GetMapTileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/maps/v0/maps/{MapName}/tiles/{Z}/{X}/{Y}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/maps/v0/maps/{MapName}/tiles/{Z}/{X}/{Y}"; if (input.MapName !== undefined) { const labelValue: string = input.MapName; if (labelValue.length <= 0) { @@ -1438,7 +1480,6 @@ export const serializeAws_restJson1GetMapTileCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1454,10 +1495,13 @@ export const serializeAws_restJson1ListDevicePositionsCommand = async ( input: ListDevicePositionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}/list-positions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/tracking/v0/trackers/{TrackerName}/list-positions"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -1479,7 +1523,6 @@ export const serializeAws_restJson1ListDevicePositionsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1495,10 +1538,12 @@ export const serializeAws_restJson1ListGeofenceCollectionsCommand = async ( input: ListGeofenceCollectionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/geofencing/v0/list-collections"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/geofencing/v0/list-collections"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1511,7 +1556,6 @@ export const serializeAws_restJson1ListGeofenceCollectionsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1527,10 +1571,13 @@ export const serializeAws_restJson1ListGeofencesCommand = async ( input: ListGeofencesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/geofencing/v0/collections/{CollectionName}/list-geofences"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/geofencing/v0/collections/{CollectionName}/list-geofences"; if (input.CollectionName !== undefined) { const labelValue: string = input.CollectionName; if (labelValue.length <= 0) { @@ -1551,7 +1598,6 @@ export const serializeAws_restJson1ListGeofencesCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1567,10 +1613,11 @@ export const serializeAws_restJson1ListMapsCommand = async ( input: ListMapsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/maps/v0/list-maps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/maps/v0/list-maps"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1583,7 +1630,6 @@ export const serializeAws_restJson1ListMapsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1599,10 +1645,11 @@ export const serializeAws_restJson1ListPlaceIndexesCommand = async ( input: ListPlaceIndexesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/places/v0/list-indexes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/places/v0/list-indexes"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1615,7 +1662,6 @@ export const serializeAws_restJson1ListPlaceIndexesCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1631,10 +1677,12 @@ export const serializeAws_restJson1ListRouteCalculatorsCommand = async ( input: ListRouteCalculatorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/routes/v0/list-calculators"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/routes/v0/list-calculators"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1647,7 +1695,6 @@ export const serializeAws_restJson1ListRouteCalculatorsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1663,8 +1710,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1682,7 +1730,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1698,10 +1745,13 @@ export const serializeAws_restJson1ListTrackerConsumersCommand = async ( input: ListTrackerConsumersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tracking/v0/trackers/{TrackerName}/list-consumers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/tracking/v0/trackers/{TrackerName}/list-consumers"; if (input.TrackerName !== undefined) { const labelValue: string = input.TrackerName; if (labelValue.length <= 0) { @@ -1723,7 +1773,6 @@ export const serializeAws_restJson1ListTrackerConsumersCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1739,10 +1788,12 @@ export const serializeAws_restJson1ListTrackersCommand = async ( input: ListTrackersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tracking/v0/list-trackers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tracking/v0/list-trackers"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1755,7 +1806,6 @@ export const serializeAws_restJson1ListTrackersCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1771,10 +1821,13 @@ export const serializeAws_restJson1PutGeofenceCommand = async ( input: PutGeofenceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/geofencing/v0/collections/{CollectionName}/geofences/{GeofenceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/geofencing/v0/collections/{CollectionName}/geofences/{GeofenceId}"; if (input.CollectionName !== undefined) { const labelValue: string = input.CollectionName; if (labelValue.length <= 0) { @@ -1805,7 +1858,6 @@ export const serializeAws_restJson1PutGeofenceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1821,10 +1873,13 @@ export const serializeAws_restJson1SearchPlaceIndexForPositionCommand = async ( input: SearchPlaceIndexForPositionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/places/v0/indexes/{IndexName}/search/position"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/places/v0/indexes/{IndexName}/search/position"; if (input.IndexName !== undefined) { const labelValue: string = input.IndexName; if (labelValue.length <= 0) { @@ -1847,7 +1902,6 @@ export const serializeAws_restJson1SearchPlaceIndexForPositionCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1863,10 +1917,13 @@ export const serializeAws_restJson1SearchPlaceIndexForTextCommand = async ( input: SearchPlaceIndexForTextCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/places/v0/indexes/{IndexName}/search/text"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/places/v0/indexes/{IndexName}/search/text"; if (input.IndexName !== undefined) { const labelValue: string = input.IndexName; if (labelValue.length <= 0) { @@ -1896,7 +1953,6 @@ export const serializeAws_restJson1SearchPlaceIndexForTextCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1912,10 +1968,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1936,7 +1993,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1952,8 +2008,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1974,7 +2031,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, diff --git a/clients/client-lookoutmetrics/protocols/Aws_restJson1.ts b/clients/client-lookoutmetrics/protocols/Aws_restJson1.ts index c84a468994c45..af52d78b18278 100644 --- a/clients/client-lookoutmetrics/protocols/Aws_restJson1.ts +++ b/clients/client-lookoutmetrics/protocols/Aws_restJson1.ts @@ -122,16 +122,16 @@ export const serializeAws_restJson1ActivateAnomalyDetectorCommand = async ( input: ActivateAnomalyDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ActivateAnomalyDetector"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ActivateAnomalyDetector"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && input.AnomalyDetectorArn !== null && { AnomalyDetectorArn: input.AnomalyDetectorArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -147,16 +147,16 @@ export const serializeAws_restJson1BackTestAnomalyDetectorCommand = async ( input: BackTestAnomalyDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/BackTestAnomalyDetector"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BackTestAnomalyDetector"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && input.AnomalyDetectorArn !== null && { AnomalyDetectorArn: input.AnomalyDetectorArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -172,10 +172,11 @@ export const serializeAws_restJson1CreateAlertCommand = async ( input: CreateAlertCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateAlert"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateAlert"; let body: any; body = JSON.stringify({ ...(input.Action !== undefined && @@ -189,7 +190,6 @@ export const serializeAws_restJson1CreateAlertCommand = async ( input.AnomalyDetectorArn !== null && { AnomalyDetectorArn: input.AnomalyDetectorArn }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -205,10 +205,11 @@ export const serializeAws_restJson1CreateAnomalyDetectorCommand = async ( input: CreateAnomalyDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateAnomalyDetector"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateAnomalyDetector"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorConfig !== undefined && @@ -222,7 +223,6 @@ export const serializeAws_restJson1CreateAnomalyDetectorCommand = async ( ...(input.KmsKeyArn !== undefined && input.KmsKeyArn !== null && { KmsKeyArn: input.KmsKeyArn }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -238,10 +238,11 @@ export const serializeAws_restJson1CreateMetricSetCommand = async ( input: CreateMetricSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateMetricSet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateMetricSet"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && @@ -267,7 +268,6 @@ export const serializeAws_restJson1CreateMetricSetCommand = async ( }), ...(input.Timezone !== undefined && input.Timezone !== null && { Timezone: input.Timezone }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -283,15 +283,15 @@ export const serializeAws_restJson1DeleteAlertCommand = async ( input: DeleteAlertCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteAlert"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteAlert"; let body: any; body = JSON.stringify({ ...(input.AlertArn !== undefined && input.AlertArn !== null && { AlertArn: input.AlertArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -307,16 +307,16 @@ export const serializeAws_restJson1DeleteAnomalyDetectorCommand = async ( input: DeleteAnomalyDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteAnomalyDetector"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteAnomalyDetector"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && input.AnomalyDetectorArn !== null && { AnomalyDetectorArn: input.AnomalyDetectorArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -332,15 +332,15 @@ export const serializeAws_restJson1DescribeAlertCommand = async ( input: DescribeAlertCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeAlert"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeAlert"; let body: any; body = JSON.stringify({ ...(input.AlertArn !== undefined && input.AlertArn !== null && { AlertArn: input.AlertArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -356,10 +356,12 @@ export const serializeAws_restJson1DescribeAnomalyDetectionExecutionsCommand = a input: DescribeAnomalyDetectionExecutionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeAnomalyDetectionExecutions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeAnomalyDetectionExecutions"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && @@ -368,7 +370,6 @@ export const serializeAws_restJson1DescribeAnomalyDetectionExecutionsCommand = a ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.Timestamp !== undefined && input.Timestamp !== null && { Timestamp: input.Timestamp }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -384,16 +385,16 @@ export const serializeAws_restJson1DescribeAnomalyDetectorCommand = async ( input: DescribeAnomalyDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeAnomalyDetector"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeAnomalyDetector"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && input.AnomalyDetectorArn !== null && { AnomalyDetectorArn: input.AnomalyDetectorArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -409,15 +410,15 @@ export const serializeAws_restJson1DescribeMetricSetCommand = async ( input: DescribeMetricSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeMetricSet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeMetricSet"; let body: any; body = JSON.stringify({ ...(input.MetricSetArn !== undefined && input.MetricSetArn !== null && { MetricSetArn: input.MetricSetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -433,10 +434,11 @@ export const serializeAws_restJson1GetAnomalyGroupCommand = async ( input: GetAnomalyGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetAnomalyGroup"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetAnomalyGroup"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && @@ -444,7 +446,6 @@ export const serializeAws_restJson1GetAnomalyGroupCommand = async ( ...(input.AnomalyGroupId !== undefined && input.AnomalyGroupId !== null && { AnomalyGroupId: input.AnomalyGroupId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -460,10 +461,11 @@ export const serializeAws_restJson1GetFeedbackCommand = async ( input: GetFeedbackCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetFeedback"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetFeedback"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && @@ -478,7 +480,6 @@ export const serializeAws_restJson1GetFeedbackCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -494,10 +495,11 @@ export const serializeAws_restJson1GetSampleDataCommand = async ( input: GetSampleDataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetSampleData"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetSampleData"; let body: any; body = JSON.stringify({ ...(input.S3SourceConfig !== undefined && @@ -505,7 +507,6 @@ export const serializeAws_restJson1GetSampleDataCommand = async ( S3SourceConfig: serializeAws_restJson1SampleDataS3SourceConfig(input.S3SourceConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -521,10 +522,11 @@ export const serializeAws_restJson1ListAlertsCommand = async ( input: ListAlertsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListAlerts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListAlerts"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && @@ -532,7 +534,6 @@ export const serializeAws_restJson1ListAlertsCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -548,16 +549,16 @@ export const serializeAws_restJson1ListAnomalyDetectorsCommand = async ( input: ListAnomalyDetectorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListAnomalyDetectors"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListAnomalyDetectors"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -573,10 +574,12 @@ export const serializeAws_restJson1ListAnomalyGroupSummariesCommand = async ( input: ListAnomalyGroupSummariesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListAnomalyGroupSummaries"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListAnomalyGroupSummaries"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && @@ -586,7 +589,6 @@ export const serializeAws_restJson1ListAnomalyGroupSummariesCommand = async ( ...(input.SensitivityThreshold !== undefined && input.SensitivityThreshold !== null && { SensitivityThreshold: input.SensitivityThreshold }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -602,10 +604,12 @@ export const serializeAws_restJson1ListAnomalyGroupTimeSeriesCommand = async ( input: ListAnomalyGroupTimeSeriesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListAnomalyGroupTimeSeries"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListAnomalyGroupTimeSeries"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && @@ -616,7 +620,6 @@ export const serializeAws_restJson1ListAnomalyGroupTimeSeriesCommand = async ( ...(input.MetricName !== undefined && input.MetricName !== null && { MetricName: input.MetricName }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -632,10 +635,11 @@ export const serializeAws_restJson1ListMetricSetsCommand = async ( input: ListMetricSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListMetricSets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListMetricSets"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && @@ -643,7 +647,6 @@ export const serializeAws_restJson1ListMetricSetsCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -659,8 +662,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -671,7 +675,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -687,10 +690,11 @@ export const serializeAws_restJson1PutFeedbackCommand = async ( input: PutFeedbackCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/PutFeedback"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PutFeedback"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && @@ -703,7 +707,6 @@ export const serializeAws_restJson1PutFeedbackCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -719,10 +722,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -736,7 +740,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -752,8 +755,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -767,7 +771,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -784,10 +787,11 @@ export const serializeAws_restJson1UpdateAnomalyDetectorCommand = async ( input: UpdateAnomalyDetectorCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateAnomalyDetector"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateAnomalyDetector"; let body: any; body = JSON.stringify({ ...(input.AnomalyDetectorArn !== undefined && @@ -800,7 +804,6 @@ export const serializeAws_restJson1UpdateAnomalyDetectorCommand = async ( input.AnomalyDetectorDescription !== null && { AnomalyDetectorDescription: input.AnomalyDetectorDescription }), ...(input.KmsKeyArn !== undefined && input.KmsKeyArn !== null && { KmsKeyArn: input.KmsKeyArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -816,10 +819,11 @@ export const serializeAws_restJson1UpdateMetricSetCommand = async ( input: UpdateMetricSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateMetricSet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateMetricSet"; let body: any; body = JSON.stringify({ ...(input.DimensionList !== undefined && @@ -841,7 +845,6 @@ export const serializeAws_restJson1UpdateMetricSetCommand = async ( TimestampColumn: serializeAws_restJson1TimestampColumn(input.TimestampColumn, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-lookoutvision/protocols/Aws_restJson1.ts b/clients/client-lookoutvision/protocols/Aws_restJson1.ts index 3de16abdb5cf9..469a28a5457d6 100644 --- a/clients/client-lookoutvision/protocols/Aws_restJson1.ts +++ b/clients/client-lookoutvision/protocols/Aws_restJson1.ts @@ -70,11 +70,14 @@ export const serializeAws_restJson1CreateDatasetCommand = async ( input: CreateDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken! }), }; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/datasets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-11-20/projects/{ProjectName}/datasets"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -92,7 +95,6 @@ export const serializeAws_restJson1CreateDatasetCommand = async ( }), ...(input.DatasetType !== undefined && input.DatasetType !== null && { DatasetType: input.DatasetType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -108,11 +110,13 @@ export const serializeAws_restJson1CreateModelCommand = async ( input: CreateModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken! }), }; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/models"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-11-20/projects/{ProjectName}/models"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -131,7 +135,6 @@ export const serializeAws_restJson1CreateModelCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -147,16 +150,16 @@ export const serializeAws_restJson1CreateProjectCommand = async ( input: CreateProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken! }), }; - let resolvedPath = "/2020-11-20/projects"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-11-20/projects"; let body: any; body = JSON.stringify({ ...(input.ProjectName !== undefined && input.ProjectName !== null && { ProjectName: input.ProjectName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -172,10 +175,13 @@ export const serializeAws_restJson1DeleteDatasetCommand = async ( input: DeleteDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken! }), }; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -195,7 +201,6 @@ export const serializeAws_restJson1DeleteDatasetCommand = async ( throw new Error("No value provided for input HTTP label: DatasetType."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -211,10 +216,13 @@ export const serializeAws_restJson1DeleteModelCommand = async ( input: DeleteModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken! }), }; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -234,7 +242,6 @@ export const serializeAws_restJson1DeleteModelCommand = async ( throw new Error("No value provided for input HTTP label: ModelVersion."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -250,10 +257,12 @@ export const serializeAws_restJson1DeleteProjectCommand = async ( input: DeleteProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken! }), }; - let resolvedPath = "/2020-11-20/projects/{ProjectName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-11-20/projects/{ProjectName}"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -264,7 +273,6 @@ export const serializeAws_restJson1DeleteProjectCommand = async ( throw new Error("No value provided for input HTTP label: ProjectName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -280,8 +288,11 @@ export const serializeAws_restJson1DescribeDatasetCommand = async ( input: DescribeDatasetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -301,7 +312,6 @@ export const serializeAws_restJson1DescribeDatasetCommand = async ( throw new Error("No value provided for input HTTP label: DatasetType."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -317,8 +327,11 @@ export const serializeAws_restJson1DescribeModelCommand = async ( input: DescribeModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -338,7 +351,6 @@ export const serializeAws_restJson1DescribeModelCommand = async ( throw new Error("No value provided for input HTTP label: ModelVersion."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -354,8 +366,10 @@ export const serializeAws_restJson1DescribeProjectCommand = async ( input: DescribeProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-11-20/projects/{ProjectName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-11-20/projects/{ProjectName}"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -366,7 +380,6 @@ export const serializeAws_restJson1DescribeProjectCommand = async ( throw new Error("No value provided for input HTTP label: ProjectName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -382,11 +395,14 @@ export const serializeAws_restJson1DetectAnomaliesCommand = async ( input: DetectAnomaliesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.ContentType) && { "content-type": input.ContentType! }), }; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}/detect"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}/detect"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -409,7 +425,6 @@ export const serializeAws_restJson1DetectAnomaliesCommand = async ( if (input.Body !== undefined) { body = input.Body; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -425,8 +440,11 @@ export const serializeAws_restJson1ListDatasetEntriesCommand = async ( input: ListDatasetEntriesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}/entries"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}/entries"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -459,7 +477,6 @@ export const serializeAws_restJson1ListDatasetEntriesCommand = async ( ...(input.SourceRefContains !== undefined && { sourceRefContains: input.SourceRefContains }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -476,8 +493,10 @@ export const serializeAws_restJson1ListModelsCommand = async ( input: ListModelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/models"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-11-20/projects/{ProjectName}/models"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -492,7 +511,6 @@ export const serializeAws_restJson1ListModelsCommand = async ( ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -509,14 +527,14 @@ export const serializeAws_restJson1ListProjectsCommand = async ( input: ListProjectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-11-20/projects"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-11-20/projects"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -533,8 +551,10 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-11-20/tags/{ResourceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-11-20/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -545,7 +565,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -561,11 +580,14 @@ export const serializeAws_restJson1StartModelCommand = async ( input: StartModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken! }), }; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}/start"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}/start"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -589,7 +611,6 @@ export const serializeAws_restJson1StartModelCommand = async ( ...(input.MinInferenceUnits !== undefined && input.MinInferenceUnits !== null && { MinInferenceUnits: input.MinInferenceUnits }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -605,10 +626,13 @@ export const serializeAws_restJson1StopModelCommand = async ( input: StopModelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken! }), }; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}/stop"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-11-20/projects/{ProjectName}/models/{ModelVersion}/stop"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -628,7 +652,6 @@ export const serializeAws_restJson1StopModelCommand = async ( throw new Error("No value provided for input HTTP label: ModelVersion."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -644,10 +667,12 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2020-11-20/tags/{ResourceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-11-20/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -662,7 +687,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -678,8 +702,10 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-11-20/tags/{ResourceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-11-20/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -693,7 +719,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -710,11 +735,14 @@ export const serializeAws_restJson1UpdateDatasetEntriesCommand = async ( input: UpdateDatasetEntriesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken! }), }; - let resolvedPath = "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}/entries"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-11-20/projects/{ProjectName}/datasets/{DatasetType}/entries"; if (input.ProjectName !== undefined) { const labelValue: string = input.ProjectName; if (labelValue.length <= 0) { @@ -737,7 +765,6 @@ export const serializeAws_restJson1UpdateDatasetEntriesCommand = async ( body = JSON.stringify({ ...(input.Changes !== undefined && input.Changes !== null && { Changes: context.base64Encoder(input.Changes) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-macie2/protocols/Aws_restJson1.ts b/clients/client-macie2/protocols/Aws_restJson1.ts index 459ee52469146..ecb5c68348b9e 100644 --- a/clients/client-macie2/protocols/Aws_restJson1.ts +++ b/clients/client-macie2/protocols/Aws_restJson1.ts @@ -296,10 +296,11 @@ export const serializeAws_restJson1AcceptInvitationCommand = async ( input: AcceptInvitationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitations/accept"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations/accept"; let body: any; body = JSON.stringify({ ...(input.administratorAccountId !== undefined && @@ -307,7 +308,6 @@ export const serializeAws_restJson1AcceptInvitationCommand = async ( ...(input.invitationId !== undefined && input.invitationId !== null && { invitationId: input.invitationId }), ...(input.masterAccount !== undefined && input.masterAccount !== null && { masterAccount: input.masterAccount }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -323,16 +323,17 @@ export const serializeAws_restJson1BatchGetCustomDataIdentifiersCommand = async input: BatchGetCustomDataIdentifiersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/custom-data-identifiers/get"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-data-identifiers/get"; let body: any; body = JSON.stringify({ ...(input.ids !== undefined && input.ids !== null && { ids: serializeAws_restJson1__listOf__string(input.ids, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -348,10 +349,11 @@ export const serializeAws_restJson1CreateClassificationJobCommand = async ( input: CreateClassificationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -375,7 +377,6 @@ export const serializeAws_restJson1CreateClassificationJobCommand = async ( }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -391,10 +392,11 @@ export const serializeAws_restJson1CreateCustomDataIdentifierCommand = async ( input: CreateCustomDataIdentifierCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/custom-data-identifiers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-data-identifiers"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -411,7 +413,6 @@ export const serializeAws_restJson1CreateCustomDataIdentifierCommand = async ( ...(input.regex !== undefined && input.regex !== null && { regex: input.regex }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -427,10 +428,11 @@ export const serializeAws_restJson1CreateFindingsFilterCommand = async ( input: CreateFindingsFilterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findingsfilters"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findingsfilters"; let body: any; body = JSON.stringify({ ...(input.action !== undefined && input.action !== null && { action: input.action }), @@ -444,7 +446,6 @@ export const serializeAws_restJson1CreateFindingsFilterCommand = async ( ...(input.position !== undefined && input.position !== null && { position: input.position }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -460,10 +461,11 @@ export const serializeAws_restJson1CreateInvitationsCommand = async ( input: CreateInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations"; let body: any; body = JSON.stringify({ ...(input.accountIds !== undefined && @@ -472,7 +474,6 @@ export const serializeAws_restJson1CreateInvitationsCommand = async ( input.disableEmailNotification !== null && { disableEmailNotification: input.disableEmailNotification }), ...(input.message !== undefined && input.message !== null && { message: input.message }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -488,17 +489,17 @@ export const serializeAws_restJson1CreateMemberCommand = async ( input: CreateMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/members"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members"; let body: any; body = JSON.stringify({ ...(input.account !== undefined && input.account !== null && { account: serializeAws_restJson1AccountDetail(input.account, context) }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -514,10 +515,11 @@ export const serializeAws_restJson1CreateSampleFindingsCommand = async ( input: CreateSampleFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findings/sample"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findings/sample"; let body: any; body = JSON.stringify({ ...(input.findingTypes !== undefined && @@ -525,7 +527,6 @@ export const serializeAws_restJson1CreateSampleFindingsCommand = async ( findingTypes: serializeAws_restJson1__listOfFindingType(input.findingTypes, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -541,16 +542,16 @@ export const serializeAws_restJson1DeclineInvitationsCommand = async ( input: DeclineInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitations/decline"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations/decline"; let body: any; body = JSON.stringify({ ...(input.accountIds !== undefined && input.accountIds !== null && { accountIds: serializeAws_restJson1__listOf__string(input.accountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -566,8 +567,10 @@ export const serializeAws_restJson1DeleteCustomDataIdentifierCommand = async ( input: DeleteCustomDataIdentifierCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/custom-data-identifiers/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-data-identifiers/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -578,7 +581,6 @@ export const serializeAws_restJson1DeleteCustomDataIdentifierCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -594,8 +596,9 @@ export const serializeAws_restJson1DeleteFindingsFilterCommand = async ( input: DeleteFindingsFilterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/findingsfilters/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findingsfilters/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -606,7 +609,6 @@ export const serializeAws_restJson1DeleteFindingsFilterCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -622,16 +624,16 @@ export const serializeAws_restJson1DeleteInvitationsCommand = async ( input: DeleteInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitations/delete"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations/delete"; let body: any; body = JSON.stringify({ ...(input.accountIds !== undefined && input.accountIds !== null && { accountIds: serializeAws_restJson1__listOf__string(input.accountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -647,8 +649,9 @@ export const serializeAws_restJson1DeleteMemberCommand = async ( input: DeleteMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/members/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -659,7 +662,6 @@ export const serializeAws_restJson1DeleteMemberCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -675,10 +677,11 @@ export const serializeAws_restJson1DescribeBucketsCommand = async ( input: DescribeBucketsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datasources/s3"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasources/s3"; let body: any; body = JSON.stringify({ ...(input.criteria !== undefined && @@ -690,7 +693,6 @@ export const serializeAws_restJson1DescribeBucketsCommand = async ( sortCriteria: serializeAws_restJson1BucketSortCriteria(input.sortCriteria, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -706,8 +708,9 @@ export const serializeAws_restJson1DescribeClassificationJobCommand = async ( input: DescribeClassificationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/jobs/{jobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -718,7 +721,6 @@ export const serializeAws_restJson1DescribeClassificationJobCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -734,13 +736,13 @@ export const serializeAws_restJson1DescribeOrganizationConfigurationCommand = as input: DescribeOrganizationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/admin/configuration"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/admin/configuration"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -756,13 +758,13 @@ export const serializeAws_restJson1DisableMacieCommand = async ( input: DisableMacieCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/macie"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/macie"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -778,13 +780,13 @@ export const serializeAws_restJson1DisableOrganizationAdminAccountCommand = asyn input: DisableOrganizationAdminAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/admin"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/admin"; const query: any = { ...(input.adminAccountId !== undefined && { adminAccountId: input.adminAccountId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -801,13 +803,14 @@ export const serializeAws_restJson1DisassociateFromAdministratorAccountCommand = input: DisassociateFromAdministratorAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/administrator/disassociate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/administrator/disassociate"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -823,13 +826,13 @@ export const serializeAws_restJson1DisassociateFromMasterAccountCommand = async input: DisassociateFromMasterAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/master/disassociate"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/master/disassociate"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -845,8 +848,10 @@ export const serializeAws_restJson1DisassociateMemberCommand = async ( input: DisassociateMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/members/disassociate/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members/disassociate/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -857,7 +862,6 @@ export const serializeAws_restJson1DisassociateMemberCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -873,10 +877,11 @@ export const serializeAws_restJson1EnableMacieCommand = async ( input: EnableMacieCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/macie"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/macie"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -884,7 +889,6 @@ export const serializeAws_restJson1EnableMacieCommand = async ( input.findingPublishingFrequency !== null && { findingPublishingFrequency: input.findingPublishingFrequency }), ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -900,17 +904,17 @@ export const serializeAws_restJson1EnableOrganizationAdminAccountCommand = async input: EnableOrganizationAdminAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/admin"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/admin"; let body: any; body = JSON.stringify({ ...(input.adminAccountId !== undefined && input.adminAccountId !== null && { adminAccountId: input.adminAccountId }), clientToken: input.clientToken ?? generateIdempotencyToken(), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -926,13 +930,13 @@ export const serializeAws_restJson1GetAdministratorAccountCommand = async ( input: GetAdministratorAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/administrator"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/administrator"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -948,15 +952,16 @@ export const serializeAws_restJson1GetBucketStatisticsCommand = async ( input: GetBucketStatisticsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datasources/s3/statistics"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasources/s3/statistics"; let body: any; body = JSON.stringify({ ...(input.accountId !== undefined && input.accountId !== null && { accountId: input.accountId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -972,13 +977,14 @@ export const serializeAws_restJson1GetClassificationExportConfigurationCommand = input: GetClassificationExportConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/classification-export-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/classification-export-configuration"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -994,8 +1000,10 @@ export const serializeAws_restJson1GetCustomDataIdentifierCommand = async ( input: GetCustomDataIdentifierCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/custom-data-identifiers/{id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-data-identifiers/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -1006,7 +1014,6 @@ export const serializeAws_restJson1GetCustomDataIdentifierCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1022,10 +1029,11 @@ export const serializeAws_restJson1GetFindingsCommand = async ( input: GetFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findings/describe"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findings/describe"; let body: any; body = JSON.stringify({ ...(input.findingIds !== undefined && @@ -1033,7 +1041,6 @@ export const serializeAws_restJson1GetFindingsCommand = async ( ...(input.sortCriteria !== undefined && input.sortCriteria !== null && { sortCriteria: serializeAws_restJson1SortCriteria(input.sortCriteria, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1049,8 +1056,9 @@ export const serializeAws_restJson1GetFindingsFilterCommand = async ( input: GetFindingsFilterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/findingsfilters/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findingsfilters/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -1061,7 +1069,6 @@ export const serializeAws_restJson1GetFindingsFilterCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1077,13 +1084,14 @@ export const serializeAws_restJson1GetFindingsPublicationConfigurationCommand = input: GetFindingsPublicationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findings-publication-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findings-publication-configuration"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1099,10 +1107,11 @@ export const serializeAws_restJson1GetFindingStatisticsCommand = async ( input: GetFindingStatisticsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findings/statistics"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findings/statistics"; let body: any; body = JSON.stringify({ ...(input.findingCriteria !== undefined && @@ -1116,7 +1125,6 @@ export const serializeAws_restJson1GetFindingStatisticsCommand = async ( sortCriteria: serializeAws_restJson1FindingStatisticsSortCriteria(input.sortCriteria, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1132,13 +1140,13 @@ export const serializeAws_restJson1GetInvitationsCountCommand = async ( input: GetInvitationsCountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitations/count"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations/count"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1154,13 +1162,13 @@ export const serializeAws_restJson1GetMacieSessionCommand = async ( input: GetMacieSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/macie"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/macie"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1176,13 +1184,13 @@ export const serializeAws_restJson1GetMasterAccountCommand = async ( input: GetMasterAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/master"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/master"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1198,8 +1206,9 @@ export const serializeAws_restJson1GetMemberCommand = async ( input: GetMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/members/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -1210,7 +1219,6 @@ export const serializeAws_restJson1GetMemberCommand = async ( throw new Error("No value provided for input HTTP label: id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1226,10 +1234,11 @@ export const serializeAws_restJson1GetUsageStatisticsCommand = async ( input: GetUsageStatisticsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/usage/statistics"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usage/statistics"; let body: any; body = JSON.stringify({ ...(input.filterBy !== undefined && @@ -1242,7 +1251,6 @@ export const serializeAws_restJson1GetUsageStatisticsCommand = async ( input.sortBy !== null && { sortBy: serializeAws_restJson1UsageStatisticsSortBy(input.sortBy, context) }), ...(input.timeRange !== undefined && input.timeRange !== null && { timeRange: input.timeRange }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1258,13 +1266,13 @@ export const serializeAws_restJson1GetUsageTotalsCommand = async ( input: GetUsageTotalsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/usage"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/usage"; const query: any = { ...(input.timeRange !== undefined && { timeRange: input.timeRange }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1281,10 +1289,11 @@ export const serializeAws_restJson1ListClassificationJobsCommand = async ( input: ListClassificationJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/jobs/list"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/list"; let body: any; body = JSON.stringify({ ...(input.filterCriteria !== undefined && @@ -1298,7 +1307,6 @@ export const serializeAws_restJson1ListClassificationJobsCommand = async ( sortCriteria: serializeAws_restJson1ListJobsSortCriteria(input.sortCriteria, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1314,16 +1322,17 @@ export const serializeAws_restJson1ListCustomDataIdentifiersCommand = async ( input: ListCustomDataIdentifiersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/custom-data-identifiers/list"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-data-identifiers/list"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1339,10 +1348,11 @@ export const serializeAws_restJson1ListFindingsCommand = async ( input: ListFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findings"; let body: any; body = JSON.stringify({ ...(input.findingCriteria !== undefined && @@ -1354,7 +1364,6 @@ export const serializeAws_restJson1ListFindingsCommand = async ( ...(input.sortCriteria !== undefined && input.sortCriteria !== null && { sortCriteria: serializeAws_restJson1SortCriteria(input.sortCriteria, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1370,14 +1379,14 @@ export const serializeAws_restJson1ListFindingsFiltersCommand = async ( input: ListFindingsFiltersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/findingsfilters"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findingsfilters"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1394,14 +1403,14 @@ export const serializeAws_restJson1ListInvitationsCommand = async ( input: ListInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/invitations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1418,15 +1427,15 @@ export const serializeAws_restJson1ListMembersCommand = async ( input: ListMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/members"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.onlyAssociated !== undefined && { onlyAssociated: input.onlyAssociated }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1443,14 +1452,14 @@ export const serializeAws_restJson1ListOrganizationAdminAccountsCommand = async input: ListOrganizationAdminAccountsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/admin"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/admin"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1467,8 +1476,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1479,7 +1489,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1495,10 +1504,12 @@ export const serializeAws_restJson1PutClassificationExportConfigurationCommand = input: PutClassificationExportConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/classification-export-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/classification-export-configuration"; let body: any; body = JSON.stringify({ ...(input.configuration !== undefined && @@ -1506,7 +1517,6 @@ export const serializeAws_restJson1PutClassificationExportConfigurationCommand = configuration: serializeAws_restJson1ClassificationExportConfiguration(input.configuration, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1522,10 +1532,12 @@ export const serializeAws_restJson1PutFindingsPublicationConfigurationCommand = input: PutFindingsPublicationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findings-publication-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findings-publication-configuration"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -1537,7 +1549,6 @@ export const serializeAws_restJson1PutFindingsPublicationConfigurationCommand = ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1553,10 +1564,12 @@ export const serializeAws_restJson1SearchResourcesCommand = async ( input: SearchResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/datasources/search-resources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/datasources/search-resources"; let body: any; body = JSON.stringify({ ...(input.bucketCriteria !== undefined && @@ -1570,7 +1583,6 @@ export const serializeAws_restJson1SearchResourcesCommand = async ( sortCriteria: serializeAws_restJson1SearchResourcesSortCriteria(input.sortCriteria, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1586,10 +1598,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1603,7 +1616,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1619,10 +1631,12 @@ export const serializeAws_restJson1TestCustomDataIdentifierCommand = async ( input: TestCustomDataIdentifierCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/custom-data-identifiers/test"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/custom-data-identifiers/test"; let body: any; body = JSON.stringify({ ...(input.ignoreWords !== undefined && @@ -1636,7 +1650,6 @@ export const serializeAws_restJson1TestCustomDataIdentifierCommand = async ( ...(input.regex !== undefined && input.regex !== null && { regex: input.regex }), ...(input.sampleText !== undefined && input.sampleText !== null && { sampleText: input.sampleText }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1652,8 +1665,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1667,7 +1681,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1684,10 +1697,11 @@ export const serializeAws_restJson1UpdateClassificationJobCommand = async ( input: UpdateClassificationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/jobs/{jobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -1701,7 +1715,6 @@ export const serializeAws_restJson1UpdateClassificationJobCommand = async ( body = JSON.stringify({ ...(input.jobStatus !== undefined && input.jobStatus !== null && { jobStatus: input.jobStatus }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1717,10 +1730,11 @@ export const serializeAws_restJson1UpdateFindingsFilterCommand = async ( input: UpdateFindingsFilterCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findingsfilters/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findingsfilters/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -1742,7 +1756,6 @@ export const serializeAws_restJson1UpdateFindingsFilterCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.position !== undefined && input.position !== null && { position: input.position }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1758,17 +1771,17 @@ export const serializeAws_restJson1UpdateMacieSessionCommand = async ( input: UpdateMacieSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/macie"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/macie"; let body: any; body = JSON.stringify({ ...(input.findingPublishingFrequency !== undefined && input.findingPublishingFrequency !== null && { findingPublishingFrequency: input.findingPublishingFrequency }), ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1784,10 +1797,11 @@ export const serializeAws_restJson1UpdateMemberSessionCommand = async ( input: UpdateMemberSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/macie/members/{id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/macie/members/{id}"; if (input.id !== undefined) { const labelValue: string = input.id; if (labelValue.length <= 0) { @@ -1801,7 +1815,6 @@ export const serializeAws_restJson1UpdateMemberSessionCommand = async ( body = JSON.stringify({ ...(input.status !== undefined && input.status !== null && { status: input.status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1817,15 +1830,15 @@ export const serializeAws_restJson1UpdateOrganizationConfigurationCommand = asyn input: UpdateOrganizationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/admin/configuration"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/admin/configuration"; let body: any; body = JSON.stringify({ ...(input.autoEnable !== undefined && input.autoEnable !== null && { autoEnable: input.autoEnable }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-managedblockchain/protocols/Aws_restJson1.ts b/clients/client-managedblockchain/protocols/Aws_restJson1.ts index 966dac4047494..4d9ba79ccf2cd 100644 --- a/clients/client-managedblockchain/protocols/Aws_restJson1.ts +++ b/clients/client-managedblockchain/protocols/Aws_restJson1.ts @@ -91,10 +91,12 @@ export const serializeAws_restJson1CreateMemberCommand = async ( input: CreateMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/networks/{NetworkId}/members"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/members"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -113,7 +115,6 @@ export const serializeAws_restJson1CreateMemberCommand = async ( MemberConfiguration: serializeAws_restJson1MemberConfiguration(input.MemberConfiguration, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -129,10 +130,11 @@ export const serializeAws_restJson1CreateNetworkCommand = async ( input: CreateNetworkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/networks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks"; let body: any; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), @@ -157,7 +159,6 @@ export const serializeAws_restJson1CreateNetworkCommand = async ( ...(input.VotingPolicy !== undefined && input.VotingPolicy !== null && { VotingPolicy: serializeAws_restJson1VotingPolicy(input.VotingPolicy, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -173,10 +174,12 @@ export const serializeAws_restJson1CreateNodeCommand = async ( input: CreateNodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/networks/{NetworkId}/nodes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/nodes"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -197,7 +200,6 @@ export const serializeAws_restJson1CreateNodeCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1InputTagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -213,10 +215,12 @@ export const serializeAws_restJson1CreateProposalCommand = async ( input: CreateProposalCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/networks/{NetworkId}/proposals"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/proposals"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -236,7 +240,6 @@ export const serializeAws_restJson1CreateProposalCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1InputTagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -252,8 +255,10 @@ export const serializeAws_restJson1DeleteMemberCommand = async ( input: DeleteMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks/{NetworkId}/members/{MemberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/members/{MemberId}"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -273,7 +278,6 @@ export const serializeAws_restJson1DeleteMemberCommand = async ( throw new Error("No value provided for input HTTP label: MemberId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -289,8 +293,10 @@ export const serializeAws_restJson1DeleteNodeCommand = async ( input: DeleteNodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks/{NetworkId}/nodes/{NodeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/nodes/{NodeId}"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -313,7 +319,6 @@ export const serializeAws_restJson1DeleteNodeCommand = async ( ...(input.MemberId !== undefined && { memberId: input.MemberId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -330,8 +335,10 @@ export const serializeAws_restJson1GetMemberCommand = async ( input: GetMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks/{NetworkId}/members/{MemberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/members/{MemberId}"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -351,7 +358,6 @@ export const serializeAws_restJson1GetMemberCommand = async ( throw new Error("No value provided for input HTTP label: MemberId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -367,8 +373,9 @@ export const serializeAws_restJson1GetNetworkCommand = async ( input: GetNetworkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks/{NetworkId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -379,7 +386,6 @@ export const serializeAws_restJson1GetNetworkCommand = async ( throw new Error("No value provided for input HTTP label: NetworkId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -395,8 +401,10 @@ export const serializeAws_restJson1GetNodeCommand = async ( input: GetNodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks/{NetworkId}/nodes/{NodeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/nodes/{NodeId}"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -419,7 +427,6 @@ export const serializeAws_restJson1GetNodeCommand = async ( ...(input.MemberId !== undefined && { memberId: input.MemberId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -436,8 +443,11 @@ export const serializeAws_restJson1GetProposalCommand = async ( input: GetProposalCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks/{NetworkId}/proposals/{ProposalId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/networks/{NetworkId}/proposals/{ProposalId}"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -457,7 +467,6 @@ export const serializeAws_restJson1GetProposalCommand = async ( throw new Error("No value provided for input HTTP label: ProposalId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -473,14 +482,14 @@ export const serializeAws_restJson1ListInvitationsCommand = async ( input: ListInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/invitations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -497,8 +506,10 @@ export const serializeAws_restJson1ListMembersCommand = async ( input: ListMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks/{NetworkId}/members"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/members"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -516,7 +527,6 @@ export const serializeAws_restJson1ListMembersCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -533,8 +543,9 @@ export const serializeAws_restJson1ListNetworksCommand = async ( input: ListNetworksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks"; const query: any = { ...(input.Name !== undefined && { name: input.Name }), ...(input.Framework !== undefined && { framework: input.Framework }), @@ -543,7 +554,6 @@ export const serializeAws_restJson1ListNetworksCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -560,8 +570,10 @@ export const serializeAws_restJson1ListNodesCommand = async ( input: ListNodesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks/{NetworkId}/nodes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/nodes"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -578,7 +590,6 @@ export const serializeAws_restJson1ListNodesCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -595,8 +606,10 @@ export const serializeAws_restJson1ListProposalsCommand = async ( input: ListProposalsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks/{NetworkId}/proposals"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/proposals"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -611,7 +624,6 @@ export const serializeAws_restJson1ListProposalsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -628,8 +640,11 @@ export const serializeAws_restJson1ListProposalVotesCommand = async ( input: ListProposalVotesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/networks/{NetworkId}/proposals/{ProposalId}/votes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/networks/{NetworkId}/proposals/{ProposalId}/votes"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -653,7 +668,6 @@ export const serializeAws_restJson1ListProposalVotesCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -670,8 +684,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -682,7 +697,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -698,8 +712,10 @@ export const serializeAws_restJson1RejectInvitationCommand = async ( input: RejectInvitationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/invitations/{InvitationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations/{InvitationId}"; if (input.InvitationId !== undefined) { const labelValue: string = input.InvitationId; if (labelValue.length <= 0) { @@ -710,7 +726,6 @@ export const serializeAws_restJson1RejectInvitationCommand = async ( throw new Error("No value provided for input HTTP label: InvitationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -726,10 +741,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -744,7 +760,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1InputTagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -760,8 +775,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -775,7 +791,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -792,10 +807,12 @@ export const serializeAws_restJson1UpdateMemberCommand = async ( input: UpdateMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/networks/{NetworkId}/members/{MemberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/members/{MemberId}"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -824,7 +841,6 @@ export const serializeAws_restJson1UpdateMemberCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -840,10 +856,12 @@ export const serializeAws_restJson1UpdateNodeCommand = async ( input: UpdateNodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/networks/{NetworkId}/nodes/{NodeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/networks/{NetworkId}/nodes/{NodeId}"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -873,7 +891,6 @@ export const serializeAws_restJson1UpdateNodeCommand = async ( }), ...(input.MemberId !== undefined && input.MemberId !== null && { MemberId: input.MemberId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -889,10 +906,13 @@ export const serializeAws_restJson1VoteOnProposalCommand = async ( input: VoteOnProposalCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/networks/{NetworkId}/proposals/{ProposalId}/votes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/networks/{NetworkId}/proposals/{ProposalId}/votes"; if (input.NetworkId !== undefined) { const labelValue: string = input.NetworkId; if (labelValue.length <= 0) { @@ -916,7 +936,6 @@ export const serializeAws_restJson1VoteOnProposalCommand = async ( ...(input.Vote !== undefined && input.Vote !== null && { Vote: input.Vote }), ...(input.VoterMemberId !== undefined && input.VoterMemberId !== null && { VoterMemberId: input.VoterMemberId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-marketplace-catalog/protocols/Aws_restJson1.ts b/clients/client-marketplace-catalog/protocols/Aws_restJson1.ts index 198d43b6632d5..0128ed17aeb44 100644 --- a/clients/client-marketplace-catalog/protocols/Aws_restJson1.ts +++ b/clients/client-marketplace-catalog/protocols/Aws_restJson1.ts @@ -39,14 +39,14 @@ export const serializeAws_restJson1CancelChangeSetCommand = async ( input: CancelChangeSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/CancelChangeSet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CancelChangeSet"; const query: any = { ...(input.Catalog !== undefined && { catalog: input.Catalog }), ...(input.ChangeSetId !== undefined && { changeSetId: input.ChangeSetId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -63,14 +63,14 @@ export const serializeAws_restJson1DescribeChangeSetCommand = async ( input: DescribeChangeSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/DescribeChangeSet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeChangeSet"; const query: any = { ...(input.Catalog !== undefined && { catalog: input.Catalog }), ...(input.ChangeSetId !== undefined && { changeSetId: input.ChangeSetId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -87,14 +87,14 @@ export const serializeAws_restJson1DescribeEntityCommand = async ( input: DescribeEntityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/DescribeEntity"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeEntity"; const query: any = { ...(input.Catalog !== undefined && { catalog: input.Catalog }), ...(input.EntityId !== undefined && { entityId: input.EntityId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -111,10 +111,11 @@ export const serializeAws_restJson1ListChangeSetsCommand = async ( input: ListChangeSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListChangeSets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListChangeSets"; let body: any; body = JSON.stringify({ ...(input.Catalog !== undefined && input.Catalog !== null && { Catalog: input.Catalog }), @@ -124,7 +125,6 @@ export const serializeAws_restJson1ListChangeSetsCommand = async ( ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.Sort !== undefined && input.Sort !== null && { Sort: serializeAws_restJson1Sort(input.Sort, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -140,10 +140,11 @@ export const serializeAws_restJson1ListEntitiesCommand = async ( input: ListEntitiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListEntities"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListEntities"; let body: any; body = JSON.stringify({ ...(input.Catalog !== undefined && input.Catalog !== null && { Catalog: input.Catalog }), @@ -154,7 +155,6 @@ export const serializeAws_restJson1ListEntitiesCommand = async ( ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.Sort !== undefined && input.Sort !== null && { Sort: serializeAws_restJson1Sort(input.Sort, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -170,10 +170,11 @@ export const serializeAws_restJson1StartChangeSetCommand = async ( input: StartChangeSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/StartChangeSet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StartChangeSet"; let body: any; body = JSON.stringify({ ...(input.Catalog !== undefined && input.Catalog !== null && { Catalog: input.Catalog }), @@ -183,7 +184,6 @@ export const serializeAws_restJson1StartChangeSetCommand = async ( ...(input.ClientRequestToken !== undefined && input.ClientRequestToken !== null && { ClientRequestToken: input.ClientRequestToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-mediaconnect/protocols/Aws_restJson1.ts b/clients/client-mediaconnect/protocols/Aws_restJson1.ts index 36eb6ceb87904..ef697953e172b 100644 --- a/clients/client-mediaconnect/protocols/Aws_restJson1.ts +++ b/clients/client-mediaconnect/protocols/Aws_restJson1.ts @@ -129,10 +129,12 @@ export const serializeAws_restJson1AddFlowMediaStreamsCommand = async ( input: AddFlowMediaStreamsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows/{FlowArn}/mediaStreams"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/mediaStreams"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -149,7 +151,6 @@ export const serializeAws_restJson1AddFlowMediaStreamsCommand = async ( mediaStreams: serializeAws_restJson1__listOfAddMediaStreamRequest(input.MediaStreams, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -165,10 +166,12 @@ export const serializeAws_restJson1AddFlowOutputsCommand = async ( input: AddFlowOutputsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows/{FlowArn}/outputs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/outputs"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -183,7 +186,6 @@ export const serializeAws_restJson1AddFlowOutputsCommand = async ( ...(input.Outputs !== undefined && input.Outputs !== null && { outputs: serializeAws_restJson1__listOfAddOutputRequest(input.Outputs, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -199,10 +201,12 @@ export const serializeAws_restJson1AddFlowSourcesCommand = async ( input: AddFlowSourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows/{FlowArn}/source"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/source"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -217,7 +221,6 @@ export const serializeAws_restJson1AddFlowSourcesCommand = async ( ...(input.Sources !== undefined && input.Sources !== null && { sources: serializeAws_restJson1__listOfSetSourceRequest(input.Sources, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -233,10 +236,12 @@ export const serializeAws_restJson1AddFlowVpcInterfacesCommand = async ( input: AddFlowVpcInterfacesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows/{FlowArn}/vpcInterfaces"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/vpcInterfaces"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -253,7 +258,6 @@ export const serializeAws_restJson1AddFlowVpcInterfacesCommand = async ( vpcInterfaces: serializeAws_restJson1__listOfVpcInterfaceRequest(input.VpcInterfaces, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -269,10 +273,11 @@ export const serializeAws_restJson1CreateFlowCommand = async ( input: CreateFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows"; let body: any; body = JSON.stringify({ ...(input.AvailabilityZone !== undefined && @@ -301,7 +306,6 @@ export const serializeAws_restJson1CreateFlowCommand = async ( vpcInterfaces: serializeAws_restJson1__listOfVpcInterfaceRequest(input.VpcInterfaces, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -317,8 +321,9 @@ export const serializeAws_restJson1DeleteFlowCommand = async ( input: DeleteFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/flows/{FlowArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -329,7 +334,6 @@ export const serializeAws_restJson1DeleteFlowCommand = async ( throw new Error("No value provided for input HTTP label: FlowArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -345,8 +349,9 @@ export const serializeAws_restJson1DescribeFlowCommand = async ( input: DescribeFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/flows/{FlowArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -357,7 +362,6 @@ export const serializeAws_restJson1DescribeFlowCommand = async ( throw new Error("No value provided for input HTTP label: FlowArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -373,8 +377,10 @@ export const serializeAws_restJson1DescribeOfferingCommand = async ( input: DescribeOfferingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/offerings/{OfferingArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/offerings/{OfferingArn}"; if (input.OfferingArn !== undefined) { const labelValue: string = input.OfferingArn; if (labelValue.length <= 0) { @@ -385,7 +391,6 @@ export const serializeAws_restJson1DescribeOfferingCommand = async ( throw new Error("No value provided for input HTTP label: OfferingArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -401,8 +406,10 @@ export const serializeAws_restJson1DescribeReservationCommand = async ( input: DescribeReservationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/reservations/{ReservationArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/reservations/{ReservationArn}"; if (input.ReservationArn !== undefined) { const labelValue: string = input.ReservationArn; if (labelValue.length <= 0) { @@ -413,7 +420,6 @@ export const serializeAws_restJson1DescribeReservationCommand = async ( throw new Error("No value provided for input HTTP label: ReservationArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -429,10 +435,12 @@ export const serializeAws_restJson1GrantFlowEntitlementsCommand = async ( input: GrantFlowEntitlementsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows/{FlowArn}/entitlements"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/entitlements"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -449,7 +457,6 @@ export const serializeAws_restJson1GrantFlowEntitlementsCommand = async ( entitlements: serializeAws_restJson1__listOfGrantEntitlementRequest(input.Entitlements, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -465,14 +472,14 @@ export const serializeAws_restJson1ListEntitlementsCommand = async ( input: ListEntitlementsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/entitlements"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/entitlements"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -489,14 +496,14 @@ export const serializeAws_restJson1ListFlowsCommand = async ( input: ListFlowsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/flows"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -513,14 +520,14 @@ export const serializeAws_restJson1ListOfferingsCommand = async ( input: ListOfferingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/offerings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/offerings"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -537,14 +544,14 @@ export const serializeAws_restJson1ListReservationsCommand = async ( input: ListReservationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/reservations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/reservations"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -561,8 +568,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -573,7 +581,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -589,10 +596,12 @@ export const serializeAws_restJson1PurchaseOfferingCommand = async ( input: PurchaseOfferingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/offerings/{OfferingArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/offerings/{OfferingArn}"; if (input.OfferingArn !== undefined) { const labelValue: string = input.OfferingArn; if (labelValue.length <= 0) { @@ -608,7 +617,6 @@ export const serializeAws_restJson1PurchaseOfferingCommand = async ( input.ReservationName !== null && { reservationName: input.ReservationName }), ...(input.Start !== undefined && input.Start !== null && { start: input.Start }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -624,8 +632,11 @@ export const serializeAws_restJson1RemoveFlowMediaStreamCommand = async ( input: RemoveFlowMediaStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/flows/{FlowArn}/mediaStreams/{MediaStreamName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/flows/{FlowArn}/mediaStreams/{MediaStreamName}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -645,7 +656,6 @@ export const serializeAws_restJson1RemoveFlowMediaStreamCommand = async ( throw new Error("No value provided for input HTTP label: MediaStreamName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -661,8 +671,10 @@ export const serializeAws_restJson1RemoveFlowOutputCommand = async ( input: RemoveFlowOutputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/flows/{FlowArn}/outputs/{OutputArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/outputs/{OutputArn}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -682,7 +694,6 @@ export const serializeAws_restJson1RemoveFlowOutputCommand = async ( throw new Error("No value provided for input HTTP label: OutputArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -698,8 +709,10 @@ export const serializeAws_restJson1RemoveFlowSourceCommand = async ( input: RemoveFlowSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/flows/{FlowArn}/source/{SourceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/source/{SourceArn}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -719,7 +732,6 @@ export const serializeAws_restJson1RemoveFlowSourceCommand = async ( throw new Error("No value provided for input HTTP label: SourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -735,8 +747,11 @@ export const serializeAws_restJson1RemoveFlowVpcInterfaceCommand = async ( input: RemoveFlowVpcInterfaceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/flows/{FlowArn}/vpcInterfaces/{VpcInterfaceName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/flows/{FlowArn}/vpcInterfaces/{VpcInterfaceName}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -756,7 +771,6 @@ export const serializeAws_restJson1RemoveFlowVpcInterfaceCommand = async ( throw new Error("No value provided for input HTTP label: VpcInterfaceName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -772,8 +786,11 @@ export const serializeAws_restJson1RevokeFlowEntitlementCommand = async ( input: RevokeFlowEntitlementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/flows/{FlowArn}/entitlements/{EntitlementArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/flows/{FlowArn}/entitlements/{EntitlementArn}"; if (input.EntitlementArn !== undefined) { const labelValue: string = input.EntitlementArn; if (labelValue.length <= 0) { @@ -793,7 +810,6 @@ export const serializeAws_restJson1RevokeFlowEntitlementCommand = async ( throw new Error("No value provided for input HTTP label: FlowArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -809,8 +825,10 @@ export const serializeAws_restJson1StartFlowCommand = async ( input: StartFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/flows/start/{FlowArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/start/{FlowArn}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -821,7 +839,6 @@ export const serializeAws_restJson1StartFlowCommand = async ( throw new Error("No value provided for input HTTP label: FlowArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -837,8 +854,9 @@ export const serializeAws_restJson1StopFlowCommand = async ( input: StopFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/flows/stop/{FlowArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/stop/{FlowArn}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -849,7 +867,6 @@ export const serializeAws_restJson1StopFlowCommand = async ( throw new Error("No value provided for input HTTP label: FlowArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -865,10 +882,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -883,7 +901,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -899,8 +916,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -914,7 +932,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -931,10 +948,11 @@ export const serializeAws_restJson1UpdateFlowCommand = async ( input: UpdateFlowCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows/{FlowArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -951,7 +969,6 @@ export const serializeAws_restJson1UpdateFlowCommand = async ( sourceFailoverConfig: serializeAws_restJson1UpdateFailoverConfig(input.SourceFailoverConfig, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -967,10 +984,13 @@ export const serializeAws_restJson1UpdateFlowEntitlementCommand = async ( input: UpdateFlowEntitlementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows/{FlowArn}/entitlements/{EntitlementArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/flows/{FlowArn}/entitlements/{EntitlementArn}"; if (input.EntitlementArn !== undefined) { const labelValue: string = input.EntitlementArn; if (labelValue.length <= 0) { @@ -1001,7 +1021,6 @@ export const serializeAws_restJson1UpdateFlowEntitlementCommand = async ( subscribers: serializeAws_restJson1__listOf__string(input.Subscribers, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1017,10 +1036,13 @@ export const serializeAws_restJson1UpdateFlowMediaStreamCommand = async ( input: UpdateFlowMediaStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows/{FlowArn}/mediaStreams/{MediaStreamName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/flows/{FlowArn}/mediaStreams/{MediaStreamName}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -1051,7 +1073,6 @@ export const serializeAws_restJson1UpdateFlowMediaStreamCommand = async ( input.MediaStreamType !== null && { mediaStreamType: input.MediaStreamType }), ...(input.VideoFormat !== undefined && input.VideoFormat !== null && { videoFormat: input.VideoFormat }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1067,10 +1088,12 @@ export const serializeAws_restJson1UpdateFlowOutputCommand = async ( input: UpdateFlowOutputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows/{FlowArn}/outputs/{OutputArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/outputs/{OutputArn}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -1119,7 +1142,6 @@ export const serializeAws_restJson1UpdateFlowOutputCommand = async ( vpcInterfaceAttachment: serializeAws_restJson1VpcInterfaceAttachment(input.VpcInterfaceAttachment, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1135,10 +1157,12 @@ export const serializeAws_restJson1UpdateFlowSourceCommand = async ( input: UpdateFlowSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/flows/{FlowArn}/source/{SourceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/flows/{FlowArn}/source/{SourceArn}"; if (input.FlowArn !== undefined) { const labelValue: string = input.FlowArn; if (labelValue.length <= 0) { @@ -1182,7 +1206,6 @@ export const serializeAws_restJson1UpdateFlowSourceCommand = async ( input.VpcInterfaceName !== null && { vpcInterfaceName: input.VpcInterfaceName }), ...(input.WhitelistCidr !== undefined && input.WhitelistCidr !== null && { whitelistCidr: input.WhitelistCidr }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-mediaconvert/protocols/Aws_restJson1.ts b/clients/client-mediaconvert/protocols/Aws_restJson1.ts index c83aca5532ae0..ec91122e22c05 100644 --- a/clients/client-mediaconvert/protocols/Aws_restJson1.ts +++ b/clients/client-mediaconvert/protocols/Aws_restJson1.ts @@ -224,15 +224,15 @@ export const serializeAws_restJson1AssociateCertificateCommand = async ( input: AssociateCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/certificates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/certificates"; let body: any; body = JSON.stringify({ ...(input.Arn !== undefined && input.Arn !== null && { arn: input.Arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -248,8 +248,9 @@ export const serializeAws_restJson1CancelJobCommand = async ( input: CancelJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/jobs/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/jobs/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -260,7 +261,6 @@ export const serializeAws_restJson1CancelJobCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -276,10 +276,11 @@ export const serializeAws_restJson1CreateJobCommand = async ( input: CreateJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/jobs"; let body: any; body = JSON.stringify({ ...(input.AccelerationSettings !== undefined && @@ -310,7 +311,6 @@ export const serializeAws_restJson1CreateJobCommand = async ( userMetadata: serializeAws_restJson1__mapOf__string(input.UserMetadata, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -326,10 +326,11 @@ export const serializeAws_restJson1CreateJobTemplateCommand = async ( input: CreateJobTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/jobTemplates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/jobTemplates"; let body: any; body = JSON.stringify({ ...(input.AccelerationSettings !== undefined && @@ -352,7 +353,6 @@ export const serializeAws_restJson1CreateJobTemplateCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -368,10 +368,11 @@ export const serializeAws_restJson1CreatePresetCommand = async ( input: CreatePresetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/presets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/presets"; let body: any; body = JSON.stringify({ ...(input.Category !== undefined && input.Category !== null && { category: input.Category }), @@ -382,7 +383,6 @@ export const serializeAws_restJson1CreatePresetCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -398,10 +398,11 @@ export const serializeAws_restJson1CreateQueueCommand = async ( input: CreateQueueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/queues"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/queues"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { description: input.Description }), @@ -415,7 +416,6 @@ export const serializeAws_restJson1CreateQueueCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -431,8 +431,10 @@ export const serializeAws_restJson1DeleteJobTemplateCommand = async ( input: DeleteJobTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/jobTemplates/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/jobTemplates/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -443,7 +445,6 @@ export const serializeAws_restJson1DeleteJobTemplateCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -459,8 +460,10 @@ export const serializeAws_restJson1DeletePresetCommand = async ( input: DeletePresetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/presets/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/presets/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -471,7 +474,6 @@ export const serializeAws_restJson1DeletePresetCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -487,8 +489,10 @@ export const serializeAws_restJson1DeleteQueueCommand = async ( input: DeleteQueueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/queues/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/queues/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -499,7 +503,6 @@ export const serializeAws_restJson1DeleteQueueCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -515,17 +518,17 @@ export const serializeAws_restJson1DescribeEndpointsCommand = async ( input: DescribeEndpointsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/endpoints"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/endpoints"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { maxResults: input.MaxResults }), ...(input.Mode !== undefined && input.Mode !== null && { mode: input.Mode }), ...(input.NextToken !== undefined && input.NextToken !== null && { nextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -541,8 +544,10 @@ export const serializeAws_restJson1DisassociateCertificateCommand = async ( input: DisassociateCertificateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/certificates/{Arn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/certificates/{Arn}"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -553,7 +558,6 @@ export const serializeAws_restJson1DisassociateCertificateCommand = async ( throw new Error("No value provided for input HTTP label: Arn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -569,8 +573,9 @@ export const serializeAws_restJson1GetJobCommand = async ( input: GetJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/jobs/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/jobs/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -581,7 +586,6 @@ export const serializeAws_restJson1GetJobCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -597,8 +601,10 @@ export const serializeAws_restJson1GetJobTemplateCommand = async ( input: GetJobTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/jobTemplates/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/jobTemplates/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -609,7 +615,6 @@ export const serializeAws_restJson1GetJobTemplateCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -625,8 +630,10 @@ export const serializeAws_restJson1GetPresetCommand = async ( input: GetPresetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/presets/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/presets/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -637,7 +644,6 @@ export const serializeAws_restJson1GetPresetCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -653,8 +659,10 @@ export const serializeAws_restJson1GetQueueCommand = async ( input: GetQueueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/queues/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/queues/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -665,7 +673,6 @@ export const serializeAws_restJson1GetQueueCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -681,8 +688,9 @@ export const serializeAws_restJson1ListJobsCommand = async ( input: ListJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/jobs"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), @@ -691,7 +699,6 @@ export const serializeAws_restJson1ListJobsCommand = async ( ...(input.Status !== undefined && { status: input.Status }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -708,8 +715,9 @@ export const serializeAws_restJson1ListJobTemplatesCommand = async ( input: ListJobTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/jobTemplates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/jobTemplates"; const query: any = { ...(input.Category !== undefined && { category: input.Category }), ...(input.ListBy !== undefined && { listBy: input.ListBy }), @@ -718,7 +726,6 @@ export const serializeAws_restJson1ListJobTemplatesCommand = async ( ...(input.Order !== undefined && { order: input.Order }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -735,8 +742,9 @@ export const serializeAws_restJson1ListPresetsCommand = async ( input: ListPresetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/presets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/presets"; const query: any = { ...(input.Category !== undefined && { category: input.Category }), ...(input.ListBy !== undefined && { listBy: input.ListBy }), @@ -745,7 +753,6 @@ export const serializeAws_restJson1ListPresetsCommand = async ( ...(input.Order !== undefined && { order: input.Order }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -762,8 +769,9 @@ export const serializeAws_restJson1ListQueuesCommand = async ( input: ListQueuesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/queues"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/queues"; const query: any = { ...(input.ListBy !== undefined && { listBy: input.ListBy }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), @@ -771,7 +779,6 @@ export const serializeAws_restJson1ListQueuesCommand = async ( ...(input.Order !== undefined && { order: input.Order }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -788,8 +795,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2017-08-29/tags/{Arn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/tags/{Arn}"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -800,7 +808,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: Arn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -816,17 +823,17 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/tags"; let body: any; body = JSON.stringify({ ...(input.Arn !== undefined && input.Arn !== null && { arn: input.Arn }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -842,10 +849,11 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/tags/{Arn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/tags/{Arn}"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -860,7 +868,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && input.TagKeys !== null && { tagKeys: serializeAws_restJson1__listOf__string(input.TagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -876,10 +883,12 @@ export const serializeAws_restJson1UpdateJobTemplateCommand = async ( input: UpdateJobTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/jobTemplates/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/jobTemplates/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -908,7 +917,6 @@ export const serializeAws_restJson1UpdateJobTemplateCommand = async ( ...(input.StatusUpdateInterval !== undefined && input.StatusUpdateInterval !== null && { statusUpdateInterval: input.StatusUpdateInterval }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -924,10 +932,12 @@ export const serializeAws_restJson1UpdatePresetCommand = async ( input: UpdatePresetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/presets/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/presets/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -944,7 +954,6 @@ export const serializeAws_restJson1UpdatePresetCommand = async ( ...(input.Settings !== undefined && input.Settings !== null && { settings: serializeAws_restJson1PresetSettings(input.Settings, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -960,10 +969,12 @@ export const serializeAws_restJson1UpdateQueueCommand = async ( input: UpdateQueueCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2017-08-29/queues/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2017-08-29/queues/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -982,7 +993,6 @@ export const serializeAws_restJson1UpdateQueueCommand = async ( }), ...(input.Status !== undefined && input.Status !== null && { status: input.Status }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-medialive/protocols/Aws_restJson1.ts b/clients/client-medialive/protocols/Aws_restJson1.ts index cb0daa54e1a5d..243b6012611eb 100644 --- a/clients/client-medialive/protocols/Aws_restJson1.ts +++ b/clients/client-medialive/protocols/Aws_restJson1.ts @@ -370,8 +370,10 @@ export const serializeAws_restJson1AcceptInputDeviceTransferCommand = async ( input: AcceptInputDeviceTransferCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputDevices/{InputDeviceId}/accept"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputDevices/{InputDeviceId}/accept"; if (input.InputDeviceId !== undefined) { const labelValue: string = input.InputDeviceId; if (labelValue.length <= 0) { @@ -382,7 +384,6 @@ export const serializeAws_restJson1AcceptInputDeviceTransferCommand = async ( throw new Error("No value provided for input HTTP label: InputDeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -398,10 +399,11 @@ export const serializeAws_restJson1BatchDeleteCommand = async ( input: BatchDeleteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/batch/delete"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/batch/delete"; let body: any; body = JSON.stringify({ ...(input.ChannelIds !== undefined && @@ -417,7 +419,6 @@ export const serializeAws_restJson1BatchDeleteCommand = async ( multiplexIds: serializeAws_restJson1__listOf__string(input.MultiplexIds, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -433,10 +434,11 @@ export const serializeAws_restJson1BatchStartCommand = async ( input: BatchStartCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/batch/start"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/batch/start"; let body: any; body = JSON.stringify({ ...(input.ChannelIds !== undefined && @@ -446,7 +448,6 @@ export const serializeAws_restJson1BatchStartCommand = async ( multiplexIds: serializeAws_restJson1__listOf__string(input.MultiplexIds, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -462,10 +463,11 @@ export const serializeAws_restJson1BatchStopCommand = async ( input: BatchStopCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/batch/stop"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/batch/stop"; let body: any; body = JSON.stringify({ ...(input.ChannelIds !== undefined && @@ -475,7 +477,6 @@ export const serializeAws_restJson1BatchStopCommand = async ( multiplexIds: serializeAws_restJson1__listOf__string(input.MultiplexIds, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -491,10 +492,12 @@ export const serializeAws_restJson1BatchUpdateScheduleCommand = async ( input: BatchUpdateScheduleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/channels/{ChannelId}/schedule"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels/{ChannelId}/schedule"; if (input.ChannelId !== undefined) { const labelValue: string = input.ChannelId; if (labelValue.length <= 0) { @@ -515,7 +518,6 @@ export const serializeAws_restJson1BatchUpdateScheduleCommand = async ( deletes: serializeAws_restJson1BatchScheduleActionDeleteRequest(input.Deletes, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -531,8 +533,10 @@ export const serializeAws_restJson1CancelInputDeviceTransferCommand = async ( input: CancelInputDeviceTransferCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputDevices/{InputDeviceId}/cancel"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputDevices/{InputDeviceId}/cancel"; if (input.InputDeviceId !== undefined) { const labelValue: string = input.InputDeviceId; if (labelValue.length <= 0) { @@ -543,7 +547,6 @@ export const serializeAws_restJson1CancelInputDeviceTransferCommand = async ( throw new Error("No value provided for input HTTP label: InputDeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -559,10 +562,11 @@ export const serializeAws_restJson1CreateChannelCommand = async ( input: CreateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels"; let body: any; body = JSON.stringify({ ...(input.CdiInputSpecification !== undefined && @@ -595,7 +599,6 @@ export const serializeAws_restJson1CreateChannelCommand = async ( ...(input.Vpc !== undefined && input.Vpc !== null && { vpc: serializeAws_restJson1VpcOutputSettings(input.Vpc, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -611,10 +614,11 @@ export const serializeAws_restJson1CreateInputCommand = async ( input: CreateInputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/inputs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputs"; let body: any; body = JSON.stringify({ ...(input.Destinations !== undefined && @@ -643,7 +647,6 @@ export const serializeAws_restJson1CreateInputCommand = async ( ...(input.Vpc !== undefined && input.Vpc !== null && { vpc: serializeAws_restJson1InputVpcRequest(input.Vpc, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -659,10 +662,12 @@ export const serializeAws_restJson1CreateInputSecurityGroupCommand = async ( input: CreateInputSecurityGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/inputSecurityGroups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputSecurityGroups"; let body: any; body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), @@ -671,7 +676,6 @@ export const serializeAws_restJson1CreateInputSecurityGroupCommand = async ( whitelistRules: serializeAws_restJson1__listOfInputWhitelistRuleCidr(input.WhitelistRules, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -687,10 +691,11 @@ export const serializeAws_restJson1CreateMultiplexCommand = async ( input: CreateMultiplexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/multiplexes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/multiplexes"; let body: any; body = JSON.stringify({ ...(input.AvailabilityZones !== undefined && @@ -705,7 +710,6 @@ export const serializeAws_restJson1CreateMultiplexCommand = async ( requestId: input.RequestId ?? generateIdempotencyToken(), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -721,10 +725,12 @@ export const serializeAws_restJson1CreateMultiplexProgramCommand = async ( input: CreateMultiplexProgramCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/multiplexes/{MultiplexId}/programs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/multiplexes/{MultiplexId}/programs"; if (input.MultiplexId !== undefined) { const labelValue: string = input.MultiplexId; if (labelValue.length <= 0) { @@ -746,7 +752,6 @@ export const serializeAws_restJson1CreateMultiplexProgramCommand = async ( ...(input.ProgramName !== undefined && input.ProgramName !== null && { programName: input.ProgramName }), requestId: input.RequestId ?? generateIdempotencyToken(), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -762,10 +767,12 @@ export const serializeAws_restJson1CreatePartnerInputCommand = async ( input: CreatePartnerInputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/inputs/{InputId}/partners"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputs/{InputId}/partners"; if (input.InputId !== undefined) { const labelValue: string = input.InputId; if (labelValue.length <= 0) { @@ -780,7 +787,6 @@ export const serializeAws_restJson1CreatePartnerInputCommand = async ( requestId: input.RequestId ?? generateIdempotencyToken(), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -796,10 +802,11 @@ export const serializeAws_restJson1CreateTagsCommand = async ( input: CreateTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -813,7 +820,6 @@ export const serializeAws_restJson1CreateTagsCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -829,8 +835,10 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( input: DeleteChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/channels/{ChannelId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels/{ChannelId}"; if (input.ChannelId !== undefined) { const labelValue: string = input.ChannelId; if (labelValue.length <= 0) { @@ -841,7 +849,6 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( throw new Error("No value provided for input HTTP label: ChannelId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -857,8 +864,9 @@ export const serializeAws_restJson1DeleteInputCommand = async ( input: DeleteInputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputs/{InputId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputs/{InputId}"; if (input.InputId !== undefined) { const labelValue: string = input.InputId; if (labelValue.length <= 0) { @@ -869,7 +877,6 @@ export const serializeAws_restJson1DeleteInputCommand = async ( throw new Error("No value provided for input HTTP label: InputId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -885,8 +892,11 @@ export const serializeAws_restJson1DeleteInputSecurityGroupCommand = async ( input: DeleteInputSecurityGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputSecurityGroups/{InputSecurityGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/prod/inputSecurityGroups/{InputSecurityGroupId}"; if (input.InputSecurityGroupId !== undefined) { const labelValue: string = input.InputSecurityGroupId; if (labelValue.length <= 0) { @@ -897,7 +907,6 @@ export const serializeAws_restJson1DeleteInputSecurityGroupCommand = async ( throw new Error("No value provided for input HTTP label: InputSecurityGroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -913,8 +922,10 @@ export const serializeAws_restJson1DeleteMultiplexCommand = async ( input: DeleteMultiplexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/multiplexes/{MultiplexId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/multiplexes/{MultiplexId}"; if (input.MultiplexId !== undefined) { const labelValue: string = input.MultiplexId; if (labelValue.length <= 0) { @@ -925,7 +936,6 @@ export const serializeAws_restJson1DeleteMultiplexCommand = async ( throw new Error("No value provided for input HTTP label: MultiplexId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -941,8 +951,11 @@ export const serializeAws_restJson1DeleteMultiplexProgramCommand = async ( input: DeleteMultiplexProgramCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/multiplexes/{MultiplexId}/programs/{ProgramName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/prod/multiplexes/{MultiplexId}/programs/{ProgramName}"; if (input.MultiplexId !== undefined) { const labelValue: string = input.MultiplexId; if (labelValue.length <= 0) { @@ -962,7 +975,6 @@ export const serializeAws_restJson1DeleteMultiplexProgramCommand = async ( throw new Error("No value provided for input HTTP label: ProgramName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -978,8 +990,10 @@ export const serializeAws_restJson1DeleteReservationCommand = async ( input: DeleteReservationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/reservations/{ReservationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/reservations/{ReservationId}"; if (input.ReservationId !== undefined) { const labelValue: string = input.ReservationId; if (labelValue.length <= 0) { @@ -990,7 +1004,6 @@ export const serializeAws_restJson1DeleteReservationCommand = async ( throw new Error("No value provided for input HTTP label: ReservationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1006,8 +1019,10 @@ export const serializeAws_restJson1DeleteScheduleCommand = async ( input: DeleteScheduleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/channels/{ChannelId}/schedule"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels/{ChannelId}/schedule"; if (input.ChannelId !== undefined) { const labelValue: string = input.ChannelId; if (labelValue.length <= 0) { @@ -1018,7 +1033,6 @@ export const serializeAws_restJson1DeleteScheduleCommand = async ( throw new Error("No value provided for input HTTP label: ChannelId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1034,8 +1048,9 @@ export const serializeAws_restJson1DeleteTagsCommand = async ( input: DeleteTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1049,7 +1064,6 @@ export const serializeAws_restJson1DeleteTagsCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1066,8 +1080,10 @@ export const serializeAws_restJson1DescribeChannelCommand = async ( input: DescribeChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/channels/{ChannelId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels/{ChannelId}"; if (input.ChannelId !== undefined) { const labelValue: string = input.ChannelId; if (labelValue.length <= 0) { @@ -1078,7 +1094,6 @@ export const serializeAws_restJson1DescribeChannelCommand = async ( throw new Error("No value provided for input HTTP label: ChannelId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1094,8 +1109,9 @@ export const serializeAws_restJson1DescribeInputCommand = async ( input: DescribeInputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputs/{InputId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputs/{InputId}"; if (input.InputId !== undefined) { const labelValue: string = input.InputId; if (labelValue.length <= 0) { @@ -1106,7 +1122,6 @@ export const serializeAws_restJson1DescribeInputCommand = async ( throw new Error("No value provided for input HTTP label: InputId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1122,8 +1137,10 @@ export const serializeAws_restJson1DescribeInputDeviceCommand = async ( input: DescribeInputDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputDevices/{InputDeviceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputDevices/{InputDeviceId}"; if (input.InputDeviceId !== undefined) { const labelValue: string = input.InputDeviceId; if (labelValue.length <= 0) { @@ -1134,7 +1151,6 @@ export const serializeAws_restJson1DescribeInputDeviceCommand = async ( throw new Error("No value provided for input HTTP label: InputDeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1150,10 +1166,13 @@ export const serializeAws_restJson1DescribeInputDeviceThumbnailCommand = async ( input: DescribeInputDeviceThumbnailCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.Accept) && { accept: input.Accept! }), }; - let resolvedPath = "/prod/inputDevices/{InputDeviceId}/thumbnailData"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/prod/inputDevices/{InputDeviceId}/thumbnailData"; if (input.InputDeviceId !== undefined) { const labelValue: string = input.InputDeviceId; if (labelValue.length <= 0) { @@ -1164,7 +1183,6 @@ export const serializeAws_restJson1DescribeInputDeviceThumbnailCommand = async ( throw new Error("No value provided for input HTTP label: InputDeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1180,8 +1198,11 @@ export const serializeAws_restJson1DescribeInputSecurityGroupCommand = async ( input: DescribeInputSecurityGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputSecurityGroups/{InputSecurityGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/prod/inputSecurityGroups/{InputSecurityGroupId}"; if (input.InputSecurityGroupId !== undefined) { const labelValue: string = input.InputSecurityGroupId; if (labelValue.length <= 0) { @@ -1192,7 +1213,6 @@ export const serializeAws_restJson1DescribeInputSecurityGroupCommand = async ( throw new Error("No value provided for input HTTP label: InputSecurityGroupId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1208,8 +1228,10 @@ export const serializeAws_restJson1DescribeMultiplexCommand = async ( input: DescribeMultiplexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/multiplexes/{MultiplexId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/multiplexes/{MultiplexId}"; if (input.MultiplexId !== undefined) { const labelValue: string = input.MultiplexId; if (labelValue.length <= 0) { @@ -1220,7 +1242,6 @@ export const serializeAws_restJson1DescribeMultiplexCommand = async ( throw new Error("No value provided for input HTTP label: MultiplexId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1236,8 +1257,11 @@ export const serializeAws_restJson1DescribeMultiplexProgramCommand = async ( input: DescribeMultiplexProgramCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/multiplexes/{MultiplexId}/programs/{ProgramName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/prod/multiplexes/{MultiplexId}/programs/{ProgramName}"; if (input.MultiplexId !== undefined) { const labelValue: string = input.MultiplexId; if (labelValue.length <= 0) { @@ -1257,7 +1281,6 @@ export const serializeAws_restJson1DescribeMultiplexProgramCommand = async ( throw new Error("No value provided for input HTTP label: ProgramName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1273,8 +1296,10 @@ export const serializeAws_restJson1DescribeOfferingCommand = async ( input: DescribeOfferingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/offerings/{OfferingId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/offerings/{OfferingId}"; if (input.OfferingId !== undefined) { const labelValue: string = input.OfferingId; if (labelValue.length <= 0) { @@ -1285,7 +1310,6 @@ export const serializeAws_restJson1DescribeOfferingCommand = async ( throw new Error("No value provided for input HTTP label: OfferingId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1301,8 +1325,10 @@ export const serializeAws_restJson1DescribeReservationCommand = async ( input: DescribeReservationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/reservations/{ReservationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/reservations/{ReservationId}"; if (input.ReservationId !== undefined) { const labelValue: string = input.ReservationId; if (labelValue.length <= 0) { @@ -1313,7 +1339,6 @@ export const serializeAws_restJson1DescribeReservationCommand = async ( throw new Error("No value provided for input HTTP label: ReservationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1329,8 +1354,10 @@ export const serializeAws_restJson1DescribeScheduleCommand = async ( input: DescribeScheduleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/channels/{ChannelId}/schedule"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels/{ChannelId}/schedule"; if (input.ChannelId !== undefined) { const labelValue: string = input.ChannelId; if (labelValue.length <= 0) { @@ -1345,7 +1372,6 @@ export const serializeAws_restJson1DescribeScheduleCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1362,14 +1388,14 @@ export const serializeAws_restJson1ListChannelsCommand = async ( input: ListChannelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1386,14 +1412,14 @@ export const serializeAws_restJson1ListInputDevicesCommand = async ( input: ListInputDevicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputDevices"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputDevices"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1410,15 +1436,16 @@ export const serializeAws_restJson1ListInputDeviceTransfersCommand = async ( input: ListInputDeviceTransfersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputDeviceTransfers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputDeviceTransfers"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.TransferType !== undefined && { transferType: input.TransferType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1435,14 +1462,14 @@ export const serializeAws_restJson1ListInputsCommand = async ( input: ListInputsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputs"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1459,14 +1486,15 @@ export const serializeAws_restJson1ListInputSecurityGroupsCommand = async ( input: ListInputSecurityGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputSecurityGroups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputSecurityGroups"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1483,14 +1511,14 @@ export const serializeAws_restJson1ListMultiplexesCommand = async ( input: ListMultiplexesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/multiplexes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/multiplexes"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1507,8 +1535,10 @@ export const serializeAws_restJson1ListMultiplexProgramsCommand = async ( input: ListMultiplexProgramsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/multiplexes/{MultiplexId}/programs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/multiplexes/{MultiplexId}/programs"; if (input.MultiplexId !== undefined) { const labelValue: string = input.MultiplexId; if (labelValue.length <= 0) { @@ -1523,7 +1553,6 @@ export const serializeAws_restJson1ListMultiplexProgramsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1540,8 +1569,9 @@ export const serializeAws_restJson1ListOfferingsCommand = async ( input: ListOfferingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/offerings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/offerings"; const query: any = { ...(input.ChannelClass !== undefined && { channelClass: input.ChannelClass }), ...(input.ChannelConfiguration !== undefined && { channelConfiguration: input.ChannelConfiguration }), @@ -1557,7 +1587,6 @@ export const serializeAws_restJson1ListOfferingsCommand = async ( ...(input.VideoQuality !== undefined && { videoQuality: input.VideoQuality }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1574,8 +1603,9 @@ export const serializeAws_restJson1ListReservationsCommand = async ( input: ListReservationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/reservations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/reservations"; const query: any = { ...(input.ChannelClass !== undefined && { channelClass: input.ChannelClass }), ...(input.Codec !== undefined && { codec: input.Codec }), @@ -1589,7 +1619,6 @@ export const serializeAws_restJson1ListReservationsCommand = async ( ...(input.VideoQuality !== undefined && { videoQuality: input.VideoQuality }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1606,8 +1635,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1618,7 +1648,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1634,10 +1663,12 @@ export const serializeAws_restJson1PurchaseOfferingCommand = async ( input: PurchaseOfferingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/offerings/{OfferingId}/purchase"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/offerings/{OfferingId}/purchase"; if (input.OfferingId !== undefined) { const labelValue: string = input.OfferingId; if (labelValue.length <= 0) { @@ -1655,7 +1686,6 @@ export const serializeAws_restJson1PurchaseOfferingCommand = async ( ...(input.Start !== undefined && input.Start !== null && { start: input.Start }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1671,8 +1701,10 @@ export const serializeAws_restJson1RejectInputDeviceTransferCommand = async ( input: RejectInputDeviceTransferCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/inputDevices/{InputDeviceId}/reject"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputDevices/{InputDeviceId}/reject"; if (input.InputDeviceId !== undefined) { const labelValue: string = input.InputDeviceId; if (labelValue.length <= 0) { @@ -1683,7 +1715,6 @@ export const serializeAws_restJson1RejectInputDeviceTransferCommand = async ( throw new Error("No value provided for input HTTP label: InputDeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1699,8 +1730,10 @@ export const serializeAws_restJson1StartChannelCommand = async ( input: StartChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/channels/{ChannelId}/start"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels/{ChannelId}/start"; if (input.ChannelId !== undefined) { const labelValue: string = input.ChannelId; if (labelValue.length <= 0) { @@ -1711,7 +1744,6 @@ export const serializeAws_restJson1StartChannelCommand = async ( throw new Error("No value provided for input HTTP label: ChannelId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1727,8 +1759,10 @@ export const serializeAws_restJson1StartMultiplexCommand = async ( input: StartMultiplexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/multiplexes/{MultiplexId}/start"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/multiplexes/{MultiplexId}/start"; if (input.MultiplexId !== undefined) { const labelValue: string = input.MultiplexId; if (labelValue.length <= 0) { @@ -1739,7 +1773,6 @@ export const serializeAws_restJson1StartMultiplexCommand = async ( throw new Error("No value provided for input HTTP label: MultiplexId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1755,8 +1788,10 @@ export const serializeAws_restJson1StopChannelCommand = async ( input: StopChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/channels/{ChannelId}/stop"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels/{ChannelId}/stop"; if (input.ChannelId !== undefined) { const labelValue: string = input.ChannelId; if (labelValue.length <= 0) { @@ -1767,7 +1802,6 @@ export const serializeAws_restJson1StopChannelCommand = async ( throw new Error("No value provided for input HTTP label: ChannelId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1783,8 +1817,10 @@ export const serializeAws_restJson1StopMultiplexCommand = async ( input: StopMultiplexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/prod/multiplexes/{MultiplexId}/stop"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/multiplexes/{MultiplexId}/stop"; if (input.MultiplexId !== undefined) { const labelValue: string = input.MultiplexId; if (labelValue.length <= 0) { @@ -1795,7 +1831,6 @@ export const serializeAws_restJson1StopMultiplexCommand = async ( throw new Error("No value provided for input HTTP label: MultiplexId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1811,10 +1846,13 @@ export const serializeAws_restJson1TransferInputDeviceCommand = async ( input: TransferInputDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/inputDevices/{InputDeviceId}/transfer"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/prod/inputDevices/{InputDeviceId}/transfer"; if (input.InputDeviceId !== undefined) { const labelValue: string = input.InputDeviceId; if (labelValue.length <= 0) { @@ -1832,7 +1870,6 @@ export const serializeAws_restJson1TransferInputDeviceCommand = async ( ...(input.TransferMessage !== undefined && input.TransferMessage !== null && { transferMessage: input.TransferMessage }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1848,10 +1885,12 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( input: UpdateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/channels/{ChannelId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels/{ChannelId}"; if (input.ChannelId !== undefined) { const labelValue: string = input.ChannelId; if (labelValue.length <= 0) { @@ -1887,7 +1926,6 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), ...(input.RoleArn !== undefined && input.RoleArn !== null && { roleArn: input.RoleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1903,10 +1941,12 @@ export const serializeAws_restJson1UpdateChannelClassCommand = async ( input: UpdateChannelClassCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/channels/{ChannelId}/channelClass"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/channels/{ChannelId}/channelClass"; if (input.ChannelId !== undefined) { const labelValue: string = input.ChannelId; if (labelValue.length <= 0) { @@ -1924,7 +1964,6 @@ export const serializeAws_restJson1UpdateChannelClassCommand = async ( destinations: serializeAws_restJson1__listOfOutputDestination(input.Destinations, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1940,10 +1979,11 @@ export const serializeAws_restJson1UpdateInputCommand = async ( input: UpdateInputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/inputs/{InputId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputs/{InputId}"; if (input.InputId !== undefined) { const labelValue: string = input.InputId; if (labelValue.length <= 0) { @@ -1976,7 +2016,6 @@ export const serializeAws_restJson1UpdateInputCommand = async ( ...(input.Sources !== undefined && input.Sources !== null && { sources: serializeAws_restJson1__listOfInputSourceRequest(input.Sources, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1992,10 +2031,12 @@ export const serializeAws_restJson1UpdateInputDeviceCommand = async ( input: UpdateInputDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/inputDevices/{InputDeviceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/inputDevices/{InputDeviceId}"; if (input.InputDeviceId !== undefined) { const labelValue: string = input.InputDeviceId; if (labelValue.length <= 0) { @@ -2017,7 +2058,6 @@ export const serializeAws_restJson1UpdateInputDeviceCommand = async ( uhdDeviceSettings: serializeAws_restJson1InputDeviceConfigurableSettings(input.UhdDeviceSettings, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2033,10 +2073,13 @@ export const serializeAws_restJson1UpdateInputSecurityGroupCommand = async ( input: UpdateInputSecurityGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/inputSecurityGroups/{InputSecurityGroupId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/prod/inputSecurityGroups/{InputSecurityGroupId}"; if (input.InputSecurityGroupId !== undefined) { const labelValue: string = input.InputSecurityGroupId; if (labelValue.length <= 0) { @@ -2054,7 +2097,6 @@ export const serializeAws_restJson1UpdateInputSecurityGroupCommand = async ( whitelistRules: serializeAws_restJson1__listOfInputWhitelistRuleCidr(input.WhitelistRules, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2070,10 +2112,12 @@ export const serializeAws_restJson1UpdateMultiplexCommand = async ( input: UpdateMultiplexCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/multiplexes/{MultiplexId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/multiplexes/{MultiplexId}"; if (input.MultiplexId !== undefined) { const labelValue: string = input.MultiplexId; if (labelValue.length <= 0) { @@ -2091,7 +2135,6 @@ export const serializeAws_restJson1UpdateMultiplexCommand = async ( }), ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2107,10 +2150,13 @@ export const serializeAws_restJson1UpdateMultiplexProgramCommand = async ( input: UpdateMultiplexProgramCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/multiplexes/{MultiplexId}/programs/{ProgramName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/prod/multiplexes/{MultiplexId}/programs/{ProgramName}"; if (input.MultiplexId !== undefined) { const labelValue: string = input.MultiplexId; if (labelValue.length <= 0) { @@ -2139,7 +2185,6 @@ export const serializeAws_restJson1UpdateMultiplexProgramCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2155,10 +2200,12 @@ export const serializeAws_restJson1UpdateReservationCommand = async ( input: UpdateReservationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/prod/reservations/{ReservationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/prod/reservations/{ReservationId}"; if (input.ReservationId !== undefined) { const labelValue: string = input.ReservationId; if (labelValue.length <= 0) { @@ -2172,7 +2219,6 @@ export const serializeAws_restJson1UpdateReservationCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-mediapackage-vod/protocols/Aws_restJson1.ts b/clients/client-mediapackage-vod/protocols/Aws_restJson1.ts index 0c7e729ff5174..5ef9d5f3a29ee 100644 --- a/clients/client-mediapackage-vod/protocols/Aws_restJson1.ts +++ b/clients/client-mediapackage-vod/protocols/Aws_restJson1.ts @@ -92,10 +92,12 @@ export const serializeAws_restJson1ConfigureLogsCommand = async ( input: ConfigureLogsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/packaging_groups/{Id}/configure_logs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/packaging_groups/{Id}/configure_logs"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -112,7 +114,6 @@ export const serializeAws_restJson1ConfigureLogsCommand = async ( egressAccessLogs: serializeAws_restJson1EgressAccessLogs(input.EgressAccessLogs, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -128,10 +129,11 @@ export const serializeAws_restJson1CreateAssetCommand = async ( input: CreateAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/assets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets"; let body: any; body = JSON.stringify({ ...(input.Id !== undefined && input.Id !== null && { id: input.Id }), @@ -142,7 +144,6 @@ export const serializeAws_restJson1CreateAssetCommand = async ( ...(input.SourceRoleArn !== undefined && input.SourceRoleArn !== null && { sourceRoleArn: input.SourceRoleArn }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -158,10 +159,12 @@ export const serializeAws_restJson1CreatePackagingConfigurationCommand = async ( input: CreatePackagingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/packaging_configurations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/packaging_configurations"; let body: any; body = JSON.stringify({ ...(input.CmafPackage !== undefined && @@ -177,7 +180,6 @@ export const serializeAws_restJson1CreatePackagingConfigurationCommand = async ( input.PackagingGroupId !== null && { packagingGroupId: input.PackagingGroupId }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -193,10 +195,11 @@ export const serializeAws_restJson1CreatePackagingGroupCommand = async ( input: CreatePackagingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/packaging_groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/packaging_groups"; let body: any; body = JSON.stringify({ ...(input.Authorization !== undefined && @@ -210,7 +213,6 @@ export const serializeAws_restJson1CreatePackagingGroupCommand = async ( ...(input.Id !== undefined && input.Id !== null && { id: input.Id }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -226,8 +228,9 @@ export const serializeAws_restJson1DeleteAssetCommand = async ( input: DeleteAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assets/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -238,7 +241,6 @@ export const serializeAws_restJson1DeleteAssetCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -254,8 +256,10 @@ export const serializeAws_restJson1DeletePackagingConfigurationCommand = async ( input: DeletePackagingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/packaging_configurations/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/packaging_configurations/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -266,7 +270,6 @@ export const serializeAws_restJson1DeletePackagingConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -282,8 +285,9 @@ export const serializeAws_restJson1DeletePackagingGroupCommand = async ( input: DeletePackagingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/packaging_groups/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/packaging_groups/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -294,7 +298,6 @@ export const serializeAws_restJson1DeletePackagingGroupCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -310,8 +313,9 @@ export const serializeAws_restJson1DescribeAssetCommand = async ( input: DescribeAssetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assets/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -322,7 +326,6 @@ export const serializeAws_restJson1DescribeAssetCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -338,8 +341,10 @@ export const serializeAws_restJson1DescribePackagingConfigurationCommand = async input: DescribePackagingConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/packaging_configurations/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/packaging_configurations/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -350,7 +355,6 @@ export const serializeAws_restJson1DescribePackagingConfigurationCommand = async throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -366,8 +370,9 @@ export const serializeAws_restJson1DescribePackagingGroupCommand = async ( input: DescribePackagingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/packaging_groups/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/packaging_groups/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -378,7 +383,6 @@ export const serializeAws_restJson1DescribePackagingGroupCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -394,15 +398,15 @@ export const serializeAws_restJson1ListAssetsCommand = async ( input: ListAssetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/assets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assets"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.PackagingGroupId !== undefined && { packagingGroupId: input.PackagingGroupId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -419,15 +423,16 @@ export const serializeAws_restJson1ListPackagingConfigurationsCommand = async ( input: ListPackagingConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/packaging_configurations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/packaging_configurations"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.PackagingGroupId !== undefined && { packagingGroupId: input.PackagingGroupId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -444,14 +449,14 @@ export const serializeAws_restJson1ListPackagingGroupsCommand = async ( input: ListPackagingGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/packaging_groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/packaging_groups"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -468,8 +473,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -480,7 +486,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -496,10 +501,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -514,7 +520,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -530,8 +535,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -545,7 +551,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -562,10 +567,11 @@ export const serializeAws_restJson1UpdatePackagingGroupCommand = async ( input: UpdatePackagingGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/packaging_groups/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/packaging_groups/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -582,7 +588,6 @@ export const serializeAws_restJson1UpdatePackagingGroupCommand = async ( authorization: serializeAws_restJson1Authorization(input.Authorization, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-mediapackage/protocols/Aws_restJson1.ts b/clients/client-mediapackage/protocols/Aws_restJson1.ts index 068fdbe1283cf..d24a22f736395 100644 --- a/clients/client-mediapackage/protocols/Aws_restJson1.ts +++ b/clients/client-mediapackage/protocols/Aws_restJson1.ts @@ -93,10 +93,12 @@ export const serializeAws_restJson1ConfigureLogsCommand = async ( input: ConfigureLogsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channels/{Id}/configure_logs"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{Id}/configure_logs"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -117,7 +119,6 @@ export const serializeAws_restJson1ConfigureLogsCommand = async ( ingressAccessLogs: serializeAws_restJson1IngressAccessLogs(input.IngressAccessLogs, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -133,17 +134,17 @@ export const serializeAws_restJson1CreateChannelCommand = async ( input: CreateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { description: input.Description }), ...(input.Id !== undefined && input.Id !== null && { id: input.Id }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -159,10 +160,11 @@ export const serializeAws_restJson1CreateHarvestJobCommand = async ( input: CreateHarvestJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/harvest_jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/harvest_jobs"; let body: any; body = JSON.stringify({ ...(input.EndTime !== undefined && input.EndTime !== null && { endTime: input.EndTime }), @@ -175,7 +177,6 @@ export const serializeAws_restJson1CreateHarvestJobCommand = async ( }), ...(input.StartTime !== undefined && input.StartTime !== null && { startTime: input.StartTime }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -191,10 +192,11 @@ export const serializeAws_restJson1CreateOriginEndpointCommand = async ( input: CreateOriginEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/origin_endpoints"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/origin_endpoints"; let body: any; body = JSON.stringify({ ...(input.Authorization !== undefined && @@ -224,7 +226,6 @@ export const serializeAws_restJson1CreateOriginEndpointCommand = async ( ...(input.Whitelist !== undefined && input.Whitelist !== null && { whitelist: serializeAws_restJson1__listOf__string(input.Whitelist, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -240,8 +241,9 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( input: DeleteChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -252,7 +254,6 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -268,8 +269,9 @@ export const serializeAws_restJson1DeleteOriginEndpointCommand = async ( input: DeleteOriginEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/origin_endpoints/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/origin_endpoints/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -280,7 +282,6 @@ export const serializeAws_restJson1DeleteOriginEndpointCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -296,8 +297,9 @@ export const serializeAws_restJson1DescribeChannelCommand = async ( input: DescribeChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -308,7 +310,6 @@ export const serializeAws_restJson1DescribeChannelCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -324,8 +325,9 @@ export const serializeAws_restJson1DescribeHarvestJobCommand = async ( input: DescribeHarvestJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/harvest_jobs/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/harvest_jobs/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -336,7 +338,6 @@ export const serializeAws_restJson1DescribeHarvestJobCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -352,8 +353,9 @@ export const serializeAws_restJson1DescribeOriginEndpointCommand = async ( input: DescribeOriginEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/origin_endpoints/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/origin_endpoints/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -364,7 +366,6 @@ export const serializeAws_restJson1DescribeOriginEndpointCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -380,14 +381,14 @@ export const serializeAws_restJson1ListChannelsCommand = async ( input: ListChannelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -404,8 +405,9 @@ export const serializeAws_restJson1ListHarvestJobsCommand = async ( input: ListHarvestJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/harvest_jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/harvest_jobs"; const query: any = { ...(input.IncludeChannelId !== undefined && { includeChannelId: input.IncludeChannelId }), ...(input.IncludeStatus !== undefined && { includeStatus: input.IncludeStatus }), @@ -413,7 +415,6 @@ export const serializeAws_restJson1ListHarvestJobsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -430,15 +431,15 @@ export const serializeAws_restJson1ListOriginEndpointsCommand = async ( input: ListOriginEndpointsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/origin_endpoints"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/origin_endpoints"; const query: any = { ...(input.ChannelId !== undefined && { channelId: input.ChannelId }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -455,8 +456,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -467,7 +469,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -483,8 +484,10 @@ export const serializeAws_restJson1RotateChannelCredentialsCommand = async ( input: RotateChannelCredentialsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels/{Id}/credentials"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{Id}/credentials"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -495,7 +498,6 @@ export const serializeAws_restJson1RotateChannelCredentialsCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -511,8 +513,11 @@ export const serializeAws_restJson1RotateIngestEndpointCredentialsCommand = asyn input: RotateIngestEndpointCredentialsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels/{Id}/ingest_endpoints/{IngestEndpointId}/credentials"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channels/{Id}/ingest_endpoints/{IngestEndpointId}/credentials"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -532,7 +537,6 @@ export const serializeAws_restJson1RotateIngestEndpointCredentialsCommand = asyn throw new Error("No value provided for input HTTP label: IngestEndpointId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -548,10 +552,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -566,7 +571,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -582,8 +586,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -597,7 +602,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -614,10 +618,11 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( input: UpdateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channels/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -631,7 +636,6 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -647,10 +651,11 @@ export const serializeAws_restJson1UpdateOriginEndpointCommand = async ( input: UpdateOriginEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/origin_endpoints/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/origin_endpoints/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -686,7 +691,6 @@ export const serializeAws_restJson1UpdateOriginEndpointCommand = async ( ...(input.Whitelist !== undefined && input.Whitelist !== null && { whitelist: serializeAws_restJson1__listOf__string(input.Whitelist, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-mediastore-data/protocols/Aws_restJson1.ts b/clients/client-mediastore-data/protocols/Aws_restJson1.ts index f529b865f5d75..51908f81fcf2d 100644 --- a/clients/client-mediastore-data/protocols/Aws_restJson1.ts +++ b/clients/client-mediastore-data/protocols/Aws_restJson1.ts @@ -28,8 +28,9 @@ export const serializeAws_restJson1DeleteObjectCommand = async ( input: DeleteObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{Path+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Path+}"; if (input.Path !== undefined) { const labelValue: string = input.Path; if (labelValue.length <= 0) { @@ -46,7 +47,6 @@ export const serializeAws_restJson1DeleteObjectCommand = async ( throw new Error("No value provided for input HTTP label: Path."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -62,8 +62,9 @@ export const serializeAws_restJson1DescribeObjectCommand = async ( input: DescribeObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{Path+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Path+}"; if (input.Path !== undefined) { const labelValue: string = input.Path; if (labelValue.length <= 0) { @@ -80,7 +81,6 @@ export const serializeAws_restJson1DescribeObjectCommand = async ( throw new Error("No value provided for input HTTP label: Path."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -96,10 +96,11 @@ export const serializeAws_restJson1GetObjectCommand = async ( input: GetObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.Range) && { range: input.Range! }), }; - let resolvedPath = "/{Path+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Path+}"; if (input.Path !== undefined) { const labelValue: string = input.Path; if (labelValue.length <= 0) { @@ -116,7 +117,6 @@ export const serializeAws_restJson1GetObjectCommand = async ( throw new Error("No value provided for input HTTP label: Path."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -132,15 +132,15 @@ export const serializeAws_restJson1ListItemsCommand = async ( input: ListItemsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/"; const query: any = { ...(input.Path !== undefined && { Path: input.Path }), ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -157,6 +157,7 @@ export const serializeAws_restJson1PutObjectCommand = async ( input: PutObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", "x-amz-content-sha256": "UNSIGNED-PAYLOAD", @@ -167,7 +168,7 @@ export const serializeAws_restJson1PutObjectCommand = async ( "x-amz-upload-availability": input.UploadAvailability!, }), }; - let resolvedPath = "/{Path+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Path+}"; if (input.Path !== undefined) { const labelValue: string = input.Path; if (labelValue.length <= 0) { @@ -187,7 +188,6 @@ export const serializeAws_restJson1PutObjectCommand = async ( if (input.Body !== undefined) { body = input.Body; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-mediatailor/protocols/Aws_restJson1.ts b/clients/client-mediatailor/protocols/Aws_restJson1.ts index 84276509e3ac5..18367f11ba9b3 100644 --- a/clients/client-mediatailor/protocols/Aws_restJson1.ts +++ b/clients/client-mediatailor/protocols/Aws_restJson1.ts @@ -113,10 +113,11 @@ export const serializeAws_restJson1CreateChannelCommand = async ( input: CreateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channel/{ChannelName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -134,7 +135,6 @@ export const serializeAws_restJson1CreateChannelCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -150,10 +150,13 @@ export const serializeAws_restJson1CreateProgramCommand = async ( input: CreateProgramCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channel/{ChannelName}/program/{ProgramName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channel/{ChannelName}/program/{ProgramName}"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -184,7 +187,6 @@ export const serializeAws_restJson1CreateProgramCommand = async ( input.SourceLocationName !== null && { SourceLocationName: input.SourceLocationName }), ...(input.VodSourceName !== undefined && input.VodSourceName !== null && { VodSourceName: input.VodSourceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -200,10 +202,12 @@ export const serializeAws_restJson1CreateSourceLocationCommand = async ( input: CreateSourceLocationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sourceLocation/{SourceLocationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sourceLocation/{SourceLocationName}"; if (input.SourceLocationName !== undefined) { const labelValue: string = input.SourceLocationName; if (labelValue.length <= 0) { @@ -233,7 +237,6 @@ export const serializeAws_restJson1CreateSourceLocationCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -249,10 +252,13 @@ export const serializeAws_restJson1CreateVodSourceCommand = async ( input: CreateVodSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}"; if (input.SourceLocationName !== undefined) { const labelValue: string = input.SourceLocationName; if (labelValue.length <= 0) { @@ -283,7 +289,6 @@ export const serializeAws_restJson1CreateVodSourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -299,8 +304,9 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( input: DeleteChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channel/{ChannelName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -311,7 +317,6 @@ export const serializeAws_restJson1DeleteChannelCommand = async ( throw new Error("No value provided for input HTTP label: ChannelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -327,8 +332,10 @@ export const serializeAws_restJson1DeleteChannelPolicyCommand = async ( input: DeleteChannelPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channel/{ChannelName}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/policy"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -339,7 +346,6 @@ export const serializeAws_restJson1DeleteChannelPolicyCommand = async ( throw new Error("No value provided for input HTTP label: ChannelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -355,8 +361,10 @@ export const serializeAws_restJson1DeletePlaybackConfigurationCommand = async ( input: DeletePlaybackConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/playbackConfiguration/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/playbackConfiguration/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -367,7 +375,6 @@ export const serializeAws_restJson1DeletePlaybackConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -383,8 +390,11 @@ export const serializeAws_restJson1DeleteProgramCommand = async ( input: DeleteProgramCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channel/{ChannelName}/program/{ProgramName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channel/{ChannelName}/program/{ProgramName}"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -404,7 +414,6 @@ export const serializeAws_restJson1DeleteProgramCommand = async ( throw new Error("No value provided for input HTTP label: ProgramName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -420,8 +429,10 @@ export const serializeAws_restJson1DeleteSourceLocationCommand = async ( input: DeleteSourceLocationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sourceLocation/{SourceLocationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sourceLocation/{SourceLocationName}"; if (input.SourceLocationName !== undefined) { const labelValue: string = input.SourceLocationName; if (labelValue.length <= 0) { @@ -432,7 +443,6 @@ export const serializeAws_restJson1DeleteSourceLocationCommand = async ( throw new Error("No value provided for input HTTP label: SourceLocationName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -448,8 +458,11 @@ export const serializeAws_restJson1DeleteVodSourceCommand = async ( input: DeleteVodSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}"; if (input.SourceLocationName !== undefined) { const labelValue: string = input.SourceLocationName; if (labelValue.length <= 0) { @@ -469,7 +482,6 @@ export const serializeAws_restJson1DeleteVodSourceCommand = async ( throw new Error("No value provided for input HTTP label: VodSourceName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -485,8 +497,9 @@ export const serializeAws_restJson1DescribeChannelCommand = async ( input: DescribeChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channel/{ChannelName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -497,7 +510,6 @@ export const serializeAws_restJson1DescribeChannelCommand = async ( throw new Error("No value provided for input HTTP label: ChannelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -513,8 +525,11 @@ export const serializeAws_restJson1DescribeProgramCommand = async ( input: DescribeProgramCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channel/{ChannelName}/program/{ProgramName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/channel/{ChannelName}/program/{ProgramName}"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -534,7 +549,6 @@ export const serializeAws_restJson1DescribeProgramCommand = async ( throw new Error("No value provided for input HTTP label: ProgramName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -550,8 +564,10 @@ export const serializeAws_restJson1DescribeSourceLocationCommand = async ( input: DescribeSourceLocationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sourceLocation/{SourceLocationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sourceLocation/{SourceLocationName}"; if (input.SourceLocationName !== undefined) { const labelValue: string = input.SourceLocationName; if (labelValue.length <= 0) { @@ -562,7 +578,6 @@ export const serializeAws_restJson1DescribeSourceLocationCommand = async ( throw new Error("No value provided for input HTTP label: SourceLocationName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -578,8 +593,11 @@ export const serializeAws_restJson1DescribeVodSourceCommand = async ( input: DescribeVodSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}"; if (input.SourceLocationName !== undefined) { const labelValue: string = input.SourceLocationName; if (labelValue.length <= 0) { @@ -599,7 +617,6 @@ export const serializeAws_restJson1DescribeVodSourceCommand = async ( throw new Error("No value provided for input HTTP label: VodSourceName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -615,8 +632,10 @@ export const serializeAws_restJson1GetChannelPolicyCommand = async ( input: GetChannelPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channel/{ChannelName}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/policy"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -627,7 +646,6 @@ export const serializeAws_restJson1GetChannelPolicyCommand = async ( throw new Error("No value provided for input HTTP label: ChannelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -643,8 +661,10 @@ export const serializeAws_restJson1GetChannelScheduleCommand = async ( input: GetChannelScheduleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channel/{ChannelName}/schedule"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/schedule"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -660,7 +680,6 @@ export const serializeAws_restJson1GetChannelScheduleCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -677,8 +696,10 @@ export const serializeAws_restJson1GetPlaybackConfigurationCommand = async ( input: GetPlaybackConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/playbackConfiguration/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/playbackConfiguration/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -689,7 +710,6 @@ export const serializeAws_restJson1GetPlaybackConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -705,14 +725,14 @@ export const serializeAws_restJson1ListChannelsCommand = async ( input: ListChannelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channels"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channels"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -729,14 +749,14 @@ export const serializeAws_restJson1ListPlaybackConfigurationsCommand = async ( input: ListPlaybackConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/playbackConfigurations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/playbackConfigurations"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -753,14 +773,14 @@ export const serializeAws_restJson1ListSourceLocationsCommand = async ( input: ListSourceLocationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sourceLocations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sourceLocations"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -777,8 +797,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -789,7 +810,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -805,8 +825,11 @@ export const serializeAws_restJson1ListVodSourcesCommand = async ( input: ListVodSourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sourceLocation/{SourceLocationName}/vodSources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sourceLocation/{SourceLocationName}/vodSources"; if (input.SourceLocationName !== undefined) { const labelValue: string = input.SourceLocationName; if (labelValue.length <= 0) { @@ -821,7 +844,6 @@ export const serializeAws_restJson1ListVodSourcesCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -838,10 +860,12 @@ export const serializeAws_restJson1PutChannelPolicyCommand = async ( input: PutChannelPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channel/{ChannelName}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/policy"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -855,7 +879,6 @@ export const serializeAws_restJson1PutChannelPolicyCommand = async ( body = JSON.stringify({ ...(input.Policy !== undefined && input.Policy !== null && { Policy: input.Policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -871,10 +894,11 @@ export const serializeAws_restJson1PutPlaybackConfigurationCommand = async ( input: PutPlaybackConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/playbackConfiguration"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/playbackConfiguration"; let body: any; body = JSON.stringify({ ...(input.AdDecisionServerUrl !== undefined && @@ -921,7 +945,6 @@ export const serializeAws_restJson1PutPlaybackConfigurationCommand = async ( ...(input.VideoContentSourceUrl !== undefined && input.VideoContentSourceUrl !== null && { VideoContentSourceUrl: input.VideoContentSourceUrl }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -937,8 +960,10 @@ export const serializeAws_restJson1StartChannelCommand = async ( input: StartChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channel/{ChannelName}/start"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/start"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -949,7 +974,6 @@ export const serializeAws_restJson1StartChannelCommand = async ( throw new Error("No value provided for input HTTP label: ChannelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -965,8 +989,10 @@ export const serializeAws_restJson1StopChannelCommand = async ( input: StopChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/channel/{ChannelName}/stop"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}/stop"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -977,7 +1003,6 @@ export const serializeAws_restJson1StopChannelCommand = async ( throw new Error("No value provided for input HTTP label: ChannelName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -993,10 +1018,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1011,7 +1037,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1027,8 +1052,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1042,7 +1068,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1059,10 +1084,11 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( input: UpdateChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/channel/{ChannelName}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/channel/{ChannelName}"; if (input.ChannelName !== undefined) { const labelValue: string = input.ChannelName; if (labelValue.length <= 0) { @@ -1077,7 +1103,6 @@ export const serializeAws_restJson1UpdateChannelCommand = async ( ...(input.Outputs !== undefined && input.Outputs !== null && { Outputs: serializeAws_restJson1RequestOutputs(input.Outputs, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1093,10 +1118,12 @@ export const serializeAws_restJson1UpdateSourceLocationCommand = async ( input: UpdateSourceLocationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sourceLocation/{SourceLocationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sourceLocation/{SourceLocationName}"; if (input.SourceLocationName !== undefined) { const labelValue: string = input.SourceLocationName; if (labelValue.length <= 0) { @@ -1124,7 +1151,6 @@ export const serializeAws_restJson1UpdateSourceLocationCommand = async ( HttpConfiguration: serializeAws_restJson1HttpConfiguration(input.HttpConfiguration, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1140,10 +1166,13 @@ export const serializeAws_restJson1UpdateVodSourceCommand = async ( input: UpdateVodSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/sourceLocation/{SourceLocationName}/vodSource/{VodSourceName}"; if (input.SourceLocationName !== undefined) { const labelValue: string = input.SourceLocationName; if (labelValue.length <= 0) { @@ -1172,7 +1201,6 @@ export const serializeAws_restJson1UpdateVodSourceCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-mgn/protocols/Aws_restJson1.ts b/clients/client-mgn/protocols/Aws_restJson1.ts index f35732aaecee3..e2fb6842b72e1 100644 --- a/clients/client-mgn/protocols/Aws_restJson1.ts +++ b/clients/client-mgn/protocols/Aws_restJson1.ts @@ -129,10 +129,12 @@ export const serializeAws_restJson1ChangeServerLifeCycleStateCommand = async ( input: ChangeServerLifeCycleStateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ChangeServerLifeCycleState"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ChangeServerLifeCycleState"; let body: any; body = JSON.stringify({ ...(input.lifeCycle !== undefined && @@ -142,7 +144,6 @@ export const serializeAws_restJson1ChangeServerLifeCycleStateCommand = async ( ...(input.sourceServerID !== undefined && input.sourceServerID !== null && { sourceServerID: input.sourceServerID }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -158,10 +159,12 @@ export const serializeAws_restJson1CreateReplicationConfigurationTemplateCommand input: CreateReplicationConfigurationTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateReplicationConfigurationTemplate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateReplicationConfigurationTemplate"; let body: any; body = JSON.stringify({ ...(input.associateDefaultSecurityGroup !== undefined && @@ -203,7 +206,6 @@ export const serializeAws_restJson1CreateReplicationConfigurationTemplateCommand useDedicatedReplicationServer: input.useDedicatedReplicationServer, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -219,15 +221,15 @@ export const serializeAws_restJson1DeleteJobCommand = async ( input: DeleteJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteJob"; let body: any; body = JSON.stringify({ ...(input.jobID !== undefined && input.jobID !== null && { jobID: input.jobID }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -243,10 +245,12 @@ export const serializeAws_restJson1DeleteReplicationConfigurationTemplateCommand input: DeleteReplicationConfigurationTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteReplicationConfigurationTemplate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteReplicationConfigurationTemplate"; let body: any; body = JSON.stringify({ ...(input.replicationConfigurationTemplateID !== undefined && @@ -254,7 +258,6 @@ export const serializeAws_restJson1DeleteReplicationConfigurationTemplateCommand replicationConfigurationTemplateID: input.replicationConfigurationTemplateID, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -270,16 +273,16 @@ export const serializeAws_restJson1DeleteSourceServerCommand = async ( input: DeleteSourceServerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteSourceServer"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteSourceServer"; let body: any; body = JSON.stringify({ ...(input.sourceServerID !== undefined && input.sourceServerID !== null && { sourceServerID: input.sourceServerID }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -295,17 +298,17 @@ export const serializeAws_restJson1DescribeJobLogItemsCommand = async ( input: DescribeJobLogItemsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeJobLogItems"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeJobLogItems"; let body: any; body = JSON.stringify({ ...(input.jobID !== undefined && input.jobID !== null && { jobID: input.jobID }), ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -321,10 +324,11 @@ export const serializeAws_restJson1DescribeJobsCommand = async ( input: DescribeJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeJobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeJobs"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -332,7 +336,6 @@ export const serializeAws_restJson1DescribeJobsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -348,10 +351,13 @@ export const serializeAws_restJson1DescribeReplicationConfigurationTemplatesComm input: DescribeReplicationConfigurationTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeReplicationConfigurationTemplates"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/DescribeReplicationConfigurationTemplates"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), @@ -364,7 +370,6 @@ export const serializeAws_restJson1DescribeReplicationConfigurationTemplatesComm ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -380,10 +385,11 @@ export const serializeAws_restJson1DescribeSourceServersCommand = async ( input: DescribeSourceServersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeSourceServers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeSourceServers"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -393,7 +399,6 @@ export const serializeAws_restJson1DescribeSourceServersCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -409,16 +414,16 @@ export const serializeAws_restJson1DisconnectFromServiceCommand = async ( input: DisconnectFromServiceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DisconnectFromService"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DisconnectFromService"; let body: any; body = JSON.stringify({ ...(input.sourceServerID !== undefined && input.sourceServerID !== null && { sourceServerID: input.sourceServerID }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -434,16 +439,16 @@ export const serializeAws_restJson1FinalizeCutoverCommand = async ( input: FinalizeCutoverCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/FinalizeCutover"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FinalizeCutover"; let body: any; body = JSON.stringify({ ...(input.sourceServerID !== undefined && input.sourceServerID !== null && { sourceServerID: input.sourceServerID }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -459,16 +464,16 @@ export const serializeAws_restJson1GetLaunchConfigurationCommand = async ( input: GetLaunchConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetLaunchConfiguration"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetLaunchConfiguration"; let body: any; body = JSON.stringify({ ...(input.sourceServerID !== undefined && input.sourceServerID !== null && { sourceServerID: input.sourceServerID }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -484,16 +489,17 @@ export const serializeAws_restJson1GetReplicationConfigurationCommand = async ( input: GetReplicationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetReplicationConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetReplicationConfiguration"; let body: any; body = JSON.stringify({ ...(input.sourceServerID !== undefined && input.sourceServerID !== null && { sourceServerID: input.sourceServerID }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -509,13 +515,13 @@ export const serializeAws_restJson1InitializeServiceCommand = async ( input: InitializeServiceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/InitializeService"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/InitializeService"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -531,8 +537,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -543,7 +550,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -559,16 +565,16 @@ export const serializeAws_restJson1MarkAsArchivedCommand = async ( input: MarkAsArchivedCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/MarkAsArchived"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MarkAsArchived"; let body: any; body = JSON.stringify({ ...(input.sourceServerID !== undefined && input.sourceServerID !== null && { sourceServerID: input.sourceServerID }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -584,16 +590,16 @@ export const serializeAws_restJson1RetryDataReplicationCommand = async ( input: RetryDataReplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/RetryDataReplication"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/RetryDataReplication"; let body: any; body = JSON.stringify({ ...(input.sourceServerID !== undefined && input.sourceServerID !== null && { sourceServerID: input.sourceServerID }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -609,10 +615,11 @@ export const serializeAws_restJson1StartCutoverCommand = async ( input: StartCutoverCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/StartCutover"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StartCutover"; let body: any; body = JSON.stringify({ ...(input.sourceServerIDs !== undefined && @@ -622,7 +629,6 @@ export const serializeAws_restJson1StartCutoverCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -638,10 +644,11 @@ export const serializeAws_restJson1StartTestCommand = async ( input: StartTestCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/StartTest"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StartTest"; let body: any; body = JSON.stringify({ ...(input.sourceServerIDs !== undefined && @@ -651,7 +658,6 @@ export const serializeAws_restJson1StartTestCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -667,10 +673,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -685,7 +692,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -701,10 +707,12 @@ export const serializeAws_restJson1TerminateTargetInstancesCommand = async ( input: TerminateTargetInstancesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/TerminateTargetInstances"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TerminateTargetInstances"; let body: any; body = JSON.stringify({ ...(input.sourceServerIDs !== undefined && @@ -717,7 +725,6 @@ export const serializeAws_restJson1TerminateTargetInstancesCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -733,8 +740,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -748,7 +756,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -765,10 +772,12 @@ export const serializeAws_restJson1UpdateLaunchConfigurationCommand = async ( input: UpdateLaunchConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateLaunchConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateLaunchConfiguration"; let body: any; body = JSON.stringify({ ...(input.copyPrivateIp !== undefined && input.copyPrivateIp !== null && { copyPrivateIp: input.copyPrivateIp }), @@ -785,7 +794,6 @@ export const serializeAws_restJson1UpdateLaunchConfigurationCommand = async ( targetInstanceTypeRightSizingMethod: input.targetInstanceTypeRightSizingMethod, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -801,10 +809,12 @@ export const serializeAws_restJson1UpdateReplicationConfigurationCommand = async input: UpdateReplicationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateReplicationConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateReplicationConfiguration"; let body: any; body = JSON.stringify({ ...(input.associateDefaultSecurityGroup !== undefined && @@ -851,7 +861,6 @@ export const serializeAws_restJson1UpdateReplicationConfigurationCommand = async useDedicatedReplicationServer: input.useDedicatedReplicationServer, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -867,10 +876,12 @@ export const serializeAws_restJson1UpdateReplicationConfigurationTemplateCommand input: UpdateReplicationConfigurationTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateReplicationConfigurationTemplate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateReplicationConfigurationTemplate"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), @@ -915,7 +926,6 @@ export const serializeAws_restJson1UpdateReplicationConfigurationTemplateCommand useDedicatedReplicationServer: input.useDedicatedReplicationServer, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-mobile/protocols/Aws_restJson1.ts b/clients/client-mobile/protocols/Aws_restJson1.ts index 3d725153a3b61..d8c023eb6f04d 100644 --- a/clients/client-mobile/protocols/Aws_restJson1.ts +++ b/clients/client-mobile/protocols/Aws_restJson1.ts @@ -39,10 +39,11 @@ export const serializeAws_restJson1CreateProjectCommand = async ( input: CreateProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", }; - let resolvedPath = "/projects"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects"; const query: any = { ...(input.name !== undefined && { name: input.name }), ...(input.region !== undefined && { region: input.region }), @@ -52,7 +53,6 @@ export const serializeAws_restJson1CreateProjectCommand = async ( if (input.contents !== undefined) { body = input.contents; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -69,8 +69,9 @@ export const serializeAws_restJson1DeleteProjectCommand = async ( input: DeleteProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects/{projectId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects/{projectId}"; if (input.projectId !== undefined) { const labelValue: string = input.projectId; if (labelValue.length <= 0) { @@ -81,7 +82,6 @@ export const serializeAws_restJson1DeleteProjectCommand = async ( throw new Error("No value provided for input HTTP label: projectId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -97,8 +97,9 @@ export const serializeAws_restJson1DescribeBundleCommand = async ( input: DescribeBundleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bundles/{bundleId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bundles/{bundleId}"; if (input.bundleId !== undefined) { const labelValue: string = input.bundleId; if (labelValue.length <= 0) { @@ -109,7 +110,6 @@ export const serializeAws_restJson1DescribeBundleCommand = async ( throw new Error("No value provided for input HTTP label: bundleId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -125,14 +125,14 @@ export const serializeAws_restJson1DescribeProjectCommand = async ( input: DescribeProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/project"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/project"; const query: any = { ...(input.projectId !== undefined && { projectId: input.projectId }), ...(input.syncFromResources !== undefined && { syncFromResources: input.syncFromResources.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -149,8 +149,9 @@ export const serializeAws_restJson1ExportBundleCommand = async ( input: ExportBundleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bundles/{bundleId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bundles/{bundleId}"; if (input.bundleId !== undefined) { const labelValue: string = input.bundleId; if (labelValue.length <= 0) { @@ -165,7 +166,6 @@ export const serializeAws_restJson1ExportBundleCommand = async ( ...(input.platform !== undefined && { platform: input.platform }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -182,8 +182,9 @@ export const serializeAws_restJson1ExportProjectCommand = async ( input: ExportProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/exports/{projectId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/exports/{projectId}"; if (input.projectId !== undefined) { const labelValue: string = input.projectId; if (labelValue.length <= 0) { @@ -194,7 +195,6 @@ export const serializeAws_restJson1ExportProjectCommand = async ( throw new Error("No value provided for input HTTP label: projectId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -210,14 +210,14 @@ export const serializeAws_restJson1ListBundlesCommand = async ( input: ListBundlesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/bundles"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/bundles"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -234,14 +234,14 @@ export const serializeAws_restJson1ListProjectsCommand = async ( input: ListProjectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/projects"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/projects"; const query: any = { ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -258,10 +258,11 @@ export const serializeAws_restJson1UpdateProjectCommand = async ( input: UpdateProjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", }; - let resolvedPath = "/update"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/update"; const query: any = { ...(input.projectId !== undefined && { projectId: input.projectId }), }; @@ -269,7 +270,6 @@ export const serializeAws_restJson1UpdateProjectCommand = async ( if (input.contents !== undefined) { body = input.contents; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-mq/protocols/Aws_restJson1.ts b/clients/client-mq/protocols/Aws_restJson1.ts index 65264c2b1f51d..69fb916d57d77 100644 --- a/clients/client-mq/protocols/Aws_restJson1.ts +++ b/clients/client-mq/protocols/Aws_restJson1.ts @@ -91,10 +91,11 @@ export const serializeAws_restJson1CreateBrokerCommand = async ( input: CreateBrokerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/brokers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers"; let body: any; body = JSON.stringify({ ...(input.AuthenticationStrategy !== undefined && @@ -140,7 +141,6 @@ export const serializeAws_restJson1CreateBrokerCommand = async ( ...(input.Users !== undefined && input.Users !== null && { users: serializeAws_restJson1__listOfUser(input.Users, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -156,10 +156,11 @@ export const serializeAws_restJson1CreateConfigurationCommand = async ( input: CreateConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/configurations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations"; let body: any; body = JSON.stringify({ ...(input.AuthenticationStrategy !== undefined && @@ -170,7 +171,6 @@ export const serializeAws_restJson1CreateConfigurationCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -186,10 +186,11 @@ export const serializeAws_restJson1CreateTagsCommand = async ( input: CreateTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -204,7 +205,6 @@ export const serializeAws_restJson1CreateTagsCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1__mapOf__string(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -220,10 +220,12 @@ export const serializeAws_restJson1CreateUserCommand = async ( input: CreateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/brokers/{BrokerId}/users/{Username}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/users/{Username}"; if (input.BrokerId !== undefined) { const labelValue: string = input.BrokerId; if (labelValue.length <= 0) { @@ -249,7 +251,6 @@ export const serializeAws_restJson1CreateUserCommand = async ( input.Groups !== null && { groups: serializeAws_restJson1__listOf__string(input.Groups, context) }), ...(input.Password !== undefined && input.Password !== null && { password: input.Password }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -265,8 +266,9 @@ export const serializeAws_restJson1DeleteBrokerCommand = async ( input: DeleteBrokerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/brokers/{BrokerId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}"; if (input.BrokerId !== undefined) { const labelValue: string = input.BrokerId; if (labelValue.length <= 0) { @@ -277,7 +279,6 @@ export const serializeAws_restJson1DeleteBrokerCommand = async ( throw new Error("No value provided for input HTTP label: BrokerId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -293,8 +294,9 @@ export const serializeAws_restJson1DeleteTagsCommand = async ( input: DeleteTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -308,7 +310,6 @@ export const serializeAws_restJson1DeleteTagsCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -325,8 +326,10 @@ export const serializeAws_restJson1DeleteUserCommand = async ( input: DeleteUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/brokers/{BrokerId}/users/{Username}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/users/{Username}"; if (input.BrokerId !== undefined) { const labelValue: string = input.BrokerId; if (labelValue.length <= 0) { @@ -346,7 +349,6 @@ export const serializeAws_restJson1DeleteUserCommand = async ( throw new Error("No value provided for input HTTP label: Username."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -362,8 +364,9 @@ export const serializeAws_restJson1DescribeBrokerCommand = async ( input: DescribeBrokerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/brokers/{BrokerId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}"; if (input.BrokerId !== undefined) { const labelValue: string = input.BrokerId; if (labelValue.length <= 0) { @@ -374,7 +377,6 @@ export const serializeAws_restJson1DescribeBrokerCommand = async ( throw new Error("No value provided for input HTTP label: BrokerId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -390,15 +392,15 @@ export const serializeAws_restJson1DescribeBrokerEngineTypesCommand = async ( input: DescribeBrokerEngineTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/broker-engine-types"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/broker-engine-types"; const query: any = { ...(input.EngineType !== undefined && { engineType: input.EngineType }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -415,8 +417,10 @@ export const serializeAws_restJson1DescribeBrokerInstanceOptionsCommand = async input: DescribeBrokerInstanceOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/broker-instance-options"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/broker-instance-options"; const query: any = { ...(input.EngineType !== undefined && { engineType: input.EngineType }), ...(input.HostInstanceType !== undefined && { hostInstanceType: input.HostInstanceType }), @@ -425,7 +429,6 @@ export const serializeAws_restJson1DescribeBrokerInstanceOptionsCommand = async ...(input.StorageType !== undefined && { storageType: input.StorageType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -442,8 +445,10 @@ export const serializeAws_restJson1DescribeConfigurationCommand = async ( input: DescribeConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/configurations/{ConfigurationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{ConfigurationId}"; if (input.ConfigurationId !== undefined) { const labelValue: string = input.ConfigurationId; if (labelValue.length <= 0) { @@ -454,7 +459,6 @@ export const serializeAws_restJson1DescribeConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: ConfigurationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -470,8 +474,11 @@ export const serializeAws_restJson1DescribeConfigurationRevisionCommand = async input: DescribeConfigurationRevisionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/configurations/{ConfigurationId}/revisions/{ConfigurationRevision}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/configurations/{ConfigurationId}/revisions/{ConfigurationRevision}"; if (input.ConfigurationId !== undefined) { const labelValue: string = input.ConfigurationId; if (labelValue.length <= 0) { @@ -491,7 +498,6 @@ export const serializeAws_restJson1DescribeConfigurationRevisionCommand = async throw new Error("No value provided for input HTTP label: ConfigurationRevision."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -507,8 +513,10 @@ export const serializeAws_restJson1DescribeUserCommand = async ( input: DescribeUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/brokers/{BrokerId}/users/{Username}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/users/{Username}"; if (input.BrokerId !== undefined) { const labelValue: string = input.BrokerId; if (labelValue.length <= 0) { @@ -528,7 +536,6 @@ export const serializeAws_restJson1DescribeUserCommand = async ( throw new Error("No value provided for input HTTP label: Username."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -544,14 +551,14 @@ export const serializeAws_restJson1ListBrokersCommand = async ( input: ListBrokersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/brokers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -568,8 +575,11 @@ export const serializeAws_restJson1ListConfigurationRevisionsCommand = async ( input: ListConfigurationRevisionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/configurations/{ConfigurationId}/revisions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/configurations/{ConfigurationId}/revisions"; if (input.ConfigurationId !== undefined) { const labelValue: string = input.ConfigurationId; if (labelValue.length <= 0) { @@ -584,7 +594,6 @@ export const serializeAws_restJson1ListConfigurationRevisionsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -601,14 +610,14 @@ export const serializeAws_restJson1ListConfigurationsCommand = async ( input: ListConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/configurations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -625,8 +634,9 @@ export const serializeAws_restJson1ListTagsCommand = async ( input: ListTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -637,7 +647,6 @@ export const serializeAws_restJson1ListTagsCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -653,8 +662,10 @@ export const serializeAws_restJson1ListUsersCommand = async ( input: ListUsersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/brokers/{BrokerId}/users"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/users"; if (input.BrokerId !== undefined) { const labelValue: string = input.BrokerId; if (labelValue.length <= 0) { @@ -669,7 +680,6 @@ export const serializeAws_restJson1ListUsersCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -686,8 +696,10 @@ export const serializeAws_restJson1RebootBrokerCommand = async ( input: RebootBrokerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/brokers/{BrokerId}/reboot"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/reboot"; if (input.BrokerId !== undefined) { const labelValue: string = input.BrokerId; if (labelValue.length <= 0) { @@ -698,7 +710,6 @@ export const serializeAws_restJson1RebootBrokerCommand = async ( throw new Error("No value provided for input HTTP label: BrokerId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -714,10 +725,11 @@ export const serializeAws_restJson1UpdateBrokerCommand = async ( input: UpdateBrokerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/brokers/{BrokerId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}"; if (input.BrokerId !== undefined) { const labelValue: string = input.BrokerId; if (labelValue.length <= 0) { @@ -750,7 +762,6 @@ export const serializeAws_restJson1UpdateBrokerCommand = async ( securityGroups: serializeAws_restJson1__listOf__string(input.SecurityGroups, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -766,10 +777,12 @@ export const serializeAws_restJson1UpdateConfigurationCommand = async ( input: UpdateConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/configurations/{ConfigurationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/configurations/{ConfigurationId}"; if (input.ConfigurationId !== undefined) { const labelValue: string = input.ConfigurationId; if (labelValue.length <= 0) { @@ -784,7 +797,6 @@ export const serializeAws_restJson1UpdateConfigurationCommand = async ( ...(input.Data !== undefined && input.Data !== null && { data: input.Data }), ...(input.Description !== undefined && input.Description !== null && { description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -800,10 +812,12 @@ export const serializeAws_restJson1UpdateUserCommand = async ( input: UpdateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/brokers/{BrokerId}/users/{Username}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/brokers/{BrokerId}/users/{Username}"; if (input.BrokerId !== undefined) { const labelValue: string = input.BrokerId; if (labelValue.length <= 0) { @@ -829,7 +843,6 @@ export const serializeAws_restJson1UpdateUserCommand = async ( input.Groups !== null && { groups: serializeAws_restJson1__listOf__string(input.Groups, context) }), ...(input.Password !== undefined && input.Password !== null && { password: input.Password }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-mwaa/protocols/Aws_restJson1.ts b/clients/client-mwaa/protocols/Aws_restJson1.ts index 5ab6022c9194d..b020bac9ea03b 100644 --- a/clients/client-mwaa/protocols/Aws_restJson1.ts +++ b/clients/client-mwaa/protocols/Aws_restJson1.ts @@ -57,8 +57,9 @@ export const serializeAws_restJson1CreateCliTokenCommand = async ( input: CreateCliTokenCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/clitoken/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clitoken/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -76,7 +77,6 @@ export const serializeAws_restJson1CreateCliTokenCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -92,10 +92,11 @@ export const serializeAws_restJson1CreateEnvironmentCommand = async ( input: CreateEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/environments/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/environments/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -157,7 +158,6 @@ export const serializeAws_restJson1CreateEnvironmentCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -173,8 +173,9 @@ export const serializeAws_restJson1CreateWebLoginTokenCommand = async ( input: CreateWebLoginTokenCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/webtoken/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/webtoken/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -192,7 +193,6 @@ export const serializeAws_restJson1CreateWebLoginTokenCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -208,8 +208,9 @@ export const serializeAws_restJson1DeleteEnvironmentCommand = async ( input: DeleteEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/environments/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/environments/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -227,7 +228,6 @@ export const serializeAws_restJson1DeleteEnvironmentCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -243,8 +243,9 @@ export const serializeAws_restJson1GetEnvironmentCommand = async ( input: GetEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/environments/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/environments/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -262,7 +263,6 @@ export const serializeAws_restJson1GetEnvironmentCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -278,8 +278,9 @@ export const serializeAws_restJson1ListEnvironmentsCommand = async ( input: ListEnvironmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/environments"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/environments"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), @@ -292,7 +293,6 @@ export const serializeAws_restJson1ListEnvironmentsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -309,8 +309,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -328,7 +329,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -344,10 +344,12 @@ export const serializeAws_restJson1PublishMetricsCommand = async ( input: PublishMetricsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/metrics/environments/{EnvironmentName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/metrics/environments/{EnvironmentName}"; if (input.EnvironmentName !== undefined) { const labelValue: string = input.EnvironmentName; if (labelValue.length <= 0) { @@ -369,7 +371,6 @@ export const serializeAws_restJson1PublishMetricsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -385,10 +386,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -409,7 +411,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -425,8 +426,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -447,7 +449,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -464,10 +465,11 @@ export const serializeAws_restJson1UpdateEnvironmentCommand = async ( input: UpdateEnvironmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/environments/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/environments/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -530,7 +532,6 @@ export const serializeAws_restJson1UpdateEnvironmentCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, diff --git a/clients/client-networkmanager/protocols/Aws_restJson1.ts b/clients/client-networkmanager/protocols/Aws_restJson1.ts index abb0e988ebe48..e17e790b7c3b0 100644 --- a/clients/client-networkmanager/protocols/Aws_restJson1.ts +++ b/clients/client-networkmanager/protocols/Aws_restJson1.ts @@ -120,10 +120,13 @@ export const serializeAws_restJson1AssociateCustomerGatewayCommand = async ( input: AssociateCustomerGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/customer-gateway-associations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/customer-gateway-associations"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -140,7 +143,6 @@ export const serializeAws_restJson1AssociateCustomerGatewayCommand = async ( ...(input.DeviceId !== undefined && input.DeviceId !== null && { DeviceId: input.DeviceId }), ...(input.LinkId !== undefined && input.LinkId !== null && { LinkId: input.LinkId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -156,10 +158,13 @@ export const serializeAws_restJson1AssociateLinkCommand = async ( input: AssociateLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/link-associations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/link-associations"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -174,7 +179,6 @@ export const serializeAws_restJson1AssociateLinkCommand = async ( ...(input.DeviceId !== undefined && input.DeviceId !== null && { DeviceId: input.DeviceId }), ...(input.LinkId !== undefined && input.LinkId !== null && { LinkId: input.LinkId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -190,10 +194,13 @@ export const serializeAws_restJson1AssociateTransitGatewayConnectPeerCommand = a input: AssociateTransitGatewayConnectPeerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/transit-gateway-connect-peer-associations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/transit-gateway-connect-peer-associations"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -212,7 +219,6 @@ export const serializeAws_restJson1AssociateTransitGatewayConnectPeerCommand = a TransitGatewayConnectPeerArn: input.TransitGatewayConnectPeerArn, }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -228,10 +234,13 @@ export const serializeAws_restJson1CreateConnectionCommand = async ( input: CreateConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/connections"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/connections"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -253,7 +262,6 @@ export const serializeAws_restJson1CreateConnectionCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -269,10 +277,13 @@ export const serializeAws_restJson1CreateDeviceCommand = async ( input: CreateDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/devices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/devices"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -297,7 +308,6 @@ export const serializeAws_restJson1CreateDeviceCommand = async ( ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), ...(input.Vendor !== undefined && input.Vendor !== null && { Vendor: input.Vendor }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -313,17 +323,17 @@ export const serializeAws_restJson1CreateGlobalNetworkCommand = async ( input: CreateGlobalNetworkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-networks"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -339,10 +349,12 @@ export const serializeAws_restJson1CreateLinkCommand = async ( input: CreateLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/links"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-networks/{GlobalNetworkId}/links"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -363,7 +375,6 @@ export const serializeAws_restJson1CreateLinkCommand = async ( input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -379,10 +390,12 @@ export const serializeAws_restJson1CreateSiteCommand = async ( input: CreateSiteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/sites"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-networks/{GlobalNetworkId}/sites"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -400,7 +413,6 @@ export const serializeAws_restJson1CreateSiteCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -416,8 +428,11 @@ export const serializeAws_restJson1DeleteConnectionCommand = async ( input: DeleteConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/connections/{ConnectionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/connections/{ConnectionId}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -437,7 +452,6 @@ export const serializeAws_restJson1DeleteConnectionCommand = async ( throw new Error("No value provided for input HTTP label: ConnectionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -453,8 +467,11 @@ export const serializeAws_restJson1DeleteDeviceCommand = async ( input: DeleteDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/devices/{DeviceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/devices/{DeviceId}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -474,7 +491,6 @@ export const serializeAws_restJson1DeleteDeviceCommand = async ( throw new Error("No value provided for input HTTP label: DeviceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -490,8 +506,10 @@ export const serializeAws_restJson1DeleteGlobalNetworkCommand = async ( input: DeleteGlobalNetworkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-networks/{GlobalNetworkId}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -502,7 +520,6 @@ export const serializeAws_restJson1DeleteGlobalNetworkCommand = async ( throw new Error("No value provided for input HTTP label: GlobalNetworkId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -518,8 +535,11 @@ export const serializeAws_restJson1DeleteLinkCommand = async ( input: DeleteLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/links/{LinkId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/links/{LinkId}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -539,7 +559,6 @@ export const serializeAws_restJson1DeleteLinkCommand = async ( throw new Error("No value provided for input HTTP label: LinkId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -555,8 +574,11 @@ export const serializeAws_restJson1DeleteSiteCommand = async ( input: DeleteSiteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/sites/{SiteId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/sites/{SiteId}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -576,7 +598,6 @@ export const serializeAws_restJson1DeleteSiteCommand = async ( throw new Error("No value provided for input HTTP label: SiteId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -592,8 +613,11 @@ export const serializeAws_restJson1DeregisterTransitGatewayCommand = async ( input: DeregisterTransitGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/transit-gateway-registrations/{TransitGatewayArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/transit-gateway-registrations/{TransitGatewayArn}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -613,7 +637,6 @@ export const serializeAws_restJson1DeregisterTransitGatewayCommand = async ( throw new Error("No value provided for input HTTP label: TransitGatewayArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -629,8 +652,9 @@ export const serializeAws_restJson1DescribeGlobalNetworksCommand = async ( input: DescribeGlobalNetworksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-networks"; const query: any = { ...(input.GlobalNetworkIds !== undefined && { globalNetworkIds: (input.GlobalNetworkIds || []).map((_entry) => _entry), @@ -639,7 +663,6 @@ export const serializeAws_restJson1DescribeGlobalNetworksCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -656,8 +679,11 @@ export const serializeAws_restJson1DisassociateCustomerGatewayCommand = async ( input: DisassociateCustomerGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/customer-gateway-associations/{CustomerGatewayArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/customer-gateway-associations/{CustomerGatewayArn}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -677,7 +703,6 @@ export const serializeAws_restJson1DisassociateCustomerGatewayCommand = async ( throw new Error("No value provided for input HTTP label: CustomerGatewayArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -693,8 +718,11 @@ export const serializeAws_restJson1DisassociateLinkCommand = async ( input: DisassociateLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/link-associations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/link-associations"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -709,7 +737,6 @@ export const serializeAws_restJson1DisassociateLinkCommand = async ( ...(input.LinkId !== undefined && { linkId: input.LinkId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -726,8 +753,10 @@ export const serializeAws_restJson1DisassociateTransitGatewayConnectPeerCommand input: DisassociateTransitGatewayConnectPeerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-networks/{GlobalNetworkId}/transit-gateway-connect-peer-associations/{TransitGatewayConnectPeerArn}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; @@ -748,7 +777,6 @@ export const serializeAws_restJson1DisassociateTransitGatewayConnectPeerCommand throw new Error("No value provided for input HTTP label: TransitGatewayConnectPeerArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -764,8 +792,11 @@ export const serializeAws_restJson1GetConnectionsCommand = async ( input: GetConnectionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/connections"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/connections"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -782,7 +813,6 @@ export const serializeAws_restJson1GetConnectionsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -799,8 +829,11 @@ export const serializeAws_restJson1GetCustomerGatewayAssociationsCommand = async input: GetCustomerGatewayAssociationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/customer-gateway-associations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/customer-gateway-associations"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -818,7 +851,6 @@ export const serializeAws_restJson1GetCustomerGatewayAssociationsCommand = async ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -835,8 +867,11 @@ export const serializeAws_restJson1GetDevicesCommand = async ( input: GetDevicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/devices"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/devices"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -853,7 +888,6 @@ export const serializeAws_restJson1GetDevicesCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -870,8 +904,11 @@ export const serializeAws_restJson1GetLinkAssociationsCommand = async ( input: GetLinkAssociationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/link-associations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/link-associations"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -888,7 +925,6 @@ export const serializeAws_restJson1GetLinkAssociationsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -905,8 +941,10 @@ export const serializeAws_restJson1GetLinksCommand = async ( input: GetLinksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/links"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-networks/{GlobalNetworkId}/links"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -925,7 +963,6 @@ export const serializeAws_restJson1GetLinksCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -942,8 +979,10 @@ export const serializeAws_restJson1GetSitesCommand = async ( input: GetSitesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/sites"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-networks/{GlobalNetworkId}/sites"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -959,7 +998,6 @@ export const serializeAws_restJson1GetSitesCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -976,8 +1014,11 @@ export const serializeAws_restJson1GetTransitGatewayConnectPeerAssociationsComma input: GetTransitGatewayConnectPeerAssociationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/transit-gateway-connect-peer-associations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/transit-gateway-connect-peer-associations"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -995,7 +1036,6 @@ export const serializeAws_restJson1GetTransitGatewayConnectPeerAssociationsComma ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1012,8 +1052,11 @@ export const serializeAws_restJson1GetTransitGatewayRegistrationsCommand = async input: GetTransitGatewayRegistrationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/global-networks/{GlobalNetworkId}/transit-gateway-registrations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/transit-gateway-registrations"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -1031,7 +1074,6 @@ export const serializeAws_restJson1GetTransitGatewayRegistrationsCommand = async ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1048,8 +1090,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1060,7 +1103,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1076,10 +1118,13 @@ export const serializeAws_restJson1RegisterTransitGatewayCommand = async ( input: RegisterTransitGatewayCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/transit-gateway-registrations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/transit-gateway-registrations"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -1094,7 +1139,6 @@ export const serializeAws_restJson1RegisterTransitGatewayCommand = async ( ...(input.TransitGatewayArn !== undefined && input.TransitGatewayArn !== null && { TransitGatewayArn: input.TransitGatewayArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1110,10 +1154,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1128,7 +1173,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1144,8 +1188,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1159,7 +1204,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1176,10 +1220,13 @@ export const serializeAws_restJson1UpdateConnectionCommand = async ( input: UpdateConnectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/connections/{ConnectionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/connections/{ConnectionId}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -1205,7 +1252,6 @@ export const serializeAws_restJson1UpdateConnectionCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.LinkId !== undefined && input.LinkId !== null && { LinkId: input.LinkId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1221,10 +1267,13 @@ export const serializeAws_restJson1UpdateDeviceCommand = async ( input: UpdateDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/devices/{DeviceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/devices/{DeviceId}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -1256,7 +1305,6 @@ export const serializeAws_restJson1UpdateDeviceCommand = async ( ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), ...(input.Vendor !== undefined && input.Vendor !== null && { Vendor: input.Vendor }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1272,10 +1320,12 @@ export const serializeAws_restJson1UpdateGlobalNetworkCommand = async ( input: UpdateGlobalNetworkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/global-networks/{GlobalNetworkId}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -1289,7 +1339,6 @@ export const serializeAws_restJson1UpdateGlobalNetworkCommand = async ( body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1305,10 +1354,13 @@ export const serializeAws_restJson1UpdateLinkCommand = async ( input: UpdateLinkCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/links/{LinkId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/links/{LinkId}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -1335,7 +1387,6 @@ export const serializeAws_restJson1UpdateLinkCommand = async ( ...(input.Provider !== undefined && input.Provider !== null && { Provider: input.Provider }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1351,10 +1402,13 @@ export const serializeAws_restJson1UpdateSiteCommand = async ( input: UpdateSiteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/global-networks/{GlobalNetworkId}/sites/{SiteId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/global-networks/{GlobalNetworkId}/sites/{SiteId}"; if (input.GlobalNetworkId !== undefined) { const labelValue: string = input.GlobalNetworkId; if (labelValue.length <= 0) { @@ -1379,7 +1433,6 @@ export const serializeAws_restJson1UpdateSiteCommand = async ( ...(input.Location !== undefined && input.Location !== null && { Location: serializeAws_restJson1Location(input.Location, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-nimble/protocols/Aws_restJson1.ts b/clients/client-nimble/protocols/Aws_restJson1.ts index 9072a1786d8bf..79dbed0906ebb 100644 --- a/clients/client-nimble/protocols/Aws_restJson1.ts +++ b/clients/client-nimble/protocols/Aws_restJson1.ts @@ -181,11 +181,14 @@ export const serializeAws_restJson1AcceptEulasCommand = async ( input: AcceptEulasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/eula-acceptances"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/eula-acceptances"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -200,7 +203,6 @@ export const serializeAws_restJson1AcceptEulasCommand = async ( ...(input.eulaIds !== undefined && input.eulaIds !== null && { eulaIds: serializeAws_restJson1EulaIdList(input.eulaIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -216,11 +218,14 @@ export const serializeAws_restJson1CreateLaunchProfileCommand = async ( input: CreateLaunchProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -255,7 +260,6 @@ export const serializeAws_restJson1CreateLaunchProfileCommand = async ( }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -271,11 +275,14 @@ export const serializeAws_restJson1CreateStreamingImageCommand = async ( input: CreateStreamingImageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-images"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-images"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -292,7 +299,6 @@ export const serializeAws_restJson1CreateStreamingImageCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -308,11 +314,14 @@ export const serializeAws_restJson1CreateStreamingSessionCommand = async ( input: CreateStreamingSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-sessions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-sessions"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -332,7 +341,6 @@ export const serializeAws_restJson1CreateStreamingSessionCommand = async ( input.streamingImageId !== null && { streamingImageId: input.streamingImageId }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -348,11 +356,14 @@ export const serializeAws_restJson1CreateStreamingSessionStreamCommand = async ( input: CreateStreamingSessionStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-sessions/{sessionId}/streams"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-sessions/{sessionId}/streams"; if (input.sessionId !== undefined) { const labelValue: string = input.sessionId; if (labelValue.length <= 0) { @@ -376,7 +387,6 @@ export const serializeAws_restJson1CreateStreamingSessionStreamCommand = async ( ...(input.expirationInSeconds !== undefined && input.expirationInSeconds !== null && { expirationInSeconds: input.expirationInSeconds }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -392,11 +402,12 @@ export const serializeAws_restJson1CreateStudioCommand = async ( input: CreateStudioCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/studios"; let body: any; body = JSON.stringify({ ...(input.adminRoleArn !== undefined && input.adminRoleArn !== null && { adminRoleArn: input.adminRoleArn }), @@ -412,7 +423,6 @@ export const serializeAws_restJson1CreateStudioCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), ...(input.userRoleArn !== undefined && input.userRoleArn !== null && { userRoleArn: input.userRoleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -428,11 +438,14 @@ export const serializeAws_restJson1CreateStudioComponentCommand = async ( input: CreateStudioComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/studio-components"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/studio-components"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -475,7 +488,6 @@ export const serializeAws_restJson1CreateStudioComponentCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -491,10 +503,13 @@ export const serializeAws_restJson1DeleteLaunchProfileCommand = async ( input: DeleteLaunchProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}"; if (input.launchProfileId !== undefined) { const labelValue: string = input.launchProfileId; if (labelValue.length <= 0) { @@ -514,7 +529,6 @@ export const serializeAws_restJson1DeleteLaunchProfileCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -530,10 +544,13 @@ export const serializeAws_restJson1DeleteLaunchProfileMemberCommand = async ( input: DeleteLaunchProfileMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/membership/{principalId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/membership/{principalId}"; if (input.launchProfileId !== undefined) { const labelValue: string = input.launchProfileId; if (labelValue.length <= 0) { @@ -562,7 +579,6 @@ export const serializeAws_restJson1DeleteLaunchProfileMemberCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -578,10 +594,13 @@ export const serializeAws_restJson1DeleteStreamingImageCommand = async ( input: DeleteStreamingImageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-images/{streamingImageId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-images/{streamingImageId}"; if (input.streamingImageId !== undefined) { const labelValue: string = input.streamingImageId; if (labelValue.length <= 0) { @@ -601,7 +620,6 @@ export const serializeAws_restJson1DeleteStreamingImageCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -617,10 +635,13 @@ export const serializeAws_restJson1DeleteStreamingSessionCommand = async ( input: DeleteStreamingSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-sessions/{sessionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-sessions/{sessionId}"; if (input.sessionId !== undefined) { const labelValue: string = input.sessionId; if (labelValue.length <= 0) { @@ -640,7 +661,6 @@ export const serializeAws_restJson1DeleteStreamingSessionCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -656,10 +676,12 @@ export const serializeAws_restJson1DeleteStudioCommand = async ( input: DeleteStudioCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/studios/{studioId}"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -670,7 +692,6 @@ export const serializeAws_restJson1DeleteStudioCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -686,10 +707,13 @@ export const serializeAws_restJson1DeleteStudioComponentCommand = async ( input: DeleteStudioComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/studio-components/{studioComponentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/studio-components/{studioComponentId}"; if (input.studioComponentId !== undefined) { const labelValue: string = input.studioComponentId; if (labelValue.length <= 0) { @@ -709,7 +733,6 @@ export const serializeAws_restJson1DeleteStudioComponentCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -725,10 +748,13 @@ export const serializeAws_restJson1DeleteStudioMemberCommand = async ( input: DeleteStudioMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/membership/{principalId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/membership/{principalId}"; if (input.principalId !== undefined) { const labelValue: string = input.principalId; if (labelValue.length <= 0) { @@ -748,7 +774,6 @@ export const serializeAws_restJson1DeleteStudioMemberCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -764,8 +789,10 @@ export const serializeAws_restJson1GetEulaCommand = async ( input: GetEulaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/eulas/{eulaId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/eulas/{eulaId}"; if (input.eulaId !== undefined) { const labelValue: string = input.eulaId; if (labelValue.length <= 0) { @@ -776,7 +803,6 @@ export const serializeAws_restJson1GetEulaCommand = async ( throw new Error("No value provided for input HTTP label: eulaId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -792,8 +818,11 @@ export const serializeAws_restJson1GetLaunchProfileCommand = async ( input: GetLaunchProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}"; if (input.launchProfileId !== undefined) { const labelValue: string = input.launchProfileId; if (labelValue.length <= 0) { @@ -813,7 +842,6 @@ export const serializeAws_restJson1GetLaunchProfileCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -829,8 +857,11 @@ export const serializeAws_restJson1GetLaunchProfileDetailsCommand = async ( input: GetLaunchProfileDetailsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/details"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/details"; if (input.launchProfileId !== undefined) { const labelValue: string = input.launchProfileId; if (labelValue.length <= 0) { @@ -850,7 +881,6 @@ export const serializeAws_restJson1GetLaunchProfileDetailsCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -866,8 +896,11 @@ export const serializeAws_restJson1GetLaunchProfileInitializationCommand = async input: GetLaunchProfileInitializationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/init"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/init"; if (input.launchProfileId !== undefined) { const labelValue: string = input.launchProfileId; if (labelValue.length <= 0) { @@ -894,7 +927,6 @@ export const serializeAws_restJson1GetLaunchProfileInitializationCommand = async ...(input.platform !== undefined && { platform: input.platform }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -911,8 +943,11 @@ export const serializeAws_restJson1GetLaunchProfileMemberCommand = async ( input: GetLaunchProfileMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/membership/{principalId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/membership/{principalId}"; if (input.launchProfileId !== undefined) { const labelValue: string = input.launchProfileId; if (labelValue.length <= 0) { @@ -941,7 +976,6 @@ export const serializeAws_restJson1GetLaunchProfileMemberCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -957,8 +991,11 @@ export const serializeAws_restJson1GetStreamingImageCommand = async ( input: GetStreamingImageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-images/{streamingImageId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-images/{streamingImageId}"; if (input.streamingImageId !== undefined) { const labelValue: string = input.streamingImageId; if (labelValue.length <= 0) { @@ -978,7 +1015,6 @@ export const serializeAws_restJson1GetStreamingImageCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -994,8 +1030,11 @@ export const serializeAws_restJson1GetStreamingSessionCommand = async ( input: GetStreamingSessionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-sessions/{sessionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-sessions/{sessionId}"; if (input.sessionId !== undefined) { const labelValue: string = input.sessionId; if (labelValue.length <= 0) { @@ -1015,7 +1054,6 @@ export const serializeAws_restJson1GetStreamingSessionCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1031,8 +1069,11 @@ export const serializeAws_restJson1GetStreamingSessionStreamCommand = async ( input: GetStreamingSessionStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-sessions/{sessionId}/streams/{streamId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-sessions/{sessionId}/streams/{streamId}"; if (input.sessionId !== undefined) { const labelValue: string = input.sessionId; if (labelValue.length <= 0) { @@ -1061,7 +1102,6 @@ export const serializeAws_restJson1GetStreamingSessionStreamCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1077,8 +1117,10 @@ export const serializeAws_restJson1GetStudioCommand = async ( input: GetStudioCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/studios/{studioId}"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -1089,7 +1131,6 @@ export const serializeAws_restJson1GetStudioCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1105,8 +1146,11 @@ export const serializeAws_restJson1GetStudioComponentCommand = async ( input: GetStudioComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/studio-components/{studioComponentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/studio-components/{studioComponentId}"; if (input.studioComponentId !== undefined) { const labelValue: string = input.studioComponentId; if (labelValue.length <= 0) { @@ -1126,7 +1170,6 @@ export const serializeAws_restJson1GetStudioComponentCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1142,8 +1185,11 @@ export const serializeAws_restJson1GetStudioMemberCommand = async ( input: GetStudioMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/membership/{principalId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/membership/{principalId}"; if (input.principalId !== undefined) { const labelValue: string = input.principalId; if (labelValue.length <= 0) { @@ -1163,7 +1209,6 @@ export const serializeAws_restJson1GetStudioMemberCommand = async ( throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1179,8 +1224,11 @@ export const serializeAws_restJson1ListEulaAcceptancesCommand = async ( input: ListEulaAcceptancesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/eula-acceptances"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/eula-acceptances"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -1195,7 +1243,6 @@ export const serializeAws_restJson1ListEulaAcceptancesCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1212,14 +1259,14 @@ export const serializeAws_restJson1ListEulasCommand = async ( input: ListEulasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/eulas"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/eulas"; const query: any = { ...(input.eulaIds !== undefined && { eulaIds: (input.eulaIds || []).map((_entry) => _entry) }), ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1236,8 +1283,11 @@ export const serializeAws_restJson1ListLaunchProfileMembersCommand = async ( input: ListLaunchProfileMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/membership"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/membership"; if (input.launchProfileId !== undefined) { const labelValue: string = input.launchProfileId; if (labelValue.length <= 0) { @@ -1261,7 +1311,6 @@ export const serializeAws_restJson1ListLaunchProfileMembersCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1278,8 +1327,11 @@ export const serializeAws_restJson1ListLaunchProfilesCommand = async ( input: ListLaunchProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -1296,7 +1348,6 @@ export const serializeAws_restJson1ListLaunchProfilesCommand = async ( ...(input.states !== undefined && { states: (input.states || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1313,8 +1364,11 @@ export const serializeAws_restJson1ListStreamingImagesCommand = async ( input: ListStreamingImagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-images"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-images"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -1329,7 +1383,6 @@ export const serializeAws_restJson1ListStreamingImagesCommand = async ( ...(input.owner !== undefined && { owner: input.owner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1346,8 +1399,11 @@ export const serializeAws_restJson1ListStreamingSessionsCommand = async ( input: ListStreamingSessionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-sessions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-sessions"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -1363,7 +1419,6 @@ export const serializeAws_restJson1ListStreamingSessionsCommand = async ( ...(input.sessionIds !== undefined && { sessionIds: input.sessionIds }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1380,8 +1435,11 @@ export const serializeAws_restJson1ListStudioComponentsCommand = async ( input: ListStudioComponentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/studio-components"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/studio-components"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -1398,7 +1456,6 @@ export const serializeAws_restJson1ListStudioComponentsCommand = async ( ...(input.types !== undefined && { types: (input.types || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1415,8 +1472,10 @@ export const serializeAws_restJson1ListStudioMembersCommand = async ( input: ListStudioMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios/{studioId}/membership"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/studios/{studioId}/membership"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -1431,7 +1490,6 @@ export const serializeAws_restJson1ListStudioMembersCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1448,13 +1506,13 @@ export const serializeAws_restJson1ListStudiosCommand = async ( input: ListStudiosCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/studios"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/studios"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1471,8 +1529,10 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/tags/{resourceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1483,7 +1543,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1499,11 +1558,14 @@ export const serializeAws_restJson1PutLaunchProfileMembersCommand = async ( input: PutLaunchProfileMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/membership"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/membership"; if (input.launchProfileId !== undefined) { const labelValue: string = input.launchProfileId; if (labelValue.length <= 0) { @@ -1529,7 +1591,6 @@ export const serializeAws_restJson1PutLaunchProfileMembersCommand = async ( ...(input.members !== undefined && input.members !== null && { members: serializeAws_restJson1NewLaunchProfileMemberList(input.members, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1545,11 +1606,13 @@ export const serializeAws_restJson1PutStudioMembersCommand = async ( input: PutStudioMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/membership"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/studios/{studioId}/membership"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -1566,7 +1629,6 @@ export const serializeAws_restJson1PutStudioMembersCommand = async ( ...(input.members !== undefined && input.members !== null && { members: serializeAws_restJson1NewStudioMemberList(input.members, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1582,10 +1644,13 @@ export const serializeAws_restJson1StartStudioSSOConfigurationRepairCommand = as input: StartStudioSSOConfigurationRepairCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/sso-configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/sso-configuration"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -1596,7 +1661,6 @@ export const serializeAws_restJson1StartStudioSSOConfigurationRepairCommand = as throw new Error("No value provided for input HTTP label: studioId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1612,10 +1676,12 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/2020-08-01/tags/{resourceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1629,7 +1695,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1645,8 +1710,10 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2020-08-01/tags/{resourceArn}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1660,7 +1727,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1677,11 +1743,14 @@ export const serializeAws_restJson1UpdateLaunchProfileCommand = async ( input: UpdateLaunchProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}"; if (input.launchProfileId !== undefined) { const labelValue: string = input.launchProfileId; if (labelValue.length <= 0) { @@ -1720,7 +1789,6 @@ export const serializeAws_restJson1UpdateLaunchProfileCommand = async ( studioComponentIds: serializeAws_restJson1LaunchProfileStudioComponentIdList(input.studioComponentIds, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1736,11 +1804,14 @@ export const serializeAws_restJson1UpdateLaunchProfileMemberCommand = async ( input: UpdateLaunchProfileMemberCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/membership/{principalId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/launch-profiles/{launchProfileId}/membership/{principalId}"; if (input.launchProfileId !== undefined) { const labelValue: string = input.launchProfileId; if (labelValue.length <= 0) { @@ -1772,7 +1843,6 @@ export const serializeAws_restJson1UpdateLaunchProfileMemberCommand = async ( body = JSON.stringify({ ...(input.persona !== undefined && input.persona !== null && { persona: input.persona }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1788,11 +1858,14 @@ export const serializeAws_restJson1UpdateStreamingImageCommand = async ( input: UpdateStreamingImageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/streaming-images/{streamingImageId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/streaming-images/{streamingImageId}"; if (input.streamingImageId !== undefined) { const labelValue: string = input.streamingImageId; if (labelValue.length <= 0) { @@ -1816,7 +1889,6 @@ export const serializeAws_restJson1UpdateStreamingImageCommand = async ( ...(input.description !== undefined && input.description !== null && { description: input.description }), ...(input.name !== undefined && input.name !== null && { name: input.name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1832,11 +1904,13 @@ export const serializeAws_restJson1UpdateStudioCommand = async ( input: UpdateStudioCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2020-08-01/studios/{studioId}"; if (input.studioId !== undefined) { const labelValue: string = input.studioId; if (labelValue.length <= 0) { @@ -1852,7 +1926,6 @@ export const serializeAws_restJson1UpdateStudioCommand = async ( ...(input.displayName !== undefined && input.displayName !== null && { displayName: input.displayName }), ...(input.userRoleArn !== undefined && input.userRoleArn !== null && { userRoleArn: input.userRoleArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1868,11 +1941,14 @@ export const serializeAws_restJson1UpdateStudioComponentCommand = async ( input: UpdateStudioComponentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.clientToken) && { "x-amz-client-token": input.clientToken! }), }; - let resolvedPath = "/2020-08-01/studios/{studioId}/studio-components/{studioComponentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2020-08-01/studios/{studioId}/studio-components/{studioComponentId}"; if (input.studioComponentId !== undefined) { const labelValue: string = input.studioComponentId; if (labelValue.length <= 0) { @@ -1923,7 +1999,6 @@ export const serializeAws_restJson1UpdateStudioComponentCommand = async ( ...(input.subtype !== undefined && input.subtype !== null && { subtype: input.subtype }), ...(input.type !== undefined && input.type !== null && { type: input.type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-outposts/protocols/Aws_restJson1.ts b/clients/client-outposts/protocols/Aws_restJson1.ts index d00f4a0b3206c..f337ef1b69ed9 100644 --- a/clients/client-outposts/protocols/Aws_restJson1.ts +++ b/clients/client-outposts/protocols/Aws_restJson1.ts @@ -42,10 +42,11 @@ export const serializeAws_restJson1CreateOutpostCommand = async ( input: CreateOutpostCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/outposts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/outposts"; let body: any; body = JSON.stringify({ ...(input.AvailabilityZone !== undefined && @@ -57,7 +58,6 @@ export const serializeAws_restJson1CreateOutpostCommand = async ( ...(input.SiteId !== undefined && input.SiteId !== null && { SiteId: input.SiteId }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -73,8 +73,9 @@ export const serializeAws_restJson1DeleteOutpostCommand = async ( input: DeleteOutpostCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/outposts/{OutpostId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/outposts/{OutpostId}"; if (input.OutpostId !== undefined) { const labelValue: string = input.OutpostId; if (labelValue.length <= 0) { @@ -85,7 +86,6 @@ export const serializeAws_restJson1DeleteOutpostCommand = async ( throw new Error("No value provided for input HTTP label: OutpostId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -101,8 +101,9 @@ export const serializeAws_restJson1DeleteSiteCommand = async ( input: DeleteSiteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sites/{SiteId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sites/{SiteId}"; if (input.SiteId !== undefined) { const labelValue: string = input.SiteId; if (labelValue.length <= 0) { @@ -113,7 +114,6 @@ export const serializeAws_restJson1DeleteSiteCommand = async ( throw new Error("No value provided for input HTTP label: SiteId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -129,8 +129,9 @@ export const serializeAws_restJson1GetOutpostCommand = async ( input: GetOutpostCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/outposts/{OutpostId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/outposts/{OutpostId}"; if (input.OutpostId !== undefined) { const labelValue: string = input.OutpostId; if (labelValue.length <= 0) { @@ -141,7 +142,6 @@ export const serializeAws_restJson1GetOutpostCommand = async ( throw new Error("No value provided for input HTTP label: OutpostId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -157,8 +157,10 @@ export const serializeAws_restJson1GetOutpostInstanceTypesCommand = async ( input: GetOutpostInstanceTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/outposts/{OutpostId}/instanceTypes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/outposts/{OutpostId}/instanceTypes"; if (input.OutpostId !== undefined) { const labelValue: string = input.OutpostId; if (labelValue.length <= 0) { @@ -173,7 +175,6 @@ export const serializeAws_restJson1GetOutpostInstanceTypesCommand = async ( ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -190,14 +191,14 @@ export const serializeAws_restJson1ListOutpostsCommand = async ( input: ListOutpostsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/outposts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/outposts"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -214,14 +215,14 @@ export const serializeAws_restJson1ListSitesCommand = async ( input: ListSitesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sites"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sites"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -238,8 +239,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -250,7 +252,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -266,10 +267,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -283,7 +285,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -299,8 +300,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -314,7 +316,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-personalize-events/protocols/Aws_restJson1.ts b/clients/client-personalize-events/protocols/Aws_restJson1.ts index 831538f18ef0f..7c25fa80e034a 100644 --- a/clients/client-personalize-events/protocols/Aws_restJson1.ts +++ b/clients/client-personalize-events/protocols/Aws_restJson1.ts @@ -27,10 +27,11 @@ export const serializeAws_restJson1PutEventsCommand = async ( input: PutEventsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/events"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/events"; let body: any; body = JSON.stringify({ ...(input.eventList !== undefined && @@ -39,7 +40,6 @@ export const serializeAws_restJson1PutEventsCommand = async ( ...(input.trackingId !== undefined && input.trackingId !== null && { trackingId: input.trackingId }), ...(input.userId !== undefined && input.userId !== null && { userId: input.userId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -55,17 +55,17 @@ export const serializeAws_restJson1PutItemsCommand = async ( input: PutItemsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/items"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/items"; let body: any; body = JSON.stringify({ ...(input.datasetArn !== undefined && input.datasetArn !== null && { datasetArn: input.datasetArn }), ...(input.items !== undefined && input.items !== null && { items: serializeAws_restJson1ItemList(input.items, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -81,17 +81,17 @@ export const serializeAws_restJson1PutUsersCommand = async ( input: PutUsersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/users"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/users"; let body: any; body = JSON.stringify({ ...(input.datasetArn !== undefined && input.datasetArn !== null && { datasetArn: input.datasetArn }), ...(input.users !== undefined && input.users !== null && { users: serializeAws_restJson1UserList(input.users, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-personalize-runtime/protocols/Aws_restJson1.ts b/clients/client-personalize-runtime/protocols/Aws_restJson1.ts index 11d6d991fa613..37dc2c126c8ab 100644 --- a/clients/client-personalize-runtime/protocols/Aws_restJson1.ts +++ b/clients/client-personalize-runtime/protocols/Aws_restJson1.ts @@ -21,10 +21,11 @@ export const serializeAws_restJson1GetPersonalizedRankingCommand = async ( input: GetPersonalizedRankingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/personalize-ranking"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/personalize-ranking"; let body: any; body = JSON.stringify({ ...(input.campaignArn !== undefined && input.campaignArn !== null && { campaignArn: input.campaignArn }), @@ -37,7 +38,6 @@ export const serializeAws_restJson1GetPersonalizedRankingCommand = async ( input.inputList !== null && { inputList: serializeAws_restJson1InputList(input.inputList, context) }), ...(input.userId !== undefined && input.userId !== null && { userId: input.userId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -53,10 +53,11 @@ export const serializeAws_restJson1GetRecommendationsCommand = async ( input: GetRecommendationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/recommendations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/recommendations"; let body: any; body = JSON.stringify({ ...(input.campaignArn !== undefined && input.campaignArn !== null && { campaignArn: input.campaignArn }), @@ -69,7 +70,6 @@ export const serializeAws_restJson1GetRecommendationsCommand = async ( ...(input.numResults !== undefined && input.numResults !== null && { numResults: input.numResults }), ...(input.userId !== undefined && input.userId !== null && { userId: input.userId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-pinpoint-email/protocols/Aws_restJson1.ts b/clients/client-pinpoint-email/protocols/Aws_restJson1.ts index f1121206547b7..3490b44a8446a 100644 --- a/clients/client-pinpoint-email/protocols/Aws_restJson1.ts +++ b/clients/client-pinpoint-email/protocols/Aws_restJson1.ts @@ -214,10 +214,12 @@ export const serializeAws_restJson1CreateConfigurationSetCommand = async ( input: CreateConfigurationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/configuration-sets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/configuration-sets"; let body: any; body = JSON.stringify({ ...(input.ConfigurationSetName !== undefined && @@ -241,7 +243,6 @@ export const serializeAws_restJson1CreateConfigurationSetCommand = async ( TrackingOptions: serializeAws_restJson1TrackingOptions(input.TrackingOptions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -257,10 +258,13 @@ export const serializeAws_restJson1CreateConfigurationSetEventDestinationCommand input: CreateConfigurationSetEventDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -279,7 +283,6 @@ export const serializeAws_restJson1CreateConfigurationSetEventDestinationCommand ...(input.EventDestinationName !== undefined && input.EventDestinationName !== null && { EventDestinationName: input.EventDestinationName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -295,17 +298,18 @@ export const serializeAws_restJson1CreateDedicatedIpPoolCommand = async ( input: CreateDedicatedIpPoolCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/dedicated-ip-pools"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ip-pools"; let body: any; body = JSON.stringify({ ...(input.PoolName !== undefined && input.PoolName !== null && { PoolName: input.PoolName }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -321,10 +325,12 @@ export const serializeAws_restJson1CreateDeliverabilityTestReportCommand = async input: CreateDeliverabilityTestReportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/deliverability-dashboard/test"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/deliverability-dashboard/test"; let body: any; body = JSON.stringify({ ...(input.Content !== undefined && @@ -335,7 +341,6 @@ export const serializeAws_restJson1CreateDeliverabilityTestReportCommand = async ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -351,17 +356,17 @@ export const serializeAws_restJson1CreateEmailIdentityCommand = async ( input: CreateEmailIdentityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/identities"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/identities"; let body: any; body = JSON.stringify({ ...(input.EmailIdentity !== undefined && input.EmailIdentity !== null && { EmailIdentity: input.EmailIdentity }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -377,8 +382,11 @@ export const serializeAws_restJson1DeleteConfigurationSetCommand = async ( input: DeleteConfigurationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/configuration-sets/{ConfigurationSetName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/configuration-sets/{ConfigurationSetName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -389,7 +397,6 @@ export const serializeAws_restJson1DeleteConfigurationSetCommand = async ( throw new Error("No value provided for input HTTP label: ConfigurationSetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -405,8 +412,11 @@ export const serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand input: DeleteConfigurationSetEventDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -426,7 +436,6 @@ export const serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand throw new Error("No value provided for input HTTP label: EventDestinationName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -442,8 +451,10 @@ export const serializeAws_restJson1DeleteDedicatedIpPoolCommand = async ( input: DeleteDedicatedIpPoolCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/dedicated-ip-pools/{PoolName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ip-pools/{PoolName}"; if (input.PoolName !== undefined) { const labelValue: string = input.PoolName; if (labelValue.length <= 0) { @@ -454,7 +465,6 @@ export const serializeAws_restJson1DeleteDedicatedIpPoolCommand = async ( throw new Error("No value provided for input HTTP label: PoolName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -470,8 +480,10 @@ export const serializeAws_restJson1DeleteEmailIdentityCommand = async ( input: DeleteEmailIdentityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/identities/{EmailIdentity}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/identities/{EmailIdentity}"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -482,7 +494,6 @@ export const serializeAws_restJson1DeleteEmailIdentityCommand = async ( throw new Error("No value provided for input HTTP label: EmailIdentity."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -498,13 +509,13 @@ export const serializeAws_restJson1GetAccountCommand = async ( input: GetAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/account"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/account"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -520,15 +531,17 @@ export const serializeAws_restJson1GetBlacklistReportsCommand = async ( input: GetBlacklistReportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/deliverability-dashboard/blacklist-report"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/deliverability-dashboard/blacklist-report"; const query: any = { ...(input.BlacklistItemNames !== undefined && { BlacklistItemNames: (input.BlacklistItemNames || []).map((_entry) => _entry), }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -545,8 +558,11 @@ export const serializeAws_restJson1GetConfigurationSetCommand = async ( input: GetConfigurationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/configuration-sets/{ConfigurationSetName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/configuration-sets/{ConfigurationSetName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -557,7 +573,6 @@ export const serializeAws_restJson1GetConfigurationSetCommand = async ( throw new Error("No value provided for input HTTP label: ConfigurationSetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -573,8 +588,11 @@ export const serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = input: GetConfigurationSetEventDestinationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -585,7 +603,6 @@ export const serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = throw new Error("No value provided for input HTTP label: ConfigurationSetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -601,8 +618,10 @@ export const serializeAws_restJson1GetDedicatedIpCommand = async ( input: GetDedicatedIpCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/dedicated-ips/{Ip}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ips/{Ip}"; if (input.Ip !== undefined) { const labelValue: string = input.Ip; if (labelValue.length <= 0) { @@ -613,7 +632,6 @@ export const serializeAws_restJson1GetDedicatedIpCommand = async ( throw new Error("No value provided for input HTTP label: Ip."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -629,15 +647,15 @@ export const serializeAws_restJson1GetDedicatedIpsCommand = async ( input: GetDedicatedIpsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/dedicated-ips"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ips"; const query: any = { ...(input.PoolName !== undefined && { PoolName: input.PoolName }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -654,13 +672,14 @@ export const serializeAws_restJson1GetDeliverabilityDashboardOptionsCommand = as input: GetDeliverabilityDashboardOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/deliverability-dashboard"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/deliverability-dashboard"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -676,8 +695,11 @@ export const serializeAws_restJson1GetDeliverabilityTestReportCommand = async ( input: GetDeliverabilityTestReportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/deliverability-dashboard/test-reports/{ReportId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/deliverability-dashboard/test-reports/{ReportId}"; if (input.ReportId !== undefined) { const labelValue: string = input.ReportId; if (labelValue.length <= 0) { @@ -688,7 +710,6 @@ export const serializeAws_restJson1GetDeliverabilityTestReportCommand = async ( throw new Error("No value provided for input HTTP label: ReportId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -704,8 +725,11 @@ export const serializeAws_restJson1GetDomainDeliverabilityCampaignCommand = asyn input: GetDomainDeliverabilityCampaignCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/deliverability-dashboard/campaigns/{CampaignId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/deliverability-dashboard/campaigns/{CampaignId}"; if (input.CampaignId !== undefined) { const labelValue: string = input.CampaignId; if (labelValue.length <= 0) { @@ -716,7 +740,6 @@ export const serializeAws_restJson1GetDomainDeliverabilityCampaignCommand = asyn throw new Error("No value provided for input HTTP label: CampaignId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -732,8 +755,11 @@ export const serializeAws_restJson1GetDomainStatisticsReportCommand = async ( input: GetDomainStatisticsReportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/deliverability-dashboard/statistics-report/{Domain}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/deliverability-dashboard/statistics-report/{Domain}"; if (input.Domain !== undefined) { const labelValue: string = input.Domain; if (labelValue.length <= 0) { @@ -748,7 +774,6 @@ export const serializeAws_restJson1GetDomainStatisticsReportCommand = async ( ...(input.EndDate !== undefined && { EndDate: (input.EndDate.toISOString().split(".")[0] + "Z").toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -765,8 +790,10 @@ export const serializeAws_restJson1GetEmailIdentityCommand = async ( input: GetEmailIdentityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/identities/{EmailIdentity}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/identities/{EmailIdentity}"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -777,7 +804,6 @@ export const serializeAws_restJson1GetEmailIdentityCommand = async ( throw new Error("No value provided for input HTTP label: EmailIdentity."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -793,14 +819,15 @@ export const serializeAws_restJson1ListConfigurationSetsCommand = async ( input: ListConfigurationSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/configuration-sets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/configuration-sets"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -817,14 +844,15 @@ export const serializeAws_restJson1ListDedicatedIpPoolsCommand = async ( input: ListDedicatedIpPoolsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/dedicated-ip-pools"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ip-pools"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -841,14 +869,16 @@ export const serializeAws_restJson1ListDeliverabilityTestReportsCommand = async input: ListDeliverabilityTestReportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/deliverability-dashboard/test-reports"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/deliverability-dashboard/test-reports"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -865,8 +895,11 @@ export const serializeAws_restJson1ListDomainDeliverabilityCampaignsCommand = as input: ListDomainDeliverabilityCampaignsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/deliverability-dashboard/domains/{SubscribedDomain}/campaigns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/deliverability-dashboard/domains/{SubscribedDomain}/campaigns"; if (input.SubscribedDomain !== undefined) { const labelValue: string = input.SubscribedDomain; if (labelValue.length <= 0) { @@ -883,7 +916,6 @@ export const serializeAws_restJson1ListDomainDeliverabilityCampaignsCommand = as ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -900,14 +932,14 @@ export const serializeAws_restJson1ListEmailIdentitiesCommand = async ( input: ListEmailIdentitiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/identities"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/identities"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -924,13 +956,13 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/tags"; const query: any = { ...(input.ResourceArn !== undefined && { ResourceArn: input.ResourceArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -947,16 +979,17 @@ export const serializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommand input: PutAccountDedicatedIpWarmupAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/account/dedicated-ips/warmup"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/account/dedicated-ips/warmup"; let body: any; body = JSON.stringify({ ...(input.AutoWarmupEnabled !== undefined && input.AutoWarmupEnabled !== null && { AutoWarmupEnabled: input.AutoWarmupEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -972,16 +1005,17 @@ export const serializeAws_restJson1PutAccountSendingAttributesCommand = async ( input: PutAccountSendingAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/account/sending"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/account/sending"; let body: any; body = JSON.stringify({ ...(input.SendingEnabled !== undefined && input.SendingEnabled !== null && { SendingEnabled: input.SendingEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -997,10 +1031,13 @@ export const serializeAws_restJson1PutConfigurationSetDeliveryOptionsCommand = a input: PutConfigurationSetDeliveryOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/configuration-sets/{ConfigurationSetName}/delivery-options"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/configuration-sets/{ConfigurationSetName}/delivery-options"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -1016,7 +1053,6 @@ export const serializeAws_restJson1PutConfigurationSetDeliveryOptionsCommand = a input.SendingPoolName !== null && { SendingPoolName: input.SendingPoolName }), ...(input.TlsPolicy !== undefined && input.TlsPolicy !== null && { TlsPolicy: input.TlsPolicy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1032,10 +1068,13 @@ export const serializeAws_restJson1PutConfigurationSetReputationOptionsCommand = input: PutConfigurationSetReputationOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/configuration-sets/{ConfigurationSetName}/reputation-options"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/configuration-sets/{ConfigurationSetName}/reputation-options"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -1050,7 +1089,6 @@ export const serializeAws_restJson1PutConfigurationSetReputationOptionsCommand = ...(input.ReputationMetricsEnabled !== undefined && input.ReputationMetricsEnabled !== null && { ReputationMetricsEnabled: input.ReputationMetricsEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1066,10 +1104,13 @@ export const serializeAws_restJson1PutConfigurationSetSendingOptionsCommand = as input: PutConfigurationSetSendingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/configuration-sets/{ConfigurationSetName}/sending"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/configuration-sets/{ConfigurationSetName}/sending"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -1084,7 +1125,6 @@ export const serializeAws_restJson1PutConfigurationSetSendingOptionsCommand = as ...(input.SendingEnabled !== undefined && input.SendingEnabled !== null && { SendingEnabled: input.SendingEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1100,10 +1140,13 @@ export const serializeAws_restJson1PutConfigurationSetTrackingOptionsCommand = a input: PutConfigurationSetTrackingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/configuration-sets/{ConfigurationSetName}/tracking-options"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/configuration-sets/{ConfigurationSetName}/tracking-options"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -1118,7 +1161,6 @@ export const serializeAws_restJson1PutConfigurationSetTrackingOptionsCommand = a ...(input.CustomRedirectDomain !== undefined && input.CustomRedirectDomain !== null && { CustomRedirectDomain: input.CustomRedirectDomain }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1134,10 +1176,12 @@ export const serializeAws_restJson1PutDedicatedIpInPoolCommand = async ( input: PutDedicatedIpInPoolCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/dedicated-ips/{Ip}/pool"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ips/{Ip}/pool"; if (input.Ip !== undefined) { const labelValue: string = input.Ip; if (labelValue.length <= 0) { @@ -1152,7 +1196,6 @@ export const serializeAws_restJson1PutDedicatedIpInPoolCommand = async ( ...(input.DestinationPoolName !== undefined && input.DestinationPoolName !== null && { DestinationPoolName: input.DestinationPoolName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1168,10 +1211,12 @@ export const serializeAws_restJson1PutDedicatedIpWarmupAttributesCommand = async input: PutDedicatedIpWarmupAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/dedicated-ips/{Ip}/warmup"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/dedicated-ips/{Ip}/warmup"; if (input.Ip !== undefined) { const labelValue: string = input.Ip; if (labelValue.length <= 0) { @@ -1186,7 +1231,6 @@ export const serializeAws_restJson1PutDedicatedIpWarmupAttributesCommand = async ...(input.WarmupPercentage !== undefined && input.WarmupPercentage !== null && { WarmupPercentage: input.WarmupPercentage }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1202,10 +1246,12 @@ export const serializeAws_restJson1PutDeliverabilityDashboardOptionCommand = asy input: PutDeliverabilityDashboardOptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/deliverability-dashboard"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/deliverability-dashboard"; let body: any; body = JSON.stringify({ ...(input.DashboardEnabled !== undefined && @@ -1215,7 +1261,6 @@ export const serializeAws_restJson1PutDeliverabilityDashboardOptionCommand = asy SubscribedDomains: serializeAws_restJson1DomainDeliverabilityTrackingOptions(input.SubscribedDomains, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1231,10 +1276,12 @@ export const serializeAws_restJson1PutEmailIdentityDkimAttributesCommand = async input: PutEmailIdentityDkimAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/identities/{EmailIdentity}/dkim"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/identities/{EmailIdentity}/dkim"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -1249,7 +1296,6 @@ export const serializeAws_restJson1PutEmailIdentityDkimAttributesCommand = async ...(input.SigningEnabled !== undefined && input.SigningEnabled !== null && { SigningEnabled: input.SigningEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1265,10 +1311,13 @@ export const serializeAws_restJson1PutEmailIdentityFeedbackAttributesCommand = a input: PutEmailIdentityFeedbackAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/identities/{EmailIdentity}/feedback"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/identities/{EmailIdentity}/feedback"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -1283,7 +1332,6 @@ export const serializeAws_restJson1PutEmailIdentityFeedbackAttributesCommand = a ...(input.EmailForwardingEnabled !== undefined && input.EmailForwardingEnabled !== null && { EmailForwardingEnabled: input.EmailForwardingEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1299,10 +1347,13 @@ export const serializeAws_restJson1PutEmailIdentityMailFromAttributesCommand = a input: PutEmailIdentityMailFromAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/identities/{EmailIdentity}/mail-from"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/identities/{EmailIdentity}/mail-from"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -1319,7 +1370,6 @@ export const serializeAws_restJson1PutEmailIdentityMailFromAttributesCommand = a ...(input.MailFromDomain !== undefined && input.MailFromDomain !== null && { MailFromDomain: input.MailFromDomain }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1335,10 +1385,12 @@ export const serializeAws_restJson1SendEmailCommand = async ( input: SendEmailCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/outbound-emails"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/outbound-emails"; let body: any; body = JSON.stringify({ ...(input.ConfigurationSetName !== undefined && @@ -1360,7 +1412,6 @@ export const serializeAws_restJson1SendEmailCommand = async ( ReplyToAddresses: serializeAws_restJson1EmailAddressList(input.ReplyToAddresses, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1376,17 +1427,17 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/tags"; let body: any; body = JSON.stringify({ ...(input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1402,14 +1453,14 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/email/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/email/tags"; const query: any = { ...(input.ResourceArn !== undefined && { ResourceArn: input.ResourceArn }), ...(input.TagKeys !== undefined && { TagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1426,10 +1477,13 @@ export const serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand input: UpdateConfigurationSetEventDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -1455,7 +1509,6 @@ export const serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand EventDestination: serializeAws_restJson1EventDestinationDefinition(input.EventDestination, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-pinpoint-sms-voice/protocols/Aws_restJson1.ts b/clients/client-pinpoint-sms-voice/protocols/Aws_restJson1.ts index 1a9e9ccb1cdde..4bd9fc66b27b7 100644 --- a/clients/client-pinpoint-sms-voice/protocols/Aws_restJson1.ts +++ b/clients/client-pinpoint-sms-voice/protocols/Aws_restJson1.ts @@ -63,16 +63,17 @@ export const serializeAws_restJson1CreateConfigurationSetCommand = async ( input: CreateConfigurationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/sms-voice/configuration-sets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/sms-voice/configuration-sets"; let body: any; body = JSON.stringify({ ...(input.ConfigurationSetName !== undefined && input.ConfigurationSetName !== null && { ConfigurationSetName: input.ConfigurationSetName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -88,10 +89,13 @@ export const serializeAws_restJson1CreateConfigurationSetEventDestinationCommand input: CreateConfigurationSetEventDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -110,7 +114,6 @@ export const serializeAws_restJson1CreateConfigurationSetEventDestinationCommand ...(input.EventDestinationName !== undefined && input.EventDestinationName !== null && { EventDestinationName: input.EventDestinationName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -126,8 +129,11 @@ export const serializeAws_restJson1DeleteConfigurationSetCommand = async ( input: DeleteConfigurationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/sms-voice/configuration-sets/{ConfigurationSetName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/sms-voice/configuration-sets/{ConfigurationSetName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -138,7 +144,6 @@ export const serializeAws_restJson1DeleteConfigurationSetCommand = async ( throw new Error("No value provided for input HTTP label: ConfigurationSetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -154,8 +159,10 @@ export const serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand input: DeleteConfigurationSetEventDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; @@ -176,7 +183,6 @@ export const serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand throw new Error("No value provided for input HTTP label: EventDestinationName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -192,8 +198,11 @@ export const serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = input: GetConfigurationSetEventDestinationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -204,7 +213,6 @@ export const serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = throw new Error("No value provided for input HTTP label: ConfigurationSetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -220,14 +228,15 @@ export const serializeAws_restJson1ListConfigurationSetsCommand = async ( input: ListConfigurationSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/sms-voice/configuration-sets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/sms-voice/configuration-sets"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -244,10 +253,12 @@ export const serializeAws_restJson1SendVoiceMessageCommand = async ( input: SendVoiceMessageCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/sms-voice/voice/message"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/sms-voice/voice/message"; let body: any; body = JSON.stringify({ ...(input.CallerId !== undefined && input.CallerId !== null && { CallerId: input.CallerId }), @@ -260,7 +271,6 @@ export const serializeAws_restJson1SendVoiceMessageCommand = async ( ...(input.OriginationPhoneNumber !== undefined && input.OriginationPhoneNumber !== null && { OriginationPhoneNumber: input.OriginationPhoneNumber }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -276,10 +286,12 @@ export const serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand input: UpdateConfigurationSetEventDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/sms-voice/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; @@ -306,7 +318,6 @@ export const serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand EventDestination: serializeAws_restJson1EventDestinationDefinition(input.EventDestination, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-pinpoint/protocols/Aws_restJson1.ts b/clients/client-pinpoint/protocols/Aws_restJson1.ts index 1161798211a2c..bee0d38095f95 100644 --- a/clients/client-pinpoint/protocols/Aws_restJson1.ts +++ b/clients/client-pinpoint/protocols/Aws_restJson1.ts @@ -431,10 +431,11 @@ export const serializeAws_restJson1CreateAppCommand = async ( input: CreateAppCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps"; let body: any; if (input.CreateApplicationRequest !== undefined) { body = serializeAws_restJson1CreateApplicationRequest(input.CreateApplicationRequest, context); @@ -443,7 +444,6 @@ export const serializeAws_restJson1CreateAppCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -459,10 +459,12 @@ export const serializeAws_restJson1CreateCampaignCommand = async ( input: CreateCampaignCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/campaigns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/campaigns"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -480,7 +482,6 @@ export const serializeAws_restJson1CreateCampaignCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -496,10 +497,12 @@ export const serializeAws_restJson1CreateEmailTemplateCommand = async ( input: CreateEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/templates/{TemplateName}/email"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/email"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -517,7 +520,6 @@ export const serializeAws_restJson1CreateEmailTemplateCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -533,10 +535,12 @@ export const serializeAws_restJson1CreateExportJobCommand = async ( input: CreateExportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/jobs/export"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/jobs/export"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -554,7 +558,6 @@ export const serializeAws_restJson1CreateExportJobCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -570,10 +573,12 @@ export const serializeAws_restJson1CreateImportJobCommand = async ( input: CreateImportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/jobs/import"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/jobs/import"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -591,7 +596,6 @@ export const serializeAws_restJson1CreateImportJobCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -607,10 +611,12 @@ export const serializeAws_restJson1CreateJourneyCommand = async ( input: CreateJourneyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/journeys"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/journeys"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -628,7 +634,6 @@ export const serializeAws_restJson1CreateJourneyCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -644,10 +649,12 @@ export const serializeAws_restJson1CreatePushTemplateCommand = async ( input: CreatePushTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/templates/{TemplateName}/push"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/push"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -665,7 +672,6 @@ export const serializeAws_restJson1CreatePushTemplateCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -681,10 +687,11 @@ export const serializeAws_restJson1CreateRecommenderConfigurationCommand = async input: CreateRecommenderConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/recommenders"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/recommenders"; let body: any; if (input.CreateRecommenderConfiguration !== undefined) { body = serializeAws_restJson1CreateRecommenderConfigurationShape(input.CreateRecommenderConfiguration, context); @@ -693,7 +700,6 @@ export const serializeAws_restJson1CreateRecommenderConfigurationCommand = async body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -709,10 +715,12 @@ export const serializeAws_restJson1CreateSegmentCommand = async ( input: CreateSegmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/segments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/segments"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -730,7 +738,6 @@ export const serializeAws_restJson1CreateSegmentCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -746,10 +753,12 @@ export const serializeAws_restJson1CreateSmsTemplateCommand = async ( input: CreateSmsTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/templates/{TemplateName}/sms"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/sms"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -767,7 +776,6 @@ export const serializeAws_restJson1CreateSmsTemplateCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -783,10 +791,12 @@ export const serializeAws_restJson1CreateVoiceTemplateCommand = async ( input: CreateVoiceTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/templates/{TemplateName}/voice"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/voice"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -804,7 +814,6 @@ export const serializeAws_restJson1CreateVoiceTemplateCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -820,8 +829,10 @@ export const serializeAws_restJson1DeleteAdmChannelCommand = async ( input: DeleteAdmChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/adm"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/adm"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -832,7 +843,6 @@ export const serializeAws_restJson1DeleteAdmChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -848,8 +858,10 @@ export const serializeAws_restJson1DeleteApnsChannelCommand = async ( input: DeleteApnsChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/apns"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -860,7 +872,6 @@ export const serializeAws_restJson1DeleteApnsChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -876,8 +887,11 @@ export const serializeAws_restJson1DeleteApnsSandboxChannelCommand = async ( input: DeleteApnsSandboxChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns_sandbox"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/channels/apns_sandbox"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -888,7 +902,6 @@ export const serializeAws_restJson1DeleteApnsSandboxChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -904,8 +917,11 @@ export const serializeAws_restJson1DeleteApnsVoipChannelCommand = async ( input: DeleteApnsVoipChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns_voip"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/channels/apns_voip"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -916,7 +932,6 @@ export const serializeAws_restJson1DeleteApnsVoipChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -932,8 +947,11 @@ export const serializeAws_restJson1DeleteApnsVoipSandboxChannelCommand = async ( input: DeleteApnsVoipSandboxChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns_voip_sandbox"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/channels/apns_voip_sandbox"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -944,7 +962,6 @@ export const serializeAws_restJson1DeleteApnsVoipSandboxChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -960,8 +977,9 @@ export const serializeAws_restJson1DeleteAppCommand = async ( input: DeleteAppCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -972,7 +990,6 @@ export const serializeAws_restJson1DeleteAppCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -988,8 +1005,10 @@ export const serializeAws_restJson1DeleteBaiduChannelCommand = async ( input: DeleteBaiduChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/baidu"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/baidu"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1000,7 +1019,6 @@ export const serializeAws_restJson1DeleteBaiduChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1016,8 +1034,11 @@ export const serializeAws_restJson1DeleteCampaignCommand = async ( input: DeleteCampaignCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/campaigns/{CampaignId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1037,7 +1058,6 @@ export const serializeAws_restJson1DeleteCampaignCommand = async ( throw new Error("No value provided for input HTTP label: CampaignId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1053,8 +1073,10 @@ export const serializeAws_restJson1DeleteEmailChannelCommand = async ( input: DeleteEmailChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/email"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/email"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1065,7 +1087,6 @@ export const serializeAws_restJson1DeleteEmailChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1081,8 +1102,10 @@ export const serializeAws_restJson1DeleteEmailTemplateCommand = async ( input: DeleteEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/templates/{TemplateName}/email"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/email"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -1096,7 +1119,6 @@ export const serializeAws_restJson1DeleteEmailTemplateCommand = async ( ...(input.Version !== undefined && { version: input.Version }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1113,8 +1135,11 @@ export const serializeAws_restJson1DeleteEndpointCommand = async ( input: DeleteEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/endpoints/{EndpointId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/endpoints/{EndpointId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1134,7 +1159,6 @@ export const serializeAws_restJson1DeleteEndpointCommand = async ( throw new Error("No value provided for input HTTP label: EndpointId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1150,8 +1174,10 @@ export const serializeAws_restJson1DeleteEventStreamCommand = async ( input: DeleteEventStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/eventstream"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/eventstream"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1162,7 +1188,6 @@ export const serializeAws_restJson1DeleteEventStreamCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1178,8 +1203,10 @@ export const serializeAws_restJson1DeleteGcmChannelCommand = async ( input: DeleteGcmChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/gcm"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/gcm"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1190,7 +1217,6 @@ export const serializeAws_restJson1DeleteGcmChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1206,8 +1232,11 @@ export const serializeAws_restJson1DeleteJourneyCommand = async ( input: DeleteJourneyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/journeys/{JourneyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/journeys/{JourneyId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1227,7 +1256,6 @@ export const serializeAws_restJson1DeleteJourneyCommand = async ( throw new Error("No value provided for input HTTP label: JourneyId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1243,8 +1271,10 @@ export const serializeAws_restJson1DeletePushTemplateCommand = async ( input: DeletePushTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/templates/{TemplateName}/push"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/push"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -1258,7 +1288,6 @@ export const serializeAws_restJson1DeletePushTemplateCommand = async ( ...(input.Version !== undefined && { version: input.Version }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1275,8 +1304,10 @@ export const serializeAws_restJson1DeleteRecommenderConfigurationCommand = async input: DeleteRecommenderConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/recommenders/{RecommenderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/recommenders/{RecommenderId}"; if (input.RecommenderId !== undefined) { const labelValue: string = input.RecommenderId; if (labelValue.length <= 0) { @@ -1287,7 +1318,6 @@ export const serializeAws_restJson1DeleteRecommenderConfigurationCommand = async throw new Error("No value provided for input HTTP label: RecommenderId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1303,8 +1333,11 @@ export const serializeAws_restJson1DeleteSegmentCommand = async ( input: DeleteSegmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/segments/{SegmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/segments/{SegmentId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1324,7 +1357,6 @@ export const serializeAws_restJson1DeleteSegmentCommand = async ( throw new Error("No value provided for input HTTP label: SegmentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1340,8 +1372,10 @@ export const serializeAws_restJson1DeleteSmsChannelCommand = async ( input: DeleteSmsChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/sms"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/sms"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1352,7 +1386,6 @@ export const serializeAws_restJson1DeleteSmsChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1368,8 +1401,10 @@ export const serializeAws_restJson1DeleteSmsTemplateCommand = async ( input: DeleteSmsTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/templates/{TemplateName}/sms"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/sms"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -1383,7 +1418,6 @@ export const serializeAws_restJson1DeleteSmsTemplateCommand = async ( ...(input.Version !== undefined && { version: input.Version }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1400,8 +1434,10 @@ export const serializeAws_restJson1DeleteUserEndpointsCommand = async ( input: DeleteUserEndpointsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/users/{UserId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/users/{UserId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1421,7 +1457,6 @@ export const serializeAws_restJson1DeleteUserEndpointsCommand = async ( throw new Error("No value provided for input HTTP label: UserId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1437,8 +1472,10 @@ export const serializeAws_restJson1DeleteVoiceChannelCommand = async ( input: DeleteVoiceChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/voice"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/voice"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1449,7 +1486,6 @@ export const serializeAws_restJson1DeleteVoiceChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1465,8 +1501,10 @@ export const serializeAws_restJson1DeleteVoiceTemplateCommand = async ( input: DeleteVoiceTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/templates/{TemplateName}/voice"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/voice"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -1480,7 +1518,6 @@ export const serializeAws_restJson1DeleteVoiceTemplateCommand = async ( ...(input.Version !== undefined && { version: input.Version }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1497,8 +1534,10 @@ export const serializeAws_restJson1GetAdmChannelCommand = async ( input: GetAdmChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/adm"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/adm"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1509,7 +1548,6 @@ export const serializeAws_restJson1GetAdmChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1525,8 +1563,10 @@ export const serializeAws_restJson1GetApnsChannelCommand = async ( input: GetApnsChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/apns"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1537,7 +1577,6 @@ export const serializeAws_restJson1GetApnsChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1553,8 +1592,11 @@ export const serializeAws_restJson1GetApnsSandboxChannelCommand = async ( input: GetApnsSandboxChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns_sandbox"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/channels/apns_sandbox"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1565,7 +1607,6 @@ export const serializeAws_restJson1GetApnsSandboxChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1581,8 +1622,11 @@ export const serializeAws_restJson1GetApnsVoipChannelCommand = async ( input: GetApnsVoipChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns_voip"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/channels/apns_voip"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1593,7 +1637,6 @@ export const serializeAws_restJson1GetApnsVoipChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1609,8 +1652,11 @@ export const serializeAws_restJson1GetApnsVoipSandboxChannelCommand = async ( input: GetApnsVoipSandboxChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns_voip_sandbox"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/channels/apns_voip_sandbox"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1621,7 +1667,6 @@ export const serializeAws_restJson1GetApnsVoipSandboxChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1637,8 +1682,9 @@ export const serializeAws_restJson1GetAppCommand = async ( input: GetAppCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1649,7 +1695,6 @@ export const serializeAws_restJson1GetAppCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1665,8 +1710,11 @@ export const serializeAws_restJson1GetApplicationDateRangeKpiCommand = async ( input: GetApplicationDateRangeKpiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/kpis/daterange/{KpiName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/kpis/daterange/{KpiName}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1694,7 +1742,6 @@ export const serializeAws_restJson1GetApplicationDateRangeKpiCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1711,8 +1758,10 @@ export const serializeAws_restJson1GetApplicationSettingsCommand = async ( input: GetApplicationSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/settings"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1723,7 +1772,6 @@ export const serializeAws_restJson1GetApplicationSettingsCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1739,14 +1787,14 @@ export const serializeAws_restJson1GetAppsCommand = async ( input: GetAppsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps"; const query: any = { ...(input.PageSize !== undefined && { "page-size": input.PageSize }), ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1763,8 +1811,10 @@ export const serializeAws_restJson1GetBaiduChannelCommand = async ( input: GetBaiduChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/baidu"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/baidu"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1775,7 +1825,6 @@ export const serializeAws_restJson1GetBaiduChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1791,8 +1840,11 @@ export const serializeAws_restJson1GetCampaignCommand = async ( input: GetCampaignCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/campaigns/{CampaignId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1812,7 +1864,6 @@ export const serializeAws_restJson1GetCampaignCommand = async ( throw new Error("No value provided for input HTTP label: CampaignId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1828,8 +1879,11 @@ export const serializeAws_restJson1GetCampaignActivitiesCommand = async ( input: GetCampaignActivitiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/activities"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/activities"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1853,7 +1907,6 @@ export const serializeAws_restJson1GetCampaignActivitiesCommand = async ( ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1870,8 +1923,11 @@ export const serializeAws_restJson1GetCampaignDateRangeKpiCommand = async ( input: GetCampaignDateRangeKpiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/kpis/daterange/{KpiName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/kpis/daterange/{KpiName}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1908,7 +1964,6 @@ export const serializeAws_restJson1GetCampaignDateRangeKpiCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1925,8 +1980,10 @@ export const serializeAws_restJson1GetCampaignsCommand = async ( input: GetCampaignsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/campaigns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/campaigns"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1941,7 +1998,6 @@ export const serializeAws_restJson1GetCampaignsCommand = async ( ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1958,8 +2014,11 @@ export const serializeAws_restJson1GetCampaignVersionCommand = async ( input: GetCampaignVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/versions/{Version}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/versions/{Version}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -1988,7 +2047,6 @@ export const serializeAws_restJson1GetCampaignVersionCommand = async ( throw new Error("No value provided for input HTTP label: Version."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2004,8 +2062,11 @@ export const serializeAws_restJson1GetCampaignVersionsCommand = async ( input: GetCampaignVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}/versions"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2029,7 +2090,6 @@ export const serializeAws_restJson1GetCampaignVersionsCommand = async ( ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2046,8 +2106,10 @@ export const serializeAws_restJson1GetChannelsCommand = async ( input: GetChannelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2058,7 +2120,6 @@ export const serializeAws_restJson1GetChannelsCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2074,8 +2135,10 @@ export const serializeAws_restJson1GetEmailChannelCommand = async ( input: GetEmailChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/email"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/email"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2086,7 +2149,6 @@ export const serializeAws_restJson1GetEmailChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2102,8 +2164,10 @@ export const serializeAws_restJson1GetEmailTemplateCommand = async ( input: GetEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/templates/{TemplateName}/email"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/email"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -2117,7 +2181,6 @@ export const serializeAws_restJson1GetEmailTemplateCommand = async ( ...(input.Version !== undefined && { version: input.Version }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2134,8 +2197,11 @@ export const serializeAws_restJson1GetEndpointCommand = async ( input: GetEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/endpoints/{EndpointId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/endpoints/{EndpointId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2155,7 +2221,6 @@ export const serializeAws_restJson1GetEndpointCommand = async ( throw new Error("No value provided for input HTTP label: EndpointId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2171,8 +2236,10 @@ export const serializeAws_restJson1GetEventStreamCommand = async ( input: GetEventStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/eventstream"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/eventstream"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2183,7 +2250,6 @@ export const serializeAws_restJson1GetEventStreamCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2199,8 +2265,11 @@ export const serializeAws_restJson1GetExportJobCommand = async ( input: GetExportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/jobs/export/{JobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/jobs/export/{JobId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2220,7 +2289,6 @@ export const serializeAws_restJson1GetExportJobCommand = async ( throw new Error("No value provided for input HTTP label: JobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2236,8 +2304,10 @@ export const serializeAws_restJson1GetExportJobsCommand = async ( input: GetExportJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/jobs/export"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/jobs/export"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2252,7 +2322,6 @@ export const serializeAws_restJson1GetExportJobsCommand = async ( ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2269,8 +2338,10 @@ export const serializeAws_restJson1GetGcmChannelCommand = async ( input: GetGcmChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/gcm"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/gcm"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2281,7 +2352,6 @@ export const serializeAws_restJson1GetGcmChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2297,8 +2367,11 @@ export const serializeAws_restJson1GetImportJobCommand = async ( input: GetImportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/jobs/import/{JobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/jobs/import/{JobId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2318,7 +2391,6 @@ export const serializeAws_restJson1GetImportJobCommand = async ( throw new Error("No value provided for input HTTP label: JobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2334,8 +2406,10 @@ export const serializeAws_restJson1GetImportJobsCommand = async ( input: GetImportJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/jobs/import"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/jobs/import"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2350,7 +2424,6 @@ export const serializeAws_restJson1GetImportJobsCommand = async ( ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2367,8 +2440,11 @@ export const serializeAws_restJson1GetJourneyCommand = async ( input: GetJourneyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/journeys/{JourneyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/journeys/{JourneyId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2388,7 +2464,6 @@ export const serializeAws_restJson1GetJourneyCommand = async ( throw new Error("No value provided for input HTTP label: JourneyId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2404,8 +2479,11 @@ export const serializeAws_restJson1GetJourneyDateRangeKpiCommand = async ( input: GetJourneyDateRangeKpiCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/journeys/{JourneyId}/kpis/daterange/{KpiName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/journeys/{JourneyId}/kpis/daterange/{KpiName}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2442,7 +2520,6 @@ export const serializeAws_restJson1GetJourneyDateRangeKpiCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2459,8 +2536,11 @@ export const serializeAws_restJson1GetJourneyExecutionActivityMetricsCommand = a input: GetJourneyExecutionActivityMetricsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/journeys/{JourneyId}/activities/{JourneyActivityId}/execution-metrics"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/journeys/{JourneyId}/activities/{JourneyActivityId}/execution-metrics"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2493,7 +2573,6 @@ export const serializeAws_restJson1GetJourneyExecutionActivityMetricsCommand = a ...(input.PageSize !== undefined && { "page-size": input.PageSize }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2510,8 +2589,11 @@ export const serializeAws_restJson1GetJourneyExecutionMetricsCommand = async ( input: GetJourneyExecutionMetricsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/journeys/{JourneyId}/execution-metrics"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/journeys/{JourneyId}/execution-metrics"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2535,7 +2617,6 @@ export const serializeAws_restJson1GetJourneyExecutionMetricsCommand = async ( ...(input.PageSize !== undefined && { "page-size": input.PageSize }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2552,8 +2633,10 @@ export const serializeAws_restJson1GetPushTemplateCommand = async ( input: GetPushTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/templates/{TemplateName}/push"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/push"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -2567,7 +2650,6 @@ export const serializeAws_restJson1GetPushTemplateCommand = async ( ...(input.Version !== undefined && { version: input.Version }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2584,8 +2666,10 @@ export const serializeAws_restJson1GetRecommenderConfigurationCommand = async ( input: GetRecommenderConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/recommenders/{RecommenderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/recommenders/{RecommenderId}"; if (input.RecommenderId !== undefined) { const labelValue: string = input.RecommenderId; if (labelValue.length <= 0) { @@ -2596,7 +2680,6 @@ export const serializeAws_restJson1GetRecommenderConfigurationCommand = async ( throw new Error("No value provided for input HTTP label: RecommenderId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2612,14 +2695,14 @@ export const serializeAws_restJson1GetRecommenderConfigurationsCommand = async ( input: GetRecommenderConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/recommenders"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/recommenders"; const query: any = { ...(input.PageSize !== undefined && { "page-size": input.PageSize }), ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2636,8 +2719,11 @@ export const serializeAws_restJson1GetSegmentCommand = async ( input: GetSegmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/segments/{SegmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/segments/{SegmentId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2657,7 +2743,6 @@ export const serializeAws_restJson1GetSegmentCommand = async ( throw new Error("No value provided for input HTTP label: SegmentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2673,8 +2758,11 @@ export const serializeAws_restJson1GetSegmentExportJobsCommand = async ( input: GetSegmentExportJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/segments/{SegmentId}/jobs/export"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/segments/{SegmentId}/jobs/export"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2698,7 +2786,6 @@ export const serializeAws_restJson1GetSegmentExportJobsCommand = async ( ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2715,8 +2802,11 @@ export const serializeAws_restJson1GetSegmentImportJobsCommand = async ( input: GetSegmentImportJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/segments/{SegmentId}/jobs/import"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/segments/{SegmentId}/jobs/import"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2740,7 +2830,6 @@ export const serializeAws_restJson1GetSegmentImportJobsCommand = async ( ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2757,8 +2846,10 @@ export const serializeAws_restJson1GetSegmentsCommand = async ( input: GetSegmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/segments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/segments"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2773,7 +2864,6 @@ export const serializeAws_restJson1GetSegmentsCommand = async ( ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2790,8 +2880,11 @@ export const serializeAws_restJson1GetSegmentVersionCommand = async ( input: GetSegmentVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/segments/{SegmentId}/versions/{Version}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/segments/{SegmentId}/versions/{Version}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2820,7 +2913,6 @@ export const serializeAws_restJson1GetSegmentVersionCommand = async ( throw new Error("No value provided for input HTTP label: Version."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2836,8 +2928,11 @@ export const serializeAws_restJson1GetSegmentVersionsCommand = async ( input: GetSegmentVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/segments/{SegmentId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/segments/{SegmentId}/versions"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2861,7 +2956,6 @@ export const serializeAws_restJson1GetSegmentVersionsCommand = async ( ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2878,8 +2972,10 @@ export const serializeAws_restJson1GetSmsChannelCommand = async ( input: GetSmsChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/sms"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/sms"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2890,7 +2986,6 @@ export const serializeAws_restJson1GetSmsChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2906,8 +3001,10 @@ export const serializeAws_restJson1GetSmsTemplateCommand = async ( input: GetSmsTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/templates/{TemplateName}/sms"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/sms"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -2921,7 +3018,6 @@ export const serializeAws_restJson1GetSmsTemplateCommand = async ( ...(input.Version !== undefined && { version: input.Version }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2938,8 +3034,10 @@ export const serializeAws_restJson1GetUserEndpointsCommand = async ( input: GetUserEndpointsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/users/{UserId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/users/{UserId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2959,7 +3057,6 @@ export const serializeAws_restJson1GetUserEndpointsCommand = async ( throw new Error("No value provided for input HTTP label: UserId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2975,8 +3072,10 @@ export const serializeAws_restJson1GetVoiceChannelCommand = async ( input: GetVoiceChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/voice"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/voice"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -2987,7 +3086,6 @@ export const serializeAws_restJson1GetVoiceChannelCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3003,8 +3101,10 @@ export const serializeAws_restJson1GetVoiceTemplateCommand = async ( input: GetVoiceTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/templates/{TemplateName}/voice"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/voice"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -3018,7 +3118,6 @@ export const serializeAws_restJson1GetVoiceTemplateCommand = async ( ...(input.Version !== undefined && { version: input.Version }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3035,8 +3134,10 @@ export const serializeAws_restJson1ListJourneysCommand = async ( input: ListJourneysCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/apps/{ApplicationId}/journeys"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/journeys"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3051,7 +3152,6 @@ export const serializeAws_restJson1ListJourneysCommand = async ( ...(input.Token !== undefined && { token: input.Token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3068,8 +3168,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -3080,7 +3181,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3096,8 +3196,9 @@ export const serializeAws_restJson1ListTemplatesCommand = async ( input: ListTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/templates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates"; const query: any = { ...(input.NextToken !== undefined && { "next-token": input.NextToken }), ...(input.PageSize !== undefined && { "page-size": input.PageSize }), @@ -3105,7 +3206,6 @@ export const serializeAws_restJson1ListTemplatesCommand = async ( ...(input.TemplateType !== undefined && { "template-type": input.TemplateType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3122,8 +3222,11 @@ export const serializeAws_restJson1ListTemplateVersionsCommand = async ( input: ListTemplateVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/templates/{TemplateName}/{TemplateType}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/templates/{TemplateName}/{TemplateType}/versions"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -3147,7 +3250,6 @@ export const serializeAws_restJson1ListTemplateVersionsCommand = async ( ...(input.PageSize !== undefined && { "page-size": input.PageSize }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3164,10 +3266,12 @@ export const serializeAws_restJson1PhoneNumberValidateCommand = async ( input: PhoneNumberValidateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/phone/number/validate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/phone/number/validate"; let body: any; if (input.NumberValidateRequest !== undefined) { body = serializeAws_restJson1NumberValidateRequest(input.NumberValidateRequest, context); @@ -3176,7 +3280,6 @@ export const serializeAws_restJson1PhoneNumberValidateCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3192,10 +3295,12 @@ export const serializeAws_restJson1PutEventsCommand = async ( input: PutEventsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/events"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/events"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3213,7 +3318,6 @@ export const serializeAws_restJson1PutEventsCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3229,10 +3333,12 @@ export const serializeAws_restJson1PutEventStreamCommand = async ( input: PutEventStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/eventstream"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/eventstream"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3250,7 +3356,6 @@ export const serializeAws_restJson1PutEventStreamCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3266,10 +3371,13 @@ export const serializeAws_restJson1RemoveAttributesCommand = async ( input: RemoveAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/attributes/{AttributeType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/attributes/{AttributeType}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3296,7 +3404,6 @@ export const serializeAws_restJson1RemoveAttributesCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3312,10 +3419,12 @@ export const serializeAws_restJson1SendMessagesCommand = async ( input: SendMessagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/messages"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/messages"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3333,7 +3442,6 @@ export const serializeAws_restJson1SendMessagesCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3349,10 +3457,12 @@ export const serializeAws_restJson1SendUsersMessagesCommand = async ( input: SendUsersMessagesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/users-messages"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/users-messages"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3370,7 +3480,6 @@ export const serializeAws_restJson1SendUsersMessagesCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3386,10 +3495,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -3407,7 +3517,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3423,8 +3532,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -3438,7 +3548,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3455,10 +3564,12 @@ export const serializeAws_restJson1UpdateAdmChannelCommand = async ( input: UpdateAdmChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/adm"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/adm"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3476,7 +3587,6 @@ export const serializeAws_restJson1UpdateAdmChannelCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3492,10 +3602,12 @@ export const serializeAws_restJson1UpdateApnsChannelCommand = async ( input: UpdateApnsChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/apns"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3513,7 +3625,6 @@ export const serializeAws_restJson1UpdateApnsChannelCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3529,10 +3640,13 @@ export const serializeAws_restJson1UpdateApnsSandboxChannelCommand = async ( input: UpdateApnsSandboxChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns_sandbox"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/channels/apns_sandbox"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3550,7 +3664,6 @@ export const serializeAws_restJson1UpdateApnsSandboxChannelCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3566,10 +3679,13 @@ export const serializeAws_restJson1UpdateApnsVoipChannelCommand = async ( input: UpdateApnsVoipChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns_voip"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/channels/apns_voip"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3587,7 +3703,6 @@ export const serializeAws_restJson1UpdateApnsVoipChannelCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3603,10 +3718,13 @@ export const serializeAws_restJson1UpdateApnsVoipSandboxChannelCommand = async ( input: UpdateApnsVoipSandboxChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/apns_voip_sandbox"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/channels/apns_voip_sandbox"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3624,7 +3742,6 @@ export const serializeAws_restJson1UpdateApnsVoipSandboxChannelCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3640,10 +3757,12 @@ export const serializeAws_restJson1UpdateApplicationSettingsCommand = async ( input: UpdateApplicationSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/settings"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3661,7 +3780,6 @@ export const serializeAws_restJson1UpdateApplicationSettingsCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3677,10 +3795,12 @@ export const serializeAws_restJson1UpdateBaiduChannelCommand = async ( input: UpdateBaiduChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/baidu"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/baidu"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3698,7 +3818,6 @@ export const serializeAws_restJson1UpdateBaiduChannelCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3714,10 +3833,13 @@ export const serializeAws_restJson1UpdateCampaignCommand = async ( input: UpdateCampaignCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/campaigns/{CampaignId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/campaigns/{CampaignId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3744,7 +3866,6 @@ export const serializeAws_restJson1UpdateCampaignCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3760,10 +3881,12 @@ export const serializeAws_restJson1UpdateEmailChannelCommand = async ( input: UpdateEmailChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/email"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/email"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3781,7 +3904,6 @@ export const serializeAws_restJson1UpdateEmailChannelCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3797,10 +3919,12 @@ export const serializeAws_restJson1UpdateEmailTemplateCommand = async ( input: UpdateEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/templates/{TemplateName}/email"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/email"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -3822,7 +3946,6 @@ export const serializeAws_restJson1UpdateEmailTemplateCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3839,10 +3962,13 @@ export const serializeAws_restJson1UpdateEndpointCommand = async ( input: UpdateEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/endpoints/{EndpointId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/endpoints/{EndpointId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3869,7 +3995,6 @@ export const serializeAws_restJson1UpdateEndpointCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3885,10 +4010,12 @@ export const serializeAws_restJson1UpdateEndpointsBatchCommand = async ( input: UpdateEndpointsBatchCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/endpoints"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/endpoints"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3906,7 +4033,6 @@ export const serializeAws_restJson1UpdateEndpointsBatchCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3922,10 +4048,12 @@ export const serializeAws_restJson1UpdateGcmChannelCommand = async ( input: UpdateGcmChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/gcm"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/gcm"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3943,7 +4071,6 @@ export const serializeAws_restJson1UpdateGcmChannelCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3959,10 +4086,13 @@ export const serializeAws_restJson1UpdateJourneyCommand = async ( input: UpdateJourneyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/journeys/{JourneyId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/journeys/{JourneyId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -3989,7 +4119,6 @@ export const serializeAws_restJson1UpdateJourneyCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4005,10 +4134,13 @@ export const serializeAws_restJson1UpdateJourneyStateCommand = async ( input: UpdateJourneyStateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/journeys/{JourneyId}/state"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/journeys/{JourneyId}/state"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -4035,7 +4167,6 @@ export const serializeAws_restJson1UpdateJourneyStateCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4051,10 +4182,12 @@ export const serializeAws_restJson1UpdatePushTemplateCommand = async ( input: UpdatePushTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/templates/{TemplateName}/push"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/push"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -4076,7 +4209,6 @@ export const serializeAws_restJson1UpdatePushTemplateCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4093,10 +4225,12 @@ export const serializeAws_restJson1UpdateRecommenderConfigurationCommand = async input: UpdateRecommenderConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/recommenders/{RecommenderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/recommenders/{RecommenderId}"; if (input.RecommenderId !== undefined) { const labelValue: string = input.RecommenderId; if (labelValue.length <= 0) { @@ -4114,7 +4248,6 @@ export const serializeAws_restJson1UpdateRecommenderConfigurationCommand = async body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4130,10 +4263,13 @@ export const serializeAws_restJson1UpdateSegmentCommand = async ( input: UpdateSegmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/segments/{SegmentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/apps/{ApplicationId}/segments/{SegmentId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -4160,7 +4296,6 @@ export const serializeAws_restJson1UpdateSegmentCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4176,10 +4311,12 @@ export const serializeAws_restJson1UpdateSmsChannelCommand = async ( input: UpdateSmsChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/sms"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/sms"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -4197,7 +4334,6 @@ export const serializeAws_restJson1UpdateSmsChannelCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4213,10 +4349,12 @@ export const serializeAws_restJson1UpdateSmsTemplateCommand = async ( input: UpdateSmsTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/templates/{TemplateName}/sms"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/sms"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -4238,7 +4376,6 @@ export const serializeAws_restJson1UpdateSmsTemplateCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4255,10 +4392,13 @@ export const serializeAws_restJson1UpdateTemplateActiveVersionCommand = async ( input: UpdateTemplateActiveVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/templates/{TemplateName}/{TemplateType}/active-version"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/templates/{TemplateName}/{TemplateType}/active-version"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -4285,7 +4425,6 @@ export const serializeAws_restJson1UpdateTemplateActiveVersionCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4301,10 +4440,12 @@ export const serializeAws_restJson1UpdateVoiceChannelCommand = async ( input: UpdateVoiceChannelCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/apps/{ApplicationId}/channels/voice"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apps/{ApplicationId}/channels/voice"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -4322,7 +4463,6 @@ export const serializeAws_restJson1UpdateVoiceChannelCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4338,10 +4478,12 @@ export const serializeAws_restJson1UpdateVoiceTemplateCommand = async ( input: UpdateVoiceTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/templates/{TemplateName}/voice"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/templates/{TemplateName}/voice"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -4363,7 +4505,6 @@ export const serializeAws_restJson1UpdateVoiceTemplateCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-polly/protocols/Aws_restJson1.ts b/clients/client-polly/protocols/Aws_restJson1.ts index 41e142d5bb8ed..159e7d14e56b1 100644 --- a/clients/client-polly/protocols/Aws_restJson1.ts +++ b/clients/client-polly/protocols/Aws_restJson1.ts @@ -65,8 +65,9 @@ export const serializeAws_restJson1DeleteLexiconCommand = async ( input: DeleteLexiconCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/lexicons/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -77,7 +78,6 @@ export const serializeAws_restJson1DeleteLexiconCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -93,8 +93,9 @@ export const serializeAws_restJson1DescribeVoicesCommand = async ( input: DescribeVoicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/voices"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/voices"; const query: any = { ...(input.Engine !== undefined && { Engine: input.Engine }), ...(input.LanguageCode !== undefined && { LanguageCode: input.LanguageCode }), @@ -104,7 +105,6 @@ export const serializeAws_restJson1DescribeVoicesCommand = async ( ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -121,8 +121,9 @@ export const serializeAws_restJson1GetLexiconCommand = async ( input: GetLexiconCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/lexicons/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -133,7 +134,6 @@ export const serializeAws_restJson1GetLexiconCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -149,8 +149,10 @@ export const serializeAws_restJson1GetSpeechSynthesisTaskCommand = async ( input: GetSpeechSynthesisTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/synthesisTasks/{TaskId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks/{TaskId}"; if (input.TaskId !== undefined) { const labelValue: string = input.TaskId; if (labelValue.length <= 0) { @@ -161,7 +163,6 @@ export const serializeAws_restJson1GetSpeechSynthesisTaskCommand = async ( throw new Error("No value provided for input HTTP label: TaskId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -177,13 +178,13 @@ export const serializeAws_restJson1ListLexiconsCommand = async ( input: ListLexiconsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/lexicons"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -200,15 +201,15 @@ export const serializeAws_restJson1ListSpeechSynthesisTasksCommand = async ( input: ListSpeechSynthesisTasksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/synthesisTasks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.Status !== undefined && { Status: input.Status }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -225,10 +226,11 @@ export const serializeAws_restJson1PutLexiconCommand = async ( input: PutLexiconCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/lexicons/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/lexicons/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -242,7 +244,6 @@ export const serializeAws_restJson1PutLexiconCommand = async ( body = JSON.stringify({ ...(input.Content !== undefined && input.Content !== null && { Content: input.Content }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -258,10 +259,11 @@ export const serializeAws_restJson1StartSpeechSynthesisTaskCommand = async ( input: StartSpeechSynthesisTaskCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/synthesisTasks"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/synthesisTasks"; let body: any; body = JSON.stringify({ ...(input.Engine !== undefined && input.Engine !== null && { Engine: input.Engine }), @@ -285,7 +287,6 @@ export const serializeAws_restJson1StartSpeechSynthesisTaskCommand = async ( ...(input.TextType !== undefined && input.TextType !== null && { TextType: input.TextType }), ...(input.VoiceId !== undefined && input.VoiceId !== null && { VoiceId: input.VoiceId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -301,10 +302,11 @@ export const serializeAws_restJson1SynthesizeSpeechCommand = async ( input: SynthesizeSpeechCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/speech"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/speech"; let body: any; body = JSON.stringify({ ...(input.Engine !== undefined && input.Engine !== null && { Engine: input.Engine }), @@ -323,7 +325,6 @@ export const serializeAws_restJson1SynthesizeSpeechCommand = async ( ...(input.TextType !== undefined && input.TextType !== null && { TextType: input.TextType }), ...(input.VoiceId !== undefined && input.VoiceId !== null && { VoiceId: input.VoiceId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-qldb/protocols/Aws_restJson1.ts b/clients/client-qldb/protocols/Aws_restJson1.ts index 44ae4d85668e6..48fcbde8526cb 100644 --- a/clients/client-qldb/protocols/Aws_restJson1.ts +++ b/clients/client-qldb/protocols/Aws_restJson1.ts @@ -78,8 +78,11 @@ export const serializeAws_restJson1CancelJournalKinesisStreamCommand = async ( input: CancelJournalKinesisStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ledgers/{LedgerName}/journal-kinesis-streams/{StreamId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/ledgers/{LedgerName}/journal-kinesis-streams/{StreamId}"; if (input.LedgerName !== undefined) { const labelValue: string = input.LedgerName; if (labelValue.length <= 0) { @@ -99,7 +102,6 @@ export const serializeAws_restJson1CancelJournalKinesisStreamCommand = async ( throw new Error("No value provided for input HTTP label: StreamId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -115,10 +117,11 @@ export const serializeAws_restJson1CreateLedgerCommand = async ( input: CreateLedgerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ledgers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers"; let body: any; body = JSON.stringify({ ...(input.DeletionProtection !== undefined && @@ -128,7 +131,6 @@ export const serializeAws_restJson1CreateLedgerCommand = async ( input.PermissionsMode !== null && { PermissionsMode: input.PermissionsMode }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -144,8 +146,9 @@ export const serializeAws_restJson1DeleteLedgerCommand = async ( input: DeleteLedgerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ledgers/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -156,7 +159,6 @@ export const serializeAws_restJson1DeleteLedgerCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -172,8 +174,11 @@ export const serializeAws_restJson1DescribeJournalKinesisStreamCommand = async ( input: DescribeJournalKinesisStreamCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ledgers/{LedgerName}/journal-kinesis-streams/{StreamId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/ledgers/{LedgerName}/journal-kinesis-streams/{StreamId}"; if (input.LedgerName !== undefined) { const labelValue: string = input.LedgerName; if (labelValue.length <= 0) { @@ -193,7 +198,6 @@ export const serializeAws_restJson1DescribeJournalKinesisStreamCommand = async ( throw new Error("No value provided for input HTTP label: StreamId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -209,8 +213,11 @@ export const serializeAws_restJson1DescribeJournalS3ExportCommand = async ( input: DescribeJournalS3ExportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ledgers/{Name}/journal-s3-exports/{ExportId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/ledgers/{Name}/journal-s3-exports/{ExportId}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -230,7 +237,6 @@ export const serializeAws_restJson1DescribeJournalS3ExportCommand = async ( throw new Error("No value provided for input HTTP label: ExportId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -246,8 +252,9 @@ export const serializeAws_restJson1DescribeLedgerCommand = async ( input: DescribeLedgerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ledgers/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -258,7 +265,6 @@ export const serializeAws_restJson1DescribeLedgerCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -274,10 +280,12 @@ export const serializeAws_restJson1ExportJournalToS3Command = async ( input: ExportJournalToS3CommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ledgers/{Name}/journal-s3-exports"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers/{Name}/journal-s3-exports"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -301,7 +309,6 @@ export const serializeAws_restJson1ExportJournalToS3Command = async ( S3ExportConfiguration: serializeAws_restJson1S3ExportConfiguration(input.S3ExportConfiguration, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -317,10 +324,11 @@ export const serializeAws_restJson1GetBlockCommand = async ( input: GetBlockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ledgers/{Name}/block"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers/{Name}/block"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -339,7 +347,6 @@ export const serializeAws_restJson1GetBlockCommand = async ( DigestTipAddress: serializeAws_restJson1ValueHolder(input.DigestTipAddress, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -355,8 +362,9 @@ export const serializeAws_restJson1GetDigestCommand = async ( input: GetDigestCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ledgers/{Name}/digest"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers/{Name}/digest"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -367,7 +375,6 @@ export const serializeAws_restJson1GetDigestCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -383,10 +390,11 @@ export const serializeAws_restJson1GetRevisionCommand = async ( input: GetRevisionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ledgers/{Name}/revision"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers/{Name}/revision"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -406,7 +414,6 @@ export const serializeAws_restJson1GetRevisionCommand = async ( }), ...(input.DocumentId !== undefined && input.DocumentId !== null && { DocumentId: input.DocumentId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -422,8 +429,11 @@ export const serializeAws_restJson1ListJournalKinesisStreamsForLedgerCommand = a input: ListJournalKinesisStreamsForLedgerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ledgers/{LedgerName}/journal-kinesis-streams"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/ledgers/{LedgerName}/journal-kinesis-streams"; if (input.LedgerName !== undefined) { const labelValue: string = input.LedgerName; if (labelValue.length <= 0) { @@ -438,7 +448,6 @@ export const serializeAws_restJson1ListJournalKinesisStreamsForLedgerCommand = a ...(input.NextToken !== undefined && { next_token: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -455,14 +464,14 @@ export const serializeAws_restJson1ListJournalS3ExportsCommand = async ( input: ListJournalS3ExportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/journal-s3-exports"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/journal-s3-exports"; const query: any = { ...(input.MaxResults !== undefined && { max_results: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { next_token: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -479,8 +488,10 @@ export const serializeAws_restJson1ListJournalS3ExportsForLedgerCommand = async input: ListJournalS3ExportsForLedgerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ledgers/{Name}/journal-s3-exports"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers/{Name}/journal-s3-exports"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -495,7 +506,6 @@ export const serializeAws_restJson1ListJournalS3ExportsForLedgerCommand = async ...(input.NextToken !== undefined && { next_token: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -512,14 +522,14 @@ export const serializeAws_restJson1ListLedgersCommand = async ( input: ListLedgersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ledgers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers"; const query: any = { ...(input.MaxResults !== undefined && { max_results: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { next_token: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -536,8 +546,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -548,7 +559,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -564,10 +574,13 @@ export const serializeAws_restJson1StreamJournalToKinesisCommand = async ( input: StreamJournalToKinesisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ledgers/{LedgerName}/journal-kinesis-streams"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/ledgers/{LedgerName}/journal-kinesis-streams"; if (input.LedgerName !== undefined) { const labelValue: string = input.LedgerName; if (labelValue.length <= 0) { @@ -593,7 +606,6 @@ export const serializeAws_restJson1StreamJournalToKinesisCommand = async ( ...(input.StreamName !== undefined && input.StreamName !== null && { StreamName: input.StreamName }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -609,10 +621,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -626,7 +639,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -642,8 +654,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -657,7 +670,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -674,10 +686,11 @@ export const serializeAws_restJson1UpdateLedgerCommand = async ( input: UpdateLedgerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ledgers/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -692,7 +705,6 @@ export const serializeAws_restJson1UpdateLedgerCommand = async ( ...(input.DeletionProtection !== undefined && input.DeletionProtection !== null && { DeletionProtection: input.DeletionProtection }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -708,10 +720,12 @@ export const serializeAws_restJson1UpdateLedgerPermissionsModeCommand = async ( input: UpdateLedgerPermissionsModeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ledgers/{Name}/permissions-mode"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ledgers/{Name}/permissions-mode"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -726,7 +740,6 @@ export const serializeAws_restJson1UpdateLedgerPermissionsModeCommand = async ( ...(input.PermissionsMode !== undefined && input.PermissionsMode !== null && { PermissionsMode: input.PermissionsMode }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-quicksight/protocols/Aws_restJson1.ts b/clients/client-quicksight/protocols/Aws_restJson1.ts index 4232022b8ec42..384b2663fda6b 100644 --- a/clients/client-quicksight/protocols/Aws_restJson1.ts +++ b/clients/client-quicksight/protocols/Aws_restJson1.ts @@ -411,8 +411,11 @@ export const serializeAws_restJson1CancelIngestionCommand = async ( input: CancelIngestionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets/{DataSetId}/ingestions/{IngestionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sets/{DataSetId}/ingestions/{IngestionId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -441,7 +444,6 @@ export const serializeAws_restJson1CancelIngestionCommand = async ( throw new Error("No value provided for input HTTP label: IngestionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -457,10 +459,12 @@ export const serializeAws_restJson1CreateAccountCustomizationCommand = async ( input: CreateAccountCustomizationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/customizations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/customizations"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -482,7 +486,6 @@ export const serializeAws_restJson1CreateAccountCustomizationCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -499,10 +502,13 @@ export const serializeAws_restJson1CreateAnalysisCommand = async ( input: CreateAnalysisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/analyses/{AnalysisId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/analyses/{AnalysisId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -538,7 +544,6 @@ export const serializeAws_restJson1CreateAnalysisCommand = async ( input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), ...(input.ThemeArn !== undefined && input.ThemeArn !== null && { ThemeArn: input.ThemeArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -554,10 +559,13 @@ export const serializeAws_restJson1CreateDashboardCommand = async ( input: CreateDashboardCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/dashboards/{DashboardId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/dashboards/{DashboardId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -599,7 +607,6 @@ export const serializeAws_restJson1CreateDashboardCommand = async ( ...(input.VersionDescription !== undefined && input.VersionDescription !== null && { VersionDescription: input.VersionDescription }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -615,10 +622,12 @@ export const serializeAws_restJson1CreateDataSetCommand = async ( input: CreateDataSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/data-sets"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -670,7 +679,6 @@ export const serializeAws_restJson1CreateDataSetCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -686,10 +694,12 @@ export const serializeAws_restJson1CreateDataSourceCommand = async ( input: CreateDataSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/data-sources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/data-sources"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -727,7 +737,6 @@ export const serializeAws_restJson1CreateDataSourceCommand = async ( VpcConnectionProperties: serializeAws_restJson1VpcConnectionProperties(input.VpcConnectionProperties, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -743,10 +752,13 @@ export const serializeAws_restJson1CreateFolderCommand = async ( input: CreateFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/folders/{FolderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/folders/{FolderId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -778,7 +790,6 @@ export const serializeAws_restJson1CreateFolderCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -794,8 +805,11 @@ export const serializeAws_restJson1CreateFolderMembershipCommand = async ( input: CreateFolderMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/folders/{FolderId}/members/{MemberType}/{MemberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/folders/{FolderId}/members/{MemberType}/{MemberId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -833,7 +847,6 @@ export const serializeAws_restJson1CreateFolderMembershipCommand = async ( throw new Error("No value provided for input HTTP label: MemberType."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -849,10 +862,13 @@ export const serializeAws_restJson1CreateGroupCommand = async ( input: CreateGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -876,7 +892,6 @@ export const serializeAws_restJson1CreateGroupCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.GroupName !== undefined && input.GroupName !== null && { GroupName: input.GroupName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -892,8 +907,11 @@ export const serializeAws_restJson1CreateGroupMembershipCommand = async ( input: CreateGroupMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}/members/{MemberName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}/members/{MemberName}"; if (input.MemberName !== undefined) { const labelValue: string = input.MemberName; if (labelValue.length <= 0) { @@ -931,7 +949,6 @@ export const serializeAws_restJson1CreateGroupMembershipCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -947,10 +964,13 @@ export const serializeAws_restJson1CreateIAMPolicyAssignmentCommand = async ( input: CreateIAMPolicyAssignmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/iam-policy-assignments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/iam-policy-assignments"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -979,7 +999,6 @@ export const serializeAws_restJson1CreateIAMPolicyAssignmentCommand = async ( input.Identities !== null && { Identities: serializeAws_restJson1IdentityMap(input.Identities, context) }), ...(input.PolicyArn !== undefined && input.PolicyArn !== null && { PolicyArn: input.PolicyArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -995,8 +1014,11 @@ export const serializeAws_restJson1CreateIngestionCommand = async ( input: CreateIngestionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets/{DataSetId}/ingestions/{IngestionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sets/{DataSetId}/ingestions/{IngestionId}"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -1025,7 +1047,6 @@ export const serializeAws_restJson1CreateIngestionCommand = async ( throw new Error("No value provided for input HTTP label: AwsAccountId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1041,10 +1062,11 @@ export const serializeAws_restJson1CreateNamespaceCommand = async ( input: CreateNamespaceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1061,7 +1083,6 @@ export const serializeAws_restJson1CreateNamespaceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1077,10 +1098,13 @@ export const serializeAws_restJson1CreateTemplateCommand = async ( input: CreateTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1115,7 +1139,6 @@ export const serializeAws_restJson1CreateTemplateCommand = async ( ...(input.VersionDescription !== undefined && input.VersionDescription !== null && { VersionDescription: input.VersionDescription }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1131,10 +1154,13 @@ export const serializeAws_restJson1CreateTemplateAliasCommand = async ( input: CreateTemplateAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}/aliases/{AliasName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}/aliases/{AliasName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1167,7 +1193,6 @@ export const serializeAws_restJson1CreateTemplateAliasCommand = async ( ...(input.TemplateVersionNumber !== undefined && input.TemplateVersionNumber !== null && { TemplateVersionNumber: input.TemplateVersionNumber }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1183,10 +1208,12 @@ export const serializeAws_restJson1CreateThemeCommand = async ( input: CreateThemeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/themes/{ThemeId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1222,7 +1249,6 @@ export const serializeAws_restJson1CreateThemeCommand = async ( ...(input.VersionDescription !== undefined && input.VersionDescription !== null && { VersionDescription: input.VersionDescription }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1238,10 +1264,13 @@ export const serializeAws_restJson1CreateThemeAliasCommand = async ( input: CreateThemeAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}/aliases/{AliasName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/themes/{ThemeId}/aliases/{AliasName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1274,7 +1303,6 @@ export const serializeAws_restJson1CreateThemeAliasCommand = async ( ...(input.ThemeVersionNumber !== undefined && input.ThemeVersionNumber !== null && { ThemeVersionNumber: input.ThemeVersionNumber }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1290,8 +1318,10 @@ export const serializeAws_restJson1DeleteAccountCustomizationCommand = async ( input: DeleteAccountCustomizationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/customizations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/customizations"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1305,7 +1335,6 @@ export const serializeAws_restJson1DeleteAccountCustomizationCommand = async ( ...(input.Namespace !== undefined && { namespace: input.Namespace }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1322,8 +1351,11 @@ export const serializeAws_restJson1DeleteAnalysisCommand = async ( input: DeleteAnalysisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/analyses/{AnalysisId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/analyses/{AnalysisId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1351,7 +1383,6 @@ export const serializeAws_restJson1DeleteAnalysisCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1368,8 +1399,11 @@ export const serializeAws_restJson1DeleteDashboardCommand = async ( input: DeleteDashboardCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/dashboards/{DashboardId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/dashboards/{DashboardId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1392,7 +1426,6 @@ export const serializeAws_restJson1DeleteDashboardCommand = async ( ...(input.VersionNumber !== undefined && { "version-number": input.VersionNumber.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1409,8 +1442,11 @@ export const serializeAws_restJson1DeleteDataSetCommand = async ( input: DeleteDataSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets/{DataSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sets/{DataSetId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1430,7 +1466,6 @@ export const serializeAws_restJson1DeleteDataSetCommand = async ( throw new Error("No value provided for input HTTP label: DataSetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1446,8 +1481,11 @@ export const serializeAws_restJson1DeleteDataSourceCommand = async ( input: DeleteDataSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sources/{DataSourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sources/{DataSourceId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1467,7 +1505,6 @@ export const serializeAws_restJson1DeleteDataSourceCommand = async ( throw new Error("No value provided for input HTTP label: DataSourceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1483,8 +1520,11 @@ export const serializeAws_restJson1DeleteFolderCommand = async ( input: DeleteFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/folders/{FolderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/folders/{FolderId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1504,7 +1544,6 @@ export const serializeAws_restJson1DeleteFolderCommand = async ( throw new Error("No value provided for input HTTP label: FolderId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1520,8 +1559,11 @@ export const serializeAws_restJson1DeleteFolderMembershipCommand = async ( input: DeleteFolderMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/folders/{FolderId}/members/{MemberType}/{MemberId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/folders/{FolderId}/members/{MemberType}/{MemberId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1559,7 +1601,6 @@ export const serializeAws_restJson1DeleteFolderMembershipCommand = async ( throw new Error("No value provided for input HTTP label: MemberType."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1575,8 +1616,11 @@ export const serializeAws_restJson1DeleteGroupCommand = async ( input: DeleteGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}"; if (input.GroupName !== undefined) { const labelValue: string = input.GroupName; if (labelValue.length <= 0) { @@ -1605,7 +1649,6 @@ export const serializeAws_restJson1DeleteGroupCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1621,8 +1664,11 @@ export const serializeAws_restJson1DeleteGroupMembershipCommand = async ( input: DeleteGroupMembershipCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}/members/{MemberName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}/members/{MemberName}"; if (input.MemberName !== undefined) { const labelValue: string = input.MemberName; if (labelValue.length <= 0) { @@ -1660,7 +1706,6 @@ export const serializeAws_restJson1DeleteGroupMembershipCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1676,8 +1721,11 @@ export const serializeAws_restJson1DeleteIAMPolicyAssignmentCommand = async ( input: DeleteIAMPolicyAssignmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespace/{Namespace}/iam-policy-assignments/{AssignmentName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespace/{Namespace}/iam-policy-assignments/{AssignmentName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1706,7 +1754,6 @@ export const serializeAws_restJson1DeleteIAMPolicyAssignmentCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1722,8 +1769,11 @@ export const serializeAws_restJson1DeleteNamespaceCommand = async ( input: DeleteNamespaceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1743,7 +1793,6 @@ export const serializeAws_restJson1DeleteNamespaceCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1759,8 +1808,11 @@ export const serializeAws_restJson1DeleteTemplateCommand = async ( input: DeleteTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1783,7 +1835,6 @@ export const serializeAws_restJson1DeleteTemplateCommand = async ( ...(input.VersionNumber !== undefined && { "version-number": input.VersionNumber.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1800,8 +1851,11 @@ export const serializeAws_restJson1DeleteTemplateAliasCommand = async ( input: DeleteTemplateAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}/aliases/{AliasName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}/aliases/{AliasName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1830,7 +1884,6 @@ export const serializeAws_restJson1DeleteTemplateAliasCommand = async ( throw new Error("No value provided for input HTTP label: AliasName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1846,8 +1899,10 @@ export const serializeAws_restJson1DeleteThemeCommand = async ( input: DeleteThemeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/themes/{ThemeId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1870,7 +1925,6 @@ export const serializeAws_restJson1DeleteThemeCommand = async ( ...(input.VersionNumber !== undefined && { "version-number": input.VersionNumber.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1887,8 +1941,11 @@ export const serializeAws_restJson1DeleteThemeAliasCommand = async ( input: DeleteThemeAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}/aliases/{AliasName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/themes/{ThemeId}/aliases/{AliasName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -1917,7 +1974,6 @@ export const serializeAws_restJson1DeleteThemeAliasCommand = async ( throw new Error("No value provided for input HTTP label: AliasName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1933,8 +1989,11 @@ export const serializeAws_restJson1DeleteUserCommand = async ( input: DeleteUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/users/{UserName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/users/{UserName}"; if (input.UserName !== undefined) { const labelValue: string = input.UserName; if (labelValue.length <= 0) { @@ -1963,7 +2022,6 @@ export const serializeAws_restJson1DeleteUserCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1979,8 +2037,11 @@ export const serializeAws_restJson1DeleteUserByPrincipalIdCommand = async ( input: DeleteUserByPrincipalIdCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/user-principals/{PrincipalId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/user-principals/{PrincipalId}"; if (input.PrincipalId !== undefined) { const labelValue: string = input.PrincipalId; if (labelValue.length <= 0) { @@ -2009,7 +2070,6 @@ export const serializeAws_restJson1DeleteUserByPrincipalIdCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2025,8 +2085,10 @@ export const serializeAws_restJson1DescribeAccountCustomizationCommand = async ( input: DescribeAccountCustomizationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/customizations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/customizations"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2041,7 +2103,6 @@ export const serializeAws_restJson1DescribeAccountCustomizationCommand = async ( ...(input.Resolved !== undefined && { resolved: input.Resolved.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2058,8 +2119,10 @@ export const serializeAws_restJson1DescribeAccountSettingsCommand = async ( input: DescribeAccountSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/settings"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2070,7 +2133,6 @@ export const serializeAws_restJson1DescribeAccountSettingsCommand = async ( throw new Error("No value provided for input HTTP label: AwsAccountId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2086,8 +2148,11 @@ export const serializeAws_restJson1DescribeAnalysisCommand = async ( input: DescribeAnalysisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/analyses/{AnalysisId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/analyses/{AnalysisId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2107,7 +2172,6 @@ export const serializeAws_restJson1DescribeAnalysisCommand = async ( throw new Error("No value provided for input HTTP label: AnalysisId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2123,8 +2187,11 @@ export const serializeAws_restJson1DescribeAnalysisPermissionsCommand = async ( input: DescribeAnalysisPermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/analyses/{AnalysisId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/analyses/{AnalysisId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2144,7 +2211,6 @@ export const serializeAws_restJson1DescribeAnalysisPermissionsCommand = async ( throw new Error("No value provided for input HTTP label: AnalysisId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2160,8 +2226,11 @@ export const serializeAws_restJson1DescribeDashboardCommand = async ( input: DescribeDashboardCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/dashboards/{DashboardId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/dashboards/{DashboardId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2185,7 +2254,6 @@ export const serializeAws_restJson1DescribeDashboardCommand = async ( ...(input.AliasName !== undefined && { "alias-name": input.AliasName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2202,8 +2270,11 @@ export const serializeAws_restJson1DescribeDashboardPermissionsCommand = async ( input: DescribeDashboardPermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/dashboards/{DashboardId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/dashboards/{DashboardId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2223,7 +2294,6 @@ export const serializeAws_restJson1DescribeDashboardPermissionsCommand = async ( throw new Error("No value provided for input HTTP label: DashboardId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2239,8 +2309,11 @@ export const serializeAws_restJson1DescribeDataSetCommand = async ( input: DescribeDataSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets/{DataSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sets/{DataSetId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2260,7 +2333,6 @@ export const serializeAws_restJson1DescribeDataSetCommand = async ( throw new Error("No value provided for input HTTP label: DataSetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2276,8 +2348,11 @@ export const serializeAws_restJson1DescribeDataSetPermissionsCommand = async ( input: DescribeDataSetPermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets/{DataSetId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sets/{DataSetId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2297,7 +2372,6 @@ export const serializeAws_restJson1DescribeDataSetPermissionsCommand = async ( throw new Error("No value provided for input HTTP label: DataSetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2313,8 +2387,11 @@ export const serializeAws_restJson1DescribeDataSourceCommand = async ( input: DescribeDataSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sources/{DataSourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sources/{DataSourceId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2334,7 +2411,6 @@ export const serializeAws_restJson1DescribeDataSourceCommand = async ( throw new Error("No value provided for input HTTP label: DataSourceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2350,8 +2426,11 @@ export const serializeAws_restJson1DescribeDataSourcePermissionsCommand = async input: DescribeDataSourcePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sources/{DataSourceId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sources/{DataSourceId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2371,7 +2450,6 @@ export const serializeAws_restJson1DescribeDataSourcePermissionsCommand = async throw new Error("No value provided for input HTTP label: DataSourceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2387,8 +2465,11 @@ export const serializeAws_restJson1DescribeFolderCommand = async ( input: DescribeFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/folders/{FolderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/folders/{FolderId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2408,7 +2489,6 @@ export const serializeAws_restJson1DescribeFolderCommand = async ( throw new Error("No value provided for input HTTP label: FolderId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2424,8 +2504,11 @@ export const serializeAws_restJson1DescribeFolderPermissionsCommand = async ( input: DescribeFolderPermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/folders/{FolderId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/folders/{FolderId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2445,7 +2528,6 @@ export const serializeAws_restJson1DescribeFolderPermissionsCommand = async ( throw new Error("No value provided for input HTTP label: FolderId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2461,8 +2543,11 @@ export const serializeAws_restJson1DescribeFolderResolvedPermissionsCommand = as input: DescribeFolderResolvedPermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/folders/{FolderId}/resolved-permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/folders/{FolderId}/resolved-permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2482,7 +2567,6 @@ export const serializeAws_restJson1DescribeFolderResolvedPermissionsCommand = as throw new Error("No value provided for input HTTP label: FolderId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2498,8 +2582,11 @@ export const serializeAws_restJson1DescribeGroupCommand = async ( input: DescribeGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}"; if (input.GroupName !== undefined) { const labelValue: string = input.GroupName; if (labelValue.length <= 0) { @@ -2528,7 +2615,6 @@ export const serializeAws_restJson1DescribeGroupCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2544,8 +2630,11 @@ export const serializeAws_restJson1DescribeIAMPolicyAssignmentCommand = async ( input: DescribeIAMPolicyAssignmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/iam-policy-assignments/{AssignmentName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/iam-policy-assignments/{AssignmentName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2574,7 +2663,6 @@ export const serializeAws_restJson1DescribeIAMPolicyAssignmentCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2590,8 +2678,11 @@ export const serializeAws_restJson1DescribeIngestionCommand = async ( input: DescribeIngestionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets/{DataSetId}/ingestions/{IngestionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sets/{DataSetId}/ingestions/{IngestionId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2620,7 +2711,6 @@ export const serializeAws_restJson1DescribeIngestionCommand = async ( throw new Error("No value provided for input HTTP label: IngestionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2636,8 +2726,11 @@ export const serializeAws_restJson1DescribeNamespaceCommand = async ( input: DescribeNamespaceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2657,7 +2750,6 @@ export const serializeAws_restJson1DescribeNamespaceCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2673,8 +2765,11 @@ export const serializeAws_restJson1DescribeTemplateCommand = async ( input: DescribeTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2698,7 +2793,6 @@ export const serializeAws_restJson1DescribeTemplateCommand = async ( ...(input.AliasName !== undefined && { "alias-name": input.AliasName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2715,8 +2809,11 @@ export const serializeAws_restJson1DescribeTemplateAliasCommand = async ( input: DescribeTemplateAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}/aliases/{AliasName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}/aliases/{AliasName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2745,7 +2842,6 @@ export const serializeAws_restJson1DescribeTemplateAliasCommand = async ( throw new Error("No value provided for input HTTP label: AliasName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2761,8 +2857,11 @@ export const serializeAws_restJson1DescribeTemplatePermissionsCommand = async ( input: DescribeTemplatePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2782,7 +2881,6 @@ export const serializeAws_restJson1DescribeTemplatePermissionsCommand = async ( throw new Error("No value provided for input HTTP label: TemplateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2798,8 +2896,10 @@ export const serializeAws_restJson1DescribeThemeCommand = async ( input: DescribeThemeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/themes/{ThemeId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2823,7 +2923,6 @@ export const serializeAws_restJson1DescribeThemeCommand = async ( ...(input.AliasName !== undefined && { "alias-name": input.AliasName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2840,8 +2939,11 @@ export const serializeAws_restJson1DescribeThemeAliasCommand = async ( input: DescribeThemeAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}/aliases/{AliasName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/themes/{ThemeId}/aliases/{AliasName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2870,7 +2972,6 @@ export const serializeAws_restJson1DescribeThemeAliasCommand = async ( throw new Error("No value provided for input HTTP label: AliasName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2886,8 +2987,11 @@ export const serializeAws_restJson1DescribeThemePermissionsCommand = async ( input: DescribeThemePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/themes/{ThemeId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -2907,7 +3011,6 @@ export const serializeAws_restJson1DescribeThemePermissionsCommand = async ( throw new Error("No value provided for input HTTP label: ThemeId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2923,8 +3026,11 @@ export const serializeAws_restJson1DescribeUserCommand = async ( input: DescribeUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/users/{UserName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/users/{UserName}"; if (input.UserName !== undefined) { const labelValue: string = input.UserName; if (labelValue.length <= 0) { @@ -2953,7 +3059,6 @@ export const serializeAws_restJson1DescribeUserCommand = async ( throw new Error("No value provided for input HTTP label: Namespace."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2969,8 +3074,11 @@ export const serializeAws_restJson1GetDashboardEmbedUrlCommand = async ( input: GetDashboardEmbedUrlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/dashboards/{DashboardId}/embed-url"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/dashboards/{DashboardId}/embed-url"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3006,7 +3114,6 @@ export const serializeAws_restJson1GetDashboardEmbedUrlCommand = async ( }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3023,8 +3130,11 @@ export const serializeAws_restJson1GetSessionEmbedUrlCommand = async ( input: GetSessionEmbedUrlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/session-embed-url"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/session-embed-url"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3042,7 +3152,6 @@ export const serializeAws_restJson1GetSessionEmbedUrlCommand = async ( ...(input.UserArn !== undefined && { "user-arn": input.UserArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3059,8 +3168,10 @@ export const serializeAws_restJson1ListAnalysesCommand = async ( input: ListAnalysesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/analyses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/analyses"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3075,7 +3186,6 @@ export const serializeAws_restJson1ListAnalysesCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3092,8 +3202,10 @@ export const serializeAws_restJson1ListDashboardsCommand = async ( input: ListDashboardsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/dashboards"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/dashboards"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3108,7 +3220,6 @@ export const serializeAws_restJson1ListDashboardsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3125,8 +3236,11 @@ export const serializeAws_restJson1ListDashboardVersionsCommand = async ( input: ListDashboardVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/dashboards/{DashboardId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/dashboards/{DashboardId}/versions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3150,7 +3264,6 @@ export const serializeAws_restJson1ListDashboardVersionsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3167,8 +3280,10 @@ export const serializeAws_restJson1ListDataSetsCommand = async ( input: ListDataSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/data-sets"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3183,7 +3298,6 @@ export const serializeAws_restJson1ListDataSetsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3200,8 +3314,10 @@ export const serializeAws_restJson1ListDataSourcesCommand = async ( input: ListDataSourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/data-sources"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3216,7 +3332,6 @@ export const serializeAws_restJson1ListDataSourcesCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3233,8 +3348,11 @@ export const serializeAws_restJson1ListFolderMembersCommand = async ( input: ListFolderMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/folders/{FolderId}/members"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/folders/{FolderId}/members"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3258,7 +3376,6 @@ export const serializeAws_restJson1ListFolderMembersCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3275,8 +3392,10 @@ export const serializeAws_restJson1ListFoldersCommand = async ( input: ListFoldersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/folders"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/folders"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3291,7 +3410,6 @@ export const serializeAws_restJson1ListFoldersCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3308,8 +3426,11 @@ export const serializeAws_restJson1ListGroupMembershipsCommand = async ( input: ListGroupMembershipsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}/members"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}/members"; if (input.GroupName !== undefined) { const labelValue: string = input.GroupName; if (labelValue.length <= 0) { @@ -3342,7 +3463,6 @@ export const serializeAws_restJson1ListGroupMembershipsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3359,8 +3479,11 @@ export const serializeAws_restJson1ListGroupsCommand = async ( input: ListGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3384,7 +3507,6 @@ export const serializeAws_restJson1ListGroupsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3401,10 +3523,13 @@ export const serializeAws_restJson1ListIAMPolicyAssignmentsCommand = async ( input: ListIAMPolicyAssignmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/iam-policy-assignments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/iam-policy-assignments"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3432,7 +3557,6 @@ export const serializeAws_restJson1ListIAMPolicyAssignmentsCommand = async ( ...(input.AssignmentStatus !== undefined && input.AssignmentStatus !== null && { AssignmentStatus: input.AssignmentStatus }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3449,8 +3573,11 @@ export const serializeAws_restJson1ListIAMPolicyAssignmentsForUserCommand = asyn input: ListIAMPolicyAssignmentsForUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/users/{UserName}/iam-policy-assignments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/users/{UserName}/iam-policy-assignments"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3483,7 +3610,6 @@ export const serializeAws_restJson1ListIAMPolicyAssignmentsForUserCommand = asyn ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3500,8 +3626,11 @@ export const serializeAws_restJson1ListIngestionsCommand = async ( input: ListIngestionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets/{DataSetId}/ingestions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sets/{DataSetId}/ingestions"; if (input.DataSetId !== undefined) { const labelValue: string = input.DataSetId; if (labelValue.length <= 0) { @@ -3525,7 +3654,6 @@ export const serializeAws_restJson1ListIngestionsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3542,8 +3670,10 @@ export const serializeAws_restJson1ListNamespacesCommand = async ( input: ListNamespacesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/namespaces"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3558,7 +3688,6 @@ export const serializeAws_restJson1ListNamespacesCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3575,8 +3704,10 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/resources/{ResourceArn}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resources/{ResourceArn}/tags"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -3587,7 +3718,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3603,8 +3733,11 @@ export const serializeAws_restJson1ListTemplateAliasesCommand = async ( input: ListTemplateAliasesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}/aliases"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}/aliases"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3628,7 +3761,6 @@ export const serializeAws_restJson1ListTemplateAliasesCommand = async ( ...(input.MaxResults !== undefined && { "max-result": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3645,8 +3777,10 @@ export const serializeAws_restJson1ListTemplatesCommand = async ( input: ListTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/templates"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/templates"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3661,7 +3795,6 @@ export const serializeAws_restJson1ListTemplatesCommand = async ( ...(input.MaxResults !== undefined && { "max-result": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3678,8 +3811,11 @@ export const serializeAws_restJson1ListTemplateVersionsCommand = async ( input: ListTemplateVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}/versions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3703,7 +3839,6 @@ export const serializeAws_restJson1ListTemplateVersionsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3720,8 +3855,11 @@ export const serializeAws_restJson1ListThemeAliasesCommand = async ( input: ListThemeAliasesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}/aliases"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/themes/{ThemeId}/aliases"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3745,7 +3883,6 @@ export const serializeAws_restJson1ListThemeAliasesCommand = async ( ...(input.MaxResults !== undefined && { "max-result": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3762,8 +3899,10 @@ export const serializeAws_restJson1ListThemesCommand = async ( input: ListThemesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/themes"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/themes"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3779,7 +3918,6 @@ export const serializeAws_restJson1ListThemesCommand = async ( ...(input.Type !== undefined && { type: input.Type }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3796,8 +3934,11 @@ export const serializeAws_restJson1ListThemeVersionsCommand = async ( input: ListThemeVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/themes/{ThemeId}/versions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3821,7 +3962,6 @@ export const serializeAws_restJson1ListThemeVersionsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3838,8 +3978,11 @@ export const serializeAws_restJson1ListUserGroupsCommand = async ( input: ListUserGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/users/{UserName}/groups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/users/{UserName}/groups"; if (input.UserName !== undefined) { const labelValue: string = input.UserName; if (labelValue.length <= 0) { @@ -3872,7 +4015,6 @@ export const serializeAws_restJson1ListUserGroupsCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3889,8 +4031,11 @@ export const serializeAws_restJson1ListUsersCommand = async ( input: ListUsersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/users"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/users"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3914,7 +4059,6 @@ export const serializeAws_restJson1ListUsersCommand = async ( ...(input.MaxResults !== undefined && { "max-results": input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3931,10 +4075,13 @@ export const serializeAws_restJson1RegisterUserCommand = async ( input: RegisterUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/users"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/users"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -3972,7 +4119,6 @@ export const serializeAws_restJson1RegisterUserCommand = async ( ...(input.UserName !== undefined && input.UserName !== null && { UserName: input.UserName }), ...(input.UserRole !== undefined && input.UserRole !== null && { UserRole: input.UserRole }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3988,8 +4134,11 @@ export const serializeAws_restJson1RestoreAnalysisCommand = async ( input: RestoreAnalysisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/restore/analyses/{AnalysisId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/restore/analyses/{AnalysisId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4009,7 +4158,6 @@ export const serializeAws_restJson1RestoreAnalysisCommand = async ( throw new Error("No value provided for input HTTP label: AnalysisId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4025,10 +4173,12 @@ export const serializeAws_restJson1SearchAnalysesCommand = async ( input: SearchAnalysesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/search/analyses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/search/analyses"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4045,7 +4195,6 @@ export const serializeAws_restJson1SearchAnalysesCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4061,10 +4210,13 @@ export const serializeAws_restJson1SearchDashboardsCommand = async ( input: SearchDashboardsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/search/dashboards"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/search/dashboards"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4081,7 +4233,6 @@ export const serializeAws_restJson1SearchDashboardsCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4097,10 +4248,12 @@ export const serializeAws_restJson1SearchFoldersCommand = async ( input: SearchFoldersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/search/folders"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/search/folders"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4117,7 +4270,6 @@ export const serializeAws_restJson1SearchFoldersCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4133,10 +4285,12 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/resources/{ResourceArn}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resources/{ResourceArn}/tags"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -4151,7 +4305,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4167,8 +4320,10 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/resources/{ResourceArn}/tags"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resources/{ResourceArn}/tags"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -4182,7 +4337,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { keys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4199,10 +4353,12 @@ export const serializeAws_restJson1UpdateAccountCustomizationCommand = async ( input: UpdateAccountCustomizationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/customizations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/customizations"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4222,7 +4378,6 @@ export const serializeAws_restJson1UpdateAccountCustomizationCommand = async ( AccountCustomization: serializeAws_restJson1AccountCustomization(input.AccountCustomization, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4239,10 +4394,12 @@ export const serializeAws_restJson1UpdateAccountSettingsCommand = async ( input: UpdateAccountSettingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/settings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/settings"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4259,7 +4416,6 @@ export const serializeAws_restJson1UpdateAccountSettingsCommand = async ( ...(input.NotificationEmail !== undefined && input.NotificationEmail !== null && { NotificationEmail: input.NotificationEmail }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4275,10 +4431,13 @@ export const serializeAws_restJson1UpdateAnalysisCommand = async ( input: UpdateAnalysisCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/analyses/{AnalysisId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/analyses/{AnalysisId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4308,7 +4467,6 @@ export const serializeAws_restJson1UpdateAnalysisCommand = async ( }), ...(input.ThemeArn !== undefined && input.ThemeArn !== null && { ThemeArn: input.ThemeArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4324,10 +4482,13 @@ export const serializeAws_restJson1UpdateAnalysisPermissionsCommand = async ( input: UpdateAnalysisPermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/analyses/{AnalysisId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/analyses/{AnalysisId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4357,7 +4518,6 @@ export const serializeAws_restJson1UpdateAnalysisPermissionsCommand = async ( RevokePermissions: serializeAws_restJson1UpdateResourcePermissionList(input.RevokePermissions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4373,10 +4533,13 @@ export const serializeAws_restJson1UpdateDashboardCommand = async ( input: UpdateDashboardCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/dashboards/{DashboardId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/dashboards/{DashboardId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4412,7 +4575,6 @@ export const serializeAws_restJson1UpdateDashboardCommand = async ( ...(input.VersionDescription !== undefined && input.VersionDescription !== null && { VersionDescription: input.VersionDescription }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4428,10 +4590,13 @@ export const serializeAws_restJson1UpdateDashboardPermissionsCommand = async ( input: UpdateDashboardPermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/dashboards/{DashboardId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/dashboards/{DashboardId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4461,7 +4626,6 @@ export const serializeAws_restJson1UpdateDashboardPermissionsCommand = async ( RevokePermissions: serializeAws_restJson1UpdateResourcePermissionList(input.RevokePermissions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4477,8 +4641,11 @@ export const serializeAws_restJson1UpdateDashboardPublishedVersionCommand = asyn input: UpdateDashboardPublishedVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts/{AwsAccountId}/dashboards/{DashboardId}/versions/{VersionNumber}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/dashboards/{DashboardId}/versions/{VersionNumber}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4507,7 +4674,6 @@ export const serializeAws_restJson1UpdateDashboardPublishedVersionCommand = asyn throw new Error("No value provided for input HTTP label: VersionNumber."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4523,10 +4689,13 @@ export const serializeAws_restJson1UpdateDataSetCommand = async ( input: UpdateDataSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets/{DataSetId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sets/{DataSetId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4580,7 +4749,6 @@ export const serializeAws_restJson1UpdateDataSetCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4596,10 +4764,13 @@ export const serializeAws_restJson1UpdateDataSetPermissionsCommand = async ( input: UpdateDataSetPermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/data-sets/{DataSetId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sets/{DataSetId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4629,7 +4800,6 @@ export const serializeAws_restJson1UpdateDataSetPermissionsCommand = async ( RevokePermissions: serializeAws_restJson1ResourcePermissionList(input.RevokePermissions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4645,10 +4815,13 @@ export const serializeAws_restJson1UpdateDataSourceCommand = async ( input: UpdateDataSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/data-sources/{DataSourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sources/{DataSourceId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4687,7 +4860,6 @@ export const serializeAws_restJson1UpdateDataSourceCommand = async ( VpcConnectionProperties: serializeAws_restJson1VpcConnectionProperties(input.VpcConnectionProperties, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4703,10 +4875,13 @@ export const serializeAws_restJson1UpdateDataSourcePermissionsCommand = async ( input: UpdateDataSourcePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/data-sources/{DataSourceId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/data-sources/{DataSourceId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4736,7 +4911,6 @@ export const serializeAws_restJson1UpdateDataSourcePermissionsCommand = async ( RevokePermissions: serializeAws_restJson1ResourcePermissionList(input.RevokePermissions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4752,10 +4926,13 @@ export const serializeAws_restJson1UpdateFolderCommand = async ( input: UpdateFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/folders/{FolderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/folders/{FolderId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4778,7 +4955,6 @@ export const serializeAws_restJson1UpdateFolderCommand = async ( body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4794,10 +4970,13 @@ export const serializeAws_restJson1UpdateFolderPermissionsCommand = async ( input: UpdateFolderPermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/folders/{FolderId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/folders/{FolderId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4827,7 +5006,6 @@ export const serializeAws_restJson1UpdateFolderPermissionsCommand = async ( RevokePermissions: serializeAws_restJson1ResourcePermissionList(input.RevokePermissions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4843,10 +5021,13 @@ export const serializeAws_restJson1UpdateGroupCommand = async ( input: UpdateGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/groups/{GroupName}"; if (input.GroupName !== undefined) { const labelValue: string = input.GroupName; if (labelValue.length <= 0) { @@ -4878,7 +5059,6 @@ export const serializeAws_restJson1UpdateGroupCommand = async ( body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4894,10 +5074,13 @@ export const serializeAws_restJson1UpdateIAMPolicyAssignmentCommand = async ( input: UpdateIAMPolicyAssignmentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/iam-policy-assignments/{AssignmentName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/iam-policy-assignments/{AssignmentName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4933,7 +5116,6 @@ export const serializeAws_restJson1UpdateIAMPolicyAssignmentCommand = async ( input.Identities !== null && { Identities: serializeAws_restJson1IdentityMap(input.Identities, context) }), ...(input.PolicyArn !== undefined && input.PolicyArn !== null && { PolicyArn: input.PolicyArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4949,10 +5131,13 @@ export const serializeAws_restJson1UpdateTemplateCommand = async ( input: UpdateTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -4981,7 +5166,6 @@ export const serializeAws_restJson1UpdateTemplateCommand = async ( ...(input.VersionDescription !== undefined && input.VersionDescription !== null && { VersionDescription: input.VersionDescription }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4997,10 +5181,13 @@ export const serializeAws_restJson1UpdateTemplateAliasCommand = async ( input: UpdateTemplateAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}/aliases/{AliasName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}/aliases/{AliasName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -5033,7 +5220,6 @@ export const serializeAws_restJson1UpdateTemplateAliasCommand = async ( ...(input.TemplateVersionNumber !== undefined && input.TemplateVersionNumber !== null && { TemplateVersionNumber: input.TemplateVersionNumber }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5049,10 +5235,13 @@ export const serializeAws_restJson1UpdateTemplatePermissionsCommand = async ( input: UpdateTemplatePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/templates/{TemplateId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/templates/{TemplateId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -5082,7 +5271,6 @@ export const serializeAws_restJson1UpdateTemplatePermissionsCommand = async ( RevokePermissions: serializeAws_restJson1UpdateResourcePermissionList(input.RevokePermissions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5098,10 +5286,12 @@ export const serializeAws_restJson1UpdateThemeCommand = async ( input: UpdateThemeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts/{AwsAccountId}/themes/{ThemeId}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -5131,7 +5321,6 @@ export const serializeAws_restJson1UpdateThemeCommand = async ( ...(input.VersionDescription !== undefined && input.VersionDescription !== null && { VersionDescription: input.VersionDescription }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5147,10 +5336,13 @@ export const serializeAws_restJson1UpdateThemeAliasCommand = async ( input: UpdateThemeAliasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}/aliases/{AliasName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/themes/{ThemeId}/aliases/{AliasName}"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -5183,7 +5375,6 @@ export const serializeAws_restJson1UpdateThemeAliasCommand = async ( ...(input.ThemeVersionNumber !== undefined && input.ThemeVersionNumber !== null && { ThemeVersionNumber: input.ThemeVersionNumber }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5199,10 +5390,13 @@ export const serializeAws_restJson1UpdateThemePermissionsCommand = async ( input: UpdateThemePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/themes/{ThemeId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/themes/{ThemeId}/permissions"; if (input.AwsAccountId !== undefined) { const labelValue: string = input.AwsAccountId; if (labelValue.length <= 0) { @@ -5232,7 +5426,6 @@ export const serializeAws_restJson1UpdateThemePermissionsCommand = async ( RevokePermissions: serializeAws_restJson1UpdateResourcePermissionList(input.RevokePermissions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -5248,10 +5441,13 @@ export const serializeAws_restJson1UpdateUserCommand = async ( input: UpdateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts/{AwsAccountId}/namespaces/{Namespace}/users/{UserName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/accounts/{AwsAccountId}/namespaces/{Namespace}/users/{UserName}"; if (input.UserName !== undefined) { const labelValue: string = input.UserName; if (labelValue.length <= 0) { @@ -5296,7 +5492,6 @@ export const serializeAws_restJson1UpdateUserCommand = async ( ...(input.UnapplyCustomPermissions !== undefined && input.UnapplyCustomPermissions !== null && { UnapplyCustomPermissions: input.UnapplyCustomPermissions }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-ram/protocols/Aws_restJson1.ts b/clients/client-ram/protocols/Aws_restJson1.ts index e6166a20b420a..1959404e54967 100644 --- a/clients/client-ram/protocols/Aws_restJson1.ts +++ b/clients/client-ram/protocols/Aws_restJson1.ts @@ -121,17 +121,18 @@ export const serializeAws_restJson1AcceptResourceShareInvitationCommand = async input: AcceptResourceShareInvitationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/acceptresourceshareinvitation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/acceptresourceshareinvitation"; let body: any; body = JSON.stringify({ ...(input.clientToken !== undefined && input.clientToken !== null && { clientToken: input.clientToken }), ...(input.resourceShareInvitationArn !== undefined && input.resourceShareInvitationArn !== null && { resourceShareInvitationArn: input.resourceShareInvitationArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -147,10 +148,11 @@ export const serializeAws_restJson1AssociateResourceShareCommand = async ( input: AssociateResourceShareCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/associateresourceshare"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/associateresourceshare"; let body: any; body = JSON.stringify({ ...(input.clientToken !== undefined && input.clientToken !== null && { clientToken: input.clientToken }), @@ -165,7 +167,6 @@ export const serializeAws_restJson1AssociateResourceShareCommand = async ( ...(input.resourceShareArn !== undefined && input.resourceShareArn !== null && { resourceShareArn: input.resourceShareArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -181,10 +182,12 @@ export const serializeAws_restJson1AssociateResourceSharePermissionCommand = asy input: AssociateResourceSharePermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/associateresourcesharepermission"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/associateresourcesharepermission"; let body: any; body = JSON.stringify({ ...(input.clientToken !== undefined && input.clientToken !== null && { clientToken: input.clientToken }), @@ -195,7 +198,6 @@ export const serializeAws_restJson1AssociateResourceSharePermissionCommand = asy ...(input.resourceShareArn !== undefined && input.resourceShareArn !== null && { resourceShareArn: input.resourceShareArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -211,10 +213,11 @@ export const serializeAws_restJson1CreateResourceShareCommand = async ( input: CreateResourceShareCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createresourceshare"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createresourceshare"; let body: any; body = JSON.stringify({ ...(input.allowExternalPrincipals !== undefined && @@ -236,7 +239,6 @@ export const serializeAws_restJson1CreateResourceShareCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -252,14 +254,14 @@ export const serializeAws_restJson1DeleteResourceShareCommand = async ( input: DeleteResourceShareCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/deleteresourceshare"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteresourceshare"; const query: any = { ...(input.resourceShareArn !== undefined && { resourceShareArn: input.resourceShareArn }), ...(input.clientToken !== undefined && { clientToken: input.clientToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -276,10 +278,12 @@ export const serializeAws_restJson1DisassociateResourceShareCommand = async ( input: DisassociateResourceShareCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/disassociateresourceshare"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/disassociateresourceshare"; let body: any; body = JSON.stringify({ ...(input.clientToken !== undefined && input.clientToken !== null && { clientToken: input.clientToken }), @@ -294,7 +298,6 @@ export const serializeAws_restJson1DisassociateResourceShareCommand = async ( ...(input.resourceShareArn !== undefined && input.resourceShareArn !== null && { resourceShareArn: input.resourceShareArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -310,10 +313,12 @@ export const serializeAws_restJson1DisassociateResourceSharePermissionCommand = input: DisassociateResourceSharePermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/disassociateresourcesharepermission"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/disassociateresourcesharepermission"; let body: any; body = JSON.stringify({ ...(input.clientToken !== undefined && input.clientToken !== null && { clientToken: input.clientToken }), @@ -321,7 +326,6 @@ export const serializeAws_restJson1DisassociateResourceSharePermissionCommand = ...(input.resourceShareArn !== undefined && input.resourceShareArn !== null && { resourceShareArn: input.resourceShareArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -337,13 +341,14 @@ export const serializeAws_restJson1EnableSharingWithAwsOrganizationCommand = asy input: EnableSharingWithAwsOrganizationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/enablesharingwithawsorganization"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/enablesharingwithawsorganization"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -359,17 +364,17 @@ export const serializeAws_restJson1GetPermissionCommand = async ( input: GetPermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getpermission"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getpermission"; let body: any; body = JSON.stringify({ ...(input.permissionArn !== undefined && input.permissionArn !== null && { permissionArn: input.permissionArn }), ...(input.permissionVersion !== undefined && input.permissionVersion !== null && { permissionVersion: input.permissionVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -385,10 +390,11 @@ export const serializeAws_restJson1GetResourcePoliciesCommand = async ( input: GetResourcePoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getresourcepolicies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getresourcepolicies"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), @@ -399,7 +405,6 @@ export const serializeAws_restJson1GetResourcePoliciesCommand = async ( resourceArns: serializeAws_restJson1ResourceArnList(input.resourceArns, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -415,10 +420,12 @@ export const serializeAws_restJson1GetResourceShareAssociationsCommand = async ( input: GetResourceShareAssociationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getresourceshareassociations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getresourceshareassociations"; let body: any; body = JSON.stringify({ ...(input.associationStatus !== undefined && @@ -434,7 +441,6 @@ export const serializeAws_restJson1GetResourceShareAssociationsCommand = async ( resourceShareArns: serializeAws_restJson1ResourceShareArnList(input.resourceShareArns, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -450,10 +456,12 @@ export const serializeAws_restJson1GetResourceShareInvitationsCommand = async ( input: GetResourceShareInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getresourceshareinvitations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getresourceshareinvitations"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), @@ -470,7 +478,6 @@ export const serializeAws_restJson1GetResourceShareInvitationsCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -486,10 +493,11 @@ export const serializeAws_restJson1GetResourceSharesCommand = async ( input: GetResourceSharesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getresourceshares"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getresourceshares"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), @@ -506,7 +514,6 @@ export const serializeAws_restJson1GetResourceSharesCommand = async ( ...(input.tagFilters !== undefined && input.tagFilters !== null && { tagFilters: serializeAws_restJson1TagFilters(input.tagFilters, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -522,10 +529,12 @@ export const serializeAws_restJson1ListPendingInvitationResourcesCommand = async input: ListPendingInvitationResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listpendinginvitationresources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listpendinginvitationresources"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), @@ -533,7 +542,6 @@ export const serializeAws_restJson1ListPendingInvitationResourcesCommand = async ...(input.resourceShareInvitationArn !== undefined && input.resourceShareInvitationArn !== null && { resourceShareInvitationArn: input.resourceShareInvitationArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -549,17 +557,17 @@ export const serializeAws_restJson1ListPermissionsCommand = async ( input: ListPermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listpermissions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listpermissions"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), ...(input.resourceType !== undefined && input.resourceType !== null && { resourceType: input.resourceType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -575,10 +583,11 @@ export const serializeAws_restJson1ListPrincipalsCommand = async ( input: ListPrincipalsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listprincipals"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listprincipals"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), @@ -595,7 +604,6 @@ export const serializeAws_restJson1ListPrincipalsCommand = async ( }), ...(input.resourceType !== undefined && input.resourceType !== null && { resourceType: input.resourceType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -611,10 +619,11 @@ export const serializeAws_restJson1ListResourcesCommand = async ( input: ListResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listresources"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listresources"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), @@ -631,7 +640,6 @@ export const serializeAws_restJson1ListResourcesCommand = async ( }), ...(input.resourceType !== undefined && input.resourceType !== null && { resourceType: input.resourceType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -647,10 +655,12 @@ export const serializeAws_restJson1ListResourceSharePermissionsCommand = async ( input: ListResourceSharePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listresourcesharepermissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listresourcesharepermissions"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), @@ -658,7 +668,6 @@ export const serializeAws_restJson1ListResourceSharePermissionsCommand = async ( ...(input.resourceShareArn !== undefined && input.resourceShareArn !== null && { resourceShareArn: input.resourceShareArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -674,16 +683,16 @@ export const serializeAws_restJson1ListResourceTypesCommand = async ( input: ListResourceTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listresourcetypes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listresourcetypes"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -699,13 +708,14 @@ export const serializeAws_restJson1PromoteResourceShareCreatedFromPolicyCommand input: PromoteResourceShareCreatedFromPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/promoteresourcesharecreatedfrompolicy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/promoteresourcesharecreatedfrompolicy"; const query: any = { ...(input.resourceShareArn !== undefined && { resourceShareArn: input.resourceShareArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -722,17 +732,18 @@ export const serializeAws_restJson1RejectResourceShareInvitationCommand = async input: RejectResourceShareInvitationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/rejectresourceshareinvitation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/rejectresourceshareinvitation"; let body: any; body = JSON.stringify({ ...(input.clientToken !== undefined && input.clientToken !== null && { clientToken: input.clientToken }), ...(input.resourceShareInvitationArn !== undefined && input.resourceShareInvitationArn !== null && { resourceShareInvitationArn: input.resourceShareInvitationArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -748,10 +759,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tagresource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tagresource"; let body: any; body = JSON.stringify({ ...(input.resourceShareArn !== undefined && @@ -759,7 +771,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagList(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -775,10 +786,11 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/untagresource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/untagresource"; let body: any; body = JSON.stringify({ ...(input.resourceShareArn !== undefined && @@ -786,7 +798,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && input.tagKeys !== null && { tagKeys: serializeAws_restJson1TagKeyList(input.tagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -802,10 +813,11 @@ export const serializeAws_restJson1UpdateResourceShareCommand = async ( input: UpdateResourceShareCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateresourceshare"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateresourceshare"; let body: any; body = JSON.stringify({ ...(input.allowExternalPrincipals !== undefined && @@ -815,7 +827,6 @@ export const serializeAws_restJson1UpdateResourceShareCommand = async ( ...(input.resourceShareArn !== undefined && input.resourceShareArn !== null && { resourceShareArn: input.resourceShareArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-rds-data/protocols/Aws_restJson1.ts b/clients/client-rds-data/protocols/Aws_restJson1.ts index f5bec9a1e95e6..16263b9eac510 100644 --- a/clients/client-rds-data/protocols/Aws_restJson1.ts +++ b/clients/client-rds-data/protocols/Aws_restJson1.ts @@ -50,10 +50,11 @@ export const serializeAws_restJson1BatchExecuteStatementCommand = async ( input: BatchExecuteStatementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/BatchExecute"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BatchExecute"; let body: any; body = JSON.stringify({ ...(input.database !== undefined && input.database !== null && { database: input.database }), @@ -67,7 +68,6 @@ export const serializeAws_restJson1BatchExecuteStatementCommand = async ( ...(input.sql !== undefined && input.sql !== null && { sql: input.sql }), ...(input.transactionId !== undefined && input.transactionId !== null && { transactionId: input.transactionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -83,10 +83,11 @@ export const serializeAws_restJson1BeginTransactionCommand = async ( input: BeginTransactionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/BeginTransaction"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BeginTransaction"; let body: any; body = JSON.stringify({ ...(input.database !== undefined && input.database !== null && { database: input.database }), @@ -94,7 +95,6 @@ export const serializeAws_restJson1BeginTransactionCommand = async ( ...(input.schema !== undefined && input.schema !== null && { schema: input.schema }), ...(input.secretArn !== undefined && input.secretArn !== null && { secretArn: input.secretArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -110,17 +110,17 @@ export const serializeAws_restJson1CommitTransactionCommand = async ( input: CommitTransactionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CommitTransaction"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CommitTransaction"; let body: any; body = JSON.stringify({ ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), ...(input.secretArn !== undefined && input.secretArn !== null && { secretArn: input.secretArn }), ...(input.transactionId !== undefined && input.transactionId !== null && { transactionId: input.transactionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -136,10 +136,11 @@ export const serializeAws_restJson1ExecuteSqlCommand = async ( input: ExecuteSqlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ExecuteSql"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ExecuteSql"; let body: any; body = JSON.stringify({ ...(input.awsSecretStoreArn !== undefined && @@ -150,7 +151,6 @@ export const serializeAws_restJson1ExecuteSqlCommand = async ( ...(input.schema !== undefined && input.schema !== null && { schema: input.schema }), ...(input.sqlStatements !== undefined && input.sqlStatements !== null && { sqlStatements: input.sqlStatements }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -166,10 +166,11 @@ export const serializeAws_restJson1ExecuteStatementCommand = async ( input: ExecuteStatementCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/Execute"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/Execute"; let body: any; body = JSON.stringify({ ...(input.continueAfterTimeout !== undefined && @@ -189,7 +190,6 @@ export const serializeAws_restJson1ExecuteStatementCommand = async ( ...(input.sql !== undefined && input.sql !== null && { sql: input.sql }), ...(input.transactionId !== undefined && input.transactionId !== null && { transactionId: input.transactionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -205,17 +205,17 @@ export const serializeAws_restJson1RollbackTransactionCommand = async ( input: RollbackTransactionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/RollbackTransaction"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/RollbackTransaction"; let body: any; body = JSON.stringify({ ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), ...(input.secretArn !== undefined && input.secretArn !== null && { secretArn: input.secretArn }), ...(input.transactionId !== undefined && input.transactionId !== null && { transactionId: input.transactionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-resource-groups/protocols/Aws_restJson1.ts b/clients/client-resource-groups/protocols/Aws_restJson1.ts index d14955bb196e4..da754b2808b03 100644 --- a/clients/client-resource-groups/protocols/Aws_restJson1.ts +++ b/clients/client-resource-groups/protocols/Aws_restJson1.ts @@ -61,10 +61,11 @@ export const serializeAws_restJson1CreateGroupCommand = async ( input: CreateGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/groups"; let body: any; body = JSON.stringify({ ...(input.Configuration !== undefined && @@ -79,7 +80,6 @@ export const serializeAws_restJson1CreateGroupCommand = async ( }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -95,16 +95,16 @@ export const serializeAws_restJson1DeleteGroupCommand = async ( input: DeleteGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/delete-group"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/delete-group"; let body: any; body = JSON.stringify({ ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }), ...(input.GroupName !== undefined && input.GroupName !== null && { GroupName: input.GroupName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -120,16 +120,16 @@ export const serializeAws_restJson1GetGroupCommand = async ( input: GetGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/get-group"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/get-group"; let body: any; body = JSON.stringify({ ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }), ...(input.GroupName !== undefined && input.GroupName !== null && { GroupName: input.GroupName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -145,15 +145,15 @@ export const serializeAws_restJson1GetGroupConfigurationCommand = async ( input: GetGroupConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/get-group-configuration"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/get-group-configuration"; let body: any; body = JSON.stringify({ ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -169,16 +169,16 @@ export const serializeAws_restJson1GetGroupQueryCommand = async ( input: GetGroupQueryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/get-group-query"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/get-group-query"; let body: any; body = JSON.stringify({ ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }), ...(input.GroupName !== undefined && input.GroupName !== null && { GroupName: input.GroupName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -194,8 +194,9 @@ export const serializeAws_restJson1GetTagsCommand = async ( input: GetTagsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/resources/{Arn}/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resources/{Arn}/tags"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -206,7 +207,6 @@ export const serializeAws_restJson1GetTagsCommand = async ( throw new Error("No value provided for input HTTP label: Arn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -222,10 +222,11 @@ export const serializeAws_restJson1GroupResourcesCommand = async ( input: GroupResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/group-resources"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/group-resources"; let body: any; body = JSON.stringify({ ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }), @@ -234,7 +235,6 @@ export const serializeAws_restJson1GroupResourcesCommand = async ( ResourceArns: serializeAws_restJson1ResourceArnList(input.ResourceArns, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -250,10 +250,11 @@ export const serializeAws_restJson1ListGroupResourcesCommand = async ( input: ListGroupResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/list-group-resources"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/list-group-resources"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -263,7 +264,6 @@ export const serializeAws_restJson1ListGroupResourcesCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -279,10 +279,11 @@ export const serializeAws_restJson1ListGroupsCommand = async ( input: ListGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/groups-list"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/groups-list"; const query: any = { ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), @@ -292,7 +293,6 @@ export const serializeAws_restJson1ListGroupsCommand = async ( ...(input.Filters !== undefined && input.Filters !== null && { Filters: serializeAws_restJson1GroupFilterList(input.Filters, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -309,10 +309,11 @@ export const serializeAws_restJson1PutGroupConfigurationCommand = async ( input: PutGroupConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/put-group-configuration"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/put-group-configuration"; let body: any; body = JSON.stringify({ ...(input.Configuration !== undefined && @@ -321,7 +322,6 @@ export const serializeAws_restJson1PutGroupConfigurationCommand = async ( }), ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -337,10 +337,11 @@ export const serializeAws_restJson1SearchResourcesCommand = async ( input: SearchResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/resources/search"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resources/search"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -350,7 +351,6 @@ export const serializeAws_restJson1SearchResourcesCommand = async ( ResourceQuery: serializeAws_restJson1ResourceQuery(input.ResourceQuery, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -366,10 +366,11 @@ export const serializeAws_restJson1TagCommand = async ( input: TagCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/resources/{Arn}/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resources/{Arn}/tags"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -383,7 +384,6 @@ export const serializeAws_restJson1TagCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -399,10 +399,11 @@ export const serializeAws_restJson1UngroupResourcesCommand = async ( input: UngroupResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ungroup-resources"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ungroup-resources"; let body: any; body = JSON.stringify({ ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }), @@ -411,7 +412,6 @@ export const serializeAws_restJson1UngroupResourcesCommand = async ( ResourceArns: serializeAws_restJson1ResourceArnList(input.ResourceArns, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -427,10 +427,11 @@ export const serializeAws_restJson1UntagCommand = async ( input: UntagCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/resources/{Arn}/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/resources/{Arn}/tags"; if (input.Arn !== undefined) { const labelValue: string = input.Arn; if (labelValue.length <= 0) { @@ -445,7 +446,6 @@ export const serializeAws_restJson1UntagCommand = async ( ...(input.Keys !== undefined && input.Keys !== null && { Keys: serializeAws_restJson1TagKeyList(input.Keys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -461,17 +461,17 @@ export const serializeAws_restJson1UpdateGroupCommand = async ( input: UpdateGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/update-group"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/update-group"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }), ...(input.GroupName !== undefined && input.GroupName !== null && { GroupName: input.GroupName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -487,10 +487,11 @@ export const serializeAws_restJson1UpdateGroupQueryCommand = async ( input: UpdateGroupQueryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/update-group-query"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/update-group-query"; let body: any; body = JSON.stringify({ ...(input.Group !== undefined && input.Group !== null && { Group: input.Group }), @@ -500,7 +501,6 @@ export const serializeAws_restJson1UpdateGroupQueryCommand = async ( ResourceQuery: serializeAws_restJson1ResourceQuery(input.ResourceQuery, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-robomaker/protocols/Aws_restJson1.ts b/clients/client-robomaker/protocols/Aws_restJson1.ts index 5e90660984bfe..1f9ba3f4a3907 100644 --- a/clients/client-robomaker/protocols/Aws_restJson1.ts +++ b/clients/client-robomaker/protocols/Aws_restJson1.ts @@ -251,16 +251,16 @@ export const serializeAws_restJson1BatchDeleteWorldsCommand = async ( input: BatchDeleteWorldsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/batchDeleteWorlds"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/batchDeleteWorlds"; let body: any; body = JSON.stringify({ ...(input.worlds !== undefined && input.worlds !== null && { worlds: serializeAws_restJson1Arns(input.worlds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -276,15 +276,16 @@ export const serializeAws_restJson1BatchDescribeSimulationJobCommand = async ( input: BatchDescribeSimulationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/batchDescribeSimulationJob"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/batchDescribeSimulationJob"; let body: any; body = JSON.stringify({ ...(input.jobs !== undefined && input.jobs !== null && { jobs: serializeAws_restJson1Arns(input.jobs, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -300,15 +301,15 @@ export const serializeAws_restJson1CancelDeploymentJobCommand = async ( input: CancelDeploymentJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/cancelDeploymentJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cancelDeploymentJob"; let body: any; body = JSON.stringify({ ...(input.job !== undefined && input.job !== null && { job: input.job }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -324,15 +325,15 @@ export const serializeAws_restJson1CancelSimulationJobCommand = async ( input: CancelSimulationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/cancelSimulationJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cancelSimulationJob"; let body: any; body = JSON.stringify({ ...(input.job !== undefined && input.job !== null && { job: input.job }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -348,15 +349,16 @@ export const serializeAws_restJson1CancelSimulationJobBatchCommand = async ( input: CancelSimulationJobBatchCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/cancelSimulationJobBatch"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cancelSimulationJobBatch"; let body: any; body = JSON.stringify({ ...(input.batch !== undefined && input.batch !== null && { batch: input.batch }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -372,15 +374,15 @@ export const serializeAws_restJson1CancelWorldExportJobCommand = async ( input: CancelWorldExportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/cancelWorldExportJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cancelWorldExportJob"; let body: any; body = JSON.stringify({ ...(input.job !== undefined && input.job !== null && { job: input.job }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -396,15 +398,16 @@ export const serializeAws_restJson1CancelWorldGenerationJobCommand = async ( input: CancelWorldGenerationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/cancelWorldGenerationJob"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/cancelWorldGenerationJob"; let body: any; body = JSON.stringify({ ...(input.job !== undefined && input.job !== null && { job: input.job }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -420,10 +423,11 @@ export const serializeAws_restJson1CreateDeploymentJobCommand = async ( input: CreateDeploymentJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createDeploymentJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createDeploymentJob"; let body: any; body = JSON.stringify({ clientRequestToken: input.clientRequestToken ?? generateIdempotencyToken(), @@ -441,7 +445,6 @@ export const serializeAws_restJson1CreateDeploymentJobCommand = async ( ...(input.fleet !== undefined && input.fleet !== null && { fleet: input.fleet }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -457,16 +460,16 @@ export const serializeAws_restJson1CreateFleetCommand = async ( input: CreateFleetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createFleet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createFleet"; let body: any; body = JSON.stringify({ ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -482,10 +485,11 @@ export const serializeAws_restJson1CreateRobotCommand = async ( input: CreateRobotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createRobot"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createRobot"; let body: any; body = JSON.stringify({ ...(input.architecture !== undefined && input.architecture !== null && { architecture: input.architecture }), @@ -494,7 +498,6 @@ export const serializeAws_restJson1CreateRobotCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -510,10 +513,11 @@ export const serializeAws_restJson1CreateRobotApplicationCommand = async ( input: CreateRobotApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createRobotApplication"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createRobotApplication"; let body: any; body = JSON.stringify({ ...(input.name !== undefined && input.name !== null && { name: input.name }), @@ -525,7 +529,6 @@ export const serializeAws_restJson1CreateRobotApplicationCommand = async ( input.sources !== null && { sources: serializeAws_restJson1SourceConfigs(input.sources, context) }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -541,17 +544,18 @@ export const serializeAws_restJson1CreateRobotApplicationVersionCommand = async input: CreateRobotApplicationVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createRobotApplicationVersion"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createRobotApplicationVersion"; let body: any; body = JSON.stringify({ ...(input.application !== undefined && input.application !== null && { application: input.application }), ...(input.currentRevisionId !== undefined && input.currentRevisionId !== null && { currentRevisionId: input.currentRevisionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -567,10 +571,12 @@ export const serializeAws_restJson1CreateSimulationApplicationCommand = async ( input: CreateSimulationApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createSimulationApplication"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createSimulationApplication"; let body: any; body = JSON.stringify({ ...(input.name !== undefined && input.name !== null && { name: input.name }), @@ -590,7 +596,6 @@ export const serializeAws_restJson1CreateSimulationApplicationCommand = async ( input.sources !== null && { sources: serializeAws_restJson1SourceConfigs(input.sources, context) }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -606,17 +611,18 @@ export const serializeAws_restJson1CreateSimulationApplicationVersionCommand = a input: CreateSimulationApplicationVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createSimulationApplicationVersion"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createSimulationApplicationVersion"; let body: any; body = JSON.stringify({ ...(input.application !== undefined && input.application !== null && { application: input.application }), ...(input.currentRevisionId !== undefined && input.currentRevisionId !== null && { currentRevisionId: input.currentRevisionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -632,10 +638,11 @@ export const serializeAws_restJson1CreateSimulationJobCommand = async ( input: CreateSimulationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createSimulationJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createSimulationJob"; let body: any; body = JSON.stringify({ clientRequestToken: input.clientRequestToken ?? generateIdempotencyToken(), @@ -673,7 +680,6 @@ export const serializeAws_restJson1CreateSimulationJobCommand = async ( ...(input.vpcConfig !== undefined && input.vpcConfig !== null && { vpcConfig: serializeAws_restJson1VPCConfig(input.vpcConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -689,10 +695,11 @@ export const serializeAws_restJson1CreateWorldExportJobCommand = async ( input: CreateWorldExportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createWorldExportJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createWorldExportJob"; let body: any; body = JSON.stringify({ clientRequestToken: input.clientRequestToken ?? generateIdempotencyToken(), @@ -705,7 +712,6 @@ export const serializeAws_restJson1CreateWorldExportJobCommand = async ( ...(input.worlds !== undefined && input.worlds !== null && { worlds: serializeAws_restJson1Arns(input.worlds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -721,10 +727,12 @@ export const serializeAws_restJson1CreateWorldGenerationJobCommand = async ( input: CreateWorldGenerationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createWorldGenerationJob"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createWorldGenerationJob"; let body: any; body = JSON.stringify({ clientRequestToken: input.clientRequestToken ?? generateIdempotencyToken(), @@ -735,7 +743,6 @@ export const serializeAws_restJson1CreateWorldGenerationJobCommand = async ( ...(input.worldTags !== undefined && input.worldTags !== null && { worldTags: serializeAws_restJson1TagMap(input.worldTags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -751,10 +758,11 @@ export const serializeAws_restJson1CreateWorldTemplateCommand = async ( input: CreateWorldTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createWorldTemplate"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createWorldTemplate"; let body: any; body = JSON.stringify({ ...(input.clientRequestToken !== undefined && @@ -767,7 +775,6 @@ export const serializeAws_restJson1CreateWorldTemplateCommand = async ( templateLocation: serializeAws_restJson1TemplateLocation(input.templateLocation, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -783,15 +790,15 @@ export const serializeAws_restJson1DeleteFleetCommand = async ( input: DeleteFleetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteFleet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteFleet"; let body: any; body = JSON.stringify({ ...(input.fleet !== undefined && input.fleet !== null && { fleet: input.fleet }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -807,15 +814,15 @@ export const serializeAws_restJson1DeleteRobotCommand = async ( input: DeleteRobotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteRobot"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteRobot"; let body: any; body = JSON.stringify({ ...(input.robot !== undefined && input.robot !== null && { robot: input.robot }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -831,17 +838,17 @@ export const serializeAws_restJson1DeleteRobotApplicationCommand = async ( input: DeleteRobotApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteRobotApplication"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteRobotApplication"; let body: any; body = JSON.stringify({ ...(input.application !== undefined && input.application !== null && { application: input.application }), ...(input.applicationVersion !== undefined && input.applicationVersion !== null && { applicationVersion: input.applicationVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -857,17 +864,18 @@ export const serializeAws_restJson1DeleteSimulationApplicationCommand = async ( input: DeleteSimulationApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteSimulationApplication"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteSimulationApplication"; let body: any; body = JSON.stringify({ ...(input.application !== undefined && input.application !== null && { application: input.application }), ...(input.applicationVersion !== undefined && input.applicationVersion !== null && { applicationVersion: input.applicationVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -883,15 +891,15 @@ export const serializeAws_restJson1DeleteWorldTemplateCommand = async ( input: DeleteWorldTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteWorldTemplate"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteWorldTemplate"; let body: any; body = JSON.stringify({ ...(input.template !== undefined && input.template !== null && { template: input.template }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -907,16 +915,16 @@ export const serializeAws_restJson1DeregisterRobotCommand = async ( input: DeregisterRobotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deregisterRobot"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deregisterRobot"; let body: any; body = JSON.stringify({ ...(input.fleet !== undefined && input.fleet !== null && { fleet: input.fleet }), ...(input.robot !== undefined && input.robot !== null && { robot: input.robot }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -932,15 +940,15 @@ export const serializeAws_restJson1DescribeDeploymentJobCommand = async ( input: DescribeDeploymentJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeDeploymentJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeDeploymentJob"; let body: any; body = JSON.stringify({ ...(input.job !== undefined && input.job !== null && { job: input.job }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -956,15 +964,15 @@ export const serializeAws_restJson1DescribeFleetCommand = async ( input: DescribeFleetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeFleet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeFleet"; let body: any; body = JSON.stringify({ ...(input.fleet !== undefined && input.fleet !== null && { fleet: input.fleet }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -980,15 +988,15 @@ export const serializeAws_restJson1DescribeRobotCommand = async ( input: DescribeRobotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeRobot"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeRobot"; let body: any; body = JSON.stringify({ ...(input.robot !== undefined && input.robot !== null && { robot: input.robot }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1004,17 +1012,18 @@ export const serializeAws_restJson1DescribeRobotApplicationCommand = async ( input: DescribeRobotApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeRobotApplication"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeRobotApplication"; let body: any; body = JSON.stringify({ ...(input.application !== undefined && input.application !== null && { application: input.application }), ...(input.applicationVersion !== undefined && input.applicationVersion !== null && { applicationVersion: input.applicationVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1030,17 +1039,18 @@ export const serializeAws_restJson1DescribeSimulationApplicationCommand = async input: DescribeSimulationApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeSimulationApplication"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeSimulationApplication"; let body: any; body = JSON.stringify({ ...(input.application !== undefined && input.application !== null && { application: input.application }), ...(input.applicationVersion !== undefined && input.applicationVersion !== null && { applicationVersion: input.applicationVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1056,15 +1066,15 @@ export const serializeAws_restJson1DescribeSimulationJobCommand = async ( input: DescribeSimulationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeSimulationJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeSimulationJob"; let body: any; body = JSON.stringify({ ...(input.job !== undefined && input.job !== null && { job: input.job }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1080,15 +1090,16 @@ export const serializeAws_restJson1DescribeSimulationJobBatchCommand = async ( input: DescribeSimulationJobBatchCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeSimulationJobBatch"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeSimulationJobBatch"; let body: any; body = JSON.stringify({ ...(input.batch !== undefined && input.batch !== null && { batch: input.batch }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1104,15 +1115,15 @@ export const serializeAws_restJson1DescribeWorldCommand = async ( input: DescribeWorldCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeWorld"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeWorld"; let body: any; body = JSON.stringify({ ...(input.world !== undefined && input.world !== null && { world: input.world }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1128,15 +1139,15 @@ export const serializeAws_restJson1DescribeWorldExportJobCommand = async ( input: DescribeWorldExportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeWorldExportJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeWorldExportJob"; let body: any; body = JSON.stringify({ ...(input.job !== undefined && input.job !== null && { job: input.job }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1152,15 +1163,16 @@ export const serializeAws_restJson1DescribeWorldGenerationJobCommand = async ( input: DescribeWorldGenerationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeWorldGenerationJob"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeWorldGenerationJob"; let body: any; body = JSON.stringify({ ...(input.job !== undefined && input.job !== null && { job: input.job }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1176,15 +1188,15 @@ export const serializeAws_restJson1DescribeWorldTemplateCommand = async ( input: DescribeWorldTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeWorldTemplate"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeWorldTemplate"; let body: any; body = JSON.stringify({ ...(input.template !== undefined && input.template !== null && { template: input.template }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1200,16 +1212,16 @@ export const serializeAws_restJson1GetWorldTemplateBodyCommand = async ( input: GetWorldTemplateBodyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getWorldTemplateBody"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getWorldTemplateBody"; let body: any; body = JSON.stringify({ ...(input.generationJob !== undefined && input.generationJob !== null && { generationJob: input.generationJob }), ...(input.template !== undefined && input.template !== null && { template: input.template }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1225,10 +1237,11 @@ export const serializeAws_restJson1ListDeploymentJobsCommand = async ( input: ListDeploymentJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listDeploymentJobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listDeploymentJobs"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1236,7 +1249,6 @@ export const serializeAws_restJson1ListDeploymentJobsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1252,10 +1264,11 @@ export const serializeAws_restJson1ListFleetsCommand = async ( input: ListFleetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listFleets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listFleets"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1263,7 +1276,6 @@ export const serializeAws_restJson1ListFleetsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1279,10 +1291,11 @@ export const serializeAws_restJson1ListRobotApplicationsCommand = async ( input: ListRobotApplicationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listRobotApplications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listRobotApplications"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1292,7 +1305,6 @@ export const serializeAws_restJson1ListRobotApplicationsCommand = async ( ...(input.versionQualifier !== undefined && input.versionQualifier !== null && { versionQualifier: input.versionQualifier }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1308,10 +1320,11 @@ export const serializeAws_restJson1ListRobotsCommand = async ( input: ListRobotsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listRobots"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listRobots"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1319,7 +1332,6 @@ export const serializeAws_restJson1ListRobotsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1335,10 +1347,12 @@ export const serializeAws_restJson1ListSimulationApplicationsCommand = async ( input: ListSimulationApplicationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listSimulationApplications"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listSimulationApplications"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1348,7 +1362,6 @@ export const serializeAws_restJson1ListSimulationApplicationsCommand = async ( ...(input.versionQualifier !== undefined && input.versionQualifier !== null && { versionQualifier: input.versionQualifier }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1364,10 +1377,12 @@ export const serializeAws_restJson1ListSimulationJobBatchesCommand = async ( input: ListSimulationJobBatchesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listSimulationJobBatches"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listSimulationJobBatches"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1375,7 +1390,6 @@ export const serializeAws_restJson1ListSimulationJobBatchesCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1391,10 +1405,11 @@ export const serializeAws_restJson1ListSimulationJobsCommand = async ( input: ListSimulationJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listSimulationJobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listSimulationJobs"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1402,7 +1417,6 @@ export const serializeAws_restJson1ListSimulationJobsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1418,8 +1432,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1430,7 +1445,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1446,10 +1460,11 @@ export const serializeAws_restJson1ListWorldExportJobsCommand = async ( input: ListWorldExportJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listWorldExportJobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listWorldExportJobs"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1457,7 +1472,6 @@ export const serializeAws_restJson1ListWorldExportJobsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1473,10 +1487,11 @@ export const serializeAws_restJson1ListWorldGenerationJobsCommand = async ( input: ListWorldGenerationJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listWorldGenerationJobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listWorldGenerationJobs"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1484,7 +1499,6 @@ export const serializeAws_restJson1ListWorldGenerationJobsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1500,10 +1514,11 @@ export const serializeAws_restJson1ListWorldsCommand = async ( input: ListWorldsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listWorlds"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listWorlds"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -1511,7 +1526,6 @@ export const serializeAws_restJson1ListWorldsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1527,16 +1541,16 @@ export const serializeAws_restJson1ListWorldTemplatesCommand = async ( input: ListWorldTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listWorldTemplates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listWorldTemplates"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1552,16 +1566,16 @@ export const serializeAws_restJson1RegisterRobotCommand = async ( input: RegisterRobotCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/registerRobot"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/registerRobot"; let body: any; body = JSON.stringify({ ...(input.fleet !== undefined && input.fleet !== null && { fleet: input.fleet }), ...(input.robot !== undefined && input.robot !== null && { robot: input.robot }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1577,15 +1591,15 @@ export const serializeAws_restJson1RestartSimulationJobCommand = async ( input: RestartSimulationJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restartSimulationJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restartSimulationJob"; let body: any; body = JSON.stringify({ ...(input.job !== undefined && input.job !== null && { job: input.job }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1601,10 +1615,11 @@ export const serializeAws_restJson1StartSimulationJobBatchCommand = async ( input: StartSimulationJobBatchCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/startSimulationJobBatch"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/startSimulationJobBatch"; let body: any; body = JSON.stringify({ ...(input.batchPolicy !== undefined && @@ -1619,7 +1634,6 @@ export const serializeAws_restJson1StartSimulationJobBatchCommand = async ( }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1635,16 +1649,16 @@ export const serializeAws_restJson1SyncDeploymentJobCommand = async ( input: SyncDeploymentJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/syncDeploymentJob"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/syncDeploymentJob"; let body: any; body = JSON.stringify({ clientRequestToken: input.clientRequestToken ?? generateIdempotencyToken(), ...(input.fleet !== undefined && input.fleet !== null && { fleet: input.fleet }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1660,10 +1674,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1677,7 +1692,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1693,8 +1707,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -1708,7 +1723,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1725,10 +1739,11 @@ export const serializeAws_restJson1UpdateRobotApplicationCommand = async ( input: UpdateRobotApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateRobotApplication"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateRobotApplication"; let body: any; body = JSON.stringify({ ...(input.application !== undefined && input.application !== null && { application: input.application }), @@ -1741,7 +1756,6 @@ export const serializeAws_restJson1UpdateRobotApplicationCommand = async ( ...(input.sources !== undefined && input.sources !== null && { sources: serializeAws_restJson1SourceConfigs(input.sources, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1757,10 +1771,12 @@ export const serializeAws_restJson1UpdateSimulationApplicationCommand = async ( input: UpdateSimulationApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateSimulationApplication"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateSimulationApplication"; let body: any; body = JSON.stringify({ ...(input.application !== undefined && input.application !== null && { application: input.application }), @@ -1781,7 +1797,6 @@ export const serializeAws_restJson1UpdateSimulationApplicationCommand = async ( ...(input.sources !== undefined && input.sources !== null && { sources: serializeAws_restJson1SourceConfigs(input.sources, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1797,10 +1812,11 @@ export const serializeAws_restJson1UpdateWorldTemplateCommand = async ( input: UpdateWorldTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateWorldTemplate"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateWorldTemplate"; let body: any; body = JSON.stringify({ ...(input.name !== undefined && input.name !== null && { name: input.name }), @@ -1811,7 +1827,6 @@ export const serializeAws_restJson1UpdateWorldTemplateCommand = async ( templateLocation: serializeAws_restJson1TemplateLocation(input.templateLocation, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-route-53/protocols/Aws_restXml.ts b/clients/client-route-53/protocols/Aws_restXml.ts index f401a130c780e..09b71259f00c1 100644 --- a/clients/client-route-53/protocols/Aws_restXml.ts +++ b/clients/client-route-53/protocols/Aws_restXml.ts @@ -320,8 +320,11 @@ export const serializeAws_restXmlActivateKeySigningKeyCommand = async ( input: ActivateKeySigningKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/keysigningkey/{HostedZoneId}/{Name}/activate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/keysigningkey/{HostedZoneId}/{Name}/activate"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -341,7 +344,6 @@ export const serializeAws_restXmlActivateKeySigningKeyCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -357,10 +359,13 @@ export const serializeAws_restXmlAssociateVPCWithHostedZoneCommand = async ( input: AssociateVPCWithHostedZoneCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/hostedzone/{HostedZoneId}/associatevpc"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzone/{HostedZoneId}/associatevpc"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -383,7 +388,6 @@ export const serializeAws_restXmlAssociateVPCWithHostedZoneCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -399,10 +403,13 @@ export const serializeAws_restXmlChangeResourceRecordSetsCommand = async ( input: ChangeResourceRecordSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/hostedzone/{HostedZoneId}/rrset"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzone/{HostedZoneId}/rrset"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -421,7 +428,6 @@ export const serializeAws_restXmlChangeResourceRecordSetsCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -437,10 +443,13 @@ export const serializeAws_restXmlChangeTagsForResourceCommand = async ( input: ChangeTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/tags/{ResourceType}/{ResourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/tags/{ResourceType}/{ResourceId}"; if (input.ResourceType !== undefined) { const labelValue: string = input.ResourceType; if (labelValue.length <= 0) { @@ -480,7 +489,6 @@ export const serializeAws_restXmlChangeTagsForResourceCommand = async ( bodyNode.addChildNode(containerNode); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -496,10 +504,11 @@ export const serializeAws_restXmlCreateHealthCheckCommand = async ( input: CreateHealthCheckCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/healthcheck"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/healthcheck"; let body: any; body = ''; const bodyNode = new __XmlNode("CreateHealthCheckRequest"); @@ -515,7 +524,6 @@ export const serializeAws_restXmlCreateHealthCheckCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -531,10 +539,11 @@ export const serializeAws_restXmlCreateHostedZoneCommand = async ( input: CreateHostedZoneCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/hostedzone"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/hostedzone"; let body: any; body = ''; const bodyNode = new __XmlNode("CreateHostedZoneRequest"); @@ -562,7 +571,6 @@ export const serializeAws_restXmlCreateHostedZoneCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -578,10 +586,12 @@ export const serializeAws_restXmlCreateKeySigningKeyCommand = async ( input: CreateKeySigningKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/keysigningkey"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/keysigningkey"; let body: any; body = ''; const bodyNode = new __XmlNode("CreateKeySigningKeyRequest"); @@ -609,7 +619,6 @@ export const serializeAws_restXmlCreateKeySigningKeyCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -625,10 +634,12 @@ export const serializeAws_restXmlCreateQueryLoggingConfigCommand = async ( input: CreateQueryLoggingConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/queryloggingconfig"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/queryloggingconfig"; let body: any; body = ''; const bodyNode = new __XmlNode("CreateQueryLoggingConfigRequest"); @@ -644,7 +655,6 @@ export const serializeAws_restXmlCreateQueryLoggingConfigCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -660,10 +670,12 @@ export const serializeAws_restXmlCreateReusableDelegationSetCommand = async ( input: CreateReusableDelegationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/delegationset"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/delegationset"; let body: any; body = ''; const bodyNode = new __XmlNode("CreateReusableDelegationSetRequest"); @@ -677,7 +689,6 @@ export const serializeAws_restXmlCreateReusableDelegationSetCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -693,10 +704,12 @@ export const serializeAws_restXmlCreateTrafficPolicyCommand = async ( input: CreateTrafficPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/trafficpolicy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicy"; let body: any; body = ''; const bodyNode = new __XmlNode("CreateTrafficPolicyRequest"); @@ -716,7 +729,6 @@ export const serializeAws_restXmlCreateTrafficPolicyCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -732,10 +744,12 @@ export const serializeAws_restXmlCreateTrafficPolicyInstanceCommand = async ( input: CreateTrafficPolicyInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/trafficpolicyinstance"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicyinstance"; let body: any; body = ''; const bodyNode = new __XmlNode("CreateTrafficPolicyInstanceRequest"); @@ -765,7 +779,6 @@ export const serializeAws_restXmlCreateTrafficPolicyInstanceCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -781,10 +794,12 @@ export const serializeAws_restXmlCreateTrafficPolicyVersionCommand = async ( input: CreateTrafficPolicyVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/trafficpolicy/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicy/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -809,7 +824,6 @@ export const serializeAws_restXmlCreateTrafficPolicyVersionCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -825,10 +839,13 @@ export const serializeAws_restXmlCreateVPCAssociationAuthorizationCommand = asyn input: CreateVPCAssociationAuthorizationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/hostedzone/{HostedZoneId}/authorizevpcassociation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzone/{HostedZoneId}/authorizevpcassociation"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -847,7 +864,6 @@ export const serializeAws_restXmlCreateVPCAssociationAuthorizationCommand = asyn bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -863,8 +879,11 @@ export const serializeAws_restXmlDeactivateKeySigningKeyCommand = async ( input: DeactivateKeySigningKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/keysigningkey/{HostedZoneId}/{Name}/deactivate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/keysigningkey/{HostedZoneId}/{Name}/deactivate"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -884,7 +903,6 @@ export const serializeAws_restXmlDeactivateKeySigningKeyCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -900,8 +918,10 @@ export const serializeAws_restXmlDeleteHealthCheckCommand = async ( input: DeleteHealthCheckCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/healthcheck/{HealthCheckId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/healthcheck/{HealthCheckId}"; if (input.HealthCheckId !== undefined) { const labelValue: string = input.HealthCheckId; if (labelValue.length <= 0) { @@ -912,7 +932,6 @@ export const serializeAws_restXmlDeleteHealthCheckCommand = async ( throw new Error("No value provided for input HTTP label: HealthCheckId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -928,8 +947,10 @@ export const serializeAws_restXmlDeleteHostedZoneCommand = async ( input: DeleteHostedZoneCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzone/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/hostedzone/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -940,7 +961,6 @@ export const serializeAws_restXmlDeleteHostedZoneCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -956,8 +976,11 @@ export const serializeAws_restXmlDeleteKeySigningKeyCommand = async ( input: DeleteKeySigningKeyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/keysigningkey/{HostedZoneId}/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/keysigningkey/{HostedZoneId}/{Name}"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -977,7 +1000,6 @@ export const serializeAws_restXmlDeleteKeySigningKeyCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -993,8 +1015,10 @@ export const serializeAws_restXmlDeleteQueryLoggingConfigCommand = async ( input: DeleteQueryLoggingConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/queryloggingconfig/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/queryloggingconfig/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1005,7 +1029,6 @@ export const serializeAws_restXmlDeleteQueryLoggingConfigCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1021,8 +1044,10 @@ export const serializeAws_restXmlDeleteReusableDelegationSetCommand = async ( input: DeleteReusableDelegationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/delegationset/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/delegationset/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1033,7 +1058,6 @@ export const serializeAws_restXmlDeleteReusableDelegationSetCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1049,8 +1073,10 @@ export const serializeAws_restXmlDeleteTrafficPolicyCommand = async ( input: DeleteTrafficPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/trafficpolicy/{Id}/{Version}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicy/{Id}/{Version}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1070,7 +1096,6 @@ export const serializeAws_restXmlDeleteTrafficPolicyCommand = async ( throw new Error("No value provided for input HTTP label: Version."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1086,8 +1111,10 @@ export const serializeAws_restXmlDeleteTrafficPolicyInstanceCommand = async ( input: DeleteTrafficPolicyInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/trafficpolicyinstance/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicyinstance/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1098,7 +1125,6 @@ export const serializeAws_restXmlDeleteTrafficPolicyInstanceCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1114,10 +1140,13 @@ export const serializeAws_restXmlDeleteVPCAssociationAuthorizationCommand = asyn input: DeleteVPCAssociationAuthorizationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/hostedzone/{HostedZoneId}/deauthorizevpcassociation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzone/{HostedZoneId}/deauthorizevpcassociation"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -1136,7 +1165,6 @@ export const serializeAws_restXmlDeleteVPCAssociationAuthorizationCommand = asyn bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1152,8 +1180,11 @@ export const serializeAws_restXmlDisableHostedZoneDNSSECCommand = async ( input: DisableHostedZoneDNSSECCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzone/{HostedZoneId}/disable-dnssec"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzone/{HostedZoneId}/disable-dnssec"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -1164,7 +1195,6 @@ export const serializeAws_restXmlDisableHostedZoneDNSSECCommand = async ( throw new Error("No value provided for input HTTP label: HostedZoneId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1180,10 +1210,13 @@ export const serializeAws_restXmlDisassociateVPCFromHostedZoneCommand = async ( input: DisassociateVPCFromHostedZoneCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/hostedzone/{HostedZoneId}/disassociatevpc"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzone/{HostedZoneId}/disassociatevpc"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -1206,7 +1239,6 @@ export const serializeAws_restXmlDisassociateVPCFromHostedZoneCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1222,8 +1254,11 @@ export const serializeAws_restXmlEnableHostedZoneDNSSECCommand = async ( input: EnableHostedZoneDNSSECCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzone/{HostedZoneId}/enable-dnssec"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzone/{HostedZoneId}/enable-dnssec"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -1234,7 +1269,6 @@ export const serializeAws_restXmlEnableHostedZoneDNSSECCommand = async ( throw new Error("No value provided for input HTTP label: HostedZoneId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1250,8 +1284,10 @@ export const serializeAws_restXmlGetAccountLimitCommand = async ( input: GetAccountLimitCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/accountlimit/{Type}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/accountlimit/{Type}"; if (input.Type !== undefined) { const labelValue: string = input.Type; if (labelValue.length <= 0) { @@ -1262,7 +1298,6 @@ export const serializeAws_restXmlGetAccountLimitCommand = async ( throw new Error("No value provided for input HTTP label: Type."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1278,8 +1313,9 @@ export const serializeAws_restXmlGetChangeCommand = async ( input: GetChangeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/change/{Id}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/change/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1290,7 +1326,6 @@ export const serializeAws_restXmlGetChangeCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1306,13 +1341,14 @@ export const serializeAws_restXmlGetCheckerIpRangesCommand = async ( input: GetCheckerIpRangesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/checkeripranges"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/checkeripranges"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1328,8 +1364,11 @@ export const serializeAws_restXmlGetDNSSECCommand = async ( input: GetDNSSECCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzone/{HostedZoneId}/dnssec"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzone/{HostedZoneId}/dnssec"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -1340,7 +1379,6 @@ export const serializeAws_restXmlGetDNSSECCommand = async ( throw new Error("No value provided for input HTTP label: HostedZoneId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1356,15 +1394,15 @@ export const serializeAws_restXmlGetGeoLocationCommand = async ( input: GetGeoLocationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/geolocation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/geolocation"; const query: any = { ...(input.ContinentCode !== undefined && { continentcode: input.ContinentCode }), ...(input.CountryCode !== undefined && { countrycode: input.CountryCode }), ...(input.SubdivisionCode !== undefined && { subdivisioncode: input.SubdivisionCode }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1381,8 +1419,10 @@ export const serializeAws_restXmlGetHealthCheckCommand = async ( input: GetHealthCheckCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/healthcheck/{HealthCheckId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/healthcheck/{HealthCheckId}"; if (input.HealthCheckId !== undefined) { const labelValue: string = input.HealthCheckId; if (labelValue.length <= 0) { @@ -1393,7 +1433,6 @@ export const serializeAws_restXmlGetHealthCheckCommand = async ( throw new Error("No value provided for input HTTP label: HealthCheckId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1409,13 +1448,14 @@ export const serializeAws_restXmlGetHealthCheckCountCommand = async ( input: GetHealthCheckCountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/healthcheckcount"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/healthcheckcount"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1431,8 +1471,11 @@ export const serializeAws_restXmlGetHealthCheckLastFailureReasonCommand = async input: GetHealthCheckLastFailureReasonCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/healthcheck/{HealthCheckId}/lastfailurereason"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/healthcheck/{HealthCheckId}/lastfailurereason"; if (input.HealthCheckId !== undefined) { const labelValue: string = input.HealthCheckId; if (labelValue.length <= 0) { @@ -1443,7 +1486,6 @@ export const serializeAws_restXmlGetHealthCheckLastFailureReasonCommand = async throw new Error("No value provided for input HTTP label: HealthCheckId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1459,8 +1501,11 @@ export const serializeAws_restXmlGetHealthCheckStatusCommand = async ( input: GetHealthCheckStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/healthcheck/{HealthCheckId}/status"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/healthcheck/{HealthCheckId}/status"; if (input.HealthCheckId !== undefined) { const labelValue: string = input.HealthCheckId; if (labelValue.length <= 0) { @@ -1471,7 +1516,6 @@ export const serializeAws_restXmlGetHealthCheckStatusCommand = async ( throw new Error("No value provided for input HTTP label: HealthCheckId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1487,8 +1531,10 @@ export const serializeAws_restXmlGetHostedZoneCommand = async ( input: GetHostedZoneCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzone/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/hostedzone/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1499,7 +1545,6 @@ export const serializeAws_restXmlGetHostedZoneCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1515,13 +1560,14 @@ export const serializeAws_restXmlGetHostedZoneCountCommand = async ( input: GetHostedZoneCountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/hostedzonecount"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/hostedzonecount"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1537,8 +1583,11 @@ export const serializeAws_restXmlGetHostedZoneLimitCommand = async ( input: GetHostedZoneLimitCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzonelimit/{HostedZoneId}/{Type}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzonelimit/{HostedZoneId}/{Type}"; if (input.Type !== undefined) { const labelValue: string = input.Type; if (labelValue.length <= 0) { @@ -1558,7 +1607,6 @@ export const serializeAws_restXmlGetHostedZoneLimitCommand = async ( throw new Error("No value provided for input HTTP label: HostedZoneId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1574,8 +1622,10 @@ export const serializeAws_restXmlGetQueryLoggingConfigCommand = async ( input: GetQueryLoggingConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/queryloggingconfig/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/queryloggingconfig/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1586,7 +1636,6 @@ export const serializeAws_restXmlGetQueryLoggingConfigCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1602,8 +1651,10 @@ export const serializeAws_restXmlGetReusableDelegationSetCommand = async ( input: GetReusableDelegationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/delegationset/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/delegationset/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1614,7 +1665,6 @@ export const serializeAws_restXmlGetReusableDelegationSetCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1630,8 +1680,11 @@ export const serializeAws_restXmlGetReusableDelegationSetLimitCommand = async ( input: GetReusableDelegationSetLimitCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/reusabledelegationsetlimit/{DelegationSetId}/{Type}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/reusabledelegationsetlimit/{DelegationSetId}/{Type}"; if (input.Type !== undefined) { const labelValue: string = input.Type; if (labelValue.length <= 0) { @@ -1651,7 +1704,6 @@ export const serializeAws_restXmlGetReusableDelegationSetLimitCommand = async ( throw new Error("No value provided for input HTTP label: DelegationSetId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1667,8 +1719,10 @@ export const serializeAws_restXmlGetTrafficPolicyCommand = async ( input: GetTrafficPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/trafficpolicy/{Id}/{Version}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicy/{Id}/{Version}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1688,7 +1742,6 @@ export const serializeAws_restXmlGetTrafficPolicyCommand = async ( throw new Error("No value provided for input HTTP label: Version."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1704,8 +1757,10 @@ export const serializeAws_restXmlGetTrafficPolicyInstanceCommand = async ( input: GetTrafficPolicyInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/trafficpolicyinstance/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicyinstance/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -1716,7 +1771,6 @@ export const serializeAws_restXmlGetTrafficPolicyInstanceCommand = async ( throw new Error("No value provided for input HTTP label: Id."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1732,13 +1786,14 @@ export const serializeAws_restXmlGetTrafficPolicyInstanceCountCommand = async ( input: GetTrafficPolicyInstanceCountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/trafficpolicyinstancecount"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicyinstancecount"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1754,8 +1809,9 @@ export const serializeAws_restXmlListGeoLocationsCommand = async ( input: ListGeoLocationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/geolocations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/geolocations"; const query: any = { ...(input.StartContinentCode !== undefined && { startcontinentcode: input.StartContinentCode }), ...(input.StartCountryCode !== undefined && { startcountrycode: input.StartCountryCode }), @@ -1763,7 +1819,6 @@ export const serializeAws_restXmlListGeoLocationsCommand = async ( ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1780,14 +1835,14 @@ export const serializeAws_restXmlListHealthChecksCommand = async ( input: ListHealthChecksCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/healthcheck"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/healthcheck"; const query: any = { ...(input.Marker !== undefined && { marker: input.Marker }), ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1804,15 +1859,15 @@ export const serializeAws_restXmlListHostedZonesCommand = async ( input: ListHostedZonesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzone"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/hostedzone"; const query: any = { ...(input.Marker !== undefined && { marker: input.Marker }), ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), ...(input.DelegationSetId !== undefined && { delegationsetid: input.DelegationSetId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1829,15 +1884,16 @@ export const serializeAws_restXmlListHostedZonesByNameCommand = async ( input: ListHostedZonesByNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzonesbyname"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/hostedzonesbyname"; const query: any = { ...(input.DNSName !== undefined && { dnsname: input.DNSName }), ...(input.HostedZoneId !== undefined && { hostedzoneid: input.HostedZoneId }), ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1854,8 +1910,10 @@ export const serializeAws_restXmlListHostedZonesByVPCCommand = async ( input: ListHostedZonesByVPCCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzonesbyvpc"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/hostedzonesbyvpc"; const query: any = { ...(input.VPCId !== undefined && { vpcid: input.VPCId }), ...(input.VPCRegion !== undefined && { vpcregion: input.VPCRegion }), @@ -1863,7 +1921,6 @@ export const serializeAws_restXmlListHostedZonesByVPCCommand = async ( ...(input.NextToken !== undefined && { nexttoken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1880,15 +1937,16 @@ export const serializeAws_restXmlListQueryLoggingConfigsCommand = async ( input: ListQueryLoggingConfigsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/queryloggingconfig"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/queryloggingconfig"; const query: any = { ...(input.HostedZoneId !== undefined && { hostedzoneid: input.HostedZoneId }), ...(input.NextToken !== undefined && { nexttoken: input.NextToken }), ...(input.MaxResults !== undefined && { maxresults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1905,8 +1963,11 @@ export const serializeAws_restXmlListResourceRecordSetsCommand = async ( input: ListResourceRecordSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzone/{HostedZoneId}/rrset"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzone/{HostedZoneId}/rrset"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -1923,7 +1984,6 @@ export const serializeAws_restXmlListResourceRecordSetsCommand = async ( ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1940,14 +2000,15 @@ export const serializeAws_restXmlListReusableDelegationSetsCommand = async ( input: ListReusableDelegationSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/delegationset"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/delegationset"; const query: any = { ...(input.Marker !== undefined && { marker: input.Marker }), ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1964,8 +2025,11 @@ export const serializeAws_restXmlListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/tags/{ResourceType}/{ResourceId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/tags/{ResourceType}/{ResourceId}"; if (input.ResourceType !== undefined) { const labelValue: string = input.ResourceType; if (labelValue.length <= 0) { @@ -1985,7 +2049,6 @@ export const serializeAws_restXmlListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2001,10 +2064,12 @@ export const serializeAws_restXmlListTagsForResourcesCommand = async ( input: ListTagsForResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/tags/{ResourceType}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/tags/{ResourceType}"; if (input.ResourceType !== undefined) { const labelValue: string = input.ResourceType; if (labelValue.length <= 0) { @@ -2027,7 +2092,6 @@ export const serializeAws_restXmlListTagsForResourcesCommand = async ( bodyNode.addChildNode(containerNode); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2043,14 +2107,15 @@ export const serializeAws_restXmlListTrafficPoliciesCommand = async ( input: ListTrafficPoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/trafficpolicies"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicies"; const query: any = { ...(input.TrafficPolicyIdMarker !== undefined && { trafficpolicyid: input.TrafficPolicyIdMarker }), ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2067,8 +2132,10 @@ export const serializeAws_restXmlListTrafficPolicyInstancesCommand = async ( input: ListTrafficPolicyInstancesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/trafficpolicyinstances"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicyinstances"; const query: any = { ...(input.HostedZoneIdMarker !== undefined && { hostedzoneid: input.HostedZoneIdMarker }), ...(input.TrafficPolicyInstanceNameMarker !== undefined && { @@ -2080,7 +2147,6 @@ export const serializeAws_restXmlListTrafficPolicyInstancesCommand = async ( ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2097,8 +2163,11 @@ export const serializeAws_restXmlListTrafficPolicyInstancesByHostedZoneCommand = input: ListTrafficPolicyInstancesByHostedZoneCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/trafficpolicyinstances/hostedzone"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/trafficpolicyinstances/hostedzone"; const query: any = { ...(input.HostedZoneId !== undefined && { id: input.HostedZoneId }), ...(input.TrafficPolicyInstanceNameMarker !== undefined && { @@ -2110,7 +2179,6 @@ export const serializeAws_restXmlListTrafficPolicyInstancesByHostedZoneCommand = ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2127,8 +2195,11 @@ export const serializeAws_restXmlListTrafficPolicyInstancesByPolicyCommand = asy input: ListTrafficPolicyInstancesByPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/trafficpolicyinstances/trafficpolicy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/trafficpolicyinstances/trafficpolicy"; const query: any = { ...(input.TrafficPolicyId !== undefined && { id: input.TrafficPolicyId }), ...(input.TrafficPolicyVersion !== undefined && { version: input.TrafficPolicyVersion.toString() }), @@ -2142,7 +2213,6 @@ export const serializeAws_restXmlListTrafficPolicyInstancesByPolicyCommand = asy ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2159,8 +2229,10 @@ export const serializeAws_restXmlListTrafficPolicyVersionsCommand = async ( input: ListTrafficPolicyVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/trafficpolicies/{Id}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicies/{Id}/versions"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2175,7 +2247,6 @@ export const serializeAws_restXmlListTrafficPolicyVersionsCommand = async ( ...(input.MaxItems !== undefined && { maxitems: input.MaxItems.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2192,8 +2263,11 @@ export const serializeAws_restXmlListVPCAssociationAuthorizationsCommand = async input: ListVPCAssociationAuthorizationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/hostedzone/{HostedZoneId}/authorizevpcassociation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/2013-04-01/hostedzone/{HostedZoneId}/authorizevpcassociation"; if (input.HostedZoneId !== undefined) { const labelValue: string = input.HostedZoneId; if (labelValue.length <= 0) { @@ -2208,7 +2282,6 @@ export const serializeAws_restXmlListVPCAssociationAuthorizationsCommand = async ...(input.MaxResults !== undefined && { maxresults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2225,8 +2298,10 @@ export const serializeAws_restXmlTestDNSAnswerCommand = async ( input: TestDNSAnswerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/2013-04-01/testdnsanswer"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/testdnsanswer"; const query: any = { ...(input.HostedZoneId !== undefined && { hostedzoneid: input.HostedZoneId }), ...(input.RecordName !== undefined && { recordname: input.RecordName }), @@ -2236,7 +2311,6 @@ export const serializeAws_restXmlTestDNSAnswerCommand = async ( ...(input.EDNS0ClientSubnetMask !== undefined && { edns0clientsubnetmask: input.EDNS0ClientSubnetMask }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2253,10 +2327,12 @@ export const serializeAws_restXmlUpdateHealthCheckCommand = async ( input: UpdateHealthCheckCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/healthcheck/{HealthCheckId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/healthcheck/{HealthCheckId}"; if (input.HealthCheckId !== undefined) { const labelValue: string = input.HealthCheckId; if (labelValue.length <= 0) { @@ -2357,7 +2433,6 @@ export const serializeAws_restXmlUpdateHealthCheckCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2373,10 +2448,12 @@ export const serializeAws_restXmlUpdateHostedZoneCommentCommand = async ( input: UpdateHostedZoneCommentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/hostedzone/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/hostedzone/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2395,7 +2472,6 @@ export const serializeAws_restXmlUpdateHostedZoneCommentCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2411,10 +2487,12 @@ export const serializeAws_restXmlUpdateTrafficPolicyCommentCommand = async ( input: UpdateTrafficPolicyCommentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/trafficpolicy/{Id}/{Version}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicy/{Id}/{Version}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2442,7 +2520,6 @@ export const serializeAws_restXmlUpdateTrafficPolicyCommentCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2458,10 +2535,12 @@ export const serializeAws_restXmlUpdateTrafficPolicyInstanceCommand = async ( input: UpdateTrafficPolicyInstanceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/2013-04-01/trafficpolicyinstance/{Id}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/2013-04-01/trafficpolicyinstance/{Id}"; if (input.Id !== undefined) { const labelValue: string = input.Id; if (labelValue.length <= 0) { @@ -2492,7 +2571,6 @@ export const serializeAws_restXmlUpdateTrafficPolicyInstanceCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-s3-control/protocols/Aws_restXml.ts b/clients/client-s3-control/protocols/Aws_restXml.ts index 19b9abea292ec..28a6b8969c9d5 100644 --- a/clients/client-s3-control/protocols/Aws_restXml.ts +++ b/clients/client-s3-control/protocols/Aws_restXml.ts @@ -243,11 +243,13 @@ export const serializeAws_restXmlCreateAccessPointCommand = async ( input: CreateAccessPointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspoint/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/accesspoint/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -288,7 +290,6 @@ export const serializeAws_restXmlCreateAccessPointCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -304,11 +305,14 @@ export const serializeAws_restXmlCreateAccessPointForObjectLambdaCommand = async input: CreateAccessPointForObjectLambdaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspointforobjectlambda/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/accesspointforobjectlambda/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -338,7 +342,6 @@ export const serializeAws_restXmlCreateAccessPointForObjectLambdaCommand = async throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -354,6 +357,7 @@ export const serializeAws_restXmlCreateBucketCommand = async ( input: CreateBucketCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ACL) && { "x-amz-acl": input.ACL! }), @@ -367,7 +371,8 @@ export const serializeAws_restXmlCreateBucketCommand = async ( }), ...(isSerializableHeaderValue(input.OutpostId) && { "x-amz-outpost-id": input.OutpostId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/bucket/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -388,7 +393,6 @@ export const serializeAws_restXmlCreateBucketCommand = async ( contents.addAttribute("xmlns", "http://awss3control.amazonaws.com/doc/2018-08-20/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -404,11 +408,12 @@ export const serializeAws_restXmlCreateJobCommand = async ( input: CreateJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/jobs"; let body: any; body = ''; const bodyNode = new __XmlNode("CreateJobRequest"); @@ -474,7 +479,6 @@ export const serializeAws_restXmlCreateJobCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -490,10 +494,12 @@ export const serializeAws_restXmlDeleteAccessPointCommand = async ( input: DeleteAccessPointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspoint/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/accesspoint/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -515,7 +521,6 @@ export const serializeAws_restXmlDeleteAccessPointCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -531,10 +536,13 @@ export const serializeAws_restXmlDeleteAccessPointForObjectLambdaCommand = async input: DeleteAccessPointForObjectLambdaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspointforobjectlambda/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/accesspointforobjectlambda/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -556,7 +564,6 @@ export const serializeAws_restXmlDeleteAccessPointForObjectLambdaCommand = async throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -572,10 +579,12 @@ export const serializeAws_restXmlDeleteAccessPointPolicyCommand = async ( input: DeleteAccessPointPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspoint/{Name}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/accesspoint/{Name}/policy"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -597,7 +606,6 @@ export const serializeAws_restXmlDeleteAccessPointPolicyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -613,10 +621,13 @@ export const serializeAws_restXmlDeleteAccessPointPolicyForObjectLambdaCommand = input: DeleteAccessPointPolicyForObjectLambdaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspointforobjectlambda/{Name}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/accesspointforobjectlambda/{Name}/policy"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -638,7 +649,6 @@ export const serializeAws_restXmlDeleteAccessPointPolicyForObjectLambdaCommand = throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -654,10 +664,12 @@ export const serializeAws_restXmlDeleteBucketCommand = async ( input: DeleteBucketCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/bucket/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -679,7 +691,6 @@ export const serializeAws_restXmlDeleteBucketCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -695,10 +706,13 @@ export const serializeAws_restXmlDeleteBucketLifecycleConfigurationCommand = asy input: DeleteBucketLifecycleConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}/lifecycleconfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/bucket/{Bucket}/lifecycleconfiguration"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -720,7 +734,6 @@ export const serializeAws_restXmlDeleteBucketLifecycleConfigurationCommand = asy throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -736,10 +749,12 @@ export const serializeAws_restXmlDeleteBucketPolicyCommand = async ( input: DeleteBucketPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/bucket/{Bucket}/policy"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -761,7 +776,6 @@ export const serializeAws_restXmlDeleteBucketPolicyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -777,10 +791,12 @@ export const serializeAws_restXmlDeleteBucketTaggingCommand = async ( input: DeleteBucketTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}/tagging"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/bucket/{Bucket}/tagging"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -802,7 +818,6 @@ export const serializeAws_restXmlDeleteBucketTaggingCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -818,10 +833,12 @@ export const serializeAws_restXmlDeleteJobTaggingCommand = async ( input: DeleteJobTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/jobs/{JobId}/tagging"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/jobs/{JobId}/tagging"; if (input.JobId !== undefined) { const labelValue: string = input.JobId; if (labelValue.length <= 0) { @@ -843,7 +860,6 @@ export const serializeAws_restXmlDeleteJobTaggingCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -859,10 +875,13 @@ export const serializeAws_restXmlDeletePublicAccessBlockCommand = async ( input: DeletePublicAccessBlockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/configuration/publicAccessBlock"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/configuration/publicAccessBlock"; let body: any; let { hostname: resolvedHostname } = await context.endpoint(); if (context.disableHostPrefix !== true) { @@ -875,7 +894,6 @@ export const serializeAws_restXmlDeletePublicAccessBlockCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -891,10 +909,12 @@ export const serializeAws_restXmlDeleteStorageLensConfigurationCommand = async ( input: DeleteStorageLensConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/storagelens/{ConfigId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/storagelens/{ConfigId}"; if (input.ConfigId !== undefined) { const labelValue: string = input.ConfigId; if (labelValue.length <= 0) { @@ -916,7 +936,6 @@ export const serializeAws_restXmlDeleteStorageLensConfigurationCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -932,10 +951,12 @@ export const serializeAws_restXmlDeleteStorageLensConfigurationTaggingCommand = input: DeleteStorageLensConfigurationTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/storagelens/{ConfigId}/tagging"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/storagelens/{ConfigId}/tagging"; if (input.ConfigId !== undefined) { const labelValue: string = input.ConfigId; if (labelValue.length <= 0) { @@ -957,7 +978,6 @@ export const serializeAws_restXmlDeleteStorageLensConfigurationTaggingCommand = throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -973,10 +993,11 @@ export const serializeAws_restXmlDescribeJobCommand = async ( input: DescribeJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/jobs/{JobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/jobs/{JobId}"; if (input.JobId !== undefined) { const labelValue: string = input.JobId; if (labelValue.length <= 0) { @@ -998,7 +1019,6 @@ export const serializeAws_restXmlDescribeJobCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1014,10 +1034,12 @@ export const serializeAws_restXmlGetAccessPointCommand = async ( input: GetAccessPointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspoint/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/accesspoint/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1039,7 +1061,6 @@ export const serializeAws_restXmlGetAccessPointCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1055,10 +1076,13 @@ export const serializeAws_restXmlGetAccessPointConfigurationForObjectLambdaComma input: GetAccessPointConfigurationForObjectLambdaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspointforobjectlambda/{Name}/configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/accesspointforobjectlambda/{Name}/configuration"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1080,7 +1104,6 @@ export const serializeAws_restXmlGetAccessPointConfigurationForObjectLambdaComma throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1096,10 +1119,13 @@ export const serializeAws_restXmlGetAccessPointForObjectLambdaCommand = async ( input: GetAccessPointForObjectLambdaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspointforobjectlambda/{Name}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/accesspointforobjectlambda/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1121,7 +1147,6 @@ export const serializeAws_restXmlGetAccessPointForObjectLambdaCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1137,10 +1162,12 @@ export const serializeAws_restXmlGetAccessPointPolicyCommand = async ( input: GetAccessPointPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspoint/{Name}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/accesspoint/{Name}/policy"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1162,7 +1189,6 @@ export const serializeAws_restXmlGetAccessPointPolicyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1178,10 +1204,13 @@ export const serializeAws_restXmlGetAccessPointPolicyForObjectLambdaCommand = as input: GetAccessPointPolicyForObjectLambdaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspointforobjectlambda/{Name}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/accesspointforobjectlambda/{Name}/policy"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1203,7 +1232,6 @@ export const serializeAws_restXmlGetAccessPointPolicyForObjectLambdaCommand = as throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1219,10 +1247,13 @@ export const serializeAws_restXmlGetAccessPointPolicyStatusCommand = async ( input: GetAccessPointPolicyStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspoint/{Name}/policyStatus"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/accesspoint/{Name}/policyStatus"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1244,7 +1275,6 @@ export const serializeAws_restXmlGetAccessPointPolicyStatusCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1260,10 +1290,13 @@ export const serializeAws_restXmlGetAccessPointPolicyStatusForObjectLambdaComman input: GetAccessPointPolicyStatusForObjectLambdaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspointforobjectlambda/{Name}/policyStatus"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/accesspointforobjectlambda/{Name}/policyStatus"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1285,7 +1318,6 @@ export const serializeAws_restXmlGetAccessPointPolicyStatusForObjectLambdaComman throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1301,10 +1333,12 @@ export const serializeAws_restXmlGetBucketCommand = async ( input: GetBucketCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/bucket/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1326,7 +1360,6 @@ export const serializeAws_restXmlGetBucketCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1342,10 +1375,13 @@ export const serializeAws_restXmlGetBucketLifecycleConfigurationCommand = async input: GetBucketLifecycleConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}/lifecycleconfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/bucket/{Bucket}/lifecycleconfiguration"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1367,7 +1403,6 @@ export const serializeAws_restXmlGetBucketLifecycleConfigurationCommand = async throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1383,10 +1418,12 @@ export const serializeAws_restXmlGetBucketPolicyCommand = async ( input: GetBucketPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/bucket/{Bucket}/policy"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1408,7 +1445,6 @@ export const serializeAws_restXmlGetBucketPolicyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1424,10 +1460,12 @@ export const serializeAws_restXmlGetBucketTaggingCommand = async ( input: GetBucketTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}/tagging"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/bucket/{Bucket}/tagging"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1449,7 +1487,6 @@ export const serializeAws_restXmlGetBucketTaggingCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1465,10 +1502,12 @@ export const serializeAws_restXmlGetJobTaggingCommand = async ( input: GetJobTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/jobs/{JobId}/tagging"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/jobs/{JobId}/tagging"; if (input.JobId !== undefined) { const labelValue: string = input.JobId; if (labelValue.length <= 0) { @@ -1490,7 +1529,6 @@ export const serializeAws_restXmlGetJobTaggingCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1506,10 +1544,13 @@ export const serializeAws_restXmlGetPublicAccessBlockCommand = async ( input: GetPublicAccessBlockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/configuration/publicAccessBlock"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/configuration/publicAccessBlock"; let body: any; let { hostname: resolvedHostname } = await context.endpoint(); if (context.disableHostPrefix !== true) { @@ -1522,7 +1563,6 @@ export const serializeAws_restXmlGetPublicAccessBlockCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1538,10 +1578,12 @@ export const serializeAws_restXmlGetStorageLensConfigurationCommand = async ( input: GetStorageLensConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/storagelens/{ConfigId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/storagelens/{ConfigId}"; if (input.ConfigId !== undefined) { const labelValue: string = input.ConfigId; if (labelValue.length <= 0) { @@ -1563,7 +1605,6 @@ export const serializeAws_restXmlGetStorageLensConfigurationCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1579,10 +1620,12 @@ export const serializeAws_restXmlGetStorageLensConfigurationTaggingCommand = asy input: GetStorageLensConfigurationTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/storagelens/{ConfigId}/tagging"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/storagelens/{ConfigId}/tagging"; if (input.ConfigId !== undefined) { const labelValue: string = input.ConfigId; if (labelValue.length <= 0) { @@ -1604,7 +1647,6 @@ export const serializeAws_restXmlGetStorageLensConfigurationTaggingCommand = asy throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1620,10 +1662,11 @@ export const serializeAws_restXmlListAccessPointsCommand = async ( input: ListAccessPointsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspoint"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/accesspoint"; const query: any = { ...(input.Bucket !== undefined && { bucket: input.Bucket }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), @@ -1641,7 +1684,6 @@ export const serializeAws_restXmlListAccessPointsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1658,10 +1700,12 @@ export const serializeAws_restXmlListAccessPointsForObjectLambdaCommand = async input: ListAccessPointsForObjectLambdaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspointforobjectlambda"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/accesspointforobjectlambda"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), @@ -1678,7 +1722,6 @@ export const serializeAws_restXmlListAccessPointsForObjectLambdaCommand = async throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1695,10 +1738,11 @@ export const serializeAws_restXmlListJobsCommand = async ( input: ListJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/jobs"; const query: any = { ...(input.JobStatuses !== undefined && { jobStatuses: (input.JobStatuses || []).map((_entry) => _entry) }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), @@ -1716,7 +1760,6 @@ export const serializeAws_restXmlListJobsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1733,11 +1776,12 @@ export const serializeAws_restXmlListRegionalBucketsCommand = async ( input: ListRegionalBucketsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), ...(isSerializableHeaderValue(input.OutpostId) && { "x-amz-outpost-id": input.OutpostId! }), }; - let resolvedPath = "/v20180820/bucket"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/bucket"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), @@ -1754,7 +1798,6 @@ export const serializeAws_restXmlListRegionalBucketsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1771,10 +1814,11 @@ export const serializeAws_restXmlListStorageLensConfigurationsCommand = async ( input: ListStorageLensConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/storagelens"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/storagelens"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; @@ -1790,7 +1834,6 @@ export const serializeAws_restXmlListStorageLensConfigurationsCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1807,11 +1850,14 @@ export const serializeAws_restXmlPutAccessPointConfigurationForObjectLambdaComma input: PutAccessPointConfigurationForObjectLambdaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspointforobjectlambda/{Name}/configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/accesspointforobjectlambda/{Name}/configuration"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1841,7 +1887,6 @@ export const serializeAws_restXmlPutAccessPointConfigurationForObjectLambdaComma throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1857,11 +1902,13 @@ export const serializeAws_restXmlPutAccessPointPolicyCommand = async ( input: PutAccessPointPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspoint/{Name}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/accesspoint/{Name}/policy"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1891,7 +1938,6 @@ export const serializeAws_restXmlPutAccessPointPolicyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1907,11 +1953,14 @@ export const serializeAws_restXmlPutAccessPointPolicyForObjectLambdaCommand = as input: PutAccessPointPolicyForObjectLambdaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/accesspointforobjectlambda/{Name}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/accesspointforobjectlambda/{Name}/policy"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -1941,7 +1990,6 @@ export const serializeAws_restXmlPutAccessPointPolicyForObjectLambdaCommand = as throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -1957,11 +2005,14 @@ export const serializeAws_restXmlPutBucketLifecycleConfigurationCommand = async input: PutBucketLifecycleConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}/lifecycleconfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/bucket/{Bucket}/lifecycleconfiguration"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1993,7 +2044,6 @@ export const serializeAws_restXmlPutBucketLifecycleConfigurationCommand = async throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2009,6 +2059,7 @@ export const serializeAws_restXmlPutBucketPolicyCommand = async ( input: PutBucketPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), @@ -2016,7 +2067,8 @@ export const serializeAws_restXmlPutBucketPolicyCommand = async ( "x-amz-confirm-remove-self-bucket-access": input.ConfirmRemoveSelfBucketAccess!.toString(), }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/bucket/{Bucket}/policy"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2046,7 +2098,6 @@ export const serializeAws_restXmlPutBucketPolicyCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2062,11 +2113,13 @@ export const serializeAws_restXmlPutBucketTaggingCommand = async ( input: PutBucketTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/bucket/{Bucket}/tagging"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/bucket/{Bucket}/tagging"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2098,7 +2151,6 @@ export const serializeAws_restXmlPutBucketTaggingCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2114,11 +2166,13 @@ export const serializeAws_restXmlPutJobTaggingCommand = async ( input: PutJobTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/jobs/{JobId}/tagging"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/jobs/{JobId}/tagging"; if (input.JobId !== undefined) { const labelValue: string = input.JobId; if (labelValue.length <= 0) { @@ -2152,7 +2206,6 @@ export const serializeAws_restXmlPutJobTaggingCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2168,11 +2221,14 @@ export const serializeAws_restXmlPutPublicAccessBlockCommand = async ( input: PutPublicAccessBlockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/configuration/publicAccessBlock"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v20180820/configuration/publicAccessBlock"; let body: any; if (input.PublicAccessBlockConfiguration !== undefined) { body = serializeAws_restXmlPublicAccessBlockConfiguration(input.PublicAccessBlockConfiguration, context); @@ -2195,7 +2251,6 @@ export const serializeAws_restXmlPutPublicAccessBlockCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2211,11 +2266,13 @@ export const serializeAws_restXmlPutStorageLensConfigurationCommand = async ( input: PutStorageLensConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/storagelens/{ConfigId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/storagelens/{ConfigId}"; if (input.ConfigId !== undefined) { const labelValue: string = input.ConfigId; if (labelValue.length <= 0) { @@ -2255,7 +2312,6 @@ export const serializeAws_restXmlPutStorageLensConfigurationCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2271,11 +2327,13 @@ export const serializeAws_restXmlPutStorageLensConfigurationTaggingCommand = asy input: PutStorageLensConfigurationTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/storagelens/{ConfigId}/tagging"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/storagelens/{ConfigId}/tagging"; if (input.ConfigId !== undefined) { const labelValue: string = input.ConfigId; if (labelValue.length <= 0) { @@ -2309,7 +2367,6 @@ export const serializeAws_restXmlPutStorageLensConfigurationTaggingCommand = asy throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2325,10 +2382,12 @@ export const serializeAws_restXmlUpdateJobPriorityCommand = async ( input: UpdateJobPriorityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/jobs/{JobId}/priority"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/jobs/{JobId}/priority"; if (input.JobId !== undefined) { const labelValue: string = input.JobId; if (labelValue.length <= 0) { @@ -2353,7 +2412,6 @@ export const serializeAws_restXmlUpdateJobPriorityCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -2370,10 +2428,12 @@ export const serializeAws_restXmlUpdateJobStatusCommand = async ( input: UpdateJobStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AccountId) && { "x-amz-account-id": input.AccountId! }), }; - let resolvedPath = "/v20180820/jobs/{JobId}/status"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20180820/jobs/{JobId}/status"; if (input.JobId !== undefined) { const labelValue: string = input.JobId; if (labelValue.length <= 0) { @@ -2399,7 +2459,6 @@ export const serializeAws_restXmlUpdateJobStatusCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, diff --git a/clients/client-s3/protocols/Aws_restXml.ts b/clients/client-s3/protocols/Aws_restXml.ts index 64b9f9f37d43e..881196aadc355 100644 --- a/clients/client-s3/protocols/Aws_restXml.ts +++ b/clients/client-s3/protocols/Aws_restXml.ts @@ -414,13 +414,14 @@ export const serializeAws_restXmlAbortMultipartUploadCommand = async ( input: AbortMultipartUploadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -450,7 +451,6 @@ export const serializeAws_restXmlAbortMultipartUploadCommand = async ( ...(input.UploadId !== undefined && { uploadId: input.UploadId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -467,6 +467,7 @@ export const serializeAws_restXmlCompleteMultipartUploadCommand = async ( input: CompleteMultipartUploadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), @@ -474,7 +475,7 @@ export const serializeAws_restXmlCompleteMultipartUploadCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -514,7 +515,6 @@ export const serializeAws_restXmlCompleteMultipartUploadCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -531,6 +531,7 @@ export const serializeAws_restXmlCopyObjectCommand = async ( input: CopyObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ACL) && { "x-amz-acl": input.ACL! }), ...(isSerializableHeaderValue(input.CacheControl) && { "cache-control": input.CacheControl! }), @@ -618,7 +619,7 @@ export const serializeAws_restXmlCopyObjectCommand = async ( {} )), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -647,7 +648,6 @@ export const serializeAws_restXmlCopyObjectCommand = async ( "x-id": "CopyObject", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -664,6 +664,7 @@ export const serializeAws_restXmlCreateBucketCommand = async ( input: CreateBucketCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ACL) && { "x-amz-acl": input.ACL! }), @@ -676,7 +677,7 @@ export const serializeAws_restXmlCreateBucketCommand = async ( "x-amz-bucket-object-lock-enabled": input.ObjectLockEnabledForBucket!.toString(), }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -697,7 +698,6 @@ export const serializeAws_restXmlCreateBucketCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -713,6 +713,7 @@ export const serializeAws_restXmlCreateMultipartUploadCommand = async ( input: CreateMultipartUploadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ACL) && { "x-amz-acl": input.ACL! }), ...(isSerializableHeaderValue(input.CacheControl) && { "cache-control": input.CacheControl! }), @@ -773,7 +774,7 @@ export const serializeAws_restXmlCreateMultipartUploadCommand = async ( {} )), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -803,7 +804,6 @@ export const serializeAws_restXmlCreateMultipartUploadCommand = async ( "x-id": "CreateMultipartUpload", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -820,12 +820,13 @@ export const serializeAws_restXmlDeleteBucketCommand = async ( input: DeleteBucketCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -836,7 +837,6 @@ export const serializeAws_restXmlDeleteBucketCommand = async ( throw new Error("No value provided for input HTTP label: Bucket."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -852,12 +852,13 @@ export const serializeAws_restXmlDeleteBucketAnalyticsConfigurationCommand = asy input: DeleteBucketAnalyticsConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -872,7 +873,6 @@ export const serializeAws_restXmlDeleteBucketAnalyticsConfigurationCommand = asy ...(input.Id !== undefined && { id: input.Id }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -889,12 +889,13 @@ export const serializeAws_restXmlDeleteBucketCorsCommand = async ( input: DeleteBucketCorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -908,7 +909,6 @@ export const serializeAws_restXmlDeleteBucketCorsCommand = async ( cors: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -925,12 +925,13 @@ export const serializeAws_restXmlDeleteBucketEncryptionCommand = async ( input: DeleteBucketEncryptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -944,7 +945,6 @@ export const serializeAws_restXmlDeleteBucketEncryptionCommand = async ( encryption: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -961,8 +961,9 @@ export const serializeAws_restXmlDeleteBucketIntelligentTieringConfigurationComm input: DeleteBucketIntelligentTieringConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -977,7 +978,6 @@ export const serializeAws_restXmlDeleteBucketIntelligentTieringConfigurationComm ...(input.Id !== undefined && { id: input.Id }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -994,12 +994,13 @@ export const serializeAws_restXmlDeleteBucketInventoryConfigurationCommand = asy input: DeleteBucketInventoryConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1014,7 +1015,6 @@ export const serializeAws_restXmlDeleteBucketInventoryConfigurationCommand = asy ...(input.Id !== undefined && { id: input.Id }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1031,12 +1031,13 @@ export const serializeAws_restXmlDeleteBucketLifecycleCommand = async ( input: DeleteBucketLifecycleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1050,7 +1051,6 @@ export const serializeAws_restXmlDeleteBucketLifecycleCommand = async ( lifecycle: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1067,12 +1067,13 @@ export const serializeAws_restXmlDeleteBucketMetricsConfigurationCommand = async input: DeleteBucketMetricsConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1087,7 +1088,6 @@ export const serializeAws_restXmlDeleteBucketMetricsConfigurationCommand = async ...(input.Id !== undefined && { id: input.Id }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1104,12 +1104,13 @@ export const serializeAws_restXmlDeleteBucketOwnershipControlsCommand = async ( input: DeleteBucketOwnershipControlsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1123,7 +1124,6 @@ export const serializeAws_restXmlDeleteBucketOwnershipControlsCommand = async ( ownershipControls: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1140,12 +1140,13 @@ export const serializeAws_restXmlDeleteBucketPolicyCommand = async ( input: DeleteBucketPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1159,7 +1160,6 @@ export const serializeAws_restXmlDeleteBucketPolicyCommand = async ( policy: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1176,12 +1176,13 @@ export const serializeAws_restXmlDeleteBucketReplicationCommand = async ( input: DeleteBucketReplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1195,7 +1196,6 @@ export const serializeAws_restXmlDeleteBucketReplicationCommand = async ( replication: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1212,12 +1212,13 @@ export const serializeAws_restXmlDeleteBucketTaggingCommand = async ( input: DeleteBucketTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1231,7 +1232,6 @@ export const serializeAws_restXmlDeleteBucketTaggingCommand = async ( tagging: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1248,12 +1248,13 @@ export const serializeAws_restXmlDeleteBucketWebsiteCommand = async ( input: DeleteBucketWebsiteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1267,7 +1268,6 @@ export const serializeAws_restXmlDeleteBucketWebsiteCommand = async ( website: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1284,6 +1284,7 @@ export const serializeAws_restXmlDeleteObjectCommand = async ( input: DeleteObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.MFA) && { "x-amz-mfa": input.MFA! }), ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), @@ -1294,7 +1295,7 @@ export const serializeAws_restXmlDeleteObjectCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1324,7 +1325,6 @@ export const serializeAws_restXmlDeleteObjectCommand = async ( ...(input.VersionId !== undefined && { versionId: input.VersionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1341,6 +1341,7 @@ export const serializeAws_restXmlDeleteObjectsCommand = async ( input: DeleteObjectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.MFA) && { "x-amz-mfa": input.MFA! }), @@ -1352,7 +1353,7 @@ export const serializeAws_restXmlDeleteObjectsCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1377,7 +1378,6 @@ export const serializeAws_restXmlDeleteObjectsCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1394,12 +1394,13 @@ export const serializeAws_restXmlDeleteObjectTaggingCommand = async ( input: DeleteObjectTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1429,7 +1430,6 @@ export const serializeAws_restXmlDeleteObjectTaggingCommand = async ( ...(input.VersionId !== undefined && { versionId: input.VersionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1446,12 +1446,13 @@ export const serializeAws_restXmlDeletePublicAccessBlockCommand = async ( input: DeletePublicAccessBlockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1465,7 +1466,6 @@ export const serializeAws_restXmlDeletePublicAccessBlockCommand = async ( publicAccessBlock: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1482,12 +1482,13 @@ export const serializeAws_restXmlGetBucketAccelerateConfigurationCommand = async input: GetBucketAccelerateConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1501,7 +1502,6 @@ export const serializeAws_restXmlGetBucketAccelerateConfigurationCommand = async accelerate: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1518,12 +1518,13 @@ export const serializeAws_restXmlGetBucketAclCommand = async ( input: GetBucketAclCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1537,7 +1538,6 @@ export const serializeAws_restXmlGetBucketAclCommand = async ( acl: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1554,12 +1554,13 @@ export const serializeAws_restXmlGetBucketAnalyticsConfigurationCommand = async input: GetBucketAnalyticsConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1575,7 +1576,6 @@ export const serializeAws_restXmlGetBucketAnalyticsConfigurationCommand = async ...(input.Id !== undefined && { id: input.Id }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1592,12 +1592,13 @@ export const serializeAws_restXmlGetBucketCorsCommand = async ( input: GetBucketCorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1611,7 +1612,6 @@ export const serializeAws_restXmlGetBucketCorsCommand = async ( cors: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1628,12 +1628,13 @@ export const serializeAws_restXmlGetBucketEncryptionCommand = async ( input: GetBucketEncryptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1647,7 +1648,6 @@ export const serializeAws_restXmlGetBucketEncryptionCommand = async ( encryption: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1664,8 +1664,9 @@ export const serializeAws_restXmlGetBucketIntelligentTieringConfigurationCommand input: GetBucketIntelligentTieringConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1681,7 +1682,6 @@ export const serializeAws_restXmlGetBucketIntelligentTieringConfigurationCommand ...(input.Id !== undefined && { id: input.Id }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1698,12 +1698,13 @@ export const serializeAws_restXmlGetBucketInventoryConfigurationCommand = async input: GetBucketInventoryConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1719,7 +1720,6 @@ export const serializeAws_restXmlGetBucketInventoryConfigurationCommand = async ...(input.Id !== undefined && { id: input.Id }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1736,12 +1736,13 @@ export const serializeAws_restXmlGetBucketLifecycleConfigurationCommand = async input: GetBucketLifecycleConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1755,7 +1756,6 @@ export const serializeAws_restXmlGetBucketLifecycleConfigurationCommand = async lifecycle: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1772,12 +1772,13 @@ export const serializeAws_restXmlGetBucketLocationCommand = async ( input: GetBucketLocationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1791,7 +1792,6 @@ export const serializeAws_restXmlGetBucketLocationCommand = async ( location: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1808,12 +1808,13 @@ export const serializeAws_restXmlGetBucketLoggingCommand = async ( input: GetBucketLoggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1827,7 +1828,6 @@ export const serializeAws_restXmlGetBucketLoggingCommand = async ( logging: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1844,12 +1844,13 @@ export const serializeAws_restXmlGetBucketMetricsConfigurationCommand = async ( input: GetBucketMetricsConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1865,7 +1866,6 @@ export const serializeAws_restXmlGetBucketMetricsConfigurationCommand = async ( ...(input.Id !== undefined && { id: input.Id }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1882,12 +1882,13 @@ export const serializeAws_restXmlGetBucketNotificationConfigurationCommand = asy input: GetBucketNotificationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1901,7 +1902,6 @@ export const serializeAws_restXmlGetBucketNotificationConfigurationCommand = asy notification: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1918,12 +1918,13 @@ export const serializeAws_restXmlGetBucketOwnershipControlsCommand = async ( input: GetBucketOwnershipControlsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1937,7 +1938,6 @@ export const serializeAws_restXmlGetBucketOwnershipControlsCommand = async ( ownershipControls: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1954,12 +1954,13 @@ export const serializeAws_restXmlGetBucketPolicyCommand = async ( input: GetBucketPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -1973,7 +1974,6 @@ export const serializeAws_restXmlGetBucketPolicyCommand = async ( policy: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1990,12 +1990,13 @@ export const serializeAws_restXmlGetBucketPolicyStatusCommand = async ( input: GetBucketPolicyStatusCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2009,7 +2010,6 @@ export const serializeAws_restXmlGetBucketPolicyStatusCommand = async ( policyStatus: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2026,12 +2026,13 @@ export const serializeAws_restXmlGetBucketReplicationCommand = async ( input: GetBucketReplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2045,7 +2046,6 @@ export const serializeAws_restXmlGetBucketReplicationCommand = async ( replication: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2062,12 +2062,13 @@ export const serializeAws_restXmlGetBucketRequestPaymentCommand = async ( input: GetBucketRequestPaymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2081,7 +2082,6 @@ export const serializeAws_restXmlGetBucketRequestPaymentCommand = async ( requestPayment: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2098,12 +2098,13 @@ export const serializeAws_restXmlGetBucketTaggingCommand = async ( input: GetBucketTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2117,7 +2118,6 @@ export const serializeAws_restXmlGetBucketTaggingCommand = async ( tagging: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2134,12 +2134,13 @@ export const serializeAws_restXmlGetBucketVersioningCommand = async ( input: GetBucketVersioningCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2153,7 +2154,6 @@ export const serializeAws_restXmlGetBucketVersioningCommand = async ( versioning: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2170,12 +2170,13 @@ export const serializeAws_restXmlGetBucketWebsiteCommand = async ( input: GetBucketWebsiteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2189,7 +2190,6 @@ export const serializeAws_restXmlGetBucketWebsiteCommand = async ( website: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2206,6 +2206,7 @@ export const serializeAws_restXmlGetObjectCommand = async ( input: GetObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), ...(isSerializableHeaderValue(input.IfModifiedSince) && { @@ -2230,7 +2231,7 @@ export const serializeAws_restXmlGetObjectCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2271,7 +2272,6 @@ export const serializeAws_restXmlGetObjectCommand = async ( ...(input.PartNumber !== undefined && { partNumber: input.PartNumber.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2288,13 +2288,14 @@ export const serializeAws_restXmlGetObjectAclCommand = async ( input: GetObjectAclCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2324,7 +2325,6 @@ export const serializeAws_restXmlGetObjectAclCommand = async ( ...(input.VersionId !== undefined && { versionId: input.VersionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2341,13 +2341,14 @@ export const serializeAws_restXmlGetObjectLegalHoldCommand = async ( input: GetObjectLegalHoldCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2377,7 +2378,6 @@ export const serializeAws_restXmlGetObjectLegalHoldCommand = async ( ...(input.VersionId !== undefined && { versionId: input.VersionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2394,12 +2394,13 @@ export const serializeAws_restXmlGetObjectLockConfigurationCommand = async ( input: GetObjectLockConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2413,7 +2414,6 @@ export const serializeAws_restXmlGetObjectLockConfigurationCommand = async ( "object-lock": "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2430,13 +2430,14 @@ export const serializeAws_restXmlGetObjectRetentionCommand = async ( input: GetObjectRetentionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2466,7 +2467,6 @@ export const serializeAws_restXmlGetObjectRetentionCommand = async ( ...(input.VersionId !== undefined && { versionId: input.VersionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2483,13 +2483,14 @@ export const serializeAws_restXmlGetObjectTaggingCommand = async ( input: GetObjectTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2519,7 +2520,6 @@ export const serializeAws_restXmlGetObjectTaggingCommand = async ( ...(input.VersionId !== undefined && { versionId: input.VersionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2536,13 +2536,14 @@ export const serializeAws_restXmlGetObjectTorrentCommand = async ( input: GetObjectTorrentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2571,7 +2572,6 @@ export const serializeAws_restXmlGetObjectTorrentCommand = async ( torrent: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2588,12 +2588,13 @@ export const serializeAws_restXmlGetPublicAccessBlockCommand = async ( input: GetPublicAccessBlockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2607,7 +2608,6 @@ export const serializeAws_restXmlGetPublicAccessBlockCommand = async ( publicAccessBlock: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2624,12 +2624,13 @@ export const serializeAws_restXmlHeadBucketCommand = async ( input: HeadBucketCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2640,7 +2641,6 @@ export const serializeAws_restXmlHeadBucketCommand = async ( throw new Error("No value provided for input HTTP label: Bucket."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2656,6 +2656,7 @@ export const serializeAws_restXmlHeadObjectCommand = async ( input: HeadObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.IfMatch) && { "if-match": input.IfMatch! }), ...(isSerializableHeaderValue(input.IfModifiedSince) && { @@ -2680,7 +2681,7 @@ export const serializeAws_restXmlHeadObjectCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2710,7 +2711,6 @@ export const serializeAws_restXmlHeadObjectCommand = async ( ...(input.PartNumber !== undefined && { partNumber: input.PartNumber.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2727,12 +2727,13 @@ export const serializeAws_restXmlListBucketAnalyticsConfigurationsCommand = asyn input: ListBucketAnalyticsConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2748,7 +2749,6 @@ export const serializeAws_restXmlListBucketAnalyticsConfigurationsCommand = asyn ...(input.ContinuationToken !== undefined && { "continuation-token": input.ContinuationToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2765,8 +2765,9 @@ export const serializeAws_restXmlListBucketIntelligentTieringConfigurationsComma input: ListBucketIntelligentTieringConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2782,7 +2783,6 @@ export const serializeAws_restXmlListBucketIntelligentTieringConfigurationsComma ...(input.ContinuationToken !== undefined && { "continuation-token": input.ContinuationToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2799,12 +2799,13 @@ export const serializeAws_restXmlListBucketInventoryConfigurationsCommand = asyn input: ListBucketInventoryConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2820,7 +2821,6 @@ export const serializeAws_restXmlListBucketInventoryConfigurationsCommand = asyn ...(input.ContinuationToken !== undefined && { "continuation-token": input.ContinuationToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2837,12 +2837,13 @@ export const serializeAws_restXmlListBucketMetricsConfigurationsCommand = async input: ListBucketMetricsConfigurationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2858,7 +2859,6 @@ export const serializeAws_restXmlListBucketMetricsConfigurationsCommand = async ...(input.ContinuationToken !== undefined && { "continuation-token": input.ContinuationToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2875,13 +2875,13 @@ export const serializeAws_restXmlListBucketsCommand = async ( input: ListBucketsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2897,12 +2897,13 @@ export const serializeAws_restXmlListMultipartUploadsCommand = async ( input: ListMultipartUploadsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2922,7 +2923,6 @@ export const serializeAws_restXmlListMultipartUploadsCommand = async ( ...(input.UploadIdMarker !== undefined && { "upload-id-marker": input.UploadIdMarker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2939,13 +2939,14 @@ export const serializeAws_restXmlListObjectsCommand = async ( input: ListObjectsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -2963,7 +2964,6 @@ export const serializeAws_restXmlListObjectsCommand = async ( ...(input.Prefix !== undefined && { prefix: input.Prefix }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2980,13 +2980,14 @@ export const serializeAws_restXmlListObjectsV2Command = async ( input: ListObjectsV2CommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3007,7 +3008,6 @@ export const serializeAws_restXmlListObjectsV2Command = async ( ...(input.StartAfter !== undefined && { "start-after": input.StartAfter }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3024,12 +3024,13 @@ export const serializeAws_restXmlListObjectVersionsCommand = async ( input: ListObjectVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3049,7 +3050,6 @@ export const serializeAws_restXmlListObjectVersionsCommand = async ( ...(input.VersionIdMarker !== undefined && { "version-id-marker": input.VersionIdMarker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3066,13 +3066,14 @@ export const serializeAws_restXmlListPartsCommand = async ( input: ListPartsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3104,7 +3105,6 @@ export const serializeAws_restXmlListPartsCommand = async ( ...(input.UploadId !== undefined && { uploadId: input.UploadId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3121,13 +3121,14 @@ export const serializeAws_restXmlPutBucketAccelerateConfigurationCommand = async input: PutBucketAccelerateConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3151,7 +3152,6 @@ export const serializeAws_restXmlPutBucketAccelerateConfigurationCommand = async contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3168,6 +3168,7 @@ export const serializeAws_restXmlPutBucketAclCommand = async ( input: PutBucketAclCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ACL) && { "x-amz-acl": input.ACL! }), @@ -3181,7 +3182,7 @@ export const serializeAws_restXmlPutBucketAclCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3205,7 +3206,6 @@ export const serializeAws_restXmlPutBucketAclCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3222,13 +3222,14 @@ export const serializeAws_restXmlPutBucketAnalyticsConfigurationCommand = async input: PutBucketAnalyticsConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3253,7 +3254,6 @@ export const serializeAws_restXmlPutBucketAnalyticsConfigurationCommand = async contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3270,6 +3270,7 @@ export const serializeAws_restXmlPutBucketCorsCommand = async ( input: PutBucketCorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -3277,7 +3278,7 @@ export const serializeAws_restXmlPutBucketCorsCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3301,7 +3302,6 @@ export const serializeAws_restXmlPutBucketCorsCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3318,6 +3318,7 @@ export const serializeAws_restXmlPutBucketEncryptionCommand = async ( input: PutBucketEncryptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -3325,7 +3326,7 @@ export const serializeAws_restXmlPutBucketEncryptionCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3349,7 +3350,6 @@ export const serializeAws_restXmlPutBucketEncryptionCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3366,10 +3366,11 @@ export const serializeAws_restXmlPutBucketIntelligentTieringConfigurationCommand input: PutBucketIntelligentTieringConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3394,7 +3395,6 @@ export const serializeAws_restXmlPutBucketIntelligentTieringConfigurationCommand contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3411,13 +3411,14 @@ export const serializeAws_restXmlPutBucketInventoryConfigurationCommand = async input: PutBucketInventoryConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3442,7 +3443,6 @@ export const serializeAws_restXmlPutBucketInventoryConfigurationCommand = async contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3459,13 +3459,14 @@ export const serializeAws_restXmlPutBucketLifecycleConfigurationCommand = async input: PutBucketLifecycleConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3489,7 +3490,6 @@ export const serializeAws_restXmlPutBucketLifecycleConfigurationCommand = async contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3506,6 +3506,7 @@ export const serializeAws_restXmlPutBucketLoggingCommand = async ( input: PutBucketLoggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -3513,7 +3514,7 @@ export const serializeAws_restXmlPutBucketLoggingCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3537,7 +3538,6 @@ export const serializeAws_restXmlPutBucketLoggingCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3554,13 +3554,14 @@ export const serializeAws_restXmlPutBucketMetricsConfigurationCommand = async ( input: PutBucketMetricsConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3585,7 +3586,6 @@ export const serializeAws_restXmlPutBucketMetricsConfigurationCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3602,13 +3602,14 @@ export const serializeAws_restXmlPutBucketNotificationConfigurationCommand = asy input: PutBucketNotificationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ExpectedBucketOwner) && { "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3632,7 +3633,6 @@ export const serializeAws_restXmlPutBucketNotificationConfigurationCommand = asy contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3649,6 +3649,7 @@ export const serializeAws_restXmlPutBucketOwnershipControlsCommand = async ( input: PutBucketOwnershipControlsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -3656,7 +3657,7 @@ export const serializeAws_restXmlPutBucketOwnershipControlsCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3680,7 +3681,6 @@ export const serializeAws_restXmlPutBucketOwnershipControlsCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3697,6 +3697,7 @@ export const serializeAws_restXmlPutBucketPolicyCommand = async ( input: PutBucketPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "text/plain", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -3707,7 +3708,7 @@ export const serializeAws_restXmlPutBucketPolicyCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3729,7 +3730,6 @@ export const serializeAws_restXmlPutBucketPolicyCommand = async ( contents = input.Policy; body = contents; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3746,6 +3746,7 @@ export const serializeAws_restXmlPutBucketReplicationCommand = async ( input: PutBucketReplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -3754,7 +3755,7 @@ export const serializeAws_restXmlPutBucketReplicationCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3778,7 +3779,6 @@ export const serializeAws_restXmlPutBucketReplicationCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3795,6 +3795,7 @@ export const serializeAws_restXmlPutBucketRequestPaymentCommand = async ( input: PutBucketRequestPaymentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -3802,7 +3803,7 @@ export const serializeAws_restXmlPutBucketRequestPaymentCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3826,7 +3827,6 @@ export const serializeAws_restXmlPutBucketRequestPaymentCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3843,6 +3843,7 @@ export const serializeAws_restXmlPutBucketTaggingCommand = async ( input: PutBucketTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -3850,7 +3851,7 @@ export const serializeAws_restXmlPutBucketTaggingCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3874,7 +3875,6 @@ export const serializeAws_restXmlPutBucketTaggingCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3891,6 +3891,7 @@ export const serializeAws_restXmlPutBucketVersioningCommand = async ( input: PutBucketVersioningCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -3899,7 +3900,7 @@ export const serializeAws_restXmlPutBucketVersioningCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3923,7 +3924,6 @@ export const serializeAws_restXmlPutBucketVersioningCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3940,6 +3940,7 @@ export const serializeAws_restXmlPutBucketWebsiteCommand = async ( input: PutBucketWebsiteCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -3947,7 +3948,7 @@ export const serializeAws_restXmlPutBucketWebsiteCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -3971,7 +3972,6 @@ export const serializeAws_restXmlPutBucketWebsiteCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -3988,6 +3988,7 @@ export const serializeAws_restXmlPutObjectCommand = async ( input: PutObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.ACL) && { "x-amz-acl": input.ACL! }), @@ -4051,7 +4052,7 @@ export const serializeAws_restXmlPutObjectCommand = async ( {} )), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4088,7 +4089,6 @@ export const serializeAws_restXmlPutObjectCommand = async ( contents = input.Body; body = contents; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4105,6 +4105,7 @@ export const serializeAws_restXmlPutObjectAclCommand = async ( input: PutObjectAclCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ACL) && { "x-amz-acl": input.ACL! }), @@ -4119,7 +4120,7 @@ export const serializeAws_restXmlPutObjectAclCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4159,7 +4160,6 @@ export const serializeAws_restXmlPutObjectAclCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4176,6 +4176,7 @@ export const serializeAws_restXmlPutObjectLegalHoldCommand = async ( input: PutObjectLegalHoldCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), @@ -4184,7 +4185,7 @@ export const serializeAws_restXmlPutObjectLegalHoldCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4224,7 +4225,6 @@ export const serializeAws_restXmlPutObjectLegalHoldCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4241,6 +4241,7 @@ export const serializeAws_restXmlPutObjectLockConfigurationCommand = async ( input: PutObjectLockConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), @@ -4250,7 +4251,7 @@ export const serializeAws_restXmlPutObjectLockConfigurationCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4274,7 +4275,6 @@ export const serializeAws_restXmlPutObjectLockConfigurationCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4291,6 +4291,7 @@ export const serializeAws_restXmlPutObjectRetentionCommand = async ( input: PutObjectRetentionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), @@ -4302,7 +4303,7 @@ export const serializeAws_restXmlPutObjectRetentionCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4342,7 +4343,6 @@ export const serializeAws_restXmlPutObjectRetentionCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4359,6 +4359,7 @@ export const serializeAws_restXmlPutObjectTaggingCommand = async ( input: PutObjectTaggingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -4367,7 +4368,7 @@ export const serializeAws_restXmlPutObjectTaggingCommand = async ( }), ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4407,7 +4408,6 @@ export const serializeAws_restXmlPutObjectTaggingCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4424,6 +4424,7 @@ export const serializeAws_restXmlPutPublicAccessBlockCommand = async ( input: PutPublicAccessBlockCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.ContentMD5) && { "content-md5": input.ContentMD5! }), @@ -4431,7 +4432,7 @@ export const serializeAws_restXmlPutPublicAccessBlockCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4455,7 +4456,6 @@ export const serializeAws_restXmlPutPublicAccessBlockCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4472,6 +4472,7 @@ export const serializeAws_restXmlRestoreObjectCommand = async ( input: RestoreObjectCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.RequestPayer) && { "x-amz-request-payer": input.RequestPayer! }), @@ -4479,7 +4480,7 @@ export const serializeAws_restXmlRestoreObjectCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4520,7 +4521,6 @@ export const serializeAws_restXmlRestoreObjectCommand = async ( contents.addAttribute("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4537,6 +4537,7 @@ export const serializeAws_restXmlSelectObjectContentCommand = async ( input: SelectObjectContentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.SSECustomerAlgorithm) && { @@ -4552,7 +4553,7 @@ export const serializeAws_restXmlSelectObjectContentCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4617,7 +4618,6 @@ export const serializeAws_restXmlSelectObjectContentCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4634,6 +4634,7 @@ export const serializeAws_restXmlUploadPartCommand = async ( input: UploadPartCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.ContentLength) && { "content-length": input.ContentLength!.toString() }), @@ -4652,7 +4653,7 @@ export const serializeAws_restXmlUploadPartCommand = async ( "x-amz-expected-bucket-owner": input.ExpectedBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4691,7 +4692,6 @@ export const serializeAws_restXmlUploadPartCommand = async ( contents = input.Body; body = contents; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4708,6 +4708,7 @@ export const serializeAws_restXmlUploadPartCopyCommand = async ( input: UploadPartCopyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.CopySource) && { "x-amz-copy-source": input.CopySource! }), ...(isSerializableHeaderValue(input.CopySourceIfMatch) && { @@ -4749,7 +4750,7 @@ export const serializeAws_restXmlUploadPartCopyCommand = async ( "x-amz-source-expected-bucket-owner": input.ExpectedSourceBucketOwner!, }), }; - let resolvedPath = "/{Bucket}/{Key+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Bucket}/{Key+}"; if (input.Bucket !== undefined) { const labelValue: string = input.Bucket; if (labelValue.length <= 0) { @@ -4780,7 +4781,6 @@ export const serializeAws_restXmlUploadPartCopyCommand = async ( ...(input.UploadId !== undefined && { uploadId: input.UploadId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -4797,6 +4797,7 @@ export const serializeAws_restXmlWriteGetObjectResponseCommand = async ( input: WriteGetObjectResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", "x-amz-content-sha256": "UNSIGNED-PAYLOAD", @@ -4885,7 +4886,7 @@ export const serializeAws_restXmlWriteGetObjectResponseCommand = async ( {} )), }; - let resolvedPath = "/WriteGetObjectResponse"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/WriteGetObjectResponse"; const query: any = { "x-id": "WriteGetObjectResponse", }; @@ -4909,7 +4910,6 @@ export const serializeAws_restXmlWriteGetObjectResponseCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, diff --git a/clients/client-s3outposts/protocols/Aws_restJson1.ts b/clients/client-s3outposts/protocols/Aws_restJson1.ts index 682f3dad77be9..3ed16a95d8f03 100644 --- a/clients/client-s3outposts/protocols/Aws_restJson1.ts +++ b/clients/client-s3outposts/protocols/Aws_restJson1.ts @@ -27,10 +27,12 @@ export const serializeAws_restJson1CreateEndpointCommand = async ( input: CreateEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/S3Outposts/CreateEndpoint"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/S3Outposts/CreateEndpoint"; let body: any; body = JSON.stringify({ ...(input.OutpostId !== undefined && input.OutpostId !== null && { OutpostId: input.OutpostId }), @@ -38,7 +40,6 @@ export const serializeAws_restJson1CreateEndpointCommand = async ( input.SecurityGroupId !== null && { SecurityGroupId: input.SecurityGroupId }), ...(input.SubnetId !== undefined && input.SubnetId !== null && { SubnetId: input.SubnetId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -54,14 +55,15 @@ export const serializeAws_restJson1DeleteEndpointCommand = async ( input: DeleteEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/S3Outposts/DeleteEndpoint"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/S3Outposts/DeleteEndpoint"; const query: any = { ...(input.EndpointId !== undefined && { endpointId: input.EndpointId }), ...(input.OutpostId !== undefined && { outpostId: input.OutpostId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -78,14 +80,15 @@ export const serializeAws_restJson1ListEndpointsCommand = async ( input: ListEndpointsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/S3Outposts/ListEndpoints"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/S3Outposts/ListEndpoints"; const query: any = { ...(input.NextToken !== undefined && { nextToken: input.NextToken }), ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-sagemaker-a2i-runtime/protocols/Aws_restJson1.ts b/clients/client-sagemaker-a2i-runtime/protocols/Aws_restJson1.ts index 8652a7d309df4..d94ede144154e 100644 --- a/clients/client-sagemaker-a2i-runtime/protocols/Aws_restJson1.ts +++ b/clients/client-sagemaker-a2i-runtime/protocols/Aws_restJson1.ts @@ -33,8 +33,10 @@ export const serializeAws_restJson1DeleteHumanLoopCommand = async ( input: DeleteHumanLoopCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/human-loops/{HumanLoopName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/human-loops/{HumanLoopName}"; if (input.HumanLoopName !== undefined) { const labelValue: string = input.HumanLoopName; if (labelValue.length <= 0) { @@ -45,7 +47,6 @@ export const serializeAws_restJson1DeleteHumanLoopCommand = async ( throw new Error("No value provided for input HTTP label: HumanLoopName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -61,8 +62,10 @@ export const serializeAws_restJson1DescribeHumanLoopCommand = async ( input: DescribeHumanLoopCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/human-loops/{HumanLoopName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/human-loops/{HumanLoopName}"; if (input.HumanLoopName !== undefined) { const labelValue: string = input.HumanLoopName; if (labelValue.length <= 0) { @@ -73,7 +76,6 @@ export const serializeAws_restJson1DescribeHumanLoopCommand = async ( throw new Error("No value provided for input HTTP label: HumanLoopName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -89,8 +91,9 @@ export const serializeAws_restJson1ListHumanLoopsCommand = async ( input: ListHumanLoopsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/human-loops"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/human-loops"; const query: any = { ...(input.CreationTimeAfter !== undefined && { CreationTimeAfter: (input.CreationTimeAfter.toISOString().split(".")[0] + "Z").toString(), @@ -104,7 +107,6 @@ export const serializeAws_restJson1ListHumanLoopsCommand = async ( ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -121,10 +123,11 @@ export const serializeAws_restJson1StartHumanLoopCommand = async ( input: StartHumanLoopCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/human-loops"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/human-loops"; let body: any; body = JSON.stringify({ ...(input.DataAttributes !== undefined && @@ -139,7 +142,6 @@ export const serializeAws_restJson1StartHumanLoopCommand = async ( }), ...(input.HumanLoopName !== undefined && input.HumanLoopName !== null && { HumanLoopName: input.HumanLoopName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -155,15 +157,15 @@ export const serializeAws_restJson1StopHumanLoopCommand = async ( input: StopHumanLoopCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/human-loops/stop"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/human-loops/stop"; let body: any; body = JSON.stringify({ ...(input.HumanLoopName !== undefined && input.HumanLoopName !== null && { HumanLoopName: input.HumanLoopName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-sagemaker-edge/protocols/Aws_restJson1.ts b/clients/client-sagemaker-edge/protocols/Aws_restJson1.ts index c11352669dd83..d4d17b5b52495 100644 --- a/clients/client-sagemaker-edge/protocols/Aws_restJson1.ts +++ b/clients/client-sagemaker-edge/protocols/Aws_restJson1.ts @@ -21,17 +21,17 @@ export const serializeAws_restJson1GetDeviceRegistrationCommand = async ( input: GetDeviceRegistrationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetDeviceRegistration"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetDeviceRegistration"; let body: any; body = JSON.stringify({ ...(input.DeviceFleetName !== undefined && input.DeviceFleetName !== null && { DeviceFleetName: input.DeviceFleetName }), ...(input.DeviceName !== undefined && input.DeviceName !== null && { DeviceName: input.DeviceName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -47,10 +47,11 @@ export const serializeAws_restJson1SendHeartbeatCommand = async ( input: SendHeartbeatCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/SendHeartbeat"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SendHeartbeat"; let body: any; body = JSON.stringify({ ...(input.AgentMetrics !== undefined && @@ -62,7 +63,6 @@ export const serializeAws_restJson1SendHeartbeatCommand = async ( ...(input.Models !== undefined && input.Models !== null && { Models: serializeAws_restJson1Models(input.Models, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-sagemaker-featurestore-runtime/protocols/Aws_restJson1.ts b/clients/client-sagemaker-featurestore-runtime/protocols/Aws_restJson1.ts index 87d56ab616847..5ce17be48b928 100644 --- a/clients/client-sagemaker-featurestore-runtime/protocols/Aws_restJson1.ts +++ b/clients/client-sagemaker-featurestore-runtime/protocols/Aws_restJson1.ts @@ -30,10 +30,11 @@ export const serializeAws_restJson1BatchGetRecordCommand = async ( input: BatchGetRecordCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/BatchGetRecord"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BatchGetRecord"; let body: any; body = JSON.stringify({ ...(input.Identifiers !== undefined && @@ -41,7 +42,6 @@ export const serializeAws_restJson1BatchGetRecordCommand = async ( Identifiers: serializeAws_restJson1BatchGetRecordIdentifiers(input.Identifiers, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -57,8 +57,10 @@ export const serializeAws_restJson1DeleteRecordCommand = async ( input: DeleteRecordCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/FeatureGroup/{FeatureGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FeatureGroup/{FeatureGroupName}"; if (input.FeatureGroupName !== undefined) { const labelValue: string = input.FeatureGroupName; if (labelValue.length <= 0) { @@ -75,7 +77,6 @@ export const serializeAws_restJson1DeleteRecordCommand = async ( ...(input.EventTime !== undefined && { EventTime: input.EventTime }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -92,8 +93,10 @@ export const serializeAws_restJson1GetRecordCommand = async ( input: GetRecordCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/FeatureGroup/{FeatureGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FeatureGroup/{FeatureGroupName}"; if (input.FeatureGroupName !== undefined) { const labelValue: string = input.FeatureGroupName; if (labelValue.length <= 0) { @@ -110,7 +113,6 @@ export const serializeAws_restJson1GetRecordCommand = async ( ...(input.FeatureNames !== undefined && { FeatureName: (input.FeatureNames || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -127,10 +129,12 @@ export const serializeAws_restJson1PutRecordCommand = async ( input: PutRecordCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/FeatureGroup/{FeatureGroupName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FeatureGroup/{FeatureGroupName}"; if (input.FeatureGroupName !== undefined) { const labelValue: string = input.FeatureGroupName; if (labelValue.length <= 0) { @@ -145,7 +149,6 @@ export const serializeAws_restJson1PutRecordCommand = async ( ...(input.Record !== undefined && input.Record !== null && { Record: serializeAws_restJson1Record(input.Record, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-sagemaker-runtime/protocols/Aws_restJson1.ts b/clients/client-sagemaker-runtime/protocols/Aws_restJson1.ts index 6a15c607fa50b..e13392d8f7f45 100644 --- a/clients/client-sagemaker-runtime/protocols/Aws_restJson1.ts +++ b/clients/client-sagemaker-runtime/protocols/Aws_restJson1.ts @@ -18,6 +18,7 @@ export const serializeAws_restJson1InvokeEndpointCommand = async ( input: InvokeEndpointCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.ContentType) && { "content-type": input.ContentType! }), @@ -32,7 +33,8 @@ export const serializeAws_restJson1InvokeEndpointCommand = async ( }), ...(isSerializableHeaderValue(input.InferenceId) && { "x-amzn-sagemaker-inference-id": input.InferenceId! }), }; - let resolvedPath = "/endpoints/{EndpointName}/invocations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/endpoints/{EndpointName}/invocations"; if (input.EndpointName !== undefined) { const labelValue: string = input.EndpointName; if (labelValue.length <= 0) { @@ -46,7 +48,6 @@ export const serializeAws_restJson1InvokeEndpointCommand = async ( if (input.Body !== undefined) { body = input.Body; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-savingsplans/protocols/Aws_restJson1.ts b/clients/client-savingsplans/protocols/Aws_restJson1.ts index 570358ab3e92d..ffcfdb21cd944 100644 --- a/clients/client-savingsplans/protocols/Aws_restJson1.ts +++ b/clients/client-savingsplans/protocols/Aws_restJson1.ts @@ -67,10 +67,11 @@ export const serializeAws_restJson1CreateSavingsPlanCommand = async ( input: CreateSavingsPlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateSavingsPlan"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateSavingsPlan"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -83,7 +84,6 @@ export const serializeAws_restJson1CreateSavingsPlanCommand = async ( ...(input.upfrontPaymentAmount !== undefined && input.upfrontPaymentAmount !== null && { upfrontPaymentAmount: input.upfrontPaymentAmount }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -99,15 +99,15 @@ export const serializeAws_restJson1DeleteQueuedSavingsPlanCommand = async ( input: DeleteQueuedSavingsPlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteQueuedSavingsPlan"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteQueuedSavingsPlan"; let body: any; body = JSON.stringify({ ...(input.savingsPlanId !== undefined && input.savingsPlanId !== null && { savingsPlanId: input.savingsPlanId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -123,10 +123,12 @@ export const serializeAws_restJson1DescribeSavingsPlanRatesCommand = async ( input: DescribeSavingsPlanRatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeSavingsPlanRates"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeSavingsPlanRates"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -135,7 +137,6 @@ export const serializeAws_restJson1DescribeSavingsPlanRatesCommand = async ( ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), ...(input.savingsPlanId !== undefined && input.savingsPlanId !== null && { savingsPlanId: input.savingsPlanId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -151,10 +152,11 @@ export const serializeAws_restJson1DescribeSavingsPlansCommand = async ( input: DescribeSavingsPlansCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeSavingsPlans"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeSavingsPlans"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -172,7 +174,6 @@ export const serializeAws_restJson1DescribeSavingsPlansCommand = async ( ...(input.states !== undefined && input.states !== null && { states: serializeAws_restJson1SavingsPlanStateList(input.states, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -188,10 +189,12 @@ export const serializeAws_restJson1DescribeSavingsPlansOfferingRatesCommand = as input: DescribeSavingsPlansOfferingRatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeSavingsPlansOfferingRates"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeSavingsPlansOfferingRates"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -232,7 +235,6 @@ export const serializeAws_restJson1DescribeSavingsPlansOfferingRatesCommand = as usageTypes: serializeAws_restJson1SavingsPlanRateUsageTypeList(input.usageTypes, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -248,10 +250,12 @@ export const serializeAws_restJson1DescribeSavingsPlansOfferingsCommand = async input: DescribeSavingsPlansOfferingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DescribeSavingsPlansOfferings"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DescribeSavingsPlansOfferings"; let body: any; body = JSON.stringify({ ...(input.currencies !== undefined && @@ -290,7 +294,6 @@ export const serializeAws_restJson1DescribeSavingsPlansOfferingsCommand = async usageTypes: serializeAws_restJson1SavingsPlanUsageTypeList(input.usageTypes, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -306,15 +309,15 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListTagsForResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListTagsForResource"; let body: any; body = JSON.stringify({ ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -330,16 +333,16 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/TagResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TagResource"; let body: any; body = JSON.stringify({ ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -355,17 +358,17 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UntagResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UntagResource"; let body: any; body = JSON.stringify({ ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), ...(input.tagKeys !== undefined && input.tagKeys !== null && { tagKeys: serializeAws_restJson1TagKeyList(input.tagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-schemas/protocols/Aws_restJson1.ts b/clients/client-schemas/protocols/Aws_restJson1.ts index f2bbdb27cbb58..b45af49f04d56 100644 --- a/clients/client-schemas/protocols/Aws_restJson1.ts +++ b/clients/client-schemas/protocols/Aws_restJson1.ts @@ -85,17 +85,17 @@ export const serializeAws_restJson1CreateDiscovererCommand = async ( input: CreateDiscovererCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/discoverers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/discoverers"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.SourceArn !== undefined && input.SourceArn !== null && { SourceArn: input.SourceArn }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -111,10 +111,12 @@ export const serializeAws_restJson1CreateRegistryCommand = async ( input: CreateRegistryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/registries/name/{RegistryName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/registries/name/{RegistryName}"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -129,7 +131,6 @@ export const serializeAws_restJson1CreateRegistryCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -145,10 +146,13 @@ export const serializeAws_restJson1CreateSchemaCommand = async ( input: CreateSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -174,7 +178,6 @@ export const serializeAws_restJson1CreateSchemaCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -190,8 +193,10 @@ export const serializeAws_restJson1DeleteDiscovererCommand = async ( input: DeleteDiscovererCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/discoverers/id/{DiscovererId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/discoverers/id/{DiscovererId}"; if (input.DiscovererId !== undefined) { const labelValue: string = input.DiscovererId; if (labelValue.length <= 0) { @@ -202,7 +207,6 @@ export const serializeAws_restJson1DeleteDiscovererCommand = async ( throw new Error("No value provided for input HTTP label: DiscovererId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -218,8 +222,10 @@ export const serializeAws_restJson1DeleteRegistryCommand = async ( input: DeleteRegistryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/registries/name/{RegistryName}"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -230,7 +236,6 @@ export const serializeAws_restJson1DeleteRegistryCommand = async ( throw new Error("No value provided for input HTTP label: RegistryName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -246,13 +251,13 @@ export const serializeAws_restJson1DeleteResourcePolicyCommand = async ( input: DeleteResourcePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/policy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/policy"; const query: any = { ...(input.RegistryName !== undefined && { registryName: input.RegistryName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -269,8 +274,11 @@ export const serializeAws_restJson1DeleteSchemaCommand = async ( input: DeleteSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -290,7 +298,6 @@ export const serializeAws_restJson1DeleteSchemaCommand = async ( throw new Error("No value provided for input HTTP label: SchemaName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -306,8 +313,11 @@ export const serializeAws_restJson1DeleteSchemaVersionCommand = async ( input: DeleteSchemaVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/version/{SchemaVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/version/{SchemaVersion}"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -336,7 +346,6 @@ export const serializeAws_restJson1DeleteSchemaVersionCommand = async ( throw new Error("No value provided for input HTTP label: SchemaVersion."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -352,8 +361,11 @@ export const serializeAws_restJson1DescribeCodeBindingCommand = async ( input: DescribeCodeBindingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}"; if (input.Language !== undefined) { const labelValue: string = input.Language; if (labelValue.length <= 0) { @@ -385,7 +397,6 @@ export const serializeAws_restJson1DescribeCodeBindingCommand = async ( ...(input.SchemaVersion !== undefined && { schemaVersion: input.SchemaVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -402,8 +413,10 @@ export const serializeAws_restJson1DescribeDiscovererCommand = async ( input: DescribeDiscovererCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/discoverers/id/{DiscovererId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/discoverers/id/{DiscovererId}"; if (input.DiscovererId !== undefined) { const labelValue: string = input.DiscovererId; if (labelValue.length <= 0) { @@ -414,7 +427,6 @@ export const serializeAws_restJson1DescribeDiscovererCommand = async ( throw new Error("No value provided for input HTTP label: DiscovererId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -430,8 +442,10 @@ export const serializeAws_restJson1DescribeRegistryCommand = async ( input: DescribeRegistryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/registries/name/{RegistryName}"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -442,7 +456,6 @@ export const serializeAws_restJson1DescribeRegistryCommand = async ( throw new Error("No value provided for input HTTP label: RegistryName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -458,8 +471,11 @@ export const serializeAws_restJson1DescribeSchemaCommand = async ( input: DescribeSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -482,7 +498,6 @@ export const serializeAws_restJson1DescribeSchemaCommand = async ( ...(input.SchemaVersion !== undefined && { schemaVersion: input.SchemaVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -499,8 +514,11 @@ export const serializeAws_restJson1ExportSchemaCommand = async ( input: ExportSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/export"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/export"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -524,7 +542,6 @@ export const serializeAws_restJson1ExportSchemaCommand = async ( ...(input.Type !== undefined && { type: input.Type }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -541,8 +558,11 @@ export const serializeAws_restJson1GetCodeBindingSourceCommand = async ( input: GetCodeBindingSourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}/source"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}/source"; if (input.Language !== undefined) { const labelValue: string = input.Language; if (labelValue.length <= 0) { @@ -574,7 +594,6 @@ export const serializeAws_restJson1GetCodeBindingSourceCommand = async ( ...(input.SchemaVersion !== undefined && { schemaVersion: input.SchemaVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -591,10 +610,11 @@ export const serializeAws_restJson1GetDiscoveredSchemaCommand = async ( input: GetDiscoveredSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/discover"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/discover"; let body: any; body = JSON.stringify({ ...(input.Events !== undefined && @@ -603,7 +623,6 @@ export const serializeAws_restJson1GetDiscoveredSchemaCommand = async ( }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -619,13 +638,13 @@ export const serializeAws_restJson1GetResourcePolicyCommand = async ( input: GetResourcePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/policy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/policy"; const query: any = { ...(input.RegistryName !== undefined && { registryName: input.RegistryName }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -642,8 +661,9 @@ export const serializeAws_restJson1ListDiscoverersCommand = async ( input: ListDiscoverersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/discoverers"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/discoverers"; const query: any = { ...(input.DiscovererIdPrefix !== undefined && { discovererIdPrefix: input.DiscovererIdPrefix }), ...(input.Limit !== undefined && { limit: input.Limit.toString() }), @@ -651,7 +671,6 @@ export const serializeAws_restJson1ListDiscoverersCommand = async ( ...(input.SourceArnPrefix !== undefined && { sourceArnPrefix: input.SourceArnPrefix }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -668,8 +687,9 @@ export const serializeAws_restJson1ListRegistriesCommand = async ( input: ListRegistriesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/registries"; const query: any = { ...(input.Limit !== undefined && { limit: input.Limit.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), @@ -677,7 +697,6 @@ export const serializeAws_restJson1ListRegistriesCommand = async ( ...(input.Scope !== undefined && { scope: input.Scope }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -694,8 +713,11 @@ export const serializeAws_restJson1ListSchemasCommand = async ( input: ListSchemasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -711,7 +733,6 @@ export const serializeAws_restJson1ListSchemasCommand = async ( ...(input.SchemaNamePrefix !== undefined && { schemaNamePrefix: input.SchemaNamePrefix }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -728,8 +749,11 @@ export const serializeAws_restJson1ListSchemaVersionsCommand = async ( input: ListSchemaVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/versions"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -753,7 +777,6 @@ export const serializeAws_restJson1ListSchemaVersionsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -770,8 +793,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -782,7 +806,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -798,8 +821,11 @@ export const serializeAws_restJson1PutCodeBindingCommand = async ( input: PutCodeBindingCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}"; if (input.Language !== undefined) { const labelValue: string = input.Language; if (labelValue.length <= 0) { @@ -831,7 +857,6 @@ export const serializeAws_restJson1PutCodeBindingCommand = async ( ...(input.SchemaVersion !== undefined && { schemaVersion: input.SchemaVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -848,10 +873,11 @@ export const serializeAws_restJson1PutResourcePolicyCommand = async ( input: PutResourcePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/policy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/policy"; const query: any = { ...(input.RegistryName !== undefined && { registryName: input.RegistryName }), }; @@ -860,7 +886,6 @@ export const serializeAws_restJson1PutResourcePolicyCommand = async ( ...(input.Policy !== undefined && input.Policy !== null && { Policy: __LazyJsonString.fromObject(input.Policy) }), ...(input.RevisionId !== undefined && input.RevisionId !== null && { RevisionId: input.RevisionId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -877,8 +902,11 @@ export const serializeAws_restJson1SearchSchemasCommand = async ( input: SearchSchemasCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/search"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/search"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -894,7 +922,6 @@ export const serializeAws_restJson1SearchSchemasCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -911,8 +938,10 @@ export const serializeAws_restJson1StartDiscovererCommand = async ( input: StartDiscovererCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/discoverers/id/{DiscovererId}/start"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/discoverers/id/{DiscovererId}/start"; if (input.DiscovererId !== undefined) { const labelValue: string = input.DiscovererId; if (labelValue.length <= 0) { @@ -923,7 +952,6 @@ export const serializeAws_restJson1StartDiscovererCommand = async ( throw new Error("No value provided for input HTTP label: DiscovererId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -939,8 +967,10 @@ export const serializeAws_restJson1StopDiscovererCommand = async ( input: StopDiscovererCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v1/discoverers/id/{DiscovererId}/stop"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/discoverers/id/{DiscovererId}/stop"; if (input.DiscovererId !== undefined) { const labelValue: string = input.DiscovererId; if (labelValue.length <= 0) { @@ -951,7 +981,6 @@ export const serializeAws_restJson1StopDiscovererCommand = async ( throw new Error("No value provided for input HTTP label: DiscovererId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -967,10 +996,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -984,7 +1014,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { tags: serializeAws_restJson1Tags(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1000,8 +1029,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1015,7 +1045,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1032,10 +1061,12 @@ export const serializeAws_restJson1UpdateDiscovererCommand = async ( input: UpdateDiscovererCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/discoverers/id/{DiscovererId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/discoverers/id/{DiscovererId}"; if (input.DiscovererId !== undefined) { const labelValue: string = input.DiscovererId; if (labelValue.length <= 0) { @@ -1049,7 +1080,6 @@ export const serializeAws_restJson1UpdateDiscovererCommand = async ( body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1065,10 +1095,12 @@ export const serializeAws_restJson1UpdateRegistryCommand = async ( input: UpdateRegistryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/registries/name/{RegistryName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/registries/name/{RegistryName}"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -1082,7 +1114,6 @@ export const serializeAws_restJson1UpdateRegistryCommand = async ( body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1098,10 +1129,13 @@ export const serializeAws_restJson1UpdateSchemaCommand = async ( input: UpdateSchemaCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}"; if (input.RegistryName !== undefined) { const labelValue: string = input.RegistryName; if (labelValue.length <= 0) { @@ -1127,7 +1161,6 @@ export const serializeAws_restJson1UpdateSchemaCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-securityhub/protocols/Aws_restJson1.ts b/clients/client-securityhub/protocols/Aws_restJson1.ts index e5699c67e0016..19c6c6e5ed052 100644 --- a/clients/client-securityhub/protocols/Aws_restJson1.ts +++ b/clients/client-securityhub/protocols/Aws_restJson1.ts @@ -469,17 +469,17 @@ export const serializeAws_restJson1AcceptAdministratorInvitationCommand = async input: AcceptAdministratorInvitationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/administrator"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/administrator"; let body: any; body = JSON.stringify({ ...(input.AdministratorId !== undefined && input.AdministratorId !== null && { AdministratorId: input.AdministratorId }), ...(input.InvitationId !== undefined && input.InvitationId !== null && { InvitationId: input.InvitationId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -495,16 +495,16 @@ export const serializeAws_restJson1AcceptInvitationCommand = async ( input: AcceptInvitationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/master"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/master"; let body: any; body = JSON.stringify({ ...(input.InvitationId !== undefined && input.InvitationId !== null && { InvitationId: input.InvitationId }), ...(input.MasterId !== undefined && input.MasterId !== null && { MasterId: input.MasterId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -520,10 +520,11 @@ export const serializeAws_restJson1BatchDisableStandardsCommand = async ( input: BatchDisableStandardsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/standards/deregister"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/standards/deregister"; let body: any; body = JSON.stringify({ ...(input.StandardsSubscriptionArns !== undefined && @@ -534,7 +535,6 @@ export const serializeAws_restJson1BatchDisableStandardsCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -550,10 +550,11 @@ export const serializeAws_restJson1BatchEnableStandardsCommand = async ( input: BatchEnableStandardsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/standards/register"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/standards/register"; let body: any; body = JSON.stringify({ ...(input.StandardsSubscriptionRequests !== undefined && @@ -564,7 +565,6 @@ export const serializeAws_restJson1BatchEnableStandardsCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -580,10 +580,11 @@ export const serializeAws_restJson1BatchImportFindingsCommand = async ( input: BatchImportFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findings/import"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findings/import"; let body: any; body = JSON.stringify({ ...(input.Findings !== undefined && @@ -591,7 +592,6 @@ export const serializeAws_restJson1BatchImportFindingsCommand = async ( Findings: serializeAws_restJson1BatchImportFindingsRequestFindingList(input.Findings, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -607,10 +607,11 @@ export const serializeAws_restJson1BatchUpdateFindingsCommand = async ( input: BatchUpdateFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findings/batchupdate"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findings/batchupdate"; let body: any; body = JSON.stringify({ ...(input.Confidence !== undefined && input.Confidence !== null && { Confidence: input.Confidence }), @@ -638,7 +639,6 @@ export const serializeAws_restJson1BatchUpdateFindingsCommand = async ( ...(input.Workflow !== undefined && input.Workflow !== null && { Workflow: serializeAws_restJson1WorkflowUpdate(input.Workflow, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -654,17 +654,17 @@ export const serializeAws_restJson1CreateActionTargetCommand = async ( input: CreateActionTargetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/actionTargets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/actionTargets"; let body: any; body = JSON.stringify({ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Id !== undefined && input.Id !== null && { Id: input.Id }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -680,10 +680,11 @@ export const serializeAws_restJson1CreateInsightCommand = async ( input: CreateInsightCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/insights"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -692,7 +693,6 @@ export const serializeAws_restJson1CreateInsightCommand = async ( input.GroupByAttribute !== null && { GroupByAttribute: input.GroupByAttribute }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -708,10 +708,11 @@ export const serializeAws_restJson1CreateMembersCommand = async ( input: CreateMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/members"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members"; let body: any; body = JSON.stringify({ ...(input.AccountDetails !== undefined && @@ -719,7 +720,6 @@ export const serializeAws_restJson1CreateMembersCommand = async ( AccountDetails: serializeAws_restJson1AccountDetailsList(input.AccountDetails, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -735,16 +735,16 @@ export const serializeAws_restJson1DeclineInvitationsCommand = async ( input: DeclineInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitations/decline"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations/decline"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && input.AccountIds !== null && { AccountIds: serializeAws_restJson1AccountIdList(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -760,8 +760,10 @@ export const serializeAws_restJson1DeleteActionTargetCommand = async ( input: DeleteActionTargetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/actionTargets/{ActionTargetArn+}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/actionTargets/{ActionTargetArn+}"; if (input.ActionTargetArn !== undefined) { const labelValue: string = input.ActionTargetArn; if (labelValue.length <= 0) { @@ -778,7 +780,6 @@ export const serializeAws_restJson1DeleteActionTargetCommand = async ( throw new Error("No value provided for input HTTP label: ActionTargetArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -794,8 +795,9 @@ export const serializeAws_restJson1DeleteInsightCommand = async ( input: DeleteInsightCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/insights/{InsightArn+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights/{InsightArn+}"; if (input.InsightArn !== undefined) { const labelValue: string = input.InsightArn; if (labelValue.length <= 0) { @@ -812,7 +814,6 @@ export const serializeAws_restJson1DeleteInsightCommand = async ( throw new Error("No value provided for input HTTP label: InsightArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -828,16 +829,16 @@ export const serializeAws_restJson1DeleteInvitationsCommand = async ( input: DeleteInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitations/delete"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations/delete"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && input.AccountIds !== null && { AccountIds: serializeAws_restJson1AccountIdList(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -853,16 +854,16 @@ export const serializeAws_restJson1DeleteMembersCommand = async ( input: DeleteMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/members/delete"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members/delete"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && input.AccountIds !== null && { AccountIds: serializeAws_restJson1AccountIdList(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -878,10 +879,11 @@ export const serializeAws_restJson1DescribeActionTargetsCommand = async ( input: DescribeActionTargetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/actionTargets/get"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/actionTargets/get"; let body: any; body = JSON.stringify({ ...(input.ActionTargetArns !== undefined && @@ -891,7 +893,6 @@ export const serializeAws_restJson1DescribeActionTargetsCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -907,13 +908,13 @@ export const serializeAws_restJson1DescribeHubCommand = async ( input: DescribeHubCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/accounts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts"; const query: any = { ...(input.HubArn !== undefined && { HubArn: input.HubArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -930,13 +931,14 @@ export const serializeAws_restJson1DescribeOrganizationConfigurationCommand = as input: DescribeOrganizationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/organization/configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/organization/configuration"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -952,15 +954,15 @@ export const serializeAws_restJson1DescribeProductsCommand = async ( input: DescribeProductsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/products"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/products"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), ...(input.ProductArn !== undefined && { ProductArn: input.ProductArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -977,14 +979,14 @@ export const serializeAws_restJson1DescribeStandardsCommand = async ( input: DescribeStandardsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/standards"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/standards"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1001,8 +1003,11 @@ export const serializeAws_restJson1DescribeStandardsControlsCommand = async ( input: DescribeStandardsControlsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/standards/controls/{StandardsSubscriptionArn+}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/standards/controls/{StandardsSubscriptionArn+}"; if (input.StandardsSubscriptionArn !== undefined) { const labelValue: string = input.StandardsSubscriptionArn; if (labelValue.length <= 0) { @@ -1023,7 +1028,6 @@ export const serializeAws_restJson1DescribeStandardsControlsCommand = async ( ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1040,8 +1044,11 @@ export const serializeAws_restJson1DisableImportFindingsForProductCommand = asyn input: DisableImportFindingsForProductCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/productSubscriptions/{ProductSubscriptionArn+}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/productSubscriptions/{ProductSubscriptionArn+}"; if (input.ProductSubscriptionArn !== undefined) { const labelValue: string = input.ProductSubscriptionArn; if (labelValue.length <= 0) { @@ -1058,7 +1065,6 @@ export const serializeAws_restJson1DisableImportFindingsForProductCommand = asyn throw new Error("No value provided for input HTTP label: ProductSubscriptionArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1074,16 +1080,17 @@ export const serializeAws_restJson1DisableOrganizationAdminAccountCommand = asyn input: DisableOrganizationAdminAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/organization/admin/disable"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/organization/admin/disable"; let body: any; body = JSON.stringify({ ...(input.AdminAccountId !== undefined && input.AdminAccountId !== null && { AdminAccountId: input.AdminAccountId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1099,13 +1106,13 @@ export const serializeAws_restJson1DisableSecurityHubCommand = async ( input: DisableSecurityHubCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1121,13 +1128,14 @@ export const serializeAws_restJson1DisassociateFromAdministratorAccountCommand = input: DisassociateFromAdministratorAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/administrator/disassociate"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/administrator/disassociate"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1143,13 +1151,13 @@ export const serializeAws_restJson1DisassociateFromMasterAccountCommand = async input: DisassociateFromMasterAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/master/disassociate"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/master/disassociate"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1165,16 +1173,16 @@ export const serializeAws_restJson1DisassociateMembersCommand = async ( input: DisassociateMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/members/disassociate"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members/disassociate"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && input.AccountIds !== null && { AccountIds: serializeAws_restJson1AccountIdList(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1190,15 +1198,15 @@ export const serializeAws_restJson1EnableImportFindingsForProductCommand = async input: EnableImportFindingsForProductCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/productSubscriptions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/productSubscriptions"; let body: any; body = JSON.stringify({ ...(input.ProductArn !== undefined && input.ProductArn !== null && { ProductArn: input.ProductArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1214,16 +1222,17 @@ export const serializeAws_restJson1EnableOrganizationAdminAccountCommand = async input: EnableOrganizationAdminAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/organization/admin/enable"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/organization/admin/enable"; let body: any; body = JSON.stringify({ ...(input.AdminAccountId !== undefined && input.AdminAccountId !== null && { AdminAccountId: input.AdminAccountId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1239,17 +1248,17 @@ export const serializeAws_restJson1EnableSecurityHubCommand = async ( input: EnableSecurityHubCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts"; let body: any; body = JSON.stringify({ ...(input.EnableDefaultStandards !== undefined && input.EnableDefaultStandards !== null && { EnableDefaultStandards: input.EnableDefaultStandards }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1265,13 +1274,13 @@ export const serializeAws_restJson1GetAdministratorAccountCommand = async ( input: GetAdministratorAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/administrator"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/administrator"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1287,10 +1296,11 @@ export const serializeAws_restJson1GetEnabledStandardsCommand = async ( input: GetEnabledStandardsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/standards/get"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/standards/get"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -1303,7 +1313,6 @@ export const serializeAws_restJson1GetEnabledStandardsCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1319,10 +1328,11 @@ export const serializeAws_restJson1GetFindingsCommand = async ( input: GetFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findings"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -1332,7 +1342,6 @@ export const serializeAws_restJson1GetFindingsCommand = async ( ...(input.SortCriteria !== undefined && input.SortCriteria !== null && { SortCriteria: serializeAws_restJson1SortCriteria(input.SortCriteria, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1348,8 +1357,10 @@ export const serializeAws_restJson1GetInsightResultsCommand = async ( input: GetInsightResultsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/insights/results/{InsightArn+}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights/results/{InsightArn+}"; if (input.InsightArn !== undefined) { const labelValue: string = input.InsightArn; if (labelValue.length <= 0) { @@ -1366,7 +1377,6 @@ export const serializeAws_restJson1GetInsightResultsCommand = async ( throw new Error("No value provided for input HTTP label: InsightArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1382,10 +1392,11 @@ export const serializeAws_restJson1GetInsightsCommand = async ( input: GetInsightsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/insights/get"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights/get"; let body: any; body = JSON.stringify({ ...(input.InsightArns !== undefined && @@ -1393,7 +1404,6 @@ export const serializeAws_restJson1GetInsightsCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1409,13 +1419,13 @@ export const serializeAws_restJson1GetInvitationsCountCommand = async ( input: GetInvitationsCountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/invitations/count"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations/count"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1431,13 +1441,13 @@ export const serializeAws_restJson1GetMasterAccountCommand = async ( input: GetMasterAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/master"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/master"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1453,16 +1463,16 @@ export const serializeAws_restJson1GetMembersCommand = async ( input: GetMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/members/get"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members/get"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && input.AccountIds !== null && { AccountIds: serializeAws_restJson1AccountIdList(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1478,16 +1488,16 @@ export const serializeAws_restJson1InviteMembersCommand = async ( input: InviteMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/members/invite"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members/invite"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && input.AccountIds !== null && { AccountIds: serializeAws_restJson1AccountIdList(input.AccountIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1503,14 +1513,14 @@ export const serializeAws_restJson1ListEnabledProductsForImportCommand = async ( input: ListEnabledProductsForImportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/productSubscriptions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/productSubscriptions"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1527,14 +1537,14 @@ export const serializeAws_restJson1ListInvitationsCommand = async ( input: ListInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/invitations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/invitations"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1551,15 +1561,15 @@ export const serializeAws_restJson1ListMembersCommand = async ( input: ListMembersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/members"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/members"; const query: any = { ...(input.OnlyAssociated !== undefined && { OnlyAssociated: input.OnlyAssociated.toString() }), ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1576,14 +1586,14 @@ export const serializeAws_restJson1ListOrganizationAdminAccountsCommand = async input: ListOrganizationAdminAccountsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/organization/admin"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/organization/admin"; const query: any = { ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1600,8 +1610,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1612,7 +1623,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1628,10 +1638,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1645,7 +1656,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1661,8 +1671,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -1676,7 +1687,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1693,10 +1703,12 @@ export const serializeAws_restJson1UpdateActionTargetCommand = async ( input: UpdateActionTargetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/actionTargets/{ActionTargetArn+}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/actionTargets/{ActionTargetArn+}"; if (input.ActionTargetArn !== undefined) { const labelValue: string = input.ActionTargetArn; if (labelValue.length <= 0) { @@ -1717,7 +1729,6 @@ export const serializeAws_restJson1UpdateActionTargetCommand = async ( ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1733,10 +1744,11 @@ export const serializeAws_restJson1UpdateFindingsCommand = async ( input: UpdateFindingsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/findings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/findings"; let body: any; body = JSON.stringify({ ...(input.Filters !== undefined && @@ -1745,7 +1757,6 @@ export const serializeAws_restJson1UpdateFindingsCommand = async ( input.Note !== null && { Note: serializeAws_restJson1NoteUpdate(input.Note, context) }), ...(input.RecordState !== undefined && input.RecordState !== null && { RecordState: input.RecordState }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1761,10 +1772,11 @@ export const serializeAws_restJson1UpdateInsightCommand = async ( input: UpdateInsightCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/insights/{InsightArn+}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights/{InsightArn+}"; if (input.InsightArn !== undefined) { const labelValue: string = input.InsightArn; if (labelValue.length <= 0) { @@ -1788,7 +1800,6 @@ export const serializeAws_restJson1UpdateInsightCommand = async ( input.GroupByAttribute !== null && { GroupByAttribute: input.GroupByAttribute }), ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1804,15 +1815,16 @@ export const serializeAws_restJson1UpdateOrganizationConfigurationCommand = asyn input: UpdateOrganizationConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/organization/configuration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/organization/configuration"; let body: any; body = JSON.stringify({ ...(input.AutoEnable !== undefined && input.AutoEnable !== null && { AutoEnable: input.AutoEnable }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1828,16 +1840,16 @@ export const serializeAws_restJson1UpdateSecurityHubConfigurationCommand = async input: UpdateSecurityHubConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/accounts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/accounts"; let body: any; body = JSON.stringify({ ...(input.AutoEnableControls !== undefined && input.AutoEnableControls !== null && { AutoEnableControls: input.AutoEnableControls }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1853,10 +1865,12 @@ export const serializeAws_restJson1UpdateStandardsControlCommand = async ( input: UpdateStandardsControlCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/standards/control/{StandardsControlArn+}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/standards/control/{StandardsControlArn+}"; if (input.StandardsControlArn !== undefined) { const labelValue: string = input.StandardsControlArn; if (labelValue.length <= 0) { @@ -1878,7 +1892,6 @@ export const serializeAws_restJson1UpdateStandardsControlCommand = async ( ...(input.DisabledReason !== undefined && input.DisabledReason !== null && { DisabledReason: input.DisabledReason }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-serverlessapplicationrepository/protocols/Aws_restJson1.ts b/clients/client-serverlessapplicationrepository/protocols/Aws_restJson1.ts index 4025b3bce9e01..c83ff4b69b91e 100644 --- a/clients/client-serverlessapplicationrepository/protocols/Aws_restJson1.ts +++ b/clients/client-serverlessapplicationrepository/protocols/Aws_restJson1.ts @@ -74,10 +74,11 @@ export const serializeAws_restJson1CreateApplicationCommand = async ( input: CreateApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications"; let body: any; body = JSON.stringify({ ...(input.Author !== undefined && input.Author !== null && { author: input.Author }), @@ -99,7 +100,6 @@ export const serializeAws_restJson1CreateApplicationCommand = async ( ...(input.TemplateBody !== undefined && input.TemplateBody !== null && { templateBody: input.TemplateBody }), ...(input.TemplateUrl !== undefined && input.TemplateUrl !== null && { templateUrl: input.TemplateUrl }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -115,10 +115,13 @@ export const serializeAws_restJson1CreateApplicationVersionCommand = async ( input: CreateApplicationVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}/versions/{SemanticVersion}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/versions/{SemanticVersion}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -145,7 +148,6 @@ export const serializeAws_restJson1CreateApplicationVersionCommand = async ( ...(input.TemplateBody !== undefined && input.TemplateBody !== null && { templateBody: input.TemplateBody }), ...(input.TemplateUrl !== undefined && input.TemplateUrl !== null && { templateUrl: input.TemplateUrl }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -161,10 +163,12 @@ export const serializeAws_restJson1CreateCloudFormationChangeSetCommand = async input: CreateCloudFormationChangeSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}/changesets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}/changesets"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -206,7 +210,6 @@ export const serializeAws_restJson1CreateCloudFormationChangeSetCommand = async input.Tags !== null && { tags: serializeAws_restJson1__listOfTag(input.Tags, context) }), ...(input.TemplateId !== undefined && input.TemplateId !== null && { templateId: input.TemplateId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -222,10 +225,12 @@ export const serializeAws_restJson1CreateCloudFormationTemplateCommand = async ( input: CreateCloudFormationTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}/templates"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}/templates"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -240,7 +245,6 @@ export const serializeAws_restJson1CreateCloudFormationTemplateCommand = async ( ...(input.SemanticVersion !== undefined && input.SemanticVersion !== null && { semanticVersion: input.SemanticVersion }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -256,8 +260,10 @@ export const serializeAws_restJson1DeleteApplicationCommand = async ( input: DeleteApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -268,7 +274,6 @@ export const serializeAws_restJson1DeleteApplicationCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -284,8 +289,10 @@ export const serializeAws_restJson1GetApplicationCommand = async ( input: GetApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -299,7 +306,6 @@ export const serializeAws_restJson1GetApplicationCommand = async ( ...(input.SemanticVersion !== undefined && { semanticVersion: input.SemanticVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -316,8 +322,10 @@ export const serializeAws_restJson1GetApplicationPolicyCommand = async ( input: GetApplicationPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}/policy"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -328,7 +336,6 @@ export const serializeAws_restJson1GetApplicationPolicyCommand = async ( throw new Error("No value provided for input HTTP label: ApplicationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -344,8 +351,11 @@ export const serializeAws_restJson1GetCloudFormationTemplateCommand = async ( input: GetCloudFormationTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/templates/{TemplateId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/templates/{TemplateId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -365,7 +375,6 @@ export const serializeAws_restJson1GetCloudFormationTemplateCommand = async ( throw new Error("No value provided for input HTTP label: TemplateId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -381,8 +390,11 @@ export const serializeAws_restJson1ListApplicationDependenciesCommand = async ( input: ListApplicationDependenciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/dependencies"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{ApplicationId}/dependencies"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -398,7 +410,6 @@ export const serializeAws_restJson1ListApplicationDependenciesCommand = async ( ...(input.SemanticVersion !== undefined && { semanticVersion: input.SemanticVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -415,14 +426,14 @@ export const serializeAws_restJson1ListApplicationsCommand = async ( input: ListApplicationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications"; const query: any = { ...(input.MaxItems !== undefined && { maxItems: input.MaxItems.toString() }), ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -439,8 +450,10 @@ export const serializeAws_restJson1ListApplicationVersionsCommand = async ( input: ListApplicationVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{ApplicationId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}/versions"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -455,7 +468,6 @@ export const serializeAws_restJson1ListApplicationVersionsCommand = async ( ...(input.NextToken !== undefined && { nextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -472,10 +484,12 @@ export const serializeAws_restJson1PutApplicationPolicyCommand = async ( input: PutApplicationPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}/policy"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}/policy"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -492,7 +506,6 @@ export const serializeAws_restJson1PutApplicationPolicyCommand = async ( statements: serializeAws_restJson1__listOfApplicationPolicyStatement(input.Statements, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -508,10 +521,12 @@ export const serializeAws_restJson1UnshareApplicationCommand = async ( input: UnshareApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}/unshare"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}/unshare"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -526,7 +541,6 @@ export const serializeAws_restJson1UnshareApplicationCommand = async ( ...(input.OrganizationId !== undefined && input.OrganizationId !== null && { organizationId: input.OrganizationId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -542,10 +556,12 @@ export const serializeAws_restJson1UpdateApplicationCommand = async ( input: UpdateApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{ApplicationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{ApplicationId}"; if (input.ApplicationId !== undefined) { const labelValue: string = input.ApplicationId; if (labelValue.length <= 0) { @@ -565,7 +581,6 @@ export const serializeAws_restJson1UpdateApplicationCommand = async ( ...(input.ReadmeBody !== undefined && input.ReadmeBody !== null && { readmeBody: input.ReadmeBody }), ...(input.ReadmeUrl !== undefined && input.ReadmeUrl !== null && { readmeUrl: input.ReadmeUrl }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-service-catalog-appregistry/protocols/Aws_restJson1.ts b/clients/client-service-catalog-appregistry/protocols/Aws_restJson1.ts index abda7583c3bd3..fbaf96ac390be 100644 --- a/clients/client-service-catalog-appregistry/protocols/Aws_restJson1.ts +++ b/clients/client-service-catalog-appregistry/protocols/Aws_restJson1.ts @@ -79,8 +79,11 @@ export const serializeAws_restJson1AssociateAttributeGroupCommand = async ( input: AssociateAttributeGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{application}/attribute-groups/{attributeGroup}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{application}/attribute-groups/{attributeGroup}"; if (input.application !== undefined) { const labelValue: string = input.application; if (labelValue.length <= 0) { @@ -100,7 +103,6 @@ export const serializeAws_restJson1AssociateAttributeGroupCommand = async ( throw new Error("No value provided for input HTTP label: attributeGroup."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -116,8 +118,11 @@ export const serializeAws_restJson1AssociateResourceCommand = async ( input: AssociateResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{application}/resources/{resourceType}/{resource}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{application}/resources/{resourceType}/{resource}"; if (input.application !== undefined) { const labelValue: string = input.application; if (labelValue.length <= 0) { @@ -146,7 +151,6 @@ export const serializeAws_restJson1AssociateResourceCommand = async ( throw new Error("No value provided for input HTTP label: resource."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -162,10 +166,11 @@ export const serializeAws_restJson1CreateApplicationCommand = async ( input: CreateApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -173,7 +178,6 @@ export const serializeAws_restJson1CreateApplicationCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -189,10 +193,11 @@ export const serializeAws_restJson1CreateAttributeGroupCommand = async ( input: CreateAttributeGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/attribute-groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/attribute-groups"; let body: any; body = JSON.stringify({ ...(input.attributes !== undefined && input.attributes !== null && { attributes: input.attributes }), @@ -201,7 +206,6 @@ export const serializeAws_restJson1CreateAttributeGroupCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -217,8 +221,10 @@ export const serializeAws_restJson1DeleteApplicationCommand = async ( input: DeleteApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{application}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{application}"; if (input.application !== undefined) { const labelValue: string = input.application; if (labelValue.length <= 0) { @@ -229,7 +235,6 @@ export const serializeAws_restJson1DeleteApplicationCommand = async ( throw new Error("No value provided for input HTTP label: application."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -245,8 +250,10 @@ export const serializeAws_restJson1DeleteAttributeGroupCommand = async ( input: DeleteAttributeGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/attribute-groups/{attributeGroup}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/attribute-groups/{attributeGroup}"; if (input.attributeGroup !== undefined) { const labelValue: string = input.attributeGroup; if (labelValue.length <= 0) { @@ -257,7 +264,6 @@ export const serializeAws_restJson1DeleteAttributeGroupCommand = async ( throw new Error("No value provided for input HTTP label: attributeGroup."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -273,8 +279,11 @@ export const serializeAws_restJson1DisassociateAttributeGroupCommand = async ( input: DisassociateAttributeGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{application}/attribute-groups/{attributeGroup}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{application}/attribute-groups/{attributeGroup}"; if (input.application !== undefined) { const labelValue: string = input.application; if (labelValue.length <= 0) { @@ -294,7 +303,6 @@ export const serializeAws_restJson1DisassociateAttributeGroupCommand = async ( throw new Error("No value provided for input HTTP label: attributeGroup."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -310,8 +318,11 @@ export const serializeAws_restJson1DisassociateResourceCommand = async ( input: DisassociateResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{application}/resources/{resourceType}/{resource}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{application}/resources/{resourceType}/{resource}"; if (input.application !== undefined) { const labelValue: string = input.application; if (labelValue.length <= 0) { @@ -340,7 +351,6 @@ export const serializeAws_restJson1DisassociateResourceCommand = async ( throw new Error("No value provided for input HTTP label: resource."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -356,8 +366,10 @@ export const serializeAws_restJson1GetApplicationCommand = async ( input: GetApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{application}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{application}"; if (input.application !== undefined) { const labelValue: string = input.application; if (labelValue.length <= 0) { @@ -368,7 +380,6 @@ export const serializeAws_restJson1GetApplicationCommand = async ( throw new Error("No value provided for input HTTP label: application."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -384,8 +395,10 @@ export const serializeAws_restJson1GetAttributeGroupCommand = async ( input: GetAttributeGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/attribute-groups/{attributeGroup}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/attribute-groups/{attributeGroup}"; if (input.attributeGroup !== undefined) { const labelValue: string = input.attributeGroup; if (labelValue.length <= 0) { @@ -396,7 +409,6 @@ export const serializeAws_restJson1GetAttributeGroupCommand = async ( throw new Error("No value provided for input HTTP label: attributeGroup."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -412,14 +424,14 @@ export const serializeAws_restJson1ListApplicationsCommand = async ( input: ListApplicationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -436,8 +448,11 @@ export const serializeAws_restJson1ListAssociatedAttributeGroupsCommand = async input: ListAssociatedAttributeGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{application}/attribute-groups"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/applications/{application}/attribute-groups"; if (input.application !== undefined) { const labelValue: string = input.application; if (labelValue.length <= 0) { @@ -452,7 +467,6 @@ export const serializeAws_restJson1ListAssociatedAttributeGroupsCommand = async ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -469,8 +483,10 @@ export const serializeAws_restJson1ListAssociatedResourcesCommand = async ( input: ListAssociatedResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/applications/{application}/resources"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{application}/resources"; if (input.application !== undefined) { const labelValue: string = input.application; if (labelValue.length <= 0) { @@ -485,7 +501,6 @@ export const serializeAws_restJson1ListAssociatedResourcesCommand = async ( ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -502,14 +517,14 @@ export const serializeAws_restJson1ListAttributeGroupsCommand = async ( input: ListAttributeGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/attribute-groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/attribute-groups"; const query: any = { ...(input.nextToken !== undefined && { nextToken: input.nextToken }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -526,8 +541,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -538,7 +554,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -554,8 +569,10 @@ export const serializeAws_restJson1SyncResourceCommand = async ( input: SyncResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/sync/{resourceType}/{resource}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sync/{resourceType}/{resource}"; if (input.resourceType !== undefined) { const labelValue: string = input.resourceType; if (labelValue.length <= 0) { @@ -575,7 +592,6 @@ export const serializeAws_restJson1SyncResourceCommand = async ( throw new Error("No value provided for input HTTP label: resource."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -591,10 +607,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -608,7 +625,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1Tags(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -624,8 +640,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -639,7 +656,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -656,10 +672,12 @@ export const serializeAws_restJson1UpdateApplicationCommand = async ( input: UpdateApplicationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/applications/{application}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/applications/{application}"; if (input.application !== undefined) { const labelValue: string = input.application; if (labelValue.length <= 0) { @@ -674,7 +692,6 @@ export const serializeAws_restJson1UpdateApplicationCommand = async ( ...(input.description !== undefined && input.description !== null && { description: input.description }), ...(input.name !== undefined && input.name !== null && { name: input.name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -690,10 +707,12 @@ export const serializeAws_restJson1UpdateAttributeGroupCommand = async ( input: UpdateAttributeGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/attribute-groups/{attributeGroup}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/attribute-groups/{attributeGroup}"; if (input.attributeGroup !== undefined) { const labelValue: string = input.attributeGroup; if (labelValue.length <= 0) { @@ -709,7 +728,6 @@ export const serializeAws_restJson1UpdateAttributeGroupCommand = async ( ...(input.description !== undefined && input.description !== null && { description: input.description }), ...(input.name !== undefined && input.name !== null && { name: input.name }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-sesv2/protocols/Aws_restJson1.ts b/clients/client-sesv2/protocols/Aws_restJson1.ts index 4171ee6986400..64e69bad2a99c 100644 --- a/clients/client-sesv2/protocols/Aws_restJson1.ts +++ b/clients/client-sesv2/protocols/Aws_restJson1.ts @@ -351,10 +351,12 @@ export const serializeAws_restJson1CreateConfigurationSetCommand = async ( input: CreateConfigurationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/configuration-sets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/configuration-sets"; let body: any; body = JSON.stringify({ ...(input.ConfigurationSetName !== undefined && @@ -382,7 +384,6 @@ export const serializeAws_restJson1CreateConfigurationSetCommand = async ( TrackingOptions: serializeAws_restJson1TrackingOptions(input.TrackingOptions, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -398,10 +399,13 @@ export const serializeAws_restJson1CreateConfigurationSetEventDestinationCommand input: CreateConfigurationSetEventDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -420,7 +424,6 @@ export const serializeAws_restJson1CreateConfigurationSetEventDestinationCommand ...(input.EventDestinationName !== undefined && input.EventDestinationName !== null && { EventDestinationName: input.EventDestinationName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -436,10 +439,13 @@ export const serializeAws_restJson1CreateContactCommand = async ( input: CreateContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/contact-lists/{ContactListName}/contacts"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/contact-lists/{ContactListName}/contacts"; if (input.ContactListName !== undefined) { const labelValue: string = input.ContactListName; if (labelValue.length <= 0) { @@ -461,7 +467,6 @@ export const serializeAws_restJson1CreateContactCommand = async ( ...(input.UnsubscribeAll !== undefined && input.UnsubscribeAll !== null && { UnsubscribeAll: input.UnsubscribeAll }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -477,10 +482,11 @@ export const serializeAws_restJson1CreateContactListCommand = async ( input: CreateContactListCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/contact-lists"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/contact-lists"; let body: any; body = JSON.stringify({ ...(input.ContactListName !== undefined && @@ -491,7 +497,6 @@ export const serializeAws_restJson1CreateContactListCommand = async ( ...(input.Topics !== undefined && input.Topics !== null && { Topics: serializeAws_restJson1Topics(input.Topics, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -507,10 +512,13 @@ export const serializeAws_restJson1CreateCustomVerificationEmailTemplateCommand input: CreateCustomVerificationEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/custom-verification-email-templates"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/custom-verification-email-templates"; let body: any; body = JSON.stringify({ ...(input.FailureRedirectionURL !== undefined && @@ -525,7 +533,6 @@ export const serializeAws_restJson1CreateCustomVerificationEmailTemplateCommand ...(input.TemplateSubject !== undefined && input.TemplateSubject !== null && { TemplateSubject: input.TemplateSubject }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -541,17 +548,18 @@ export const serializeAws_restJson1CreateDedicatedIpPoolCommand = async ( input: CreateDedicatedIpPoolCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/dedicated-ip-pools"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/dedicated-ip-pools"; let body: any; body = JSON.stringify({ ...(input.PoolName !== undefined && input.PoolName !== null && { PoolName: input.PoolName }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -567,10 +575,12 @@ export const serializeAws_restJson1CreateDeliverabilityTestReportCommand = async input: CreateDeliverabilityTestReportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/deliverability-dashboard/test"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/deliverability-dashboard/test"; let body: any; body = JSON.stringify({ ...(input.Content !== undefined && @@ -581,7 +591,6 @@ export const serializeAws_restJson1CreateDeliverabilityTestReportCommand = async ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -597,10 +606,11 @@ export const serializeAws_restJson1CreateEmailIdentityCommand = async ( input: CreateEmailIdentityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/identities"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/identities"; let body: any; body = JSON.stringify({ ...(input.ConfigurationSetName !== undefined && @@ -613,7 +623,6 @@ export const serializeAws_restJson1CreateEmailIdentityCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -629,10 +638,13 @@ export const serializeAws_restJson1CreateEmailIdentityPolicyCommand = async ( input: CreateEmailIdentityPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/identities/{EmailIdentity}/policies/{PolicyName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/identities/{EmailIdentity}/policies/{PolicyName}"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -655,7 +667,6 @@ export const serializeAws_restJson1CreateEmailIdentityPolicyCommand = async ( body = JSON.stringify({ ...(input.Policy !== undefined && input.Policy !== null && { Policy: input.Policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -671,10 +682,11 @@ export const serializeAws_restJson1CreateEmailTemplateCommand = async ( input: CreateEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/templates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/templates"; let body: any; body = JSON.stringify({ ...(input.TemplateContent !== undefined && @@ -683,7 +695,6 @@ export const serializeAws_restJson1CreateEmailTemplateCommand = async ( }), ...(input.TemplateName !== undefined && input.TemplateName !== null && { TemplateName: input.TemplateName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -699,10 +710,11 @@ export const serializeAws_restJson1CreateImportJobCommand = async ( input: CreateImportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/import-jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/import-jobs"; let body: any; body = JSON.stringify({ ...(input.ImportDataSource !== undefined && @@ -714,7 +726,6 @@ export const serializeAws_restJson1CreateImportJobCommand = async ( ImportDestination: serializeAws_restJson1ImportDestination(input.ImportDestination, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -730,8 +741,11 @@ export const serializeAws_restJson1DeleteConfigurationSetCommand = async ( input: DeleteConfigurationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -742,7 +756,6 @@ export const serializeAws_restJson1DeleteConfigurationSetCommand = async ( throw new Error("No value provided for input HTTP label: ConfigurationSetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -758,8 +771,11 @@ export const serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand input: DeleteConfigurationSetEventDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -779,7 +795,6 @@ export const serializeAws_restJson1DeleteConfigurationSetEventDestinationCommand throw new Error("No value provided for input HTTP label: EventDestinationName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -795,8 +810,11 @@ export const serializeAws_restJson1DeleteContactCommand = async ( input: DeleteContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/contact-lists/{ContactListName}/contacts/{EmailAddress}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/contact-lists/{ContactListName}/contacts/{EmailAddress}"; if (input.ContactListName !== undefined) { const labelValue: string = input.ContactListName; if (labelValue.length <= 0) { @@ -816,7 +834,6 @@ export const serializeAws_restJson1DeleteContactCommand = async ( throw new Error("No value provided for input HTTP label: EmailAddress."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -832,8 +849,10 @@ export const serializeAws_restJson1DeleteContactListCommand = async ( input: DeleteContactListCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/contact-lists/{ContactListName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/contact-lists/{ContactListName}"; if (input.ContactListName !== undefined) { const labelValue: string = input.ContactListName; if (labelValue.length <= 0) { @@ -844,7 +863,6 @@ export const serializeAws_restJson1DeleteContactListCommand = async ( throw new Error("No value provided for input HTTP label: ContactListName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -860,8 +878,11 @@ export const serializeAws_restJson1DeleteCustomVerificationEmailTemplateCommand input: DeleteCustomVerificationEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/custom-verification-email-templates/{TemplateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/custom-verification-email-templates/{TemplateName}"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -872,7 +893,6 @@ export const serializeAws_restJson1DeleteCustomVerificationEmailTemplateCommand throw new Error("No value provided for input HTTP label: TemplateName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -888,8 +908,10 @@ export const serializeAws_restJson1DeleteDedicatedIpPoolCommand = async ( input: DeleteDedicatedIpPoolCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/dedicated-ip-pools/{PoolName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/dedicated-ip-pools/{PoolName}"; if (input.PoolName !== undefined) { const labelValue: string = input.PoolName; if (labelValue.length <= 0) { @@ -900,7 +922,6 @@ export const serializeAws_restJson1DeleteDedicatedIpPoolCommand = async ( throw new Error("No value provided for input HTTP label: PoolName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -916,8 +937,10 @@ export const serializeAws_restJson1DeleteEmailIdentityCommand = async ( input: DeleteEmailIdentityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/identities/{EmailIdentity}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/identities/{EmailIdentity}"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -928,7 +951,6 @@ export const serializeAws_restJson1DeleteEmailIdentityCommand = async ( throw new Error("No value provided for input HTTP label: EmailIdentity."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -944,8 +966,11 @@ export const serializeAws_restJson1DeleteEmailIdentityPolicyCommand = async ( input: DeleteEmailIdentityPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/identities/{EmailIdentity}/policies/{PolicyName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/identities/{EmailIdentity}/policies/{PolicyName}"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -965,7 +990,6 @@ export const serializeAws_restJson1DeleteEmailIdentityPolicyCommand = async ( throw new Error("No value provided for input HTTP label: PolicyName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -981,8 +1005,10 @@ export const serializeAws_restJson1DeleteEmailTemplateCommand = async ( input: DeleteEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/templates/{TemplateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/templates/{TemplateName}"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -993,7 +1019,6 @@ export const serializeAws_restJson1DeleteEmailTemplateCommand = async ( throw new Error("No value provided for input HTTP label: TemplateName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1009,8 +1034,11 @@ export const serializeAws_restJson1DeleteSuppressedDestinationCommand = async ( input: DeleteSuppressedDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/suppression/addresses/{EmailAddress}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/suppression/addresses/{EmailAddress}"; if (input.EmailAddress !== undefined) { const labelValue: string = input.EmailAddress; if (labelValue.length <= 0) { @@ -1021,7 +1049,6 @@ export const serializeAws_restJson1DeleteSuppressedDestinationCommand = async ( throw new Error("No value provided for input HTTP label: EmailAddress."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1037,13 +1064,13 @@ export const serializeAws_restJson1GetAccountCommand = async ( input: GetAccountCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/account"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/account"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1059,15 +1086,17 @@ export const serializeAws_restJson1GetBlacklistReportsCommand = async ( input: GetBlacklistReportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/deliverability-dashboard/blacklist-report"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/deliverability-dashboard/blacklist-report"; const query: any = { ...(input.BlacklistItemNames !== undefined && { BlacklistItemNames: (input.BlacklistItemNames || []).map((_entry) => _entry), }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1084,8 +1113,11 @@ export const serializeAws_restJson1GetConfigurationSetCommand = async ( input: GetConfigurationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -1096,7 +1128,6 @@ export const serializeAws_restJson1GetConfigurationSetCommand = async ( throw new Error("No value provided for input HTTP label: ConfigurationSetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1112,8 +1143,11 @@ export const serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = input: GetConfigurationSetEventDestinationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -1124,7 +1158,6 @@ export const serializeAws_restJson1GetConfigurationSetEventDestinationsCommand = throw new Error("No value provided for input HTTP label: ConfigurationSetName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1140,8 +1173,11 @@ export const serializeAws_restJson1GetContactCommand = async ( input: GetContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/contact-lists/{ContactListName}/contacts/{EmailAddress}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/contact-lists/{ContactListName}/contacts/{EmailAddress}"; if (input.ContactListName !== undefined) { const labelValue: string = input.ContactListName; if (labelValue.length <= 0) { @@ -1161,7 +1197,6 @@ export const serializeAws_restJson1GetContactCommand = async ( throw new Error("No value provided for input HTTP label: EmailAddress."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1177,8 +1212,10 @@ export const serializeAws_restJson1GetContactListCommand = async ( input: GetContactListCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/contact-lists/{ContactListName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/contact-lists/{ContactListName}"; if (input.ContactListName !== undefined) { const labelValue: string = input.ContactListName; if (labelValue.length <= 0) { @@ -1189,7 +1226,6 @@ export const serializeAws_restJson1GetContactListCommand = async ( throw new Error("No value provided for input HTTP label: ContactListName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1205,8 +1241,11 @@ export const serializeAws_restJson1GetCustomVerificationEmailTemplateCommand = a input: GetCustomVerificationEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/custom-verification-email-templates/{TemplateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/custom-verification-email-templates/{TemplateName}"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -1217,7 +1256,6 @@ export const serializeAws_restJson1GetCustomVerificationEmailTemplateCommand = a throw new Error("No value provided for input HTTP label: TemplateName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1233,8 +1271,10 @@ export const serializeAws_restJson1GetDedicatedIpCommand = async ( input: GetDedicatedIpCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/dedicated-ips/{Ip}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/dedicated-ips/{Ip}"; if (input.Ip !== undefined) { const labelValue: string = input.Ip; if (labelValue.length <= 0) { @@ -1245,7 +1285,6 @@ export const serializeAws_restJson1GetDedicatedIpCommand = async ( throw new Error("No value provided for input HTTP label: Ip."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1261,15 +1300,15 @@ export const serializeAws_restJson1GetDedicatedIpsCommand = async ( input: GetDedicatedIpsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/dedicated-ips"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/dedicated-ips"; const query: any = { ...(input.PoolName !== undefined && { PoolName: input.PoolName }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1286,13 +1325,14 @@ export const serializeAws_restJson1GetDeliverabilityDashboardOptionsCommand = as input: GetDeliverabilityDashboardOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/deliverability-dashboard"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/deliverability-dashboard"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1308,8 +1348,11 @@ export const serializeAws_restJson1GetDeliverabilityTestReportCommand = async ( input: GetDeliverabilityTestReportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/deliverability-dashboard/test-reports/{ReportId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/deliverability-dashboard/test-reports/{ReportId}"; if (input.ReportId !== undefined) { const labelValue: string = input.ReportId; if (labelValue.length <= 0) { @@ -1320,7 +1363,6 @@ export const serializeAws_restJson1GetDeliverabilityTestReportCommand = async ( throw new Error("No value provided for input HTTP label: ReportId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1336,8 +1378,11 @@ export const serializeAws_restJson1GetDomainDeliverabilityCampaignCommand = asyn input: GetDomainDeliverabilityCampaignCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/deliverability-dashboard/campaigns/{CampaignId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/deliverability-dashboard/campaigns/{CampaignId}"; if (input.CampaignId !== undefined) { const labelValue: string = input.CampaignId; if (labelValue.length <= 0) { @@ -1348,7 +1393,6 @@ export const serializeAws_restJson1GetDomainDeliverabilityCampaignCommand = asyn throw new Error("No value provided for input HTTP label: CampaignId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1364,8 +1408,11 @@ export const serializeAws_restJson1GetDomainStatisticsReportCommand = async ( input: GetDomainStatisticsReportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/deliverability-dashboard/statistics-report/{Domain}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/deliverability-dashboard/statistics-report/{Domain}"; if (input.Domain !== undefined) { const labelValue: string = input.Domain; if (labelValue.length <= 0) { @@ -1380,7 +1427,6 @@ export const serializeAws_restJson1GetDomainStatisticsReportCommand = async ( ...(input.EndDate !== undefined && { EndDate: (input.EndDate.toISOString().split(".")[0] + "Z").toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1397,8 +1443,10 @@ export const serializeAws_restJson1GetEmailIdentityCommand = async ( input: GetEmailIdentityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/identities/{EmailIdentity}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/identities/{EmailIdentity}"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -1409,7 +1457,6 @@ export const serializeAws_restJson1GetEmailIdentityCommand = async ( throw new Error("No value provided for input HTTP label: EmailIdentity."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1425,8 +1472,11 @@ export const serializeAws_restJson1GetEmailIdentityPoliciesCommand = async ( input: GetEmailIdentityPoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/identities/{EmailIdentity}/policies"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/identities/{EmailIdentity}/policies"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -1437,7 +1487,6 @@ export const serializeAws_restJson1GetEmailIdentityPoliciesCommand = async ( throw new Error("No value provided for input HTTP label: EmailIdentity."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1453,8 +1502,10 @@ export const serializeAws_restJson1GetEmailTemplateCommand = async ( input: GetEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/templates/{TemplateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/templates/{TemplateName}"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -1465,7 +1516,6 @@ export const serializeAws_restJson1GetEmailTemplateCommand = async ( throw new Error("No value provided for input HTTP label: TemplateName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1481,8 +1531,10 @@ export const serializeAws_restJson1GetImportJobCommand = async ( input: GetImportJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/import-jobs/{JobId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/import-jobs/{JobId}"; if (input.JobId !== undefined) { const labelValue: string = input.JobId; if (labelValue.length <= 0) { @@ -1493,7 +1545,6 @@ export const serializeAws_restJson1GetImportJobCommand = async ( throw new Error("No value provided for input HTTP label: JobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1509,8 +1560,11 @@ export const serializeAws_restJson1GetSuppressedDestinationCommand = async ( input: GetSuppressedDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/suppression/addresses/{EmailAddress}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/suppression/addresses/{EmailAddress}"; if (input.EmailAddress !== undefined) { const labelValue: string = input.EmailAddress; if (labelValue.length <= 0) { @@ -1521,7 +1575,6 @@ export const serializeAws_restJson1GetSuppressedDestinationCommand = async ( throw new Error("No value provided for input HTTP label: EmailAddress."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1537,14 +1590,15 @@ export const serializeAws_restJson1ListConfigurationSetsCommand = async ( input: ListConfigurationSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/configuration-sets"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/configuration-sets"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1561,14 +1615,14 @@ export const serializeAws_restJson1ListContactListsCommand = async ( input: ListContactListsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/contact-lists"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/contact-lists"; const query: any = { ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1585,10 +1639,13 @@ export const serializeAws_restJson1ListContactsCommand = async ( input: ListContactsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/contact-lists/{ContactListName}/contacts"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/contact-lists/{ContactListName}/contacts"; if (input.ContactListName !== undefined) { const labelValue: string = input.ContactListName; if (labelValue.length <= 0) { @@ -1607,7 +1664,6 @@ export const serializeAws_restJson1ListContactsCommand = async ( ...(input.Filter !== undefined && input.Filter !== null && { Filter: serializeAws_restJson1ListContactsFilter(input.Filter, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1624,14 +1680,16 @@ export const serializeAws_restJson1ListCustomVerificationEmailTemplatesCommand = input: ListCustomVerificationEmailTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/custom-verification-email-templates"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/custom-verification-email-templates"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1648,14 +1706,15 @@ export const serializeAws_restJson1ListDedicatedIpPoolsCommand = async ( input: ListDedicatedIpPoolsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/dedicated-ip-pools"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/dedicated-ip-pools"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1672,14 +1731,16 @@ export const serializeAws_restJson1ListDeliverabilityTestReportsCommand = async input: ListDeliverabilityTestReportsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/deliverability-dashboard/test-reports"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/deliverability-dashboard/test-reports"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1696,8 +1757,11 @@ export const serializeAws_restJson1ListDomainDeliverabilityCampaignsCommand = as input: ListDomainDeliverabilityCampaignsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/deliverability-dashboard/domains/{SubscribedDomain}/campaigns"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/deliverability-dashboard/domains/{SubscribedDomain}/campaigns"; if (input.SubscribedDomain !== undefined) { const labelValue: string = input.SubscribedDomain; if (labelValue.length <= 0) { @@ -1714,7 +1778,6 @@ export const serializeAws_restJson1ListDomainDeliverabilityCampaignsCommand = as ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1731,14 +1794,14 @@ export const serializeAws_restJson1ListEmailIdentitiesCommand = async ( input: ListEmailIdentitiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/identities"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/identities"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1755,14 +1818,14 @@ export const serializeAws_restJson1ListEmailTemplatesCommand = async ( input: ListEmailTemplatesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/templates"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/templates"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1779,10 +1842,11 @@ export const serializeAws_restJson1ListImportJobsCommand = async ( input: ListImportJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/import-jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/import-jobs"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), @@ -1792,7 +1856,6 @@ export const serializeAws_restJson1ListImportJobsCommand = async ( ...(input.ImportDestinationType !== undefined && input.ImportDestinationType !== null && { ImportDestinationType: input.ImportDestinationType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1809,8 +1872,10 @@ export const serializeAws_restJson1ListSuppressedDestinationsCommand = async ( input: ListSuppressedDestinationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/suppression/addresses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/suppression/addresses"; const query: any = { ...(input.Reasons !== undefined && { Reason: (input.Reasons || []).map((_entry) => _entry) }), ...(input.StartDate !== undefined && { StartDate: (input.StartDate.toISOString().split(".")[0] + "Z").toString() }), @@ -1819,7 +1884,6 @@ export const serializeAws_restJson1ListSuppressedDestinationsCommand = async ( ...(input.PageSize !== undefined && { PageSize: input.PageSize.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1836,13 +1900,13 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/tags"; const query: any = { ...(input.ResourceArn !== undefined && { ResourceArn: input.ResourceArn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1859,16 +1923,17 @@ export const serializeAws_restJson1PutAccountDedicatedIpWarmupAttributesCommand input: PutAccountDedicatedIpWarmupAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/account/dedicated-ips/warmup"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/account/dedicated-ips/warmup"; let body: any; body = JSON.stringify({ ...(input.AutoWarmupEnabled !== undefined && input.AutoWarmupEnabled !== null && { AutoWarmupEnabled: input.AutoWarmupEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1884,10 +1949,12 @@ export const serializeAws_restJson1PutAccountDetailsCommand = async ( input: PutAccountDetailsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/account/details"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/account/details"; let body: any; body = JSON.stringify({ ...(input.AdditionalContactEmailAddresses !== undefined && @@ -1906,7 +1973,6 @@ export const serializeAws_restJson1PutAccountDetailsCommand = async ( input.UseCaseDescription !== null && { UseCaseDescription: input.UseCaseDescription }), ...(input.WebsiteURL !== undefined && input.WebsiteURL !== null && { WebsiteURL: input.WebsiteURL }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1922,16 +1988,17 @@ export const serializeAws_restJson1PutAccountSendingAttributesCommand = async ( input: PutAccountSendingAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/account/sending"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/account/sending"; let body: any; body = JSON.stringify({ ...(input.SendingEnabled !== undefined && input.SendingEnabled !== null && { SendingEnabled: input.SendingEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1947,10 +2014,12 @@ export const serializeAws_restJson1PutAccountSuppressionAttributesCommand = asyn input: PutAccountSuppressionAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/account/suppression"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/account/suppression"; let body: any; body = JSON.stringify({ ...(input.SuppressedReasons !== undefined && @@ -1958,7 +2027,6 @@ export const serializeAws_restJson1PutAccountSuppressionAttributesCommand = asyn SuppressedReasons: serializeAws_restJson1SuppressionListReasons(input.SuppressedReasons, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1974,10 +2042,13 @@ export const serializeAws_restJson1PutConfigurationSetDeliveryOptionsCommand = a input: PutConfigurationSetDeliveryOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}/delivery-options"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}/delivery-options"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -1993,7 +2064,6 @@ export const serializeAws_restJson1PutConfigurationSetDeliveryOptionsCommand = a input.SendingPoolName !== null && { SendingPoolName: input.SendingPoolName }), ...(input.TlsPolicy !== undefined && input.TlsPolicy !== null && { TlsPolicy: input.TlsPolicy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2009,10 +2079,13 @@ export const serializeAws_restJson1PutConfigurationSetReputationOptionsCommand = input: PutConfigurationSetReputationOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}/reputation-options"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}/reputation-options"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -2027,7 +2100,6 @@ export const serializeAws_restJson1PutConfigurationSetReputationOptionsCommand = ...(input.ReputationMetricsEnabled !== undefined && input.ReputationMetricsEnabled !== null && { ReputationMetricsEnabled: input.ReputationMetricsEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2043,10 +2115,13 @@ export const serializeAws_restJson1PutConfigurationSetSendingOptionsCommand = as input: PutConfigurationSetSendingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}/sending"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}/sending"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -2061,7 +2136,6 @@ export const serializeAws_restJson1PutConfigurationSetSendingOptionsCommand = as ...(input.SendingEnabled !== undefined && input.SendingEnabled !== null && { SendingEnabled: input.SendingEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2077,10 +2151,13 @@ export const serializeAws_restJson1PutConfigurationSetSuppressionOptionsCommand input: PutConfigurationSetSuppressionOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}/suppression-options"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}/suppression-options"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -2097,7 +2174,6 @@ export const serializeAws_restJson1PutConfigurationSetSuppressionOptionsCommand SuppressedReasons: serializeAws_restJson1SuppressionListReasons(input.SuppressedReasons, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2113,10 +2189,13 @@ export const serializeAws_restJson1PutConfigurationSetTrackingOptionsCommand = a input: PutConfigurationSetTrackingOptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}/tracking-options"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}/tracking-options"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -2131,7 +2210,6 @@ export const serializeAws_restJson1PutConfigurationSetTrackingOptionsCommand = a ...(input.CustomRedirectDomain !== undefined && input.CustomRedirectDomain !== null && { CustomRedirectDomain: input.CustomRedirectDomain }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2147,10 +2225,12 @@ export const serializeAws_restJson1PutDedicatedIpInPoolCommand = async ( input: PutDedicatedIpInPoolCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/dedicated-ips/{Ip}/pool"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/dedicated-ips/{Ip}/pool"; if (input.Ip !== undefined) { const labelValue: string = input.Ip; if (labelValue.length <= 0) { @@ -2165,7 +2245,6 @@ export const serializeAws_restJson1PutDedicatedIpInPoolCommand = async ( ...(input.DestinationPoolName !== undefined && input.DestinationPoolName !== null && { DestinationPoolName: input.DestinationPoolName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2181,10 +2260,12 @@ export const serializeAws_restJson1PutDedicatedIpWarmupAttributesCommand = async input: PutDedicatedIpWarmupAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/dedicated-ips/{Ip}/warmup"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/dedicated-ips/{Ip}/warmup"; if (input.Ip !== undefined) { const labelValue: string = input.Ip; if (labelValue.length <= 0) { @@ -2199,7 +2280,6 @@ export const serializeAws_restJson1PutDedicatedIpWarmupAttributesCommand = async ...(input.WarmupPercentage !== undefined && input.WarmupPercentage !== null && { WarmupPercentage: input.WarmupPercentage }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2215,10 +2295,12 @@ export const serializeAws_restJson1PutDeliverabilityDashboardOptionCommand = asy input: PutDeliverabilityDashboardOptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/deliverability-dashboard"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/deliverability-dashboard"; let body: any; body = JSON.stringify({ ...(input.DashboardEnabled !== undefined && @@ -2228,7 +2310,6 @@ export const serializeAws_restJson1PutDeliverabilityDashboardOptionCommand = asy SubscribedDomains: serializeAws_restJson1DomainDeliverabilityTrackingOptions(input.SubscribedDomains, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2244,10 +2325,13 @@ export const serializeAws_restJson1PutEmailIdentityConfigurationSetAttributesCom input: PutEmailIdentityConfigurationSetAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/identities/{EmailIdentity}/configuration-set"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/identities/{EmailIdentity}/configuration-set"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -2262,7 +2346,6 @@ export const serializeAws_restJson1PutEmailIdentityConfigurationSetAttributesCom ...(input.ConfigurationSetName !== undefined && input.ConfigurationSetName !== null && { ConfigurationSetName: input.ConfigurationSetName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2278,10 +2361,12 @@ export const serializeAws_restJson1PutEmailIdentityDkimAttributesCommand = async input: PutEmailIdentityDkimAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/identities/{EmailIdentity}/dkim"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/identities/{EmailIdentity}/dkim"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -2296,7 +2381,6 @@ export const serializeAws_restJson1PutEmailIdentityDkimAttributesCommand = async ...(input.SigningEnabled !== undefined && input.SigningEnabled !== null && { SigningEnabled: input.SigningEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2312,10 +2396,13 @@ export const serializeAws_restJson1PutEmailIdentityDkimSigningAttributesCommand input: PutEmailIdentityDkimSigningAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v1/email/identities/{EmailIdentity}/dkim/signing"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v1/email/identities/{EmailIdentity}/dkim/signing"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -2334,7 +2421,6 @@ export const serializeAws_restJson1PutEmailIdentityDkimSigningAttributesCommand ...(input.SigningAttributesOrigin !== undefined && input.SigningAttributesOrigin !== null && { SigningAttributesOrigin: input.SigningAttributesOrigin }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2350,10 +2436,13 @@ export const serializeAws_restJson1PutEmailIdentityFeedbackAttributesCommand = a input: PutEmailIdentityFeedbackAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/identities/{EmailIdentity}/feedback"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/identities/{EmailIdentity}/feedback"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -2368,7 +2457,6 @@ export const serializeAws_restJson1PutEmailIdentityFeedbackAttributesCommand = a ...(input.EmailForwardingEnabled !== undefined && input.EmailForwardingEnabled !== null && { EmailForwardingEnabled: input.EmailForwardingEnabled }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2384,10 +2472,13 @@ export const serializeAws_restJson1PutEmailIdentityMailFromAttributesCommand = a input: PutEmailIdentityMailFromAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/identities/{EmailIdentity}/mail-from"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/identities/{EmailIdentity}/mail-from"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -2404,7 +2495,6 @@ export const serializeAws_restJson1PutEmailIdentityMailFromAttributesCommand = a ...(input.MailFromDomain !== undefined && input.MailFromDomain !== null && { MailFromDomain: input.MailFromDomain }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2420,16 +2510,17 @@ export const serializeAws_restJson1PutSuppressedDestinationCommand = async ( input: PutSuppressedDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/suppression/addresses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/suppression/addresses"; let body: any; body = JSON.stringify({ ...(input.EmailAddress !== undefined && input.EmailAddress !== null && { EmailAddress: input.EmailAddress }), ...(input.Reason !== undefined && input.Reason !== null && { Reason: input.Reason }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2445,10 +2536,12 @@ export const serializeAws_restJson1SendBulkEmailCommand = async ( input: SendBulkEmailCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/outbound-bulk-emails"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/outbound-bulk-emails"; let body: any; body = JSON.stringify({ ...(input.BulkEmailEntries !== undefined && @@ -2482,7 +2575,6 @@ export const serializeAws_restJson1SendBulkEmailCommand = async ( ReplyToAddresses: serializeAws_restJson1EmailAddressList(input.ReplyToAddresses, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2498,10 +2590,13 @@ export const serializeAws_restJson1SendCustomVerificationEmailCommand = async ( input: SendCustomVerificationEmailCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/outbound-custom-verification-emails"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/outbound-custom-verification-emails"; let body: any; body = JSON.stringify({ ...(input.ConfigurationSetName !== undefined && @@ -2509,7 +2604,6 @@ export const serializeAws_restJson1SendCustomVerificationEmailCommand = async ( ...(input.EmailAddress !== undefined && input.EmailAddress !== null && { EmailAddress: input.EmailAddress }), ...(input.TemplateName !== undefined && input.TemplateName !== null && { TemplateName: input.TemplateName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2525,10 +2619,12 @@ export const serializeAws_restJson1SendEmailCommand = async ( input: SendEmailCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/outbound-emails"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/outbound-emails"; let body: any; body = JSON.stringify({ ...(input.ConfigurationSetName !== undefined && @@ -2560,7 +2656,6 @@ export const serializeAws_restJson1SendEmailCommand = async ( ReplyToAddresses: serializeAws_restJson1EmailAddressList(input.ReplyToAddresses, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2576,17 +2671,17 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/tags"; let body: any; body = JSON.stringify({ ...(input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2602,10 +2697,12 @@ export const serializeAws_restJson1TestRenderEmailTemplateCommand = async ( input: TestRenderEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/templates/{TemplateName}/render"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/templates/{TemplateName}/render"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -2619,7 +2716,6 @@ export const serializeAws_restJson1TestRenderEmailTemplateCommand = async ( body = JSON.stringify({ ...(input.TemplateData !== undefined && input.TemplateData !== null && { TemplateData: input.TemplateData }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2635,14 +2731,14 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/v2/email/tags"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/tags"; const query: any = { ...(input.ResourceArn !== undefined && { ResourceArn: input.ResourceArn }), ...(input.TagKeys !== undefined && { TagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2659,10 +2755,13 @@ export const serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand input: UpdateConfigurationSetEventDestinationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/configuration-sets/{ConfigurationSetName}/event-destinations/{EventDestinationName}"; if (input.ConfigurationSetName !== undefined) { const labelValue: string = input.ConfigurationSetName; if (labelValue.length <= 0) { @@ -2688,7 +2787,6 @@ export const serializeAws_restJson1UpdateConfigurationSetEventDestinationCommand EventDestination: serializeAws_restJson1EventDestinationDefinition(input.EventDestination, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2704,10 +2802,13 @@ export const serializeAws_restJson1UpdateContactCommand = async ( input: UpdateContactCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/contact-lists/{ContactListName}/contacts/{EmailAddress}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/contact-lists/{ContactListName}/contacts/{EmailAddress}"; if (input.ContactListName !== undefined) { const labelValue: string = input.ContactListName; if (labelValue.length <= 0) { @@ -2737,7 +2838,6 @@ export const serializeAws_restJson1UpdateContactCommand = async ( ...(input.UnsubscribeAll !== undefined && input.UnsubscribeAll !== null && { UnsubscribeAll: input.UnsubscribeAll }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2753,10 +2853,12 @@ export const serializeAws_restJson1UpdateContactListCommand = async ( input: UpdateContactListCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/contact-lists/{ContactListName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/contact-lists/{ContactListName}"; if (input.ContactListName !== undefined) { const labelValue: string = input.ContactListName; if (labelValue.length <= 0) { @@ -2772,7 +2874,6 @@ export const serializeAws_restJson1UpdateContactListCommand = async ( ...(input.Topics !== undefined && input.Topics !== null && { Topics: serializeAws_restJson1Topics(input.Topics, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2788,10 +2889,13 @@ export const serializeAws_restJson1UpdateCustomVerificationEmailTemplateCommand input: UpdateCustomVerificationEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/custom-verification-email-templates/{TemplateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/custom-verification-email-templates/{TemplateName}"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -2814,7 +2918,6 @@ export const serializeAws_restJson1UpdateCustomVerificationEmailTemplateCommand ...(input.TemplateSubject !== undefined && input.TemplateSubject !== null && { TemplateSubject: input.TemplateSubject }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2830,10 +2933,13 @@ export const serializeAws_restJson1UpdateEmailIdentityPolicyCommand = async ( input: UpdateEmailIdentityPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/identities/{EmailIdentity}/policies/{PolicyName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/v2/email/identities/{EmailIdentity}/policies/{PolicyName}"; if (input.EmailIdentity !== undefined) { const labelValue: string = input.EmailIdentity; if (labelValue.length <= 0) { @@ -2856,7 +2962,6 @@ export const serializeAws_restJson1UpdateEmailIdentityPolicyCommand = async ( body = JSON.stringify({ ...(input.Policy !== undefined && input.Policy !== null && { Policy: input.Policy }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2872,10 +2977,12 @@ export const serializeAws_restJson1UpdateEmailTemplateCommand = async ( input: UpdateEmailTemplateCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/v2/email/templates/{TemplateName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/email/templates/{TemplateName}"; if (input.TemplateName !== undefined) { const labelValue: string = input.TemplateName; if (labelValue.length <= 0) { @@ -2892,7 +2999,6 @@ export const serializeAws_restJson1UpdateEmailTemplateCommand = async ( TemplateContent: serializeAws_restJson1EmailTemplateContent(input.TemplateContent, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-signer/protocols/Aws_restJson1.ts b/clients/client-signer/protocols/Aws_restJson1.ts index 63d33e52d763a..3ca39bbbb1eee 100644 --- a/clients/client-signer/protocols/Aws_restJson1.ts +++ b/clients/client-signer/protocols/Aws_restJson1.ts @@ -94,10 +94,13 @@ export const serializeAws_restJson1AddProfilePermissionCommand = async ( input: AddProfilePermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/signing-profiles/{profileName}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/signing-profiles/{profileName}/permissions"; if (input.profileName !== undefined) { const labelValue: string = input.profileName; if (labelValue.length <= 0) { @@ -116,7 +119,6 @@ export const serializeAws_restJson1AddProfilePermissionCommand = async ( ...(input.revisionId !== undefined && input.revisionId !== null && { revisionId: input.revisionId }), ...(input.statementId !== undefined && input.statementId !== null && { statementId: input.statementId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -132,8 +134,10 @@ export const serializeAws_restJson1CancelSigningProfileCommand = async ( input: CancelSigningProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/signing-profiles/{profileName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-profiles/{profileName}"; if (input.profileName !== undefined) { const labelValue: string = input.profileName; if (labelValue.length <= 0) { @@ -144,7 +148,6 @@ export const serializeAws_restJson1CancelSigningProfileCommand = async ( throw new Error("No value provided for input HTTP label: profileName."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -160,8 +163,9 @@ export const serializeAws_restJson1DescribeSigningJobCommand = async ( input: DescribeSigningJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/signing-jobs/{jobId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-jobs/{jobId}"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -172,7 +176,6 @@ export const serializeAws_restJson1DescribeSigningJobCommand = async ( throw new Error("No value provided for input HTTP label: jobId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -188,8 +191,10 @@ export const serializeAws_restJson1GetSigningPlatformCommand = async ( input: GetSigningPlatformCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/signing-platforms/{platformId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-platforms/{platformId}"; if (input.platformId !== undefined) { const labelValue: string = input.platformId; if (labelValue.length <= 0) { @@ -200,7 +205,6 @@ export const serializeAws_restJson1GetSigningPlatformCommand = async ( throw new Error("No value provided for input HTTP label: platformId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -216,8 +220,10 @@ export const serializeAws_restJson1GetSigningProfileCommand = async ( input: GetSigningProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/signing-profiles/{profileName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-profiles/{profileName}"; if (input.profileName !== undefined) { const labelValue: string = input.profileName; if (labelValue.length <= 0) { @@ -231,7 +237,6 @@ export const serializeAws_restJson1GetSigningProfileCommand = async ( ...(input.profileOwner !== undefined && { profileOwner: input.profileOwner }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -248,8 +253,11 @@ export const serializeAws_restJson1ListProfilePermissionsCommand = async ( input: ListProfilePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/signing-profiles/{profileName}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/signing-profiles/{profileName}/permissions"; if (input.profileName !== undefined) { const labelValue: string = input.profileName; if (labelValue.length <= 0) { @@ -263,7 +271,6 @@ export const serializeAws_restJson1ListProfilePermissionsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -280,8 +287,9 @@ export const serializeAws_restJson1ListSigningJobsCommand = async ( input: ListSigningJobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/signing-jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-jobs"; const query: any = { ...(input.status !== undefined && { status: input.status }), ...(input.platformId !== undefined && { platformId: input.platformId }), @@ -298,7 +306,6 @@ export const serializeAws_restJson1ListSigningJobsCommand = async ( ...(input.jobInvoker !== undefined && { jobInvoker: input.jobInvoker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -315,8 +322,9 @@ export const serializeAws_restJson1ListSigningPlatformsCommand = async ( input: ListSigningPlatformsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/signing-platforms"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-platforms"; const query: any = { ...(input.category !== undefined && { category: input.category }), ...(input.partner !== undefined && { partner: input.partner }), @@ -325,7 +333,6 @@ export const serializeAws_restJson1ListSigningPlatformsCommand = async ( ...(input.nextToken !== undefined && { nextToken: input.nextToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -342,8 +349,9 @@ export const serializeAws_restJson1ListSigningProfilesCommand = async ( input: ListSigningProfilesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/signing-profiles"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-profiles"; const query: any = { ...(input.includeCanceled !== undefined && { includeCanceled: input.includeCanceled.toString() }), ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }), @@ -352,7 +360,6 @@ export const serializeAws_restJson1ListSigningProfilesCommand = async ( ...(input.statuses !== undefined && { statuses: (input.statuses || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -369,8 +376,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -381,7 +389,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -397,10 +404,12 @@ export const serializeAws_restJson1PutSigningProfileCommand = async ( input: PutSigningProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/signing-profiles/{profileName}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-profiles/{profileName}"; if (input.profileName !== undefined) { const labelValue: string = input.profileName; if (labelValue.length <= 0) { @@ -431,7 +440,6 @@ export const serializeAws_restJson1PutSigningProfileCommand = async ( }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -447,8 +455,11 @@ export const serializeAws_restJson1RemoveProfilePermissionCommand = async ( input: RemoveProfilePermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/signing-profiles/{profileName}/permissions/{statementId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/signing-profiles/{profileName}/permissions/{statementId}"; if (input.profileName !== undefined) { const labelValue: string = input.profileName; if (labelValue.length <= 0) { @@ -471,7 +482,6 @@ export const serializeAws_restJson1RemoveProfilePermissionCommand = async ( ...(input.revisionId !== undefined && { revisionId: input.revisionId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -488,10 +498,12 @@ export const serializeAws_restJson1RevokeSignatureCommand = async ( input: RevokeSignatureCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/signing-jobs/{jobId}/revoke"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-jobs/{jobId}/revoke"; if (input.jobId !== undefined) { const labelValue: string = input.jobId; if (labelValue.length <= 0) { @@ -506,7 +518,6 @@ export const serializeAws_restJson1RevokeSignatureCommand = async ( ...(input.jobOwner !== undefined && input.jobOwner !== null && { jobOwner: input.jobOwner }), ...(input.reason !== undefined && input.reason !== null && { reason: input.reason }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -522,10 +533,12 @@ export const serializeAws_restJson1RevokeSigningProfileCommand = async ( input: RevokeSigningProfileCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/signing-profiles/{profileName}/revoke"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-profiles/{profileName}/revoke"; if (input.profileName !== undefined) { const labelValue: string = input.profileName; if (labelValue.length <= 0) { @@ -543,7 +556,6 @@ export const serializeAws_restJson1RevokeSigningProfileCommand = async ( input.profileVersion !== null && { profileVersion: input.profileVersion }), ...(input.reason !== undefined && input.reason !== null && { reason: input.reason }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -559,10 +571,11 @@ export const serializeAws_restJson1StartSigningJobCommand = async ( input: StartSigningJobCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/signing-jobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signing-jobs"; let body: any; body = JSON.stringify({ clientRequestToken: input.clientRequestToken ?? generateIdempotencyToken(), @@ -573,7 +586,6 @@ export const serializeAws_restJson1StartSigningJobCommand = async ( ...(input.source !== undefined && input.source !== null && { source: serializeAws_restJson1Source(input.source, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -589,10 +601,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -606,7 +619,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -622,8 +634,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -637,7 +650,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-ssm-incidents/protocols/Aws_restJson1.ts b/clients/client-ssm-incidents/protocols/Aws_restJson1.ts index 4798ec9013886..11c6198ccb60b 100644 --- a/clients/client-ssm-incidents/protocols/Aws_restJson1.ts +++ b/clients/client-ssm-incidents/protocols/Aws_restJson1.ts @@ -126,17 +126,17 @@ export const serializeAws_restJson1CreateReplicationSetCommand = async ( input: CreateReplicationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createReplicationSet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createReplicationSet"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), ...(input.regions !== undefined && input.regions !== null && { regions: serializeAws_restJson1RegionMapInput(input.regions, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -152,10 +152,11 @@ export const serializeAws_restJson1CreateResponsePlanCommand = async ( input: CreateResponsePlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createResponsePlan"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createResponsePlan"; let body: any; body = JSON.stringify({ ...(input.actions !== undefined && @@ -173,7 +174,6 @@ export const serializeAws_restJson1CreateResponsePlanCommand = async ( ...(input.name !== undefined && input.name !== null && { name: input.name }), ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -189,10 +189,11 @@ export const serializeAws_restJson1CreateTimelineEventCommand = async ( input: CreateTimelineEventCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createTimelineEvent"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createTimelineEvent"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -203,7 +204,6 @@ export const serializeAws_restJson1CreateTimelineEventCommand = async ( ...(input.incidentRecordArn !== undefined && input.incidentRecordArn !== null && { incidentRecordArn: input.incidentRecordArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -219,15 +219,15 @@ export const serializeAws_restJson1DeleteIncidentRecordCommand = async ( input: DeleteIncidentRecordCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteIncidentRecord"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteIncidentRecord"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -243,13 +243,13 @@ export const serializeAws_restJson1DeleteReplicationSetCommand = async ( input: DeleteReplicationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/deleteReplicationSet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteReplicationSet"; const query: any = { ...(input.arn !== undefined && { arn: input.arn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -266,16 +266,16 @@ export const serializeAws_restJson1DeleteResourcePolicyCommand = async ( input: DeleteResourcePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteResourcePolicy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteResourcePolicy"; let body: any; body = JSON.stringify({ ...(input.policyId !== undefined && input.policyId !== null && { policyId: input.policyId }), ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -291,15 +291,15 @@ export const serializeAws_restJson1DeleteResponsePlanCommand = async ( input: DeleteResponsePlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteResponsePlan"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteResponsePlan"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -315,17 +315,17 @@ export const serializeAws_restJson1DeleteTimelineEventCommand = async ( input: DeleteTimelineEventCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteTimelineEvent"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteTimelineEvent"; let body: any; body = JSON.stringify({ ...(input.eventId !== undefined && input.eventId !== null && { eventId: input.eventId }), ...(input.incidentRecordArn !== undefined && input.incidentRecordArn !== null && { incidentRecordArn: input.incidentRecordArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -341,13 +341,13 @@ export const serializeAws_restJson1GetIncidentRecordCommand = async ( input: GetIncidentRecordCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/getIncidentRecord"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getIncidentRecord"; const query: any = { ...(input.arn !== undefined && { arn: input.arn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -364,13 +364,13 @@ export const serializeAws_restJson1GetReplicationSetCommand = async ( input: GetReplicationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/getReplicationSet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getReplicationSet"; const query: any = { ...(input.arn !== undefined && { arn: input.arn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -387,10 +387,11 @@ export const serializeAws_restJson1GetResourcePoliciesCommand = async ( input: GetResourcePoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/getResourcePolicies"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getResourcePolicies"; const query: any = { ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }), }; @@ -399,7 +400,6 @@ export const serializeAws_restJson1GetResourcePoliciesCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -416,13 +416,13 @@ export const serializeAws_restJson1GetResponsePlanCommand = async ( input: GetResponsePlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/getResponsePlan"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getResponsePlan"; const query: any = { ...(input.arn !== undefined && { arn: input.arn }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -439,14 +439,14 @@ export const serializeAws_restJson1GetTimelineEventCommand = async ( input: GetTimelineEventCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/getTimelineEvent"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getTimelineEvent"; const query: any = { ...(input.incidentRecordArn !== undefined && { incidentRecordArn: input.incidentRecordArn }), ...(input.eventId !== undefined && { eventId: input.eventId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -463,10 +463,11 @@ export const serializeAws_restJson1ListIncidentRecordsCommand = async ( input: ListIncidentRecordsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listIncidentRecords"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listIncidentRecords"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -474,7 +475,6 @@ export const serializeAws_restJson1ListIncidentRecordsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -490,10 +490,11 @@ export const serializeAws_restJson1ListRelatedItemsCommand = async ( input: ListRelatedItemsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listRelatedItems"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listRelatedItems"; let body: any; body = JSON.stringify({ ...(input.incidentRecordArn !== undefined && @@ -501,7 +502,6 @@ export const serializeAws_restJson1ListRelatedItemsCommand = async ( ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -517,16 +517,16 @@ export const serializeAws_restJson1ListReplicationSetsCommand = async ( input: ListReplicationSetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listReplicationSets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listReplicationSets"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -542,16 +542,16 @@ export const serializeAws_restJson1ListResponsePlansCommand = async ( input: ListResponsePlansCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listResponsePlans"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listResponsePlans"; let body: any; body = JSON.stringify({ ...(input.maxResults !== undefined && input.maxResults !== null && { maxResults: input.maxResults }), ...(input.nextToken !== undefined && input.nextToken !== null && { nextToken: input.nextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -567,8 +567,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -579,7 +580,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: resourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -595,10 +595,11 @@ export const serializeAws_restJson1ListTimelineEventsCommand = async ( input: ListTimelineEventsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listTimelineEvents"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listTimelineEvents"; let body: any; body = JSON.stringify({ ...(input.filters !== undefined && @@ -610,7 +611,6 @@ export const serializeAws_restJson1ListTimelineEventsCommand = async ( ...(input.sortBy !== undefined && input.sortBy !== null && { sortBy: input.sortBy }), ...(input.sortOrder !== undefined && input.sortOrder !== null && { sortOrder: input.sortOrder }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -626,16 +626,16 @@ export const serializeAws_restJson1PutResourcePolicyCommand = async ( input: PutResourcePolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/putResourcePolicy"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/putResourcePolicy"; let body: any; body = JSON.stringify({ ...(input.policy !== undefined && input.policy !== null && { policy: input.policy }), ...(input.resourceArn !== undefined && input.resourceArn !== null && { resourceArn: input.resourceArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -651,10 +651,11 @@ export const serializeAws_restJson1StartIncidentCommand = async ( input: StartIncidentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/startIncident"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/startIncident"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -671,7 +672,6 @@ export const serializeAws_restJson1StartIncidentCommand = async ( triggerDetails: serializeAws_restJson1TriggerDetails(input.triggerDetails, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -687,10 +687,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -704,7 +705,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.tags !== undefined && input.tags !== null && { tags: serializeAws_restJson1TagMap(input.tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -720,8 +720,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{resourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}"; if (input.resourceArn !== undefined) { const labelValue: string = input.resourceArn; if (labelValue.length <= 0) { @@ -735,7 +736,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -752,10 +752,12 @@ export const serializeAws_restJson1UpdateDeletionProtectionCommand = async ( input: UpdateDeletionProtectionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateDeletionProtection"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateDeletionProtection"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), @@ -763,7 +765,6 @@ export const serializeAws_restJson1UpdateDeletionProtectionCommand = async ( ...(input.deletionProtected !== undefined && input.deletionProtected !== null && { deletionProtected: input.deletionProtected }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -779,10 +780,11 @@ export const serializeAws_restJson1UpdateIncidentRecordCommand = async ( input: UpdateIncidentRecordCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateIncidentRecord"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateIncidentRecord"; let body: any; body = JSON.stringify({ ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), @@ -798,7 +800,6 @@ export const serializeAws_restJson1UpdateIncidentRecordCommand = async ( ...(input.summary !== undefined && input.summary !== null && { summary: input.summary }), ...(input.title !== undefined && input.title !== null && { title: input.title }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -814,10 +815,11 @@ export const serializeAws_restJson1UpdateRelatedItemsCommand = async ( input: UpdateRelatedItemsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateRelatedItems"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateRelatedItems"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -828,7 +830,6 @@ export const serializeAws_restJson1UpdateRelatedItemsCommand = async ( relatedItemsUpdate: serializeAws_restJson1RelatedItemsUpdate(input.relatedItemsUpdate, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -844,10 +845,11 @@ export const serializeAws_restJson1UpdateReplicationSetCommand = async ( input: UpdateReplicationSetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateReplicationSet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateReplicationSet"; let body: any; body = JSON.stringify({ ...(input.actions !== undefined && @@ -855,7 +857,6 @@ export const serializeAws_restJson1UpdateReplicationSetCommand = async ( ...(input.arn !== undefined && input.arn !== null && { arn: input.arn }), clientToken: input.clientToken ?? generateIdempotencyToken(), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -871,10 +872,11 @@ export const serializeAws_restJson1UpdateResponsePlanCommand = async ( input: UpdateResponsePlanCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateResponsePlan"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateResponsePlan"; let body: any; body = JSON.stringify({ ...(input.actions !== undefined && @@ -904,7 +906,6 @@ export const serializeAws_restJson1UpdateResponsePlanCommand = async ( ...(input.incidentTemplateTitle !== undefined && input.incidentTemplateTitle !== null && { incidentTemplateTitle: input.incidentTemplateTitle }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -920,10 +921,11 @@ export const serializeAws_restJson1UpdateTimelineEventCommand = async ( input: UpdateTimelineEventCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateTimelineEvent"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateTimelineEvent"; let body: any; body = JSON.stringify({ clientToken: input.clientToken ?? generateIdempotencyToken(), @@ -935,7 +937,6 @@ export const serializeAws_restJson1UpdateTimelineEventCommand = async ( ...(input.incidentRecordArn !== undefined && input.incidentRecordArn !== null && { incidentRecordArn: input.incidentRecordArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-sso-oidc/protocols/Aws_restJson1.ts b/clients/client-sso-oidc/protocols/Aws_restJson1.ts index c3e303b90381a..058f0cdf5c021 100644 --- a/clients/client-sso-oidc/protocols/Aws_restJson1.ts +++ b/clients/client-sso-oidc/protocols/Aws_restJson1.ts @@ -35,10 +35,11 @@ export const serializeAws_restJson1CreateTokenCommand = async ( input: CreateTokenCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/token"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/token"; let body: any; body = JSON.stringify({ ...(input.clientId !== undefined && input.clientId !== null && { clientId: input.clientId }), @@ -51,7 +52,6 @@ export const serializeAws_restJson1CreateTokenCommand = async ( ...(input.scope !== undefined && input.scope !== null && { scope: serializeAws_restJson1Scopes(input.scope, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -67,10 +67,11 @@ export const serializeAws_restJson1RegisterClientCommand = async ( input: RegisterClientCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/client/register"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/client/register"; let body: any; body = JSON.stringify({ ...(input.clientName !== undefined && input.clientName !== null && { clientName: input.clientName }), @@ -78,7 +79,6 @@ export const serializeAws_restJson1RegisterClientCommand = async ( ...(input.scopes !== undefined && input.scopes !== null && { scopes: serializeAws_restJson1Scopes(input.scopes, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -94,17 +94,17 @@ export const serializeAws_restJson1StartDeviceAuthorizationCommand = async ( input: StartDeviceAuthorizationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/device_authorization"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/device_authorization"; let body: any; body = JSON.stringify({ ...(input.clientId !== undefined && input.clientId !== null && { clientId: input.clientId }), ...(input.clientSecret !== undefined && input.clientSecret !== null && { clientSecret: input.clientSecret }), ...(input.startUrl !== undefined && input.startUrl !== null && { startUrl: input.startUrl }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-sso/protocols/Aws_restJson1.ts b/clients/client-sso/protocols/Aws_restJson1.ts index e92889436c6c9..635fb3ba298ac 100644 --- a/clients/client-sso/protocols/Aws_restJson1.ts +++ b/clients/client-sso/protocols/Aws_restJson1.ts @@ -29,16 +29,16 @@ export const serializeAws_restJson1GetRoleCredentialsCommand = async ( input: GetRoleCredentialsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.accessToken) && { "x-amz-sso_bearer_token": input.accessToken! }), }; - let resolvedPath = "/federation/credentials"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/federation/credentials"; const query: any = { ...(input.roleName !== undefined && { role_name: input.roleName }), ...(input.accountId !== undefined && { account_id: input.accountId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -55,17 +55,17 @@ export const serializeAws_restJson1ListAccountRolesCommand = async ( input: ListAccountRolesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.accessToken) && { "x-amz-sso_bearer_token": input.accessToken! }), }; - let resolvedPath = "/assignment/roles"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assignment/roles"; const query: any = { ...(input.nextToken !== undefined && { next_token: input.nextToken }), ...(input.maxResults !== undefined && { max_result: input.maxResults.toString() }), ...(input.accountId !== undefined && { account_id: input.accountId }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -82,16 +82,16 @@ export const serializeAws_restJson1ListAccountsCommand = async ( input: ListAccountsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.accessToken) && { "x-amz-sso_bearer_token": input.accessToken! }), }; - let resolvedPath = "/assignment/accounts"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assignment/accounts"; const query: any = { ...(input.nextToken !== undefined && { next_token: input.nextToken }), ...(input.maxResults !== undefined && { max_result: input.maxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -108,12 +108,12 @@ export const serializeAws_restJson1LogoutCommand = async ( input: LogoutCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.accessToken) && { "x-amz-sso_bearer_token": input.accessToken! }), }; - let resolvedPath = "/logout"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/logout"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-synthetics/protocols/Aws_restJson1.ts b/clients/client-synthetics/protocols/Aws_restJson1.ts index cd76ac13a313b..db7fc272d54f5 100644 --- a/clients/client-synthetics/protocols/Aws_restJson1.ts +++ b/clients/client-synthetics/protocols/Aws_restJson1.ts @@ -61,10 +61,11 @@ export const serializeAws_restJson1CreateCanaryCommand = async ( input: CreateCanaryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/canary"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/canary"; let body: any; body = JSON.stringify({ ...(input.ArtifactS3Location !== undefined && @@ -92,7 +93,6 @@ export const serializeAws_restJson1CreateCanaryCommand = async ( ...(input.VpcConfig !== undefined && input.VpcConfig !== null && { VpcConfig: serializeAws_restJson1VpcConfigInput(input.VpcConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -108,8 +108,9 @@ export const serializeAws_restJson1DeleteCanaryCommand = async ( input: DeleteCanaryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/canary/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/canary/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -120,7 +121,6 @@ export const serializeAws_restJson1DeleteCanaryCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -136,16 +136,16 @@ export const serializeAws_restJson1DescribeCanariesCommand = async ( input: DescribeCanariesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/canaries"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/canaries"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -161,16 +161,16 @@ export const serializeAws_restJson1DescribeCanariesLastRunCommand = async ( input: DescribeCanariesLastRunCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/canaries/last-run"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/canaries/last-run"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -186,16 +186,16 @@ export const serializeAws_restJson1DescribeRuntimeVersionsCommand = async ( input: DescribeRuntimeVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/runtime-versions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/runtime-versions"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -211,8 +211,9 @@ export const serializeAws_restJson1GetCanaryCommand = async ( input: GetCanaryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/canary/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/canary/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -223,7 +224,6 @@ export const serializeAws_restJson1GetCanaryCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -239,10 +239,11 @@ export const serializeAws_restJson1GetCanaryRunsCommand = async ( input: GetCanaryRunsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/canary/{Name}/runs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/canary/{Name}/runs"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -257,7 +258,6 @@ export const serializeAws_restJson1GetCanaryRunsCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -273,8 +273,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -285,7 +286,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -301,8 +301,9 @@ export const serializeAws_restJson1StartCanaryCommand = async ( input: StartCanaryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/canary/{Name}/start"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/canary/{Name}/start"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -313,7 +314,6 @@ export const serializeAws_restJson1StartCanaryCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -329,8 +329,9 @@ export const serializeAws_restJson1StopCanaryCommand = async ( input: StopCanaryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/canary/{Name}/stop"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/canary/{Name}/stop"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -341,7 +342,6 @@ export const serializeAws_restJson1StopCanaryCommand = async ( throw new Error("No value provided for input HTTP label: Name."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -357,10 +357,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -374,7 +375,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -390,8 +390,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -405,7 +406,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -422,10 +422,11 @@ export const serializeAws_restJson1UpdateCanaryCommand = async ( input: UpdateCanaryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/canary/{Name}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/canary/{Name}"; if (input.Name !== undefined) { const labelValue: string = input.Name; if (labelValue.length <= 0) { @@ -458,7 +459,6 @@ export const serializeAws_restJson1UpdateCanaryCommand = async ( ...(input.VpcConfig !== undefined && input.VpcConfig !== null && { VpcConfig: serializeAws_restJson1VpcConfigInput(input.VpcConfig, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-transcribe-streaming/protocols/Aws_restJson1.ts b/clients/client-transcribe-streaming/protocols/Aws_restJson1.ts index a9da24c8a5030..5d2ca7846376f 100644 --- a/clients/client-transcribe-streaming/protocols/Aws_restJson1.ts +++ b/clients/client-transcribe-streaming/protocols/Aws_restJson1.ts @@ -49,6 +49,7 @@ export const serializeAws_restJson1StartMedicalStreamTranscriptionCommand = asyn input: StartMedicalStreamTranscriptionCommandInput, context: __SerdeContext & __EventStreamSerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.LanguageCode) && { "x-amzn-transcribe-language-code": input.LanguageCode! }), ...(isSerializableHeaderValue(input.MediaSampleRateHertz) && { @@ -74,14 +75,14 @@ export const serializeAws_restJson1StartMedicalStreamTranscriptionCommand = asyn "x-amzn-transcribe-content-identification-type": input.ContentIdentificationType!, }), }; - let resolvedPath = "/medical-stream-transcription"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/medical-stream-transcription"; let body: any; if (input.AudioStream !== undefined) { body = context.eventStreamMarshaller.serialize(input.AudioStream, (event) => serializeAws_restJson1AudioStream_event(event, context) ); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -97,6 +98,7 @@ export const serializeAws_restJson1StartStreamTranscriptionCommand = async ( input: StartStreamTranscriptionCommandInput, context: __SerdeContext & __EventStreamSerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.LanguageCode) && { "x-amzn-transcribe-language-code": input.LanguageCode! }), ...(isSerializableHeaderValue(input.MediaSampleRateHertz) && { @@ -129,14 +131,13 @@ export const serializeAws_restJson1StartStreamTranscriptionCommand = async ( "x-amzn-transcribe-partial-results-stability": input.PartialResultsStability!, }), }; - let resolvedPath = "/stream-transcription"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/stream-transcription"; let body: any; if (input.AudioStream !== undefined) { body = context.eventStreamMarshaller.serialize(input.AudioStream, (event) => serializeAws_restJson1AudioStream_event(event, context) ); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-wellarchitected/protocols/Aws_restJson1.ts b/clients/client-wellarchitected/protocols/Aws_restJson1.ts index 47c8a8adc5510..52a7fd83f315f 100644 --- a/clients/client-wellarchitected/protocols/Aws_restJson1.ts +++ b/clients/client-wellarchitected/protocols/Aws_restJson1.ts @@ -109,10 +109,12 @@ export const serializeAws_restJson1AssociateLensesCommand = async ( input: AssociateLensesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads/{WorkloadId}/associateLenses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads/{WorkloadId}/associateLenses"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -127,7 +129,6 @@ export const serializeAws_restJson1AssociateLensesCommand = async ( ...(input.LensAliases !== undefined && input.LensAliases !== null && { LensAliases: serializeAws_restJson1LensAliases(input.LensAliases, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -143,10 +144,12 @@ export const serializeAws_restJson1CreateMilestoneCommand = async ( input: CreateMilestoneCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads/{WorkloadId}/milestones"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads/{WorkloadId}/milestones"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -161,7 +164,6 @@ export const serializeAws_restJson1CreateMilestoneCommand = async ( ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), ...(input.MilestoneName !== undefined && input.MilestoneName !== null && { MilestoneName: input.MilestoneName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -177,10 +179,11 @@ export const serializeAws_restJson1CreateWorkloadCommand = async ( input: CreateWorkloadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads"; let body: any; body = JSON.stringify({ ...(input.AccountIds !== undefined && @@ -209,7 +212,6 @@ export const serializeAws_restJson1CreateWorkloadCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), ...(input.WorkloadName !== undefined && input.WorkloadName !== null && { WorkloadName: input.WorkloadName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -225,10 +227,12 @@ export const serializeAws_restJson1CreateWorkloadShareCommand = async ( input: CreateWorkloadShareCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads/{WorkloadId}/shares"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads/{WorkloadId}/shares"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -245,7 +249,6 @@ export const serializeAws_restJson1CreateWorkloadShareCommand = async ( input.PermissionType !== null && { PermissionType: input.PermissionType }), ...(input.SharedWith !== undefined && input.SharedWith !== null && { SharedWith: input.SharedWith }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -261,8 +264,9 @@ export const serializeAws_restJson1DeleteWorkloadCommand = async ( input: DeleteWorkloadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads/{WorkloadId}"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -276,7 +280,6 @@ export const serializeAws_restJson1DeleteWorkloadCommand = async ( ...(input.ClientRequestToken !== undefined && { ClientRequestToken: input.ClientRequestToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -293,8 +296,10 @@ export const serializeAws_restJson1DeleteWorkloadShareCommand = async ( input: DeleteWorkloadShareCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}/shares/{ShareId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads/{WorkloadId}/shares/{ShareId}"; if (input.ShareId !== undefined) { const labelValue: string = input.ShareId; if (labelValue.length <= 0) { @@ -317,7 +322,6 @@ export const serializeAws_restJson1DeleteWorkloadShareCommand = async ( ...(input.ClientRequestToken !== undefined && { ClientRequestToken: input.ClientRequestToken }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -334,10 +338,13 @@ export const serializeAws_restJson1DisassociateLensesCommand = async ( input: DisassociateLensesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads/{WorkloadId}/disassociateLenses"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/disassociateLenses"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -352,7 +359,6 @@ export const serializeAws_restJson1DisassociateLensesCommand = async ( ...(input.LensAliases !== undefined && input.LensAliases !== null && { LensAliases: serializeAws_restJson1LensAliases(input.LensAliases, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -368,8 +374,11 @@ export const serializeAws_restJson1GetAnswerCommand = async ( input: GetAnswerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}/lensReviews/{LensAlias}/answers/{QuestionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/lensReviews/{LensAlias}/answers/{QuestionId}"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -401,7 +410,6 @@ export const serializeAws_restJson1GetAnswerCommand = async ( ...(input.MilestoneNumber !== undefined && { MilestoneNumber: input.MilestoneNumber.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -418,8 +426,11 @@ export const serializeAws_restJson1GetLensReviewCommand = async ( input: GetLensReviewCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}/lensReviews/{LensAlias}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/lensReviews/{LensAlias}"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -442,7 +453,6 @@ export const serializeAws_restJson1GetLensReviewCommand = async ( ...(input.MilestoneNumber !== undefined && { MilestoneNumber: input.MilestoneNumber.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -459,8 +469,11 @@ export const serializeAws_restJson1GetLensReviewReportCommand = async ( input: GetLensReviewReportCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}/lensReviews/{LensAlias}/report"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/lensReviews/{LensAlias}/report"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -483,7 +496,6 @@ export const serializeAws_restJson1GetLensReviewReportCommand = async ( ...(input.MilestoneNumber !== undefined && { MilestoneNumber: input.MilestoneNumber.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -500,8 +512,10 @@ export const serializeAws_restJson1GetLensVersionDifferenceCommand = async ( input: GetLensVersionDifferenceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/lenses/{LensAlias}/versionDifference"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/lenses/{LensAlias}/versionDifference"; if (input.LensAlias !== undefined) { const labelValue: string = input.LensAlias; if (labelValue.length <= 0) { @@ -515,7 +529,6 @@ export const serializeAws_restJson1GetLensVersionDifferenceCommand = async ( ...(input.BaseLensVersion !== undefined && { BaseLensVersion: input.BaseLensVersion }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -532,8 +545,11 @@ export const serializeAws_restJson1GetMilestoneCommand = async ( input: GetMilestoneCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}/milestones/{MilestoneNumber}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/milestones/{MilestoneNumber}"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -553,7 +569,6 @@ export const serializeAws_restJson1GetMilestoneCommand = async ( throw new Error("No value provided for input HTTP label: MilestoneNumber."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -569,8 +584,9 @@ export const serializeAws_restJson1GetWorkloadCommand = async ( input: GetWorkloadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads/{WorkloadId}"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -581,7 +597,6 @@ export const serializeAws_restJson1GetWorkloadCommand = async ( throw new Error("No value provided for input HTTP label: WorkloadId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -597,8 +612,11 @@ export const serializeAws_restJson1ListAnswersCommand = async ( input: ListAnswersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}/lensReviews/{LensAlias}/answers"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/lensReviews/{LensAlias}/answers"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -624,7 +642,6 @@ export const serializeAws_restJson1ListAnswersCommand = async ( ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -641,14 +658,14 @@ export const serializeAws_restJson1ListLensesCommand = async ( input: ListLensesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/lenses"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/lenses"; const query: any = { ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -665,8 +682,11 @@ export const serializeAws_restJson1ListLensReviewImprovementsCommand = async ( input: ListLensReviewImprovementsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}/lensReviews/{LensAlias}/improvements"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/lensReviews/{LensAlias}/improvements"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -692,7 +712,6 @@ export const serializeAws_restJson1ListLensReviewImprovementsCommand = async ( ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -709,8 +728,10 @@ export const serializeAws_restJson1ListLensReviewsCommand = async ( input: ListLensReviewsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}/lensReviews"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads/{WorkloadId}/lensReviews"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -726,7 +747,6 @@ export const serializeAws_restJson1ListLensReviewsCommand = async ( ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -743,10 +763,13 @@ export const serializeAws_restJson1ListMilestonesCommand = async ( input: ListMilestonesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads/{WorkloadId}/milestonesSummaries"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/milestonesSummaries"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -761,7 +784,6 @@ export const serializeAws_restJson1ListMilestonesCommand = async ( ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -777,17 +799,17 @@ export const serializeAws_restJson1ListNotificationsCommand = async ( input: ListNotificationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/notifications"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/notifications"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.WorkloadId !== undefined && input.WorkloadId !== null && { WorkloadId: input.WorkloadId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -803,15 +825,15 @@ export const serializeAws_restJson1ListShareInvitationsCommand = async ( input: ListShareInvitationsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/shareInvitations"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/shareInvitations"; const query: any = { ...(input.WorkloadNamePrefix !== undefined && { WorkloadNamePrefix: input.WorkloadNamePrefix }), ...(input.NextToken !== undefined && { NextToken: input.NextToken }), ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -828,8 +850,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{WorkloadArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{WorkloadArn}"; if (input.WorkloadArn !== undefined) { const labelValue: string = input.WorkloadArn; if (labelValue.length <= 0) { @@ -840,7 +863,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: WorkloadArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -856,10 +878,11 @@ export const serializeAws_restJson1ListWorkloadsCommand = async ( input: ListWorkloadsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloadsSummaries"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloadsSummaries"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), @@ -867,7 +890,6 @@ export const serializeAws_restJson1ListWorkloadsCommand = async ( ...(input.WorkloadNamePrefix !== undefined && input.WorkloadNamePrefix !== null && { WorkloadNamePrefix: input.WorkloadNamePrefix }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -883,8 +905,10 @@ export const serializeAws_restJson1ListWorkloadSharesCommand = async ( input: ListWorkloadSharesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/workloads/{WorkloadId}/shares"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads/{WorkloadId}/shares"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -900,7 +924,6 @@ export const serializeAws_restJson1ListWorkloadSharesCommand = async ( ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -917,10 +940,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{WorkloadArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{WorkloadArn}"; if (input.WorkloadArn !== undefined) { const labelValue: string = input.WorkloadArn; if (labelValue.length <= 0) { @@ -934,7 +958,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -950,8 +973,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{WorkloadArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{WorkloadArn}"; if (input.WorkloadArn !== undefined) { const labelValue: string = input.WorkloadArn; if (labelValue.length <= 0) { @@ -965,7 +989,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -982,10 +1005,13 @@ export const serializeAws_restJson1UpdateAnswerCommand = async ( input: UpdateAnswerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads/{WorkloadId}/lensReviews/{LensAlias}/answers/{QuestionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/lensReviews/{LensAlias}/answers/{QuestionId}"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -1022,7 +1048,6 @@ export const serializeAws_restJson1UpdateAnswerCommand = async ( SelectedChoices: serializeAws_restJson1SelectedChoices(input.SelectedChoices, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1038,10 +1063,13 @@ export const serializeAws_restJson1UpdateLensReviewCommand = async ( input: UpdateLensReviewCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads/{WorkloadId}/lensReviews/{LensAlias}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/lensReviews/{LensAlias}"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -1066,7 +1094,6 @@ export const serializeAws_restJson1UpdateLensReviewCommand = async ( ...(input.PillarNotes !== undefined && input.PillarNotes !== null && { PillarNotes: serializeAws_restJson1PillarNotes(input.PillarNotes, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1082,10 +1109,12 @@ export const serializeAws_restJson1UpdateShareInvitationCommand = async ( input: UpdateShareInvitationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/shareInvitations/{ShareInvitationId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/shareInvitations/{ShareInvitationId}"; if (input.ShareInvitationId !== undefined) { const labelValue: string = input.ShareInvitationId; if (labelValue.length <= 0) { @@ -1100,7 +1129,6 @@ export const serializeAws_restJson1UpdateShareInvitationCommand = async ( ...(input.ShareInvitationAction !== undefined && input.ShareInvitationAction !== null && { ShareInvitationAction: input.ShareInvitationAction }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1116,10 +1144,11 @@ export const serializeAws_restJson1UpdateWorkloadCommand = async ( input: UpdateWorkloadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads/{WorkloadId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads/{WorkloadId}"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -1159,7 +1188,6 @@ export const serializeAws_restJson1UpdateWorkloadCommand = async ( ...(input.ReviewOwner !== undefined && input.ReviewOwner !== null && { ReviewOwner: input.ReviewOwner }), ...(input.WorkloadName !== undefined && input.WorkloadName !== null && { WorkloadName: input.WorkloadName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1175,10 +1203,12 @@ export const serializeAws_restJson1UpdateWorkloadShareCommand = async ( input: UpdateWorkloadShareCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads/{WorkloadId}/shares/{ShareId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workloads/{WorkloadId}/shares/{ShareId}"; if (input.ShareId !== undefined) { const labelValue: string = input.ShareId; if (labelValue.length <= 0) { @@ -1202,7 +1232,6 @@ export const serializeAws_restJson1UpdateWorkloadShareCommand = async ( ...(input.PermissionType !== undefined && input.PermissionType !== null && { PermissionType: input.PermissionType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1218,10 +1247,13 @@ export const serializeAws_restJson1UpgradeLensReviewCommand = async ( input: UpgradeLensReviewCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/workloads/{WorkloadId}/lensReviews/{LensAlias}/upgrade"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/workloads/{WorkloadId}/lensReviews/{LensAlias}/upgrade"; if (input.WorkloadId !== undefined) { const labelValue: string = input.WorkloadId; if (labelValue.length <= 0) { @@ -1246,7 +1278,6 @@ export const serializeAws_restJson1UpgradeLensReviewCommand = async ( input.ClientRequestToken !== null && { ClientRequestToken: input.ClientRequestToken }), ...(input.MilestoneName !== undefined && input.MilestoneName !== null && { MilestoneName: input.MilestoneName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-workdocs/protocols/Aws_restJson1.ts b/clients/client-workdocs/protocols/Aws_restJson1.ts index 66faa49ce1229..aade118f05936 100644 --- a/clients/client-workdocs/protocols/Aws_restJson1.ts +++ b/clients/client-workdocs/protocols/Aws_restJson1.ts @@ -157,10 +157,13 @@ export const serializeAws_restJson1AbortDocumentVersionUploadCommand = async ( input: AbortDocumentVersionUploadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}/versions/{VersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/documents/{DocumentId}/versions/{VersionId}"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -180,7 +183,6 @@ export const serializeAws_restJson1AbortDocumentVersionUploadCommand = async ( throw new Error("No value provided for input HTTP label: VersionId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -196,10 +198,12 @@ export const serializeAws_restJson1ActivateUserCommand = async ( input: ActivateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/users/{UserId}/activation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users/{UserId}/activation"; if (input.UserId !== undefined) { const labelValue: string = input.UserId; if (labelValue.length <= 0) { @@ -210,7 +214,6 @@ export const serializeAws_restJson1ActivateUserCommand = async ( throw new Error("No value provided for input HTTP label: UserId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -226,11 +229,14 @@ export const serializeAws_restJson1AddResourcePermissionsCommand = async ( input: AddResourcePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/resources/{ResourceId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/resources/{ResourceId}/permissions"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -249,7 +255,6 @@ export const serializeAws_restJson1AddResourcePermissionsCommand = async ( ...(input.Principals !== undefined && input.Principals !== null && { Principals: serializeAws_restJson1SharePrincipalList(input.Principals, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -265,11 +270,14 @@ export const serializeAws_restJson1CreateCommentCommand = async ( input: CreateCommentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}/versions/{VersionId}/comment"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/documents/{DocumentId}/versions/{VersionId}/comment"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -297,7 +305,6 @@ export const serializeAws_restJson1CreateCommentCommand = async ( ...(input.ThreadId !== undefined && input.ThreadId !== null && { ThreadId: input.ThreadId }), ...(input.Visibility !== undefined && input.Visibility !== null && { Visibility: input.Visibility }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -313,11 +320,14 @@ export const serializeAws_restJson1CreateCustomMetadataCommand = async ( input: CreateCustomMetadataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/resources/{ResourceId}/customMetadata"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/resources/{ResourceId}/customMetadata"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -337,7 +347,6 @@ export const serializeAws_restJson1CreateCustomMetadataCommand = async ( CustomMetadata: serializeAws_restJson1CustomMetadataMap(input.CustomMetadata, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -354,18 +363,18 @@ export const serializeAws_restJson1CreateFolderCommand = async ( input: CreateFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/folders"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders"; let body: any; body = JSON.stringify({ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }), ...(input.ParentFolderId !== undefined && input.ParentFolderId !== null && { ParentFolderId: input.ParentFolderId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -381,11 +390,13 @@ export const serializeAws_restJson1CreateLabelsCommand = async ( input: CreateLabelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/resources/{ResourceId}/labels"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/resources/{ResourceId}/labels"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -400,7 +411,6 @@ export const serializeAws_restJson1CreateLabelsCommand = async ( ...(input.Labels !== undefined && input.Labels !== null && { Labels: serializeAws_restJson1SharedLabels(input.Labels, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -416,10 +426,13 @@ export const serializeAws_restJson1CreateNotificationSubscriptionCommand = async input: CreateNotificationSubscriptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/api/v1/organizations/{OrganizationId}/subscriptions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/organizations/{OrganizationId}/subscriptions"; if (input.OrganizationId !== undefined) { const labelValue: string = input.OrganizationId; if (labelValue.length <= 0) { @@ -436,7 +449,6 @@ export const serializeAws_restJson1CreateNotificationSubscriptionCommand = async ...(input.SubscriptionType !== undefined && input.SubscriptionType !== null && { SubscriptionType: input.SubscriptionType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -452,11 +464,12 @@ export const serializeAws_restJson1CreateUserCommand = async ( input: CreateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/users"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users"; let body: any; body = JSON.stringify({ ...(input.EmailAddress !== undefined && input.EmailAddress !== null && { EmailAddress: input.EmailAddress }), @@ -470,7 +483,6 @@ export const serializeAws_restJson1CreateUserCommand = async ( ...(input.TimeZoneId !== undefined && input.TimeZoneId !== null && { TimeZoneId: input.TimeZoneId }), ...(input.Username !== undefined && input.Username !== null && { Username: input.Username }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -486,10 +498,12 @@ export const serializeAws_restJson1DeactivateUserCommand = async ( input: DeactivateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/users/{UserId}/activation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users/{UserId}/activation"; if (input.UserId !== undefined) { const labelValue: string = input.UserId; if (labelValue.length <= 0) { @@ -500,7 +514,6 @@ export const serializeAws_restJson1DeactivateUserCommand = async ( throw new Error("No value provided for input HTTP label: UserId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -516,10 +529,13 @@ export const serializeAws_restJson1DeleteCommentCommand = async ( input: DeleteCommentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}/versions/{VersionId}/comment/{CommentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/documents/{DocumentId}/versions/{VersionId}/comment/{CommentId}"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -548,7 +564,6 @@ export const serializeAws_restJson1DeleteCommentCommand = async ( throw new Error("No value provided for input HTTP label: CommentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -564,10 +579,13 @@ export const serializeAws_restJson1DeleteCustomMetadataCommand = async ( input: DeleteCustomMetadataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/resources/{ResourceId}/customMetadata"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/resources/{ResourceId}/customMetadata"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -583,7 +601,6 @@ export const serializeAws_restJson1DeleteCustomMetadataCommand = async ( ...(input.DeleteAll !== undefined && { deleteAll: input.DeleteAll.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -600,10 +617,12 @@ export const serializeAws_restJson1DeleteDocumentCommand = async ( input: DeleteDocumentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents/{DocumentId}"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -614,7 +633,6 @@ export const serializeAws_restJson1DeleteDocumentCommand = async ( throw new Error("No value provided for input HTTP label: DocumentId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -630,10 +648,12 @@ export const serializeAws_restJson1DeleteFolderCommand = async ( input: DeleteFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/folders/{FolderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}"; if (input.FolderId !== undefined) { const labelValue: string = input.FolderId; if (labelValue.length <= 0) { @@ -644,7 +664,6 @@ export const serializeAws_restJson1DeleteFolderCommand = async ( throw new Error("No value provided for input HTTP label: FolderId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -660,10 +679,12 @@ export const serializeAws_restJson1DeleteFolderContentsCommand = async ( input: DeleteFolderContentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/folders/{FolderId}/contents"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}/contents"; if (input.FolderId !== undefined) { const labelValue: string = input.FolderId; if (labelValue.length <= 0) { @@ -674,7 +695,6 @@ export const serializeAws_restJson1DeleteFolderContentsCommand = async ( throw new Error("No value provided for input HTTP label: FolderId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -690,10 +710,12 @@ export const serializeAws_restJson1DeleteLabelsCommand = async ( input: DeleteLabelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/resources/{ResourceId}/labels"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/resources/{ResourceId}/labels"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -708,7 +730,6 @@ export const serializeAws_restJson1DeleteLabelsCommand = async ( ...(input.DeleteAll !== undefined && { deleteAll: input.DeleteAll.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -725,8 +746,11 @@ export const serializeAws_restJson1DeleteNotificationSubscriptionCommand = async input: DeleteNotificationSubscriptionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/api/v1/organizations/{OrganizationId}/subscriptions/{SubscriptionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/organizations/{OrganizationId}/subscriptions/{SubscriptionId}"; if (input.SubscriptionId !== undefined) { const labelValue: string = input.SubscriptionId; if (labelValue.length <= 0) { @@ -746,7 +770,6 @@ export const serializeAws_restJson1DeleteNotificationSubscriptionCommand = async throw new Error("No value provided for input HTTP label: OrganizationId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -762,10 +785,11 @@ export const serializeAws_restJson1DeleteUserCommand = async ( input: DeleteUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/users/{UserId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users/{UserId}"; if (input.UserId !== undefined) { const labelValue: string = input.UserId; if (labelValue.length <= 0) { @@ -776,7 +800,6 @@ export const serializeAws_restJson1DeleteUserCommand = async ( throw new Error("No value provided for input HTTP label: UserId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -792,10 +815,11 @@ export const serializeAws_restJson1DescribeActivitiesCommand = async ( input: DescribeActivitiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/activities"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/activities"; const query: any = { ...(input.StartTime !== undefined && { startTime: (input.StartTime.toISOString().split(".")[0] + "Z").toString() }), ...(input.EndTime !== undefined && { endTime: (input.EndTime.toISOString().split(".")[0] + "Z").toString() }), @@ -810,7 +834,6 @@ export const serializeAws_restJson1DescribeActivitiesCommand = async ( ...(input.Marker !== undefined && { marker: input.Marker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -827,10 +850,13 @@ export const serializeAws_restJson1DescribeCommentsCommand = async ( input: DescribeCommentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}/versions/{VersionId}/comments"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/documents/{DocumentId}/versions/{VersionId}/comments"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -854,7 +880,6 @@ export const serializeAws_restJson1DescribeCommentsCommand = async ( ...(input.Marker !== undefined && { marker: input.Marker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -871,10 +896,12 @@ export const serializeAws_restJson1DescribeDocumentVersionsCommand = async ( input: DescribeDocumentVersionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}/versions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents/{DocumentId}/versions"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -891,7 +918,6 @@ export const serializeAws_restJson1DescribeDocumentVersionsCommand = async ( ...(input.Fields !== undefined && { fields: input.Fields }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -908,10 +934,12 @@ export const serializeAws_restJson1DescribeFolderContentsCommand = async ( input: DescribeFolderContentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/folders/{FolderId}/contents"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}/contents"; if (input.FolderId !== undefined) { const labelValue: string = input.FolderId; if (labelValue.length <= 0) { @@ -930,7 +958,6 @@ export const serializeAws_restJson1DescribeFolderContentsCommand = async ( ...(input.Include !== undefined && { include: input.Include }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -947,10 +974,11 @@ export const serializeAws_restJson1DescribeGroupsCommand = async ( input: DescribeGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/groups"; const query: any = { ...(input.SearchQuery !== undefined && { searchQuery: input.SearchQuery }), ...(input.OrganizationId !== undefined && { organizationId: input.OrganizationId }), @@ -958,7 +986,6 @@ export const serializeAws_restJson1DescribeGroupsCommand = async ( ...(input.Limit !== undefined && { limit: input.Limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -975,8 +1002,11 @@ export const serializeAws_restJson1DescribeNotificationSubscriptionsCommand = as input: DescribeNotificationSubscriptionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/api/v1/organizations/{OrganizationId}/subscriptions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/organizations/{OrganizationId}/subscriptions"; if (input.OrganizationId !== undefined) { const labelValue: string = input.OrganizationId; if (labelValue.length <= 0) { @@ -991,7 +1021,6 @@ export const serializeAws_restJson1DescribeNotificationSubscriptionsCommand = as ...(input.Limit !== undefined && { limit: input.Limit.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1008,10 +1037,13 @@ export const serializeAws_restJson1DescribeResourcePermissionsCommand = async ( input: DescribeResourcePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/resources/{ResourceId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/resources/{ResourceId}/permissions"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -1027,7 +1059,6 @@ export const serializeAws_restJson1DescribeResourcePermissionsCommand = async ( ...(input.Marker !== undefined && { marker: input.Marker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1044,16 +1075,16 @@ export const serializeAws_restJson1DescribeRootFoldersCommand = async ( input: DescribeRootFoldersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/me/root"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/me/root"; const query: any = { ...(input.Limit !== undefined && { limit: input.Limit.toString() }), ...(input.Marker !== undefined && { marker: input.Marker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1070,10 +1101,11 @@ export const serializeAws_restJson1DescribeUsersCommand = async ( input: DescribeUsersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/users"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users"; const query: any = { ...(input.OrganizationId !== undefined && { organizationId: input.OrganizationId }), ...(input.UserIds !== undefined && { userIds: input.UserIds }), @@ -1086,7 +1118,6 @@ export const serializeAws_restJson1DescribeUsersCommand = async ( ...(input.Fields !== undefined && { fields: input.Fields }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1103,12 +1134,12 @@ export const serializeAws_restJson1GetCurrentUserCommand = async ( input: GetCurrentUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/me"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/me"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1124,10 +1155,12 @@ export const serializeAws_restJson1GetDocumentCommand = async ( input: GetDocumentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents/{DocumentId}"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -1141,7 +1174,6 @@ export const serializeAws_restJson1GetDocumentCommand = async ( ...(input.IncludeCustomMetadata !== undefined && { includeCustomMetadata: input.IncludeCustomMetadata.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1158,10 +1190,12 @@ export const serializeAws_restJson1GetDocumentPathCommand = async ( input: GetDocumentPathCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}/path"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents/{DocumentId}/path"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -1177,7 +1211,6 @@ export const serializeAws_restJson1GetDocumentPathCommand = async ( ...(input.Marker !== undefined && { marker: input.Marker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1194,10 +1227,13 @@ export const serializeAws_restJson1GetDocumentVersionCommand = async ( input: GetDocumentVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}/versions/{VersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/documents/{DocumentId}/versions/{VersionId}"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -1221,7 +1257,6 @@ export const serializeAws_restJson1GetDocumentVersionCommand = async ( ...(input.IncludeCustomMetadata !== undefined && { includeCustomMetadata: input.IncludeCustomMetadata.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1238,10 +1273,12 @@ export const serializeAws_restJson1GetFolderCommand = async ( input: GetFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/folders/{FolderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}"; if (input.FolderId !== undefined) { const labelValue: string = input.FolderId; if (labelValue.length <= 0) { @@ -1255,7 +1292,6 @@ export const serializeAws_restJson1GetFolderCommand = async ( ...(input.IncludeCustomMetadata !== undefined && { includeCustomMetadata: input.IncludeCustomMetadata.toString() }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1272,10 +1308,12 @@ export const serializeAws_restJson1GetFolderPathCommand = async ( input: GetFolderPathCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/folders/{FolderId}/path"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}/path"; if (input.FolderId !== undefined) { const labelValue: string = input.FolderId; if (labelValue.length <= 0) { @@ -1291,7 +1329,6 @@ export const serializeAws_restJson1GetFolderPathCommand = async ( ...(input.Marker !== undefined && { marker: input.Marker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1308,10 +1345,11 @@ export const serializeAws_restJson1GetResourcesCommand = async ( input: GetResourcesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/resources"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/resources"; const query: any = { ...(input.UserId !== undefined && { userId: input.UserId }), ...(input.CollectionType !== undefined && { collectionType: input.CollectionType }), @@ -1319,7 +1357,6 @@ export const serializeAws_restJson1GetResourcesCommand = async ( ...(input.Marker !== undefined && { marker: input.Marker }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1336,11 +1373,12 @@ export const serializeAws_restJson1InitiateDocumentVersionUploadCommand = async input: InitiateDocumentVersionUploadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents"; let body: any; body = JSON.stringify({ ...(input.ContentCreatedTimestamp !== undefined && @@ -1359,7 +1397,6 @@ export const serializeAws_restJson1InitiateDocumentVersionUploadCommand = async ...(input.ParentFolderId !== undefined && input.ParentFolderId !== null && { ParentFolderId: input.ParentFolderId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1375,10 +1412,13 @@ export const serializeAws_restJson1RemoveAllResourcePermissionsCommand = async ( input: RemoveAllResourcePermissionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/resources/{ResourceId}/permissions"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/resources/{ResourceId}/permissions"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -1389,7 +1429,6 @@ export const serializeAws_restJson1RemoveAllResourcePermissionsCommand = async ( throw new Error("No value provided for input HTTP label: ResourceId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1405,10 +1444,13 @@ export const serializeAws_restJson1RemoveResourcePermissionCommand = async ( input: RemoveResourcePermissionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/resources/{ResourceId}/permissions/{PrincipalId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/resources/{ResourceId}/permissions/{PrincipalId}"; if (input.ResourceId !== undefined) { const labelValue: string = input.ResourceId; if (labelValue.length <= 0) { @@ -1431,7 +1473,6 @@ export const serializeAws_restJson1RemoveResourcePermissionCommand = async ( ...(input.PrincipalType !== undefined && { type: input.PrincipalType }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1448,11 +1489,13 @@ export const serializeAws_restJson1UpdateDocumentCommand = async ( input: UpdateDocumentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/documents/{DocumentId}"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -1469,7 +1512,6 @@ export const serializeAws_restJson1UpdateDocumentCommand = async ( input.ParentFolderId !== null && { ParentFolderId: input.ParentFolderId }), ...(input.ResourceState !== undefined && input.ResourceState !== null && { ResourceState: input.ResourceState }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1485,11 +1527,14 @@ export const serializeAws_restJson1UpdateDocumentVersionCommand = async ( input: UpdateDocumentVersionCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/documents/{DocumentId}/versions/{VersionId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/api/v1/documents/{DocumentId}/versions/{VersionId}"; if (input.DocumentId !== undefined) { const labelValue: string = input.DocumentId; if (labelValue.length <= 0) { @@ -1512,7 +1557,6 @@ export const serializeAws_restJson1UpdateDocumentVersionCommand = async ( body = JSON.stringify({ ...(input.VersionStatus !== undefined && input.VersionStatus !== null && { VersionStatus: input.VersionStatus }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1528,11 +1572,13 @@ export const serializeAws_restJson1UpdateFolderCommand = async ( input: UpdateFolderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/folders/{FolderId}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/folders/{FolderId}"; if (input.FolderId !== undefined) { const labelValue: string = input.FolderId; if (labelValue.length <= 0) { @@ -1549,7 +1595,6 @@ export const serializeAws_restJson1UpdateFolderCommand = async ( input.ParentFolderId !== null && { ParentFolderId: input.ParentFolderId }), ...(input.ResourceState !== undefined && input.ResourceState !== null && { ResourceState: input.ResourceState }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1565,11 +1610,12 @@ export const serializeAws_restJson1UpdateUserCommand = async ( input: UpdateUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.AuthenticationToken) && { authentication: input.AuthenticationToken! }), }; - let resolvedPath = "/api/v1/users/{UserId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/api/v1/users/{UserId}"; if (input.UserId !== undefined) { const labelValue: string = input.UserId; if (labelValue.length <= 0) { @@ -1591,7 +1637,6 @@ export const serializeAws_restJson1UpdateUserCommand = async ( ...(input.TimeZoneId !== undefined && input.TimeZoneId !== null && { TimeZoneId: input.TimeZoneId }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-worklink/protocols/Aws_restJson1.ts b/clients/client-worklink/protocols/Aws_restJson1.ts index 21c9950b943bd..835a955700eea 100644 --- a/clients/client-worklink/protocols/Aws_restJson1.ts +++ b/clients/client-worklink/protocols/Aws_restJson1.ts @@ -122,10 +122,11 @@ export const serializeAws_restJson1AssociateDomainCommand = async ( input: AssociateDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/associateDomain"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/associateDomain"; let body: any; body = JSON.stringify({ ...(input.AcmCertificateArn !== undefined && @@ -134,7 +135,6 @@ export const serializeAws_restJson1AssociateDomainCommand = async ( ...(input.DomainName !== undefined && input.DomainName !== null && { DomainName: input.DomainName }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -150,10 +150,12 @@ export const serializeAws_restJson1AssociateWebsiteAuthorizationProviderCommand input: AssociateWebsiteAuthorizationProviderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/associateWebsiteAuthorizationProvider"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/associateWebsiteAuthorizationProvider"; let body: any; body = JSON.stringify({ ...(input.AuthorizationProviderType !== undefined && @@ -161,7 +163,6 @@ export const serializeAws_restJson1AssociateWebsiteAuthorizationProviderCommand ...(input.DomainName !== undefined && input.DomainName !== null && { DomainName: input.DomainName }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -177,17 +178,18 @@ export const serializeAws_restJson1AssociateWebsiteCertificateAuthorityCommand = input: AssociateWebsiteCertificateAuthorityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/associateWebsiteCertificateAuthority"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/associateWebsiteCertificateAuthority"; let body: any; body = JSON.stringify({ ...(input.Certificate !== undefined && input.Certificate !== null && { Certificate: input.Certificate }), ...(input.DisplayName !== undefined && input.DisplayName !== null && { DisplayName: input.DisplayName }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -203,10 +205,11 @@ export const serializeAws_restJson1CreateFleetCommand = async ( input: CreateFleetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/createFleet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createFleet"; let body: any; body = JSON.stringify({ ...(input.DisplayName !== undefined && input.DisplayName !== null && { DisplayName: input.DisplayName }), @@ -215,7 +218,6 @@ export const serializeAws_restJson1CreateFleetCommand = async ( input.OptimizeForEndUserLocation !== null && { OptimizeForEndUserLocation: input.OptimizeForEndUserLocation }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -231,15 +233,15 @@ export const serializeAws_restJson1DeleteFleetCommand = async ( input: DeleteFleetCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/deleteFleet"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteFleet"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -255,15 +257,16 @@ export const serializeAws_restJson1DescribeAuditStreamConfigurationCommand = asy input: DescribeAuditStreamConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeAuditStreamConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeAuditStreamConfiguration"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -279,15 +282,16 @@ export const serializeAws_restJson1DescribeCompanyNetworkConfigurationCommand = input: DescribeCompanyNetworkConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeCompanyNetworkConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeCompanyNetworkConfiguration"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -303,16 +307,16 @@ export const serializeAws_restJson1DescribeDeviceCommand = async ( input: DescribeDeviceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeDevice"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeDevice"; let body: any; body = JSON.stringify({ ...(input.DeviceId !== undefined && input.DeviceId !== null && { DeviceId: input.DeviceId }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -328,15 +332,16 @@ export const serializeAws_restJson1DescribeDevicePolicyConfigurationCommand = as input: DescribeDevicePolicyConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeDevicePolicyConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeDevicePolicyConfiguration"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -352,16 +357,16 @@ export const serializeAws_restJson1DescribeDomainCommand = async ( input: DescribeDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeDomain"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeDomain"; let body: any; body = JSON.stringify({ ...(input.DomainName !== undefined && input.DomainName !== null && { DomainName: input.DomainName }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -377,15 +382,15 @@ export const serializeAws_restJson1DescribeFleetMetadataCommand = async ( input: DescribeFleetMetadataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeFleetMetadata"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeFleetMetadata"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -401,15 +406,16 @@ export const serializeAws_restJson1DescribeIdentityProviderConfigurationCommand input: DescribeIdentityProviderConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeIdentityProviderConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeIdentityProviderConfiguration"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -425,16 +431,17 @@ export const serializeAws_restJson1DescribeWebsiteCertificateAuthorityCommand = input: DescribeWebsiteCertificateAuthorityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/describeWebsiteCertificateAuthority"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/describeWebsiteCertificateAuthority"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), ...(input.WebsiteCaId !== undefined && input.WebsiteCaId !== null && { WebsiteCaId: input.WebsiteCaId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -450,16 +457,16 @@ export const serializeAws_restJson1DisassociateDomainCommand = async ( input: DisassociateDomainCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/disassociateDomain"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/disassociateDomain"; let body: any; body = JSON.stringify({ ...(input.DomainName !== undefined && input.DomainName !== null && { DomainName: input.DomainName }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -475,17 +482,18 @@ export const serializeAws_restJson1DisassociateWebsiteAuthorizationProviderComma input: DisassociateWebsiteAuthorizationProviderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/disassociateWebsiteAuthorizationProvider"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/disassociateWebsiteAuthorizationProvider"; let body: any; body = JSON.stringify({ ...(input.AuthorizationProviderId !== undefined && input.AuthorizationProviderId !== null && { AuthorizationProviderId: input.AuthorizationProviderId }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -501,16 +509,17 @@ export const serializeAws_restJson1DisassociateWebsiteCertificateAuthorityComman input: DisassociateWebsiteCertificateAuthorityCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/disassociateWebsiteCertificateAuthority"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/disassociateWebsiteCertificateAuthority"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), ...(input.WebsiteCaId !== undefined && input.WebsiteCaId !== null && { WebsiteCaId: input.WebsiteCaId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -526,17 +535,17 @@ export const serializeAws_restJson1ListDevicesCommand = async ( input: ListDevicesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listDevices"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listDevices"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -552,17 +561,17 @@ export const serializeAws_restJson1ListDomainsCommand = async ( input: ListDomainsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listDomains"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listDomains"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -578,16 +587,16 @@ export const serializeAws_restJson1ListFleetsCommand = async ( input: ListFleetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listFleets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listFleets"; let body: any; body = JSON.stringify({ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -603,8 +612,9 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -615,7 +625,6 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( throw new Error("No value provided for input HTTP label: ResourceArn."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -631,17 +640,18 @@ export const serializeAws_restJson1ListWebsiteAuthorizationProvidersCommand = as input: ListWebsiteAuthorizationProvidersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listWebsiteAuthorizationProviders"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listWebsiteAuthorizationProviders"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -657,17 +667,18 @@ export const serializeAws_restJson1ListWebsiteCertificateAuthoritiesCommand = as input: ListWebsiteCertificateAuthoritiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/listWebsiteCertificateAuthorities"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/listWebsiteCertificateAuthorities"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -683,16 +694,16 @@ export const serializeAws_restJson1RestoreDomainAccessCommand = async ( input: RestoreDomainAccessCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/restoreDomainAccess"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/restoreDomainAccess"; let body: any; body = JSON.stringify({ ...(input.DomainName !== undefined && input.DomainName !== null && { DomainName: input.DomainName }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -708,16 +719,16 @@ export const serializeAws_restJson1RevokeDomainAccessCommand = async ( input: RevokeDomainAccessCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/revokeDomainAccess"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/revokeDomainAccess"; let body: any; body = JSON.stringify({ ...(input.DomainName !== undefined && input.DomainName !== null && { DomainName: input.DomainName }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -733,16 +744,16 @@ export const serializeAws_restJson1SignOutUserCommand = async ( input: SignOutUserCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/signOutUser"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/signOutUser"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), ...(input.Username !== undefined && input.Username !== null && { Username: input.Username }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -758,10 +769,11 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -775,7 +787,6 @@ export const serializeAws_restJson1TagResourceCommand = async ( body = JSON.stringify({ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -791,8 +802,9 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/tags/{ResourceArn}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}"; if (input.ResourceArn !== undefined) { const labelValue: string = input.ResourceArn; if (labelValue.length <= 0) { @@ -806,7 +818,6 @@ export const serializeAws_restJson1UntagResourceCommand = async ( ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -823,17 +834,18 @@ export const serializeAws_restJson1UpdateAuditStreamConfigurationCommand = async input: UpdateAuditStreamConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateAuditStreamConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateAuditStreamConfiguration"; let body: any; body = JSON.stringify({ ...(input.AuditStreamArn !== undefined && input.AuditStreamArn !== null && { AuditStreamArn: input.AuditStreamArn }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -849,10 +861,12 @@ export const serializeAws_restJson1UpdateCompanyNetworkConfigurationCommand = as input: UpdateCompanyNetworkConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateCompanyNetworkConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateCompanyNetworkConfiguration"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), @@ -864,7 +878,6 @@ export const serializeAws_restJson1UpdateCompanyNetworkConfigurationCommand = as input.SubnetIds !== null && { SubnetIds: serializeAws_restJson1SubnetIds(input.SubnetIds, context) }), ...(input.VpcId !== undefined && input.VpcId !== null && { VpcId: input.VpcId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -880,17 +893,18 @@ export const serializeAws_restJson1UpdateDevicePolicyConfigurationCommand = asyn input: UpdateDevicePolicyConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateDevicePolicyConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateDevicePolicyConfiguration"; let body: any; body = JSON.stringify({ ...(input.DeviceCaCertificate !== undefined && input.DeviceCaCertificate !== null && { DeviceCaCertificate: input.DeviceCaCertificate }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -906,17 +920,17 @@ export const serializeAws_restJson1UpdateDomainMetadataCommand = async ( input: UpdateDomainMetadataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateDomainMetadata"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateDomainMetadata"; let body: any; body = JSON.stringify({ ...(input.DisplayName !== undefined && input.DisplayName !== null && { DisplayName: input.DisplayName }), ...(input.DomainName !== undefined && input.DomainName !== null && { DomainName: input.DomainName }), ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -932,10 +946,11 @@ export const serializeAws_restJson1UpdateFleetMetadataCommand = async ( input: UpdateFleetMetadataCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateFleetMetadata"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateFleetMetadata"; let body: any; body = JSON.stringify({ ...(input.DisplayName !== undefined && input.DisplayName !== null && { DisplayName: input.DisplayName }), @@ -943,7 +958,6 @@ export const serializeAws_restJson1UpdateFleetMetadataCommand = async ( ...(input.OptimizeForEndUserLocation !== undefined && input.OptimizeForEndUserLocation !== null && { OptimizeForEndUserLocation: input.OptimizeForEndUserLocation }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -959,10 +973,12 @@ export const serializeAws_restJson1UpdateIdentityProviderConfigurationCommand = input: UpdateIdentityProviderConfigurationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/updateIdentityProviderConfiguration"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/updateIdentityProviderConfiguration"; let body: any; body = JSON.stringify({ ...(input.FleetArn !== undefined && input.FleetArn !== null && { FleetArn: input.FleetArn }), @@ -973,7 +989,6 @@ export const serializeAws_restJson1UpdateIdentityProviderConfigurationCommand = ...(input.IdentityProviderType !== undefined && input.IdentityProviderType !== null && { IdentityProviderType: input.IdentityProviderType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-workmailmessageflow/protocols/Aws_restJson1.ts b/clients/client-workmailmessageflow/protocols/Aws_restJson1.ts index 368cfaa7087c7..0505acf3dc625 100644 --- a/clients/client-workmailmessageflow/protocols/Aws_restJson1.ts +++ b/clients/client-workmailmessageflow/protocols/Aws_restJson1.ts @@ -31,8 +31,9 @@ export const serializeAws_restJson1GetRawMessageContentCommand = async ( input: GetRawMessageContentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/messages/{messageId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/messages/{messageId}"; if (input.messageId !== undefined) { const labelValue: string = input.messageId; if (labelValue.length <= 0) { @@ -43,7 +44,6 @@ export const serializeAws_restJson1GetRawMessageContentCommand = async ( throw new Error("No value provided for input HTTP label: messageId."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -59,10 +59,11 @@ export const serializeAws_restJson1PutRawMessageContentCommand = async ( input: PutRawMessageContentCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/messages/{messageId}"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/messages/{messageId}"; if (input.messageId !== undefined) { const labelValue: string = input.messageId; if (labelValue.length <= 0) { @@ -77,7 +78,6 @@ export const serializeAws_restJson1PutRawMessageContentCommand = async ( ...(input.content !== undefined && input.content !== null && { content: serializeAws_restJson1RawMessageContent(input.content, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/clients/client-xray/protocols/Aws_restJson1.ts b/clients/client-xray/protocols/Aws_restJson1.ts index 6607c4b98fc6e..3cedb1d84ae2b 100644 --- a/clients/client-xray/protocols/Aws_restJson1.ts +++ b/clients/client-xray/protocols/Aws_restJson1.ts @@ -132,17 +132,17 @@ export const serializeAws_restJson1BatchGetTracesCommand = async ( input: BatchGetTracesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/Traces"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/Traces"; let body: any; body = JSON.stringify({ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.TraceIds !== undefined && input.TraceIds !== null && { TraceIds: serializeAws_restJson1TraceIdList(input.TraceIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -158,10 +158,11 @@ export const serializeAws_restJson1CreateGroupCommand = async ( input: CreateGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateGroup"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateGroup"; let body: any; body = JSON.stringify({ ...(input.FilterExpression !== undefined && @@ -174,7 +175,6 @@ export const serializeAws_restJson1CreateGroupCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -190,10 +190,11 @@ export const serializeAws_restJson1CreateSamplingRuleCommand = async ( input: CreateSamplingRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/CreateSamplingRule"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/CreateSamplingRule"; let body: any; body = JSON.stringify({ ...(input.SamplingRule !== undefined && @@ -201,7 +202,6 @@ export const serializeAws_restJson1CreateSamplingRuleCommand = async ( ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -217,16 +217,16 @@ export const serializeAws_restJson1DeleteGroupCommand = async ( input: DeleteGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteGroup"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteGroup"; let body: any; body = JSON.stringify({ ...(input.GroupARN !== undefined && input.GroupARN !== null && { GroupARN: input.GroupARN }), ...(input.GroupName !== undefined && input.GroupName !== null && { GroupName: input.GroupName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -242,16 +242,16 @@ export const serializeAws_restJson1DeleteSamplingRuleCommand = async ( input: DeleteSamplingRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DeleteSamplingRule"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DeleteSamplingRule"; let body: any; body = JSON.stringify({ ...(input.RuleARN !== undefined && input.RuleARN !== null && { RuleARN: input.RuleARN }), ...(input.RuleName !== undefined && input.RuleName !== null && { RuleName: input.RuleName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -267,13 +267,13 @@ export const serializeAws_restJson1GetEncryptionConfigCommand = async ( input: GetEncryptionConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/EncryptionConfig"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EncryptionConfig"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -289,16 +289,16 @@ export const serializeAws_restJson1GetGroupCommand = async ( input: GetGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetGroup"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetGroup"; let body: any; body = JSON.stringify({ ...(input.GroupARN !== undefined && input.GroupARN !== null && { GroupARN: input.GroupARN }), ...(input.GroupName !== undefined && input.GroupName !== null && { GroupName: input.GroupName }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -314,15 +314,15 @@ export const serializeAws_restJson1GetGroupsCommand = async ( input: GetGroupsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/Groups"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/Groups"; let body: any; body = JSON.stringify({ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -338,15 +338,15 @@ export const serializeAws_restJson1GetInsightCommand = async ( input: GetInsightCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/Insight"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/Insight"; let body: any; body = JSON.stringify({ ...(input.InsightId !== undefined && input.InsightId !== null && { InsightId: input.InsightId }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -362,17 +362,17 @@ export const serializeAws_restJson1GetInsightEventsCommand = async ( input: GetInsightEventsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/InsightEvents"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/InsightEvents"; let body: any; body = JSON.stringify({ ...(input.InsightId !== undefined && input.InsightId !== null && { InsightId: input.InsightId }), ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }), ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -388,10 +388,11 @@ export const serializeAws_restJson1GetInsightImpactGraphCommand = async ( input: GetInsightImpactGraphCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/InsightImpactGraph"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/InsightImpactGraph"; let body: any; body = JSON.stringify({ ...(input.EndTime !== undefined && @@ -401,7 +402,6 @@ export const serializeAws_restJson1GetInsightImpactGraphCommand = async ( ...(input.StartTime !== undefined && input.StartTime !== null && { StartTime: Math.round(input.StartTime.getTime() / 1000) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -417,10 +417,11 @@ export const serializeAws_restJson1GetInsightSummariesCommand = async ( input: GetInsightSummariesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/InsightSummaries"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/InsightSummaries"; let body: any; body = JSON.stringify({ ...(input.EndTime !== undefined && @@ -434,7 +435,6 @@ export const serializeAws_restJson1GetInsightSummariesCommand = async ( ...(input.States !== undefined && input.States !== null && { States: serializeAws_restJson1InsightStateList(input.States, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -450,15 +450,15 @@ export const serializeAws_restJson1GetSamplingRulesCommand = async ( input: GetSamplingRulesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GetSamplingRules"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetSamplingRules"; let body: any; body = JSON.stringify({ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -474,15 +474,16 @@ export const serializeAws_restJson1GetSamplingStatisticSummariesCommand = async input: GetSamplingStatisticSummariesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/SamplingStatisticSummaries"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SamplingStatisticSummaries"; let body: any; body = JSON.stringify({ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -498,10 +499,11 @@ export const serializeAws_restJson1GetSamplingTargetsCommand = async ( input: GetSamplingTargetsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/SamplingTargets"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SamplingTargets"; let body: any; body = JSON.stringify({ ...(input.SamplingStatisticsDocuments !== undefined && @@ -512,7 +514,6 @@ export const serializeAws_restJson1GetSamplingTargetsCommand = async ( ), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -528,10 +529,11 @@ export const serializeAws_restJson1GetServiceGraphCommand = async ( input: GetServiceGraphCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ServiceGraph"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ServiceGraph"; let body: any; body = JSON.stringify({ ...(input.EndTime !== undefined && @@ -542,7 +544,6 @@ export const serializeAws_restJson1GetServiceGraphCommand = async ( ...(input.StartTime !== undefined && input.StartTime !== null && { StartTime: Math.round(input.StartTime.getTime() / 1000) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -558,10 +559,12 @@ export const serializeAws_restJson1GetTimeSeriesServiceStatisticsCommand = async input: GetTimeSeriesServiceStatisticsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/TimeSeriesServiceStatistics"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TimeSeriesServiceStatistics"; let body: any; body = JSON.stringify({ ...(input.EndTime !== undefined && @@ -577,7 +580,6 @@ export const serializeAws_restJson1GetTimeSeriesServiceStatisticsCommand = async ...(input.StartTime !== undefined && input.StartTime !== null && { StartTime: Math.round(input.StartTime.getTime() / 1000) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -593,17 +595,17 @@ export const serializeAws_restJson1GetTraceGraphCommand = async ( input: GetTraceGraphCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/TraceGraph"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TraceGraph"; let body: any; body = JSON.stringify({ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.TraceIds !== undefined && input.TraceIds !== null && { TraceIds: serializeAws_restJson1TraceIdList(input.TraceIds, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -619,10 +621,11 @@ export const serializeAws_restJson1GetTraceSummariesCommand = async ( input: GetTraceSummariesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/TraceSummaries"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TraceSummaries"; let body: any; body = JSON.stringify({ ...(input.EndTime !== undefined && @@ -639,7 +642,6 @@ export const serializeAws_restJson1GetTraceSummariesCommand = async ( input.StartTime !== null && { StartTime: Math.round(input.StartTime.getTime() / 1000) }), ...(input.TimeRangeType !== undefined && input.TimeRangeType !== null && { TimeRangeType: input.TimeRangeType }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -655,16 +657,16 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async ( input: ListTagsForResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/ListTagsForResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ListTagsForResource"; let body: any; body = JSON.stringify({ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }), ...(input.ResourceARN !== undefined && input.ResourceARN !== null && { ResourceARN: input.ResourceARN }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -680,16 +682,16 @@ export const serializeAws_restJson1PutEncryptionConfigCommand = async ( input: PutEncryptionConfigCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/PutEncryptionConfig"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PutEncryptionConfig"; let body: any; body = JSON.stringify({ ...(input.KeyId !== undefined && input.KeyId !== null && { KeyId: input.KeyId }), ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -705,10 +707,11 @@ export const serializeAws_restJson1PutTelemetryRecordsCommand = async ( input: PutTelemetryRecordsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/TelemetryRecords"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TelemetryRecords"; let body: any; body = JSON.stringify({ ...(input.EC2InstanceId !== undefined && input.EC2InstanceId !== null && { EC2InstanceId: input.EC2InstanceId }), @@ -719,7 +722,6 @@ export const serializeAws_restJson1PutTelemetryRecordsCommand = async ( TelemetryRecords: serializeAws_restJson1TelemetryRecordList(input.TelemetryRecords, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -735,10 +737,11 @@ export const serializeAws_restJson1PutTraceSegmentsCommand = async ( input: PutTraceSegmentsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/TraceSegments"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TraceSegments"; let body: any; body = JSON.stringify({ ...(input.TraceSegmentDocuments !== undefined && @@ -746,7 +749,6 @@ export const serializeAws_restJson1PutTraceSegmentsCommand = async ( TraceSegmentDocuments: serializeAws_restJson1TraceSegmentDocumentList(input.TraceSegmentDocuments, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -762,17 +764,17 @@ export const serializeAws_restJson1TagResourceCommand = async ( input: TagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/TagResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TagResource"; let body: any; body = JSON.stringify({ ...(input.ResourceARN !== undefined && input.ResourceARN !== null && { ResourceARN: input.ResourceARN }), ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -788,17 +790,17 @@ export const serializeAws_restJson1UntagResourceCommand = async ( input: UntagResourceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UntagResource"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UntagResource"; let body: any; body = JSON.stringify({ ...(input.ResourceARN !== undefined && input.ResourceARN !== null && { ResourceARN: input.ResourceARN }), ...(input.TagKeys !== undefined && input.TagKeys !== null && { TagKeys: serializeAws_restJson1TagKeyList(input.TagKeys, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -814,10 +816,11 @@ export const serializeAws_restJson1UpdateGroupCommand = async ( input: UpdateGroupCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateGroup"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateGroup"; let body: any; body = JSON.stringify({ ...(input.FilterExpression !== undefined && @@ -829,7 +832,6 @@ export const serializeAws_restJson1UpdateGroupCommand = async ( InsightsConfiguration: serializeAws_restJson1InsightsConfiguration(input.InsightsConfiguration, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -845,10 +847,11 @@ export const serializeAws_restJson1UpdateSamplingRuleCommand = async ( input: UpdateSamplingRuleCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/UpdateSamplingRule"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateSamplingRule"; let body: any; body = JSON.stringify({ ...(input.SamplingRuleUpdate !== undefined && @@ -856,7 +859,6 @@ export const serializeAws_restJson1UpdateSamplingRuleCommand = async ( SamplingRuleUpdate: serializeAws_restJson1SamplingRuleUpdate(input.SamplingRuleUpdate, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/protocol_tests/aws-ec2/tests/functional/ec2query.spec.ts b/protocol_tests/aws-ec2/tests/functional/ec2query.spec.ts index 95bcae495b5ec..aa3d80b56544d 100644 --- a/protocol_tests/aws-ec2/tests/functional/ec2query.spec.ts +++ b/protocol_tests/aws-ec2/tests/functional/ec2query.spec.ts @@ -224,6 +224,7 @@ it("Ec2QueryEmptyInputAndEmptyOutput:Response", async () => { it("Ec2QueryEndpointTrait:Request", async () => { const client = new EC2ProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); @@ -260,6 +261,7 @@ it("Ec2QueryEndpointTrait:Request", async () => { it("Ec2QueryEndpointTraitWithHostLabel:Request", async () => { const client = new EC2ProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); diff --git a/protocol_tests/aws-json-10/tests/functional/awsjson1_0.spec.ts b/protocol_tests/aws-json-10/tests/functional/awsjson1_0.spec.ts index 02ecf1f556080..17b306a5a718e 100644 --- a/protocol_tests/aws-json-10/tests/functional/awsjson1_0.spec.ts +++ b/protocol_tests/aws-json-10/tests/functional/awsjson1_0.spec.ts @@ -212,6 +212,7 @@ it("AwsJson10EmptyInputAndEmptyOutputSendJsonObject:Response", async () => { it("AwsJson10EndpointTrait:Request", async () => { const client = new JSONRPC10Client({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); @@ -245,6 +246,7 @@ it("AwsJson10EndpointTrait:Request", async () => { it("AwsJson10EndpointTraitWithHostLabel:Request", async () => { const client = new JSONRPC10Client({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); diff --git a/protocol_tests/aws-json/tests/functional/awsjson1_1.spec.ts b/protocol_tests/aws-json/tests/functional/awsjson1_1.spec.ts index e0248795638e0..9ad6232fc0b95 100644 --- a/protocol_tests/aws-json/tests/functional/awsjson1_1.spec.ts +++ b/protocol_tests/aws-json/tests/functional/awsjson1_1.spec.ts @@ -343,6 +343,7 @@ it("json_1_1_service_responds_with_no_payload:Response", async () => { it("AwsJson11EndpointTrait:Request", async () => { const client = new JsonProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); @@ -376,6 +377,7 @@ it("AwsJson11EndpointTrait:Request", async () => { it("AwsJson11EndpointTraitWithHostLabel:Request", async () => { const client = new JsonProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); diff --git a/protocol_tests/aws-query/tests/functional/awsquery.spec.ts b/protocol_tests/aws-query/tests/functional/awsquery.spec.ts index 9456cf7c75cc7..3ee7927adf461 100644 --- a/protocol_tests/aws-query/tests/functional/awsquery.spec.ts +++ b/protocol_tests/aws-query/tests/functional/awsquery.spec.ts @@ -222,6 +222,7 @@ it("QueryEmptyInputAndEmptyOutput:Response", async () => { it("AwsQueryEndpointTrait:Request", async () => { const client = new QueryProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); @@ -258,6 +259,7 @@ it("AwsQueryEndpointTrait:Request", async () => { it("AwsQueryEndpointTraitWithHostLabel:Request", async () => { const client = new QueryProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); diff --git a/protocol_tests/aws-restjson/protocols/Aws_restJson1.ts b/protocol_tests/aws-restjson/protocols/Aws_restJson1.ts index a6100fb0326c0..3261cd324a82e 100644 --- a/protocol_tests/aws-restjson/protocols/Aws_restJson1.ts +++ b/protocol_tests/aws-restjson/protocols/Aws_restJson1.ts @@ -159,8 +159,10 @@ export const serializeAws_restJson1AllQueryStringTypesCommand = async ( input: AllQueryStringTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/AllQueryStringTypesInput"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/AllQueryStringTypesInput"; const query: any = { ...(input.queryParamsMapOfStrings !== undefined && input.queryParamsMapOfStrings), ...(input.queryString !== undefined && { String: input.queryString }), @@ -203,7 +205,6 @@ export const serializeAws_restJson1AllQueryStringTypesCommand = async ( ...(input.queryEnumList !== undefined && { EnumList: (input.queryEnumList || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -220,15 +221,16 @@ export const serializeAws_restJson1ConstantAndVariableQueryStringCommand = async input: ConstantAndVariableQueryStringCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ConstantAndVariableQueryString"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ConstantAndVariableQueryString"; const query: any = { foo: "bar", ...(input.baz !== undefined && { baz: input.baz }), ...(input.maybeSet !== undefined && { maybeSet: input.maybeSet }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -245,8 +247,10 @@ export const serializeAws_restJson1ConstantQueryStringCommand = async ( input: ConstantQueryStringCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ConstantQueryString/{hello}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ConstantQueryString/{hello}"; if (input.hello !== undefined) { const labelValue: string = input.hello; if (labelValue.length <= 0) { @@ -261,7 +265,6 @@ export const serializeAws_restJson1ConstantQueryStringCommand = async ( hello: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -278,17 +281,17 @@ export const serializeAws_restJson1DocumentTypeCommand = async ( input: DocumentTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DocumentType"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DocumentType"; let body: any; body = JSON.stringify({ ...(input.documentValue !== undefined && input.documentValue !== null && { documentValue: serializeAws_restJson1Document(input.documentValue, context) }), ...(input.stringValue !== undefined && input.stringValue !== null && { stringValue: input.stringValue }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -304,10 +307,11 @@ export const serializeAws_restJson1DocumentTypeAsPayloadCommand = async ( input: DocumentTypeAsPayloadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/DocumentTypeAsPayload"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DocumentTypeAsPayload"; let body: any; if (input.documentValue !== undefined) { if (input.documentValue === null) { @@ -317,7 +321,6 @@ export const serializeAws_restJson1DocumentTypeAsPayloadCommand = async ( } } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -333,13 +336,14 @@ export const serializeAws_restJson1EmptyInputAndEmptyOutputCommand = async ( input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/EmptyInputAndEmptyOutput"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EmptyInputAndEmptyOutput"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -355,10 +359,11 @@ export const serializeAws_restJson1EndpointOperationCommand = async ( input: EndpointOperationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/EndpointOperation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointOperation"; let body: any; body = ""; let { hostname: resolvedHostname } = await context.endpoint(); @@ -368,7 +373,6 @@ export const serializeAws_restJson1EndpointOperationCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -384,10 +388,12 @@ export const serializeAws_restJson1EndpointWithHostLabelOperationCommand = async input: EndpointWithHostLabelOperationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/EndpointWithHostLabelOperation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointWithHostLabelOperation"; let body: any; body = JSON.stringify({ ...(input.label !== undefined && input.label !== null && { label: input.label }), @@ -403,7 +409,6 @@ export const serializeAws_restJson1EndpointWithHostLabelOperationCommand = async throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -419,13 +424,13 @@ export const serializeAws_restJson1GreetingWithErrorsCommand = async ( input: GreetingWithErrorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/GreetingWithErrors"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GreetingWithErrors"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -441,15 +446,15 @@ export const serializeAws_restJson1HttpEnumPayloadCommand = async ( input: HttpEnumPayloadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "text/plain", }; - let resolvedPath = "/EnumPayload"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EnumPayload"; let body: any; if (input.payload !== undefined) { body = input.payload; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -465,16 +470,16 @@ export const serializeAws_restJson1HttpPayloadTraitsCommand = async ( input: HttpPayloadTraitsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), }; - let resolvedPath = "/HttpPayloadTraits"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadTraits"; let body: any; if (input.blob !== undefined) { body = input.blob; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -490,16 +495,17 @@ export const serializeAws_restJson1HttpPayloadTraitsWithMediaTypeCommand = async input: HttpPayloadTraitsWithMediaTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "text/plain", ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), }; - let resolvedPath = "/HttpPayloadTraitsWithMediaType"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadTraitsWithMediaType"; let body: any; if (input.blob !== undefined) { body = input.blob; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -515,10 +521,12 @@ export const serializeAws_restJson1HttpPayloadWithStructureCommand = async ( input: HttpPayloadWithStructureCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/HttpPayloadWithStructure"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithStructure"; let body: any; if (input.nested !== undefined) { body = serializeAws_restJson1NestedPayload(input.nested, context); @@ -527,7 +535,6 @@ export const serializeAws_restJson1HttpPayloadWithStructureCommand = async ( body = {}; } body = JSON.stringify(body); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -543,6 +550,7 @@ export const serializeAws_restJson1HttpPrefixHeadersCommand = async ( input: HttpPrefixHeadersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), ...(input.fooMap !== undefined && @@ -554,9 +562,8 @@ export const serializeAws_restJson1HttpPrefixHeadersCommand = async ( {} )), }; - let resolvedPath = "/HttpPrefixHeaders"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPrefixHeaders"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -572,13 +579,14 @@ export const serializeAws_restJson1HttpPrefixHeadersResponseCommand = async ( input: HttpPrefixHeadersResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/HttpPrefixHeadersResponse"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPrefixHeadersResponse"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -594,8 +602,10 @@ export const serializeAws_restJson1HttpRequestWithFloatLabelsCommand = async ( input: HttpRequestWithFloatLabelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/FloatHttpLabels/{float}/{double}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FloatHttpLabels/{float}/{double}"; if (input.float !== undefined) { const labelValue: string = input.float % 1 == 0 ? input.float + ".0" : input.float.toString(); if (labelValue.length <= 0) { @@ -615,7 +625,6 @@ export const serializeAws_restJson1HttpRequestWithFloatLabelsCommand = async ( throw new Error("No value provided for input HTTP label: double."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -631,8 +640,11 @@ export const serializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand = asy input: HttpRequestWithGreedyLabelInPathCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}"; if (input.foo !== undefined) { const labelValue: string = input.foo; if (labelValue.length <= 0) { @@ -658,7 +670,6 @@ export const serializeAws_restJson1HttpRequestWithGreedyLabelInPathCommand = asy throw new Error("No value provided for input HTTP label: baz."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -674,8 +685,11 @@ export const serializeAws_restJson1HttpRequestWithLabelsCommand = async ( input: HttpRequestWithLabelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}"; if (input.string !== undefined) { const labelValue: string = input.string; if (labelValue.length <= 0) { @@ -749,7 +763,6 @@ export const serializeAws_restJson1HttpRequestWithLabelsCommand = async ( throw new Error("No value provided for input HTTP label: timestamp."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -765,8 +778,10 @@ export const serializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatComman input: HttpRequestWithLabelsAndTimestampFormatCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}"; if (input.memberEpochSeconds !== undefined) { const labelValue: string = Math.round(input.memberEpochSeconds.getTime() / 1000).toString(); @@ -832,7 +847,6 @@ export const serializeAws_restJson1HttpRequestWithLabelsAndTimestampFormatComman throw new Error("No value provided for input HTTP label: targetDateTime."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -848,13 +862,13 @@ export const serializeAws_restJson1HttpResponseCodeCommand = async ( input: HttpResponseCodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/HttpResponseCode"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpResponseCode"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -870,15 +884,15 @@ export const serializeAws_restJson1HttpStringPayloadCommand = async ( input: HttpStringPayloadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "text/plain", }; - let resolvedPath = "/StringPayload"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StringPayload"; let body: any; if (input.payload !== undefined) { body = input.payload; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -894,13 +908,14 @@ export const serializeAws_restJson1IgnoreQueryParamsInResponseCommand = async ( input: IgnoreQueryParamsInResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/IgnoreQueryParamsInResponse"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/IgnoreQueryParamsInResponse"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -916,6 +931,7 @@ export const serializeAws_restJson1InputAndOutputWithHeadersCommand = async ( input: InputAndOutputWithHeadersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.headerString) && { "x-string": input.headerString! }), ...(isSerializableHeaderValue(input.headerByte) && { "x-byte": input.headerByte!.toString() }), @@ -952,9 +968,9 @@ export const serializeAws_restJson1InputAndOutputWithHeadersCommand = async ( "x-enumlist": (input.headerEnumList! || []).map((_entry) => _entry).join(", "), }), }; - let resolvedPath = "/InputAndOutputWithHeaders"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/InputAndOutputWithHeaders"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -970,15 +986,15 @@ export const serializeAws_restJson1JsonBlobsCommand = async ( input: JsonBlobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/JsonBlobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonBlobs"; let body: any; body = JSON.stringify({ ...(input.data !== undefined && input.data !== null && { data: context.base64Encoder(input.data) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -994,10 +1010,11 @@ export const serializeAws_restJson1JsonEnumsCommand = async ( input: JsonEnumsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/JsonEnums"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonEnums"; let body: any; body = JSON.stringify({ ...(input.fooEnum1 !== undefined && input.fooEnum1 !== null && { fooEnum1: input.fooEnum1 }), @@ -1010,7 +1027,6 @@ export const serializeAws_restJson1JsonEnumsCommand = async ( ...(input.fooEnumSet !== undefined && input.fooEnumSet !== null && { fooEnumSet: serializeAws_restJson1FooEnumSet(input.fooEnumSet, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1026,10 +1042,11 @@ export const serializeAws_restJson1JsonListsCommand = async ( input: JsonListsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/JsonLists"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonLists"; let body: any; body = JSON.stringify({ ...(input.booleanList !== undefined && @@ -1059,7 +1076,6 @@ export const serializeAws_restJson1JsonListsCommand = async ( timestampList: serializeAws_restJson1TimestampList(input.timestampList, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1075,10 +1091,11 @@ export const serializeAws_restJson1JsonMapsCommand = async ( input: JsonMapsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/JsonMaps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonMaps"; let body: any; body = JSON.stringify({ ...(input.denseBooleanMap !== undefined && @@ -1118,7 +1135,6 @@ export const serializeAws_restJson1JsonMapsCommand = async ( sparseStructMap: serializeAws_restJson1SparseStructMap(input.sparseStructMap, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1134,10 +1150,11 @@ export const serializeAws_restJson1JsonTimestampsCommand = async ( input: JsonTimestampsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/JsonTimestamps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonTimestamps"; let body: any; body = JSON.stringify({ ...(input.dateTime !== undefined && @@ -1147,7 +1164,6 @@ export const serializeAws_restJson1JsonTimestampsCommand = async ( ...(input.httpDate !== undefined && input.httpDate !== null && { httpDate: __dateToUtcString(input.httpDate) }), ...(input.normal !== undefined && input.normal !== null && { normal: Math.round(input.normal.getTime() / 1000) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1163,16 +1179,16 @@ export const serializeAws_restJson1JsonUnionsCommand = async ( input: JsonUnionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/JsonUnions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonUnions"; let body: any; body = JSON.stringify({ ...(input.contents !== undefined && input.contents !== null && { contents: serializeAws_restJson1MyUnion(input.contents, context) }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1188,14 +1204,14 @@ export const serializeAws_restJson1MediaTypeHeaderCommand = async ( input: MediaTypeHeaderCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.json) && { "x-json": Buffer.from(__LazyJsonString.fromObject(input.json!)).toString("base64"), }), }; - let resolvedPath = "/MediaTypeHeader"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MediaTypeHeader"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1211,13 +1227,13 @@ export const serializeAws_restJson1NoInputAndNoOutputCommand = async ( input: NoInputAndNoOutputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/NoInputAndNoOutput"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NoInputAndNoOutput"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1233,13 +1249,13 @@ export const serializeAws_restJson1NoInputAndOutputCommand = async ( input: NoInputAndOutputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/NoInputAndOutputOutput"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NoInputAndOutputOutput"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1255,14 +1271,15 @@ export const serializeAws_restJson1NullAndEmptyHeadersClientCommand = async ( input: NullAndEmptyHeadersClientCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.a) && { "x-a": input.a! }), ...(isSerializableHeaderValue(input.b) && { "x-b": input.b! }), ...(isSerializableHeaderValue(input.c) && { "x-c": (input.c! || []).map((_entry) => _entry).join(", ") }), }; - let resolvedPath = "/NullAndEmptyHeadersClient"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NullAndEmptyHeadersClient"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1278,14 +1295,15 @@ export const serializeAws_restJson1NullAndEmptyHeadersServerCommand = async ( input: NullAndEmptyHeadersServerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.a) && { "x-a": input.a! }), ...(isSerializableHeaderValue(input.b) && { "x-b": input.b! }), ...(isSerializableHeaderValue(input.c) && { "x-c": (input.c! || []).map((_entry) => _entry).join(", ") }), }; - let resolvedPath = "/NullAndEmptyHeadersServer"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NullAndEmptyHeadersServer"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1301,14 +1319,15 @@ export const serializeAws_restJson1OmitsNullSerializesEmptyStringCommand = async input: OmitsNullSerializesEmptyStringCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/OmitsNullSerializesEmptyString"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/OmitsNullSerializesEmptyString"; const query: any = { ...(input.nullValue !== undefined && { Null: input.nullValue }), ...(input.emptyString !== undefined && { Empty: input.emptyString }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1325,13 +1344,14 @@ export const serializeAws_restJson1QueryIdempotencyTokenAutoFillCommand = async input: QueryIdempotencyTokenAutoFillCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/QueryIdempotencyTokenAutoFill"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/QueryIdempotencyTokenAutoFill"; const query: any = { ...(input.token !== undefined && { token: input.token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1348,14 +1368,14 @@ export const serializeAws_restJson1QueryParamsAsStringListMapCommand = async ( input: QueryParamsAsStringListMapCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/StringListMap"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StringListMap"; const query: any = { ...(input.foo !== undefined && input.foo), ...(input.qux !== undefined && { corge: input.qux }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1372,14 +1392,14 @@ export const serializeAws_restJson1QueryPrecedenceCommand = async ( input: QueryPrecedenceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/Precedence"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/Precedence"; const query: any = { ...(input.baz !== undefined && input.baz), ...(input.foo !== undefined && { bar: input.foo }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1396,10 +1416,11 @@ export const serializeAws_restJson1RecursiveShapesCommand = async ( input: RecursiveShapesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", }; - let resolvedPath = "/RecursiveShapes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/RecursiveShapes"; let body: any; body = JSON.stringify({ ...(input.nested !== undefined && @@ -1407,7 +1428,6 @@ export const serializeAws_restJson1RecursiveShapesCommand = async ( nested: serializeAws_restJson1RecursiveShapesInputOutputNested1(input.nested, context), }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1423,11 +1443,12 @@ export const serializeAws_restJson1SimpleScalarPropertiesCommand = async ( input: SimpleScalarPropertiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/json", ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), }; - let resolvedPath = "/SimpleScalarProperties"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SimpleScalarProperties"; let body: any; body = JSON.stringify({ ...(input.byteValue !== undefined && input.byteValue !== null && { byteValue: input.byteValue }), @@ -1444,7 +1465,6 @@ export const serializeAws_restJson1SimpleScalarPropertiesCommand = async ( ...(input.trueBooleanValue !== undefined && input.trueBooleanValue !== null && { trueBooleanValue: input.trueBooleanValue }), }); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1460,16 +1480,16 @@ export const serializeAws_restJson1StreamingTraitsCommand = async ( input: StreamingTraitsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), }; - let resolvedPath = "/StreamingTraits"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StreamingTraits"; let body: any; if (input.blob !== undefined) { body = input.blob; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1485,16 +1505,17 @@ export const serializeAws_restJson1StreamingTraitsRequireLengthCommand = async ( input: StreamingTraitsRequireLengthCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), }; - let resolvedPath = "/StreamingTraitsRequireLength"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StreamingTraitsRequireLength"; let body: any; if (input.blob !== undefined) { body = input.blob; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1510,16 +1531,17 @@ export const serializeAws_restJson1StreamingTraitsWithMediaTypeCommand = async ( input: StreamingTraitsWithMediaTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "text/plain", ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), }; - let resolvedPath = "/StreamingTraitsWithMediaType"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StreamingTraitsWithMediaType"; let body: any; if (input.blob !== undefined) { body = input.blob; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1535,6 +1557,7 @@ export const serializeAws_restJson1TimestampFormatHeadersCommand = async ( input: TimestampFormatHeadersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.memberEpochSeconds) && { "x-memberepochseconds": Math.round(input.memberEpochSeconds!.getTime() / 1000).toString(), @@ -1558,9 +1581,8 @@ export const serializeAws_restJson1TimestampFormatHeadersCommand = async ( "x-targetdatetime": (input.targetDateTime!.toISOString().split(".")[0] + "Z").toString(), }), }; - let resolvedPath = "/TimestampFormatHeaders"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TimestampFormatHeaders"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/protocol_tests/aws-restjson/tests/functional/restjson1.spec.ts b/protocol_tests/aws-restjson/tests/functional/restjson1.spec.ts index b875bed17675d..50dcb70da407b 100644 --- a/protocol_tests/aws-restjson/tests/functional/restjson1.spec.ts +++ b/protocol_tests/aws-restjson/tests/functional/restjson1.spec.ts @@ -1279,6 +1279,7 @@ it("RestJsonEmptyInputAndEmptyOutputJsonObjectOutput:Response", async () => { it("RestJsonEndpointTrait:Request", async () => { const client = new RestJsonProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); @@ -1308,6 +1309,7 @@ it("RestJsonEndpointTrait:Request", async () => { it("RestJsonEndpointTraitWithHostLabel:Request", async () => { const client = new RestJsonProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); diff --git a/protocol_tests/aws-restxml/protocols/Aws_restXml.ts b/protocol_tests/aws-restxml/protocols/Aws_restXml.ts index a623d64193580..e3a31217884b3 100644 --- a/protocol_tests/aws-restxml/protocols/Aws_restXml.ts +++ b/protocol_tests/aws-restxml/protocols/Aws_restXml.ts @@ -183,8 +183,10 @@ export const serializeAws_restXmlAllQueryStringTypesCommand = async ( input: AllQueryStringTypesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/AllQueryStringTypesInput"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/AllQueryStringTypesInput"; const query: any = { ...(input.queryParamsMapOfStrings !== undefined && input.queryParamsMapOfStrings), ...(input.queryString !== undefined && { String: input.queryString }), @@ -227,7 +229,6 @@ export const serializeAws_restXmlAllQueryStringTypesCommand = async ( ...(input.queryEnumList !== undefined && { EnumList: (input.queryEnumList || []).map((_entry) => _entry) }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -244,10 +245,11 @@ export const serializeAws_restXmlBodyWithXmlNameCommand = async ( input: BodyWithXmlNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/BodyWithXmlName"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BodyWithXmlName"; let body: any; body = ''; const bodyNode = new __XmlNode("Ahoy"); @@ -256,7 +258,6 @@ export const serializeAws_restXmlBodyWithXmlNameCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -272,15 +273,16 @@ export const serializeAws_restXmlConstantAndVariableQueryStringCommand = async ( input: ConstantAndVariableQueryStringCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ConstantAndVariableQueryString"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ConstantAndVariableQueryString"; const query: any = { foo: "bar", ...(input.baz !== undefined && { baz: input.baz }), ...(input.maybeSet !== undefined && { maybeSet: input.maybeSet }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -297,8 +299,10 @@ export const serializeAws_restXmlConstantQueryStringCommand = async ( input: ConstantQueryStringCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/ConstantQueryString/{hello}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/ConstantQueryString/{hello}"; if (input.hello !== undefined) { const labelValue: string = input.hello; if (labelValue.length <= 0) { @@ -313,7 +317,6 @@ export const serializeAws_restXmlConstantQueryStringCommand = async ( hello: "", }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -330,13 +333,14 @@ export const serializeAws_restXmlEmptyInputAndEmptyOutputCommand = async ( input: EmptyInputAndEmptyOutputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/EmptyInputAndEmptyOutput"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EmptyInputAndEmptyOutput"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -352,10 +356,11 @@ export const serializeAws_restXmlEndpointOperationCommand = async ( input: EndpointOperationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/EndpointOperation"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointOperation"; let body: any; body = ""; let { hostname: resolvedHostname } = await context.endpoint(); @@ -365,7 +370,6 @@ export const serializeAws_restXmlEndpointOperationCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -381,10 +385,12 @@ export const serializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand = a input: EndpointWithHostLabelHeaderOperationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.accountId) && { "x-amz-account-id": input.accountId! }), }; - let resolvedPath = "/EndpointWithHostLabelHeaderOperation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointWithHostLabelHeaderOperation"; let body: any; let { hostname: resolvedHostname } = await context.endpoint(); if (context.disableHostPrefix !== true) { @@ -397,7 +403,6 @@ export const serializeAws_restXmlEndpointWithHostLabelHeaderOperationCommand = a throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -413,10 +418,12 @@ export const serializeAws_restXmlEndpointWithHostLabelOperationCommand = async ( input: EndpointWithHostLabelOperationCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/EndpointWithHostLabelOperation"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointWithHostLabelOperation"; let body: any; body = ''; const bodyNode = new __XmlNode("HostLabelInput"); @@ -436,7 +443,6 @@ export const serializeAws_restXmlEndpointWithHostLabelOperationCommand = async ( throw new Error("ValidationError: prefixed hostname must be hostname compatible."); } } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname: resolvedHostname, @@ -452,10 +458,11 @@ export const serializeAws_restXmlFlattenedXmlMapCommand = async ( input: FlattenedXmlMapCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/FlattenedXmlMap"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FlattenedXmlMap"; let body: any; body = ''; const bodyNode = new __XmlNode("FlattenedXmlMapInputOutput"); @@ -467,7 +474,6 @@ export const serializeAws_restXmlFlattenedXmlMapCommand = async ( }); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -483,10 +489,12 @@ export const serializeAws_restXmlFlattenedXmlMapWithXmlNameCommand = async ( input: FlattenedXmlMapWithXmlNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/FlattenedXmlMapWithXmlName"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FlattenedXmlMapWithXmlName"; let body: any; body = ''; const bodyNode = new __XmlNode("FlattenedXmlMapWithXmlNameInputOutput"); @@ -498,7 +506,6 @@ export const serializeAws_restXmlFlattenedXmlMapWithXmlNameCommand = async ( }); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -514,13 +521,14 @@ export const serializeAws_restXmlFlattenedXmlMapWithXmlNamespaceCommand = async input: FlattenedXmlMapWithXmlNamespaceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/FlattenedXmlMapWithXmlNamespace"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FlattenedXmlMapWithXmlNamespace"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -536,13 +544,13 @@ export const serializeAws_restXmlGreetingWithErrorsCommand = async ( input: GreetingWithErrorsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/GreetingWithErrors"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GreetingWithErrors"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -558,11 +566,12 @@ export const serializeAws_restXmlHttpPayloadTraitsCommand = async ( input: HttpPayloadTraitsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/octet-stream", ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), }; - let resolvedPath = "/HttpPayloadTraits"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadTraits"; let body: any; if (input.blob !== undefined) { body = input.blob; @@ -572,7 +581,6 @@ export const serializeAws_restXmlHttpPayloadTraitsCommand = async ( contents = input.blob; body = contents; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -588,11 +596,13 @@ export const serializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand = async ( input: HttpPayloadTraitsWithMediaTypeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "text/plain", ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), }; - let resolvedPath = "/HttpPayloadTraitsWithMediaType"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadTraitsWithMediaType"; let body: any; if (input.blob !== undefined) { body = input.blob; @@ -602,7 +612,6 @@ export const serializeAws_restXmlHttpPayloadTraitsWithMediaTypeCommand = async ( contents = input.blob; body = contents; } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -618,10 +627,12 @@ export const serializeAws_restXmlHttpPayloadWithMemberXmlNameCommand = async ( input: HttpPayloadWithMemberXmlNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/HttpPayloadWithMemberXmlName"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithMemberXmlName"; let body: any; if (input.nested !== undefined) { body = serializeAws_restXmlPayloadWithXmlName(input.nested, context); @@ -632,7 +643,6 @@ export const serializeAws_restXmlHttpPayloadWithMemberXmlNameCommand = async ( body = ''; body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -648,10 +658,12 @@ export const serializeAws_restXmlHttpPayloadWithStructureCommand = async ( input: HttpPayloadWithStructureCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/HttpPayloadWithStructure"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithStructure"; let body: any; if (input.nested !== undefined) { body = serializeAws_restXmlNestedPayload(input.nested, context); @@ -662,7 +674,6 @@ export const serializeAws_restXmlHttpPayloadWithStructureCommand = async ( body = ''; body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -678,10 +689,11 @@ export const serializeAws_restXmlHttpPayloadWithXmlNameCommand = async ( input: HttpPayloadWithXmlNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/HttpPayloadWithXmlName"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlName"; let body: any; if (input.nested !== undefined) { body = serializeAws_restXmlPayloadWithXmlName(input.nested, context); @@ -692,7 +704,6 @@ export const serializeAws_restXmlHttpPayloadWithXmlNameCommand = async ( body = ''; body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -708,10 +719,12 @@ export const serializeAws_restXmlHttpPayloadWithXmlNamespaceCommand = async ( input: HttpPayloadWithXmlNamespaceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/HttpPayloadWithXmlNamespace"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlNamespace"; let body: any; if (input.nested !== undefined) { body = serializeAws_restXmlPayloadWithXmlNamespace(input.nested, context); @@ -723,7 +736,6 @@ export const serializeAws_restXmlHttpPayloadWithXmlNamespaceCommand = async ( contents.addAttribute("xmlns", "http://foo.com"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -739,10 +751,12 @@ export const serializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand = a input: HttpPayloadWithXmlNamespaceAndPrefixCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/HttpPayloadWithXmlNamespaceAndPrefix"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlNamespaceAndPrefix"; let body: any; if (input.nested !== undefined) { body = serializeAws_restXmlPayloadWithXmlNamespaceAndPrefix(input.nested, context); @@ -754,7 +768,6 @@ export const serializeAws_restXmlHttpPayloadWithXmlNamespaceAndPrefixCommand = a contents.addAttribute("xmlns:baz", "http://foo.com"); body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -770,6 +783,7 @@ export const serializeAws_restXmlHttpPrefixHeadersCommand = async ( input: HttpPrefixHeadersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), ...(input.fooMap !== undefined && @@ -781,9 +795,8 @@ export const serializeAws_restXmlHttpPrefixHeadersCommand = async ( {} )), }; - let resolvedPath = "/HttpPrefixHeaders"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPrefixHeaders"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -799,8 +812,10 @@ export const serializeAws_restXmlHttpRequestWithFloatLabelsCommand = async ( input: HttpRequestWithFloatLabelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/FloatHttpLabels/{float}/{double}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FloatHttpLabels/{float}/{double}"; if (input.float !== undefined) { const labelValue: string = input.float % 1 == 0 ? input.float + ".0" : input.float.toString(); if (labelValue.length <= 0) { @@ -820,7 +835,6 @@ export const serializeAws_restXmlHttpRequestWithFloatLabelsCommand = async ( throw new Error("No value provided for input HTTP label: double."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -836,8 +850,11 @@ export const serializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand = async input: HttpRequestWithGreedyLabelInPathCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}"; if (input.foo !== undefined) { const labelValue: string = input.foo; if (labelValue.length <= 0) { @@ -863,7 +880,6 @@ export const serializeAws_restXmlHttpRequestWithGreedyLabelInPathCommand = async throw new Error("No value provided for input HTTP label: baz."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -879,8 +895,11 @@ export const serializeAws_restXmlHttpRequestWithLabelsCommand = async ( input: HttpRequestWithLabelsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + + "/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}"; if (input.string !== undefined) { const labelValue: string = input.string; if (labelValue.length <= 0) { @@ -954,7 +973,6 @@ export const serializeAws_restXmlHttpRequestWithLabelsCommand = async ( throw new Error("No value provided for input HTTP label: timestamp."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -970,8 +988,10 @@ export const serializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand input: HttpRequestWithLabelsAndTimestampFormatCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}"; if (input.memberEpochSeconds !== undefined) { const labelValue: string = Math.round(input.memberEpochSeconds.getTime() / 1000).toString(); @@ -1037,7 +1057,6 @@ export const serializeAws_restXmlHttpRequestWithLabelsAndTimestampFormatCommand throw new Error("No value provided for input HTTP label: targetDateTime."); } let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1053,13 +1072,13 @@ export const serializeAws_restXmlHttpResponseCodeCommand = async ( input: HttpResponseCodeCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/HttpResponseCode"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpResponseCode"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1075,13 +1094,14 @@ export const serializeAws_restXmlIgnoreQueryParamsInResponseCommand = async ( input: IgnoreQueryParamsInResponseCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/IgnoreQueryParamsInResponse"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/IgnoreQueryParamsInResponse"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1097,6 +1117,7 @@ export const serializeAws_restXmlInputAndOutputWithHeadersCommand = async ( input: InputAndOutputWithHeadersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.headerString) && { "x-string": input.headerString! }), ...(isSerializableHeaderValue(input.headerByte) && { "x-byte": input.headerByte!.toString() }), @@ -1133,9 +1154,9 @@ export const serializeAws_restXmlInputAndOutputWithHeadersCommand = async ( "x-enumlist": (input.headerEnumList! || []).map((_entry) => _entry).join(", "), }), }; - let resolvedPath = "/InputAndOutputWithHeaders"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/InputAndOutputWithHeaders"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1151,10 +1172,11 @@ export const serializeAws_restXmlNestedXmlMapsCommand = async ( input: NestedXmlMapsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/NestedXmlMaps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NestedXmlMaps"; let body: any; body = ''; const bodyNode = new __XmlNode("NestedXmlMapsInputOutput"); @@ -1174,7 +1196,6 @@ export const serializeAws_restXmlNestedXmlMapsCommand = async ( bodyNode.addChildNode(containerNode); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1190,13 +1211,13 @@ export const serializeAws_restXmlNoInputAndNoOutputCommand = async ( input: NoInputAndNoOutputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/NoInputAndNoOutput"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NoInputAndNoOutput"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1212,13 +1233,13 @@ export const serializeAws_restXmlNoInputAndOutputCommand = async ( input: NoInputAndOutputCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/NoInputAndOutputOutput"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NoInputAndOutputOutput"; let body: any; body = ""; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1234,14 +1255,15 @@ export const serializeAws_restXmlNullAndEmptyHeadersClientCommand = async ( input: NullAndEmptyHeadersClientCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.a) && { "x-a": input.a! }), ...(isSerializableHeaderValue(input.b) && { "x-b": input.b! }), ...(isSerializableHeaderValue(input.c) && { "x-c": (input.c! || []).map((_entry) => _entry).join(", ") }), }; - let resolvedPath = "/NullAndEmptyHeadersClient"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NullAndEmptyHeadersClient"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1257,14 +1279,15 @@ export const serializeAws_restXmlNullAndEmptyHeadersServerCommand = async ( input: NullAndEmptyHeadersServerCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.a) && { "x-a": input.a! }), ...(isSerializableHeaderValue(input.b) && { "x-b": input.b! }), ...(isSerializableHeaderValue(input.c) && { "x-c": (input.c! || []).map((_entry) => _entry).join(", ") }), }; - let resolvedPath = "/NullAndEmptyHeadersServer"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/NullAndEmptyHeadersServer"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1280,14 +1303,15 @@ export const serializeAws_restXmlOmitsNullSerializesEmptyStringCommand = async ( input: OmitsNullSerializesEmptyStringCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/OmitsNullSerializesEmptyString"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/OmitsNullSerializesEmptyString"; const query: any = { ...(input.nullValue !== undefined && { Null: input.nullValue }), ...(input.emptyString !== undefined && { Empty: input.emptyString }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1304,13 +1328,14 @@ export const serializeAws_restXmlQueryIdempotencyTokenAutoFillCommand = async ( input: QueryIdempotencyTokenAutoFillCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/QueryIdempotencyTokenAutoFill"; + let resolvedPath = + `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/QueryIdempotencyTokenAutoFill"; const query: any = { ...(input.token !== undefined && { token: input.token }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1327,14 +1352,14 @@ export const serializeAws_restXmlQueryParamsAsStringListMapCommand = async ( input: QueryParamsAsStringListMapCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/StringListMap"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/StringListMap"; const query: any = { ...(input.foo !== undefined && input.foo), ...(input.qux !== undefined && { corge: input.qux }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1351,14 +1376,14 @@ export const serializeAws_restXmlQueryPrecedenceCommand = async ( input: QueryPrecedenceCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = {}; - let resolvedPath = "/Precedence"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/Precedence"; const query: any = { ...(input.baz !== undefined && input.baz), ...(input.foo !== undefined && { bar: input.foo }), }; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1375,10 +1400,11 @@ export const serializeAws_restXmlRecursiveShapesCommand = async ( input: RecursiveShapesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/RecursiveShapes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/RecursiveShapes"; let body: any; body = ''; const bodyNode = new __XmlNode("RecursiveShapesInputOutput"); @@ -1387,7 +1413,6 @@ export const serializeAws_restXmlRecursiveShapesCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1403,11 +1428,12 @@ export const serializeAws_restXmlSimpleScalarPropertiesCommand = async ( input: SimpleScalarPropertiesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", ...(isSerializableHeaderValue(input.foo) && { "x-foo": input.foo! }), }; - let resolvedPath = "/SimpleScalarProperties"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SimpleScalarProperties"; let body: any; body = ''; const bodyNode = new __XmlNode("SimpleScalarPropertiesInputOutput"); @@ -1456,7 +1482,6 @@ export const serializeAws_restXmlSimpleScalarPropertiesCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1472,6 +1497,7 @@ export const serializeAws_restXmlTimestampFormatHeadersCommand = async ( input: TimestampFormatHeadersCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { ...(isSerializableHeaderValue(input.memberEpochSeconds) && { "x-memberepochseconds": Math.round(input.memberEpochSeconds!.getTime() / 1000).toString(), @@ -1495,9 +1521,8 @@ export const serializeAws_restXmlTimestampFormatHeadersCommand = async ( "x-targetdatetime": (input.targetDateTime!.toISOString().split(".")[0] + "Z").toString(), }), }; - let resolvedPath = "/TimestampFormatHeaders"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/TimestampFormatHeaders"; let body: any; - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1513,10 +1538,11 @@ export const serializeAws_restXmlXmlAttributesCommand = async ( input: XmlAttributesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlAttributes"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlAttributes"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlAttributesInputOutput"); @@ -1528,7 +1554,6 @@ export const serializeAws_restXmlXmlAttributesCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1544,10 +1569,11 @@ export const serializeAws_restXmlXmlAttributesOnPayloadCommand = async ( input: XmlAttributesOnPayloadCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlAttributesOnPayload"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlAttributesOnPayload"; let body: any; if (input.payload !== undefined) { body = serializeAws_restXmlXmlAttributesInputOutput(input.payload, context); @@ -1558,7 +1584,6 @@ export const serializeAws_restXmlXmlAttributesOnPayloadCommand = async ( body = ''; body += contents.toString(); } - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1574,10 +1599,11 @@ export const serializeAws_restXmlXmlBlobsCommand = async ( input: XmlBlobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlBlobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlBlobs"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlBlobsInputOutput"); @@ -1586,7 +1612,6 @@ export const serializeAws_restXmlXmlBlobsCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1602,10 +1627,11 @@ export const serializeAws_restXmlXmlEmptyBlobsCommand = async ( input: XmlEmptyBlobsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlEmptyBlobs"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyBlobs"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlBlobsInputOutput"); @@ -1614,7 +1640,6 @@ export const serializeAws_restXmlXmlEmptyBlobsCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1630,10 +1655,11 @@ export const serializeAws_restXmlXmlEmptyListsCommand = async ( input: XmlEmptyListsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlEmptyLists"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyLists"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlListsInputOutput"); @@ -1745,7 +1771,6 @@ export const serializeAws_restXmlXmlEmptyListsCommand = async ( bodyNode.addChildNode(containerNode); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1761,10 +1786,11 @@ export const serializeAws_restXmlXmlEmptyMapsCommand = async ( input: XmlEmptyMapsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlEmptyMaps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyMaps"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlMapsInputOutput"); @@ -1777,7 +1803,6 @@ export const serializeAws_restXmlXmlEmptyMapsCommand = async ( bodyNode.addChildNode(containerNode); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1793,10 +1818,11 @@ export const serializeAws_restXmlXmlEmptyStringsCommand = async ( input: XmlEmptyStringsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlEmptyStrings"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEmptyStrings"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlEmptyStringsInputOutput"); @@ -1805,7 +1831,6 @@ export const serializeAws_restXmlXmlEmptyStringsCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1821,10 +1846,11 @@ export const serializeAws_restXmlXmlEnumsCommand = async ( input: XmlEnumsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlEnums"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlEnums"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlEnumsInputOutput"); @@ -1865,7 +1891,6 @@ export const serializeAws_restXmlXmlEnumsCommand = async ( bodyNode.addChildNode(containerNode); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -1881,10 +1906,11 @@ export const serializeAws_restXmlXmlListsCommand = async ( input: XmlListsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlLists"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlLists"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlListsInputOutput"); @@ -1996,7 +2022,6 @@ export const serializeAws_restXmlXmlListsCommand = async ( bodyNode.addChildNode(containerNode); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2012,10 +2037,11 @@ export const serializeAws_restXmlXmlMapsCommand = async ( input: XmlMapsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlMaps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlMaps"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlMapsInputOutput"); @@ -2028,7 +2054,6 @@ export const serializeAws_restXmlXmlMapsCommand = async ( bodyNode.addChildNode(containerNode); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2044,10 +2069,11 @@ export const serializeAws_restXmlXmlMapsXmlNameCommand = async ( input: XmlMapsXmlNameCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlMapsXmlName"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlMapsXmlName"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlMapsXmlNameInputOutput"); @@ -2060,7 +2086,6 @@ export const serializeAws_restXmlXmlMapsXmlNameCommand = async ( bodyNode.addChildNode(containerNode); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2076,10 +2101,11 @@ export const serializeAws_restXmlXmlNamespacesCommand = async ( input: XmlNamespacesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlNamespaces"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlNamespaces"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlNamespacesInputOutput"); @@ -2089,7 +2115,6 @@ export const serializeAws_restXmlXmlNamespacesCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2105,10 +2130,11 @@ export const serializeAws_restXmlXmlTimestampsCommand = async ( input: XmlTimestampsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlTimestamps"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlTimestamps"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlTimestampsInputOutput"); @@ -2137,7 +2163,6 @@ export const serializeAws_restXmlXmlTimestampsCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, @@ -2153,10 +2178,11 @@ export const serializeAws_restXmlXmlUnionsCommand = async ( input: XmlUnionsCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers: any = { "content-type": "application/xml", }; - let resolvedPath = "/XmlUnions"; + let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlUnions"; let body: any; body = ''; const bodyNode = new __XmlNode("XmlUnionsInputOutput"); @@ -2165,7 +2191,6 @@ export const serializeAws_restXmlXmlUnionsCommand = async ( bodyNode.addChildNode(node); } body += bodyNode.toString(); - const { hostname, protocol = "https", port } = await context.endpoint(); return new __HttpRequest({ protocol, hostname, diff --git a/protocol_tests/aws-restxml/tests/functional/restxml.spec.ts b/protocol_tests/aws-restxml/tests/functional/restxml.spec.ts index 351b4bac524af..d6228670477ea 100644 --- a/protocol_tests/aws-restxml/tests/functional/restxml.spec.ts +++ b/protocol_tests/aws-restxml/tests/functional/restxml.spec.ts @@ -685,6 +685,7 @@ it("EmptyInputAndEmptyOutput:Response", async () => { it("RestXmlEndpointTrait:Request", async () => { const client = new RestXmlProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); @@ -716,6 +717,7 @@ it("RestXmlEndpointTrait:Request", async () => { it("RestXmlEndpointTraitWithHostLabelAndHttpBinding:Request", async () => { const client = new RestXmlProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), }); @@ -750,6 +752,7 @@ it("RestXmlEndpointTraitWithHostLabelAndHttpBinding:Request", async () => { it("RestXmlEndpointTraitWithHostLabel:Request", async () => { const client = new RestXmlProtocolClient({ ...clientParams, + endpoint: "https://example.com", requestHandler: new RequestSerializationTestHandler(), });