1010 lines
37 KiB
JavaScript
1010 lines
37 KiB
JavaScript
import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
|
|
import { collectBody, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectString as __expectString, extendedEncodeURIComponent as __extendedEncodeURIComponent, getValueFromTextNode as __getValueFromTextNode, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, strictParseInt32 as __strictParseInt32, withBaseException, } from "@smithy/smithy-client";
|
|
import { XMLParser } from "fast-xml-parser";
|
|
import { ExpiredTokenException, IDPCommunicationErrorException, IDPRejectedClaimException, InvalidAuthorizationMessageException, InvalidIdentityTokenException, MalformedPolicyDocumentException, PackedPolicyTooLargeException, RegionDisabledException, } from "../models/models_0";
|
|
import { STSServiceException as __BaseException } from "../models/STSServiceException";
|
|
export const se_AssumeRoleCommand = async (input, context) => {
|
|
const headers = SHARED_HEADERS;
|
|
let body;
|
|
body = buildFormUrlencodedString({
|
|
...se_AssumeRoleRequest(input, context),
|
|
Action: "AssumeRole",
|
|
Version: "2011-06-15",
|
|
});
|
|
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
};
|
|
export const se_AssumeRoleWithSAMLCommand = async (input, context) => {
|
|
const headers = SHARED_HEADERS;
|
|
let body;
|
|
body = buildFormUrlencodedString({
|
|
...se_AssumeRoleWithSAMLRequest(input, context),
|
|
Action: "AssumeRoleWithSAML",
|
|
Version: "2011-06-15",
|
|
});
|
|
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
};
|
|
export const se_AssumeRoleWithWebIdentityCommand = async (input, context) => {
|
|
const headers = SHARED_HEADERS;
|
|
let body;
|
|
body = buildFormUrlencodedString({
|
|
...se_AssumeRoleWithWebIdentityRequest(input, context),
|
|
Action: "AssumeRoleWithWebIdentity",
|
|
Version: "2011-06-15",
|
|
});
|
|
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
};
|
|
export const se_DecodeAuthorizationMessageCommand = async (input, context) => {
|
|
const headers = SHARED_HEADERS;
|
|
let body;
|
|
body = buildFormUrlencodedString({
|
|
...se_DecodeAuthorizationMessageRequest(input, context),
|
|
Action: "DecodeAuthorizationMessage",
|
|
Version: "2011-06-15",
|
|
});
|
|
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
};
|
|
export const se_GetAccessKeyInfoCommand = async (input, context) => {
|
|
const headers = SHARED_HEADERS;
|
|
let body;
|
|
body = buildFormUrlencodedString({
|
|
...se_GetAccessKeyInfoRequest(input, context),
|
|
Action: "GetAccessKeyInfo",
|
|
Version: "2011-06-15",
|
|
});
|
|
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
};
|
|
export const se_GetCallerIdentityCommand = async (input, context) => {
|
|
const headers = SHARED_HEADERS;
|
|
let body;
|
|
body = buildFormUrlencodedString({
|
|
...se_GetCallerIdentityRequest(input, context),
|
|
Action: "GetCallerIdentity",
|
|
Version: "2011-06-15",
|
|
});
|
|
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
};
|
|
export const se_GetFederationTokenCommand = async (input, context) => {
|
|
const headers = SHARED_HEADERS;
|
|
let body;
|
|
body = buildFormUrlencodedString({
|
|
...se_GetFederationTokenRequest(input, context),
|
|
Action: "GetFederationToken",
|
|
Version: "2011-06-15",
|
|
});
|
|
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
};
|
|
export const se_GetSessionTokenCommand = async (input, context) => {
|
|
const headers = SHARED_HEADERS;
|
|
let body;
|
|
body = buildFormUrlencodedString({
|
|
...se_GetSessionTokenRequest(input, context),
|
|
Action: "GetSessionToken",
|
|
Version: "2011-06-15",
|
|
});
|
|
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
};
|
|
export const de_AssumeRoleCommand = async (output, context) => {
|
|
if (output.statusCode >= 300) {
|
|
return de_AssumeRoleCommandError(output, context);
|
|
}
|
|
const data = await parseBody(output.body, context);
|
|
let contents = {};
|
|
contents = de_AssumeRoleResponse(data.AssumeRoleResult, context);
|
|
const response = {
|
|
$metadata: deserializeMetadata(output),
|
|
...contents,
|
|
};
|
|
return response;
|
|
};
|
|
const de_AssumeRoleCommandError = async (output, context) => {
|
|
const parsedOutput = {
|
|
...output,
|
|
body: await parseErrorBody(output.body, context),
|
|
};
|
|
const errorCode = loadQueryErrorCode(output, parsedOutput.body);
|
|
switch (errorCode) {
|
|
case "ExpiredTokenException":
|
|
case "com.amazonaws.sts#ExpiredTokenException":
|
|
throw await de_ExpiredTokenExceptionRes(parsedOutput, context);
|
|
case "MalformedPolicyDocument":
|
|
case "com.amazonaws.sts#MalformedPolicyDocumentException":
|
|
throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context);
|
|
case "PackedPolicyTooLarge":
|
|
case "com.amazonaws.sts#PackedPolicyTooLargeException":
|
|
throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context);
|
|
case "RegionDisabledException":
|
|
case "com.amazonaws.sts#RegionDisabledException":
|
|
throw await de_RegionDisabledExceptionRes(parsedOutput, context);
|
|
default:
|
|
const parsedBody = parsedOutput.body;
|
|
return throwDefaultError({
|
|
output,
|
|
parsedBody: parsedBody.Error,
|
|
errorCode,
|
|
});
|
|
}
|
|
};
|
|
export const de_AssumeRoleWithSAMLCommand = async (output, context) => {
|
|
if (output.statusCode >= 300) {
|
|
return de_AssumeRoleWithSAMLCommandError(output, context);
|
|
}
|
|
const data = await parseBody(output.body, context);
|
|
let contents = {};
|
|
contents = de_AssumeRoleWithSAMLResponse(data.AssumeRoleWithSAMLResult, context);
|
|
const response = {
|
|
$metadata: deserializeMetadata(output),
|
|
...contents,
|
|
};
|
|
return response;
|
|
};
|
|
const de_AssumeRoleWithSAMLCommandError = async (output, context) => {
|
|
const parsedOutput = {
|
|
...output,
|
|
body: await parseErrorBody(output.body, context),
|
|
};
|
|
const errorCode = loadQueryErrorCode(output, parsedOutput.body);
|
|
switch (errorCode) {
|
|
case "ExpiredTokenException":
|
|
case "com.amazonaws.sts#ExpiredTokenException":
|
|
throw await de_ExpiredTokenExceptionRes(parsedOutput, context);
|
|
case "IDPRejectedClaim":
|
|
case "com.amazonaws.sts#IDPRejectedClaimException":
|
|
throw await de_IDPRejectedClaimExceptionRes(parsedOutput, context);
|
|
case "InvalidIdentityToken":
|
|
case "com.amazonaws.sts#InvalidIdentityTokenException":
|
|
throw await de_InvalidIdentityTokenExceptionRes(parsedOutput, context);
|
|
case "MalformedPolicyDocument":
|
|
case "com.amazonaws.sts#MalformedPolicyDocumentException":
|
|
throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context);
|
|
case "PackedPolicyTooLarge":
|
|
case "com.amazonaws.sts#PackedPolicyTooLargeException":
|
|
throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context);
|
|
case "RegionDisabledException":
|
|
case "com.amazonaws.sts#RegionDisabledException":
|
|
throw await de_RegionDisabledExceptionRes(parsedOutput, context);
|
|
default:
|
|
const parsedBody = parsedOutput.body;
|
|
return throwDefaultError({
|
|
output,
|
|
parsedBody: parsedBody.Error,
|
|
errorCode,
|
|
});
|
|
}
|
|
};
|
|
export const de_AssumeRoleWithWebIdentityCommand = async (output, context) => {
|
|
if (output.statusCode >= 300) {
|
|
return de_AssumeRoleWithWebIdentityCommandError(output, context);
|
|
}
|
|
const data = await parseBody(output.body, context);
|
|
let contents = {};
|
|
contents = de_AssumeRoleWithWebIdentityResponse(data.AssumeRoleWithWebIdentityResult, context);
|
|
const response = {
|
|
$metadata: deserializeMetadata(output),
|
|
...contents,
|
|
};
|
|
return response;
|
|
};
|
|
const de_AssumeRoleWithWebIdentityCommandError = async (output, context) => {
|
|
const parsedOutput = {
|
|
...output,
|
|
body: await parseErrorBody(output.body, context),
|
|
};
|
|
const errorCode = loadQueryErrorCode(output, parsedOutput.body);
|
|
switch (errorCode) {
|
|
case "ExpiredTokenException":
|
|
case "com.amazonaws.sts#ExpiredTokenException":
|
|
throw await de_ExpiredTokenExceptionRes(parsedOutput, context);
|
|
case "IDPCommunicationError":
|
|
case "com.amazonaws.sts#IDPCommunicationErrorException":
|
|
throw await de_IDPCommunicationErrorExceptionRes(parsedOutput, context);
|
|
case "IDPRejectedClaim":
|
|
case "com.amazonaws.sts#IDPRejectedClaimException":
|
|
throw await de_IDPRejectedClaimExceptionRes(parsedOutput, context);
|
|
case "InvalidIdentityToken":
|
|
case "com.amazonaws.sts#InvalidIdentityTokenException":
|
|
throw await de_InvalidIdentityTokenExceptionRes(parsedOutput, context);
|
|
case "MalformedPolicyDocument":
|
|
case "com.amazonaws.sts#MalformedPolicyDocumentException":
|
|
throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context);
|
|
case "PackedPolicyTooLarge":
|
|
case "com.amazonaws.sts#PackedPolicyTooLargeException":
|
|
throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context);
|
|
case "RegionDisabledException":
|
|
case "com.amazonaws.sts#RegionDisabledException":
|
|
throw await de_RegionDisabledExceptionRes(parsedOutput, context);
|
|
default:
|
|
const parsedBody = parsedOutput.body;
|
|
return throwDefaultError({
|
|
output,
|
|
parsedBody: parsedBody.Error,
|
|
errorCode,
|
|
});
|
|
}
|
|
};
|
|
export const de_DecodeAuthorizationMessageCommand = async (output, context) => {
|
|
if (output.statusCode >= 300) {
|
|
return de_DecodeAuthorizationMessageCommandError(output, context);
|
|
}
|
|
const data = await parseBody(output.body, context);
|
|
let contents = {};
|
|
contents = de_DecodeAuthorizationMessageResponse(data.DecodeAuthorizationMessageResult, context);
|
|
const response = {
|
|
$metadata: deserializeMetadata(output),
|
|
...contents,
|
|
};
|
|
return response;
|
|
};
|
|
const de_DecodeAuthorizationMessageCommandError = async (output, context) => {
|
|
const parsedOutput = {
|
|
...output,
|
|
body: await parseErrorBody(output.body, context),
|
|
};
|
|
const errorCode = loadQueryErrorCode(output, parsedOutput.body);
|
|
switch (errorCode) {
|
|
case "InvalidAuthorizationMessageException":
|
|
case "com.amazonaws.sts#InvalidAuthorizationMessageException":
|
|
throw await de_InvalidAuthorizationMessageExceptionRes(parsedOutput, context);
|
|
default:
|
|
const parsedBody = parsedOutput.body;
|
|
return throwDefaultError({
|
|
output,
|
|
parsedBody: parsedBody.Error,
|
|
errorCode,
|
|
});
|
|
}
|
|
};
|
|
export const de_GetAccessKeyInfoCommand = async (output, context) => {
|
|
if (output.statusCode >= 300) {
|
|
return de_GetAccessKeyInfoCommandError(output, context);
|
|
}
|
|
const data = await parseBody(output.body, context);
|
|
let contents = {};
|
|
contents = de_GetAccessKeyInfoResponse(data.GetAccessKeyInfoResult, context);
|
|
const response = {
|
|
$metadata: deserializeMetadata(output),
|
|
...contents,
|
|
};
|
|
return response;
|
|
};
|
|
const de_GetAccessKeyInfoCommandError = async (output, context) => {
|
|
const parsedOutput = {
|
|
...output,
|
|
body: await parseErrorBody(output.body, context),
|
|
};
|
|
const errorCode = loadQueryErrorCode(output, parsedOutput.body);
|
|
const parsedBody = parsedOutput.body;
|
|
return throwDefaultError({
|
|
output,
|
|
parsedBody: parsedBody.Error,
|
|
errorCode,
|
|
});
|
|
};
|
|
export const de_GetCallerIdentityCommand = async (output, context) => {
|
|
if (output.statusCode >= 300) {
|
|
return de_GetCallerIdentityCommandError(output, context);
|
|
}
|
|
const data = await parseBody(output.body, context);
|
|
let contents = {};
|
|
contents = de_GetCallerIdentityResponse(data.GetCallerIdentityResult, context);
|
|
const response = {
|
|
$metadata: deserializeMetadata(output),
|
|
...contents,
|
|
};
|
|
return response;
|
|
};
|
|
const de_GetCallerIdentityCommandError = async (output, context) => {
|
|
const parsedOutput = {
|
|
...output,
|
|
body: await parseErrorBody(output.body, context),
|
|
};
|
|
const errorCode = loadQueryErrorCode(output, parsedOutput.body);
|
|
const parsedBody = parsedOutput.body;
|
|
return throwDefaultError({
|
|
output,
|
|
parsedBody: parsedBody.Error,
|
|
errorCode,
|
|
});
|
|
};
|
|
export const de_GetFederationTokenCommand = async (output, context) => {
|
|
if (output.statusCode >= 300) {
|
|
return de_GetFederationTokenCommandError(output, context);
|
|
}
|
|
const data = await parseBody(output.body, context);
|
|
let contents = {};
|
|
contents = de_GetFederationTokenResponse(data.GetFederationTokenResult, context);
|
|
const response = {
|
|
$metadata: deserializeMetadata(output),
|
|
...contents,
|
|
};
|
|
return response;
|
|
};
|
|
const de_GetFederationTokenCommandError = async (output, context) => {
|
|
const parsedOutput = {
|
|
...output,
|
|
body: await parseErrorBody(output.body, context),
|
|
};
|
|
const errorCode = loadQueryErrorCode(output, parsedOutput.body);
|
|
switch (errorCode) {
|
|
case "MalformedPolicyDocument":
|
|
case "com.amazonaws.sts#MalformedPolicyDocumentException":
|
|
throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context);
|
|
case "PackedPolicyTooLarge":
|
|
case "com.amazonaws.sts#PackedPolicyTooLargeException":
|
|
throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context);
|
|
case "RegionDisabledException":
|
|
case "com.amazonaws.sts#RegionDisabledException":
|
|
throw await de_RegionDisabledExceptionRes(parsedOutput, context);
|
|
default:
|
|
const parsedBody = parsedOutput.body;
|
|
return throwDefaultError({
|
|
output,
|
|
parsedBody: parsedBody.Error,
|
|
errorCode,
|
|
});
|
|
}
|
|
};
|
|
export const de_GetSessionTokenCommand = async (output, context) => {
|
|
if (output.statusCode >= 300) {
|
|
return de_GetSessionTokenCommandError(output, context);
|
|
}
|
|
const data = await parseBody(output.body, context);
|
|
let contents = {};
|
|
contents = de_GetSessionTokenResponse(data.GetSessionTokenResult, context);
|
|
const response = {
|
|
$metadata: deserializeMetadata(output),
|
|
...contents,
|
|
};
|
|
return response;
|
|
};
|
|
const de_GetSessionTokenCommandError = async (output, context) => {
|
|
const parsedOutput = {
|
|
...output,
|
|
body: await parseErrorBody(output.body, context),
|
|
};
|
|
const errorCode = loadQueryErrorCode(output, parsedOutput.body);
|
|
switch (errorCode) {
|
|
case "RegionDisabledException":
|
|
case "com.amazonaws.sts#RegionDisabledException":
|
|
throw await de_RegionDisabledExceptionRes(parsedOutput, context);
|
|
default:
|
|
const parsedBody = parsedOutput.body;
|
|
return throwDefaultError({
|
|
output,
|
|
parsedBody: parsedBody.Error,
|
|
errorCode,
|
|
});
|
|
}
|
|
};
|
|
const de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
|
|
const body = parsedOutput.body;
|
|
const deserialized = de_ExpiredTokenException(body.Error, context);
|
|
const exception = new ExpiredTokenException({
|
|
$metadata: deserializeMetadata(parsedOutput),
|
|
...deserialized,
|
|
});
|
|
return __decorateServiceException(exception, body);
|
|
};
|
|
const de_IDPCommunicationErrorExceptionRes = async (parsedOutput, context) => {
|
|
const body = parsedOutput.body;
|
|
const deserialized = de_IDPCommunicationErrorException(body.Error, context);
|
|
const exception = new IDPCommunicationErrorException({
|
|
$metadata: deserializeMetadata(parsedOutput),
|
|
...deserialized,
|
|
});
|
|
return __decorateServiceException(exception, body);
|
|
};
|
|
const de_IDPRejectedClaimExceptionRes = async (parsedOutput, context) => {
|
|
const body = parsedOutput.body;
|
|
const deserialized = de_IDPRejectedClaimException(body.Error, context);
|
|
const exception = new IDPRejectedClaimException({
|
|
$metadata: deserializeMetadata(parsedOutput),
|
|
...deserialized,
|
|
});
|
|
return __decorateServiceException(exception, body);
|
|
};
|
|
const de_InvalidAuthorizationMessageExceptionRes = async (parsedOutput, context) => {
|
|
const body = parsedOutput.body;
|
|
const deserialized = de_InvalidAuthorizationMessageException(body.Error, context);
|
|
const exception = new InvalidAuthorizationMessageException({
|
|
$metadata: deserializeMetadata(parsedOutput),
|
|
...deserialized,
|
|
});
|
|
return __decorateServiceException(exception, body);
|
|
};
|
|
const de_InvalidIdentityTokenExceptionRes = async (parsedOutput, context) => {
|
|
const body = parsedOutput.body;
|
|
const deserialized = de_InvalidIdentityTokenException(body.Error, context);
|
|
const exception = new InvalidIdentityTokenException({
|
|
$metadata: deserializeMetadata(parsedOutput),
|
|
...deserialized,
|
|
});
|
|
return __decorateServiceException(exception, body);
|
|
};
|
|
const de_MalformedPolicyDocumentExceptionRes = async (parsedOutput, context) => {
|
|
const body = parsedOutput.body;
|
|
const deserialized = de_MalformedPolicyDocumentException(body.Error, context);
|
|
const exception = new MalformedPolicyDocumentException({
|
|
$metadata: deserializeMetadata(parsedOutput),
|
|
...deserialized,
|
|
});
|
|
return __decorateServiceException(exception, body);
|
|
};
|
|
const de_PackedPolicyTooLargeExceptionRes = async (parsedOutput, context) => {
|
|
const body = parsedOutput.body;
|
|
const deserialized = de_PackedPolicyTooLargeException(body.Error, context);
|
|
const exception = new PackedPolicyTooLargeException({
|
|
$metadata: deserializeMetadata(parsedOutput),
|
|
...deserialized,
|
|
});
|
|
return __decorateServiceException(exception, body);
|
|
};
|
|
const de_RegionDisabledExceptionRes = async (parsedOutput, context) => {
|
|
const body = parsedOutput.body;
|
|
const deserialized = de_RegionDisabledException(body.Error, context);
|
|
const exception = new RegionDisabledException({
|
|
$metadata: deserializeMetadata(parsedOutput),
|
|
...deserialized,
|
|
});
|
|
return __decorateServiceException(exception, body);
|
|
};
|
|
const se_AssumeRoleRequest = (input, context) => {
|
|
const entries = {};
|
|
if (input.RoleArn != null) {
|
|
entries["RoleArn"] = input.RoleArn;
|
|
}
|
|
if (input.RoleSessionName != null) {
|
|
entries["RoleSessionName"] = input.RoleSessionName;
|
|
}
|
|
if (input.PolicyArns != null) {
|
|
const memberEntries = se_policyDescriptorListType(input.PolicyArns, context);
|
|
if (input.PolicyArns?.length === 0) {
|
|
entries.PolicyArns = [];
|
|
}
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
const loc = `PolicyArns.${key}`;
|
|
entries[loc] = value;
|
|
});
|
|
}
|
|
if (input.Policy != null) {
|
|
entries["Policy"] = input.Policy;
|
|
}
|
|
if (input.DurationSeconds != null) {
|
|
entries["DurationSeconds"] = input.DurationSeconds;
|
|
}
|
|
if (input.Tags != null) {
|
|
const memberEntries = se_tagListType(input.Tags, context);
|
|
if (input.Tags?.length === 0) {
|
|
entries.Tags = [];
|
|
}
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
const loc = `Tags.${key}`;
|
|
entries[loc] = value;
|
|
});
|
|
}
|
|
if (input.TransitiveTagKeys != null) {
|
|
const memberEntries = se_tagKeyListType(input.TransitiveTagKeys, context);
|
|
if (input.TransitiveTagKeys?.length === 0) {
|
|
entries.TransitiveTagKeys = [];
|
|
}
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
const loc = `TransitiveTagKeys.${key}`;
|
|
entries[loc] = value;
|
|
});
|
|
}
|
|
if (input.ExternalId != null) {
|
|
entries["ExternalId"] = input.ExternalId;
|
|
}
|
|
if (input.SerialNumber != null) {
|
|
entries["SerialNumber"] = input.SerialNumber;
|
|
}
|
|
if (input.TokenCode != null) {
|
|
entries["TokenCode"] = input.TokenCode;
|
|
}
|
|
if (input.SourceIdentity != null) {
|
|
entries["SourceIdentity"] = input.SourceIdentity;
|
|
}
|
|
if (input.ProvidedContexts != null) {
|
|
const memberEntries = se_ProvidedContextsListType(input.ProvidedContexts, context);
|
|
if (input.ProvidedContexts?.length === 0) {
|
|
entries.ProvidedContexts = [];
|
|
}
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
const loc = `ProvidedContexts.${key}`;
|
|
entries[loc] = value;
|
|
});
|
|
}
|
|
return entries;
|
|
};
|
|
const se_AssumeRoleWithSAMLRequest = (input, context) => {
|
|
const entries = {};
|
|
if (input.RoleArn != null) {
|
|
entries["RoleArn"] = input.RoleArn;
|
|
}
|
|
if (input.PrincipalArn != null) {
|
|
entries["PrincipalArn"] = input.PrincipalArn;
|
|
}
|
|
if (input.SAMLAssertion != null) {
|
|
entries["SAMLAssertion"] = input.SAMLAssertion;
|
|
}
|
|
if (input.PolicyArns != null) {
|
|
const memberEntries = se_policyDescriptorListType(input.PolicyArns, context);
|
|
if (input.PolicyArns?.length === 0) {
|
|
entries.PolicyArns = [];
|
|
}
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
const loc = `PolicyArns.${key}`;
|
|
entries[loc] = value;
|
|
});
|
|
}
|
|
if (input.Policy != null) {
|
|
entries["Policy"] = input.Policy;
|
|
}
|
|
if (input.DurationSeconds != null) {
|
|
entries["DurationSeconds"] = input.DurationSeconds;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_AssumeRoleWithWebIdentityRequest = (input, context) => {
|
|
const entries = {};
|
|
if (input.RoleArn != null) {
|
|
entries["RoleArn"] = input.RoleArn;
|
|
}
|
|
if (input.RoleSessionName != null) {
|
|
entries["RoleSessionName"] = input.RoleSessionName;
|
|
}
|
|
if (input.WebIdentityToken != null) {
|
|
entries["WebIdentityToken"] = input.WebIdentityToken;
|
|
}
|
|
if (input.ProviderId != null) {
|
|
entries["ProviderId"] = input.ProviderId;
|
|
}
|
|
if (input.PolicyArns != null) {
|
|
const memberEntries = se_policyDescriptorListType(input.PolicyArns, context);
|
|
if (input.PolicyArns?.length === 0) {
|
|
entries.PolicyArns = [];
|
|
}
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
const loc = `PolicyArns.${key}`;
|
|
entries[loc] = value;
|
|
});
|
|
}
|
|
if (input.Policy != null) {
|
|
entries["Policy"] = input.Policy;
|
|
}
|
|
if (input.DurationSeconds != null) {
|
|
entries["DurationSeconds"] = input.DurationSeconds;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_DecodeAuthorizationMessageRequest = (input, context) => {
|
|
const entries = {};
|
|
if (input.EncodedMessage != null) {
|
|
entries["EncodedMessage"] = input.EncodedMessage;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_GetAccessKeyInfoRequest = (input, context) => {
|
|
const entries = {};
|
|
if (input.AccessKeyId != null) {
|
|
entries["AccessKeyId"] = input.AccessKeyId;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_GetCallerIdentityRequest = (input, context) => {
|
|
const entries = {};
|
|
return entries;
|
|
};
|
|
const se_GetFederationTokenRequest = (input, context) => {
|
|
const entries = {};
|
|
if (input.Name != null) {
|
|
entries["Name"] = input.Name;
|
|
}
|
|
if (input.Policy != null) {
|
|
entries["Policy"] = input.Policy;
|
|
}
|
|
if (input.PolicyArns != null) {
|
|
const memberEntries = se_policyDescriptorListType(input.PolicyArns, context);
|
|
if (input.PolicyArns?.length === 0) {
|
|
entries.PolicyArns = [];
|
|
}
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
const loc = `PolicyArns.${key}`;
|
|
entries[loc] = value;
|
|
});
|
|
}
|
|
if (input.DurationSeconds != null) {
|
|
entries["DurationSeconds"] = input.DurationSeconds;
|
|
}
|
|
if (input.Tags != null) {
|
|
const memberEntries = se_tagListType(input.Tags, context);
|
|
if (input.Tags?.length === 0) {
|
|
entries.Tags = [];
|
|
}
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
const loc = `Tags.${key}`;
|
|
entries[loc] = value;
|
|
});
|
|
}
|
|
return entries;
|
|
};
|
|
const se_GetSessionTokenRequest = (input, context) => {
|
|
const entries = {};
|
|
if (input.DurationSeconds != null) {
|
|
entries["DurationSeconds"] = input.DurationSeconds;
|
|
}
|
|
if (input.SerialNumber != null) {
|
|
entries["SerialNumber"] = input.SerialNumber;
|
|
}
|
|
if (input.TokenCode != null) {
|
|
entries["TokenCode"] = input.TokenCode;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_policyDescriptorListType = (input, context) => {
|
|
const entries = {};
|
|
let counter = 1;
|
|
for (const entry of input) {
|
|
if (entry === null) {
|
|
continue;
|
|
}
|
|
const memberEntries = se_PolicyDescriptorType(entry, context);
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
entries[`member.${counter}.${key}`] = value;
|
|
});
|
|
counter++;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_PolicyDescriptorType = (input, context) => {
|
|
const entries = {};
|
|
if (input.arn != null) {
|
|
entries["arn"] = input.arn;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_ProvidedContext = (input, context) => {
|
|
const entries = {};
|
|
if (input.ProviderArn != null) {
|
|
entries["ProviderArn"] = input.ProviderArn;
|
|
}
|
|
if (input.ContextAssertion != null) {
|
|
entries["ContextAssertion"] = input.ContextAssertion;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_ProvidedContextsListType = (input, context) => {
|
|
const entries = {};
|
|
let counter = 1;
|
|
for (const entry of input) {
|
|
if (entry === null) {
|
|
continue;
|
|
}
|
|
const memberEntries = se_ProvidedContext(entry, context);
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
entries[`member.${counter}.${key}`] = value;
|
|
});
|
|
counter++;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_Tag = (input, context) => {
|
|
const entries = {};
|
|
if (input.Key != null) {
|
|
entries["Key"] = input.Key;
|
|
}
|
|
if (input.Value != null) {
|
|
entries["Value"] = input.Value;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_tagKeyListType = (input, context) => {
|
|
const entries = {};
|
|
let counter = 1;
|
|
for (const entry of input) {
|
|
if (entry === null) {
|
|
continue;
|
|
}
|
|
entries[`member.${counter}`] = entry;
|
|
counter++;
|
|
}
|
|
return entries;
|
|
};
|
|
const se_tagListType = (input, context) => {
|
|
const entries = {};
|
|
let counter = 1;
|
|
for (const entry of input) {
|
|
if (entry === null) {
|
|
continue;
|
|
}
|
|
const memberEntries = se_Tag(entry, context);
|
|
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
entries[`member.${counter}.${key}`] = value;
|
|
});
|
|
counter++;
|
|
}
|
|
return entries;
|
|
};
|
|
const de_AssumedRoleUser = (output, context) => {
|
|
const contents = {};
|
|
if (output["AssumedRoleId"] !== undefined) {
|
|
contents.AssumedRoleId = __expectString(output["AssumedRoleId"]);
|
|
}
|
|
if (output["Arn"] !== undefined) {
|
|
contents.Arn = __expectString(output["Arn"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_AssumeRoleResponse = (output, context) => {
|
|
const contents = {};
|
|
if (output["Credentials"] !== undefined) {
|
|
contents.Credentials = de_Credentials(output["Credentials"], context);
|
|
}
|
|
if (output["AssumedRoleUser"] !== undefined) {
|
|
contents.AssumedRoleUser = de_AssumedRoleUser(output["AssumedRoleUser"], context);
|
|
}
|
|
if (output["PackedPolicySize"] !== undefined) {
|
|
contents.PackedPolicySize = __strictParseInt32(output["PackedPolicySize"]);
|
|
}
|
|
if (output["SourceIdentity"] !== undefined) {
|
|
contents.SourceIdentity = __expectString(output["SourceIdentity"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_AssumeRoleWithSAMLResponse = (output, context) => {
|
|
const contents = {};
|
|
if (output["Credentials"] !== undefined) {
|
|
contents.Credentials = de_Credentials(output["Credentials"], context);
|
|
}
|
|
if (output["AssumedRoleUser"] !== undefined) {
|
|
contents.AssumedRoleUser = de_AssumedRoleUser(output["AssumedRoleUser"], context);
|
|
}
|
|
if (output["PackedPolicySize"] !== undefined) {
|
|
contents.PackedPolicySize = __strictParseInt32(output["PackedPolicySize"]);
|
|
}
|
|
if (output["Subject"] !== undefined) {
|
|
contents.Subject = __expectString(output["Subject"]);
|
|
}
|
|
if (output["SubjectType"] !== undefined) {
|
|
contents.SubjectType = __expectString(output["SubjectType"]);
|
|
}
|
|
if (output["Issuer"] !== undefined) {
|
|
contents.Issuer = __expectString(output["Issuer"]);
|
|
}
|
|
if (output["Audience"] !== undefined) {
|
|
contents.Audience = __expectString(output["Audience"]);
|
|
}
|
|
if (output["NameQualifier"] !== undefined) {
|
|
contents.NameQualifier = __expectString(output["NameQualifier"]);
|
|
}
|
|
if (output["SourceIdentity"] !== undefined) {
|
|
contents.SourceIdentity = __expectString(output["SourceIdentity"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_AssumeRoleWithWebIdentityResponse = (output, context) => {
|
|
const contents = {};
|
|
if (output["Credentials"] !== undefined) {
|
|
contents.Credentials = de_Credentials(output["Credentials"], context);
|
|
}
|
|
if (output["SubjectFromWebIdentityToken"] !== undefined) {
|
|
contents.SubjectFromWebIdentityToken = __expectString(output["SubjectFromWebIdentityToken"]);
|
|
}
|
|
if (output["AssumedRoleUser"] !== undefined) {
|
|
contents.AssumedRoleUser = de_AssumedRoleUser(output["AssumedRoleUser"], context);
|
|
}
|
|
if (output["PackedPolicySize"] !== undefined) {
|
|
contents.PackedPolicySize = __strictParseInt32(output["PackedPolicySize"]);
|
|
}
|
|
if (output["Provider"] !== undefined) {
|
|
contents.Provider = __expectString(output["Provider"]);
|
|
}
|
|
if (output["Audience"] !== undefined) {
|
|
contents.Audience = __expectString(output["Audience"]);
|
|
}
|
|
if (output["SourceIdentity"] !== undefined) {
|
|
contents.SourceIdentity = __expectString(output["SourceIdentity"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_Credentials = (output, context) => {
|
|
const contents = {};
|
|
if (output["AccessKeyId"] !== undefined) {
|
|
contents.AccessKeyId = __expectString(output["AccessKeyId"]);
|
|
}
|
|
if (output["SecretAccessKey"] !== undefined) {
|
|
contents.SecretAccessKey = __expectString(output["SecretAccessKey"]);
|
|
}
|
|
if (output["SessionToken"] !== undefined) {
|
|
contents.SessionToken = __expectString(output["SessionToken"]);
|
|
}
|
|
if (output["Expiration"] !== undefined) {
|
|
contents.Expiration = __expectNonNull(__parseRfc3339DateTimeWithOffset(output["Expiration"]));
|
|
}
|
|
return contents;
|
|
};
|
|
const de_DecodeAuthorizationMessageResponse = (output, context) => {
|
|
const contents = {};
|
|
if (output["DecodedMessage"] !== undefined) {
|
|
contents.DecodedMessage = __expectString(output["DecodedMessage"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_ExpiredTokenException = (output, context) => {
|
|
const contents = {};
|
|
if (output["message"] !== undefined) {
|
|
contents.message = __expectString(output["message"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_FederatedUser = (output, context) => {
|
|
const contents = {};
|
|
if (output["FederatedUserId"] !== undefined) {
|
|
contents.FederatedUserId = __expectString(output["FederatedUserId"]);
|
|
}
|
|
if (output["Arn"] !== undefined) {
|
|
contents.Arn = __expectString(output["Arn"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_GetAccessKeyInfoResponse = (output, context) => {
|
|
const contents = {};
|
|
if (output["Account"] !== undefined) {
|
|
contents.Account = __expectString(output["Account"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_GetCallerIdentityResponse = (output, context) => {
|
|
const contents = {};
|
|
if (output["UserId"] !== undefined) {
|
|
contents.UserId = __expectString(output["UserId"]);
|
|
}
|
|
if (output["Account"] !== undefined) {
|
|
contents.Account = __expectString(output["Account"]);
|
|
}
|
|
if (output["Arn"] !== undefined) {
|
|
contents.Arn = __expectString(output["Arn"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_GetFederationTokenResponse = (output, context) => {
|
|
const contents = {};
|
|
if (output["Credentials"] !== undefined) {
|
|
contents.Credentials = de_Credentials(output["Credentials"], context);
|
|
}
|
|
if (output["FederatedUser"] !== undefined) {
|
|
contents.FederatedUser = de_FederatedUser(output["FederatedUser"], context);
|
|
}
|
|
if (output["PackedPolicySize"] !== undefined) {
|
|
contents.PackedPolicySize = __strictParseInt32(output["PackedPolicySize"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_GetSessionTokenResponse = (output, context) => {
|
|
const contents = {};
|
|
if (output["Credentials"] !== undefined) {
|
|
contents.Credentials = de_Credentials(output["Credentials"], context);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_IDPCommunicationErrorException = (output, context) => {
|
|
const contents = {};
|
|
if (output["message"] !== undefined) {
|
|
contents.message = __expectString(output["message"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_IDPRejectedClaimException = (output, context) => {
|
|
const contents = {};
|
|
if (output["message"] !== undefined) {
|
|
contents.message = __expectString(output["message"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_InvalidAuthorizationMessageException = (output, context) => {
|
|
const contents = {};
|
|
if (output["message"] !== undefined) {
|
|
contents.message = __expectString(output["message"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_InvalidIdentityTokenException = (output, context) => {
|
|
const contents = {};
|
|
if (output["message"] !== undefined) {
|
|
contents.message = __expectString(output["message"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_MalformedPolicyDocumentException = (output, context) => {
|
|
const contents = {};
|
|
if (output["message"] !== undefined) {
|
|
contents.message = __expectString(output["message"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_PackedPolicyTooLargeException = (output, context) => {
|
|
const contents = {};
|
|
if (output["message"] !== undefined) {
|
|
contents.message = __expectString(output["message"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const de_RegionDisabledException = (output, context) => {
|
|
const contents = {};
|
|
if (output["message"] !== undefined) {
|
|
contents.message = __expectString(output["message"]);
|
|
}
|
|
return contents;
|
|
};
|
|
const deserializeMetadata = (output) => ({
|
|
httpStatusCode: output.statusCode,
|
|
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
extendedRequestId: output.headers["x-amz-id-2"],
|
|
cfId: output.headers["x-amz-cf-id"],
|
|
});
|
|
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
const throwDefaultError = withBaseException(__BaseException);
|
|
const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
|
|
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
const contents = {
|
|
protocol,
|
|
hostname,
|
|
port,
|
|
method: "POST",
|
|
path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
|
|
headers,
|
|
};
|
|
if (resolvedHostname !== undefined) {
|
|
contents.hostname = resolvedHostname;
|
|
}
|
|
if (body !== undefined) {
|
|
contents.body = body;
|
|
}
|
|
return new __HttpRequest(contents);
|
|
};
|
|
const SHARED_HEADERS = {
|
|
"content-type": "application/x-www-form-urlencoded",
|
|
};
|
|
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
if (encoded.length) {
|
|
const parser = new XMLParser({
|
|
attributeNamePrefix: "",
|
|
htmlEntities: true,
|
|
ignoreAttributes: false,
|
|
ignoreDeclaration: true,
|
|
parseTagValue: false,
|
|
trimValues: false,
|
|
tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined),
|
|
});
|
|
parser.addEntity("#xD", "\r");
|
|
parser.addEntity("#10", "\n");
|
|
const parsedObj = parser.parse(encoded);
|
|
const textNodeName = "#text";
|
|
const key = Object.keys(parsedObj)[0];
|
|
const parsedObjToReturn = parsedObj[key];
|
|
if (parsedObjToReturn[textNodeName]) {
|
|
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
|
|
delete parsedObjToReturn[textNodeName];
|
|
}
|
|
return __getValueFromTextNode(parsedObjToReturn);
|
|
}
|
|
return {};
|
|
});
|
|
const parseErrorBody = async (errorBody, context) => {
|
|
const value = await parseBody(errorBody, context);
|
|
if (value.Error) {
|
|
value.Error.message = value.Error.message ?? value.Error.Message;
|
|
}
|
|
return value;
|
|
};
|
|
const buildFormUrlencodedString = (formEntries) => Object.entries(formEntries)
|
|
.map(([key, value]) => __extendedEncodeURIComponent(key) + "=" + __extendedEncodeURIComponent(value))
|
|
.join("&");
|
|
const loadQueryErrorCode = (output, data) => {
|
|
if (data.Error?.Code !== undefined) {
|
|
return data.Error.Code;
|
|
}
|
|
if (output.statusCode == 404) {
|
|
return "NotFound";
|
|
}
|
|
};
|