Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/sites/node_modules/@aws-sdk/client-sso/dist-cjs/protocols/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.deserializeAws_restJson1LogoutCommand = exports.deserializeAws_restJson1ListAccountsCommand = exports.deserializeAws_restJson1ListAccountRolesCommand = exports.deserializeAws_restJson1GetRoleCredentialsCommand = exports.serializeAws_restJson1LogoutCommand = exports.serializeAws_restJson1ListAccountsCommand = exports.serializeAws_restJson1ListAccountRolesCommand = exports.serializeAws_restJson1GetRoleCredentialsCommand = void 0;
const protocol_http_1 = require("@aws-sdk/protocol-http");
const smithy_client_1 = require("@aws-sdk/smithy-client");
const models_0_1 = require("../models/models_0");
const SSOServiceException_1 = require("../models/SSOServiceException");
const serializeAws_restJson1GetRoleCredentialsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
...(isSerializableHeaderValue(input.accessToken) && { "x-amz-sso_bearer_token": input.accessToken }),
};
const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/federation/credentials";
const query = {
...(input.roleName !== undefined && { role_name: input.roleName }),
...(input.accountId !== undefined && { account_id: input.accountId }),
};
let body;
return new protocol_http_1.HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
exports.serializeAws_restJson1GetRoleCredentialsCommand = serializeAws_restJson1GetRoleCredentialsCommand;
const serializeAws_restJson1ListAccountRolesCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
...(isSerializableHeaderValue(input.accessToken) && { "x-amz-sso_bearer_token": input.accessToken }),
};
const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assignment/roles";
const query = {
...(input.nextToken !== undefined && { next_token: input.nextToken }),
...(input.maxResults !== undefined && { max_result: input.maxResults.toString() }),
...(input.accountId !== undefined && { account_id: input.accountId }),
};
let body;
return new protocol_http_1.HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
exports.serializeAws_restJson1ListAccountRolesCommand = serializeAws_restJson1ListAccountRolesCommand;
const serializeAws_restJson1ListAccountsCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
...(isSerializableHeaderValue(input.accessToken) && { "x-amz-sso_bearer_token": input.accessToken }),
};
const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/assignment/accounts";
const query = {
...(input.nextToken !== undefined && { next_token: input.nextToken }),
...(input.maxResults !== undefined && { max_result: input.maxResults.toString() }),
};
let body;
return new protocol_http_1.HttpRequest({
protocol,
hostname,
port,
method: "GET",
headers,
path: resolvedPath,
query,
body,
});
};
exports.serializeAws_restJson1ListAccountsCommand = serializeAws_restJson1ListAccountsCommand;
const serializeAws_restJson1LogoutCommand = async (input, context) => {
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
const headers = {
...(isSerializableHeaderValue(input.accessToken) && { "x-amz-sso_bearer_token": input.accessToken }),
};
const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/logout";
let body;
return new protocol_http_1.HttpRequest({
protocol,
hostname,
port,
method: "POST",
headers,
path: resolvedPath,
body,
});
};
exports.serializeAws_restJson1LogoutCommand = serializeAws_restJson1LogoutCommand;
const deserializeAws_restJson1GetRoleCredentialsCommand = async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return deserializeAws_restJson1GetRoleCredentialsCommandError(output, context);
}
const contents = {
$metadata: deserializeMetadata(output),
roleCredentials: undefined,
};
const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
if (data.roleCredentials !== undefined && data.roleCredentials !== null) {
contents.roleCredentials = deserializeAws_restJson1RoleCredentials(data.roleCredentials, context);
}
return Promise.resolve(contents);
};
exports.deserializeAws_restJson1GetRoleCredentialsCommand = deserializeAws_restJson1GetRoleCredentialsCommand;
const deserializeAws_restJson1GetRoleCredentialsCommandError = async (output, context) => {
const parsedOutput = {
...output,
body: await parseBody(output.body, context),
};
let response;
let errorCode = "UnknownError";
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
switch (errorCode) {
case "InvalidRequestException":
case "com.amazonaws.sso#InvalidRequestException":
throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
case "ResourceNotFoundException":
case "com.amazonaws.sso#ResourceNotFoundException":
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
case "TooManyRequestsException":
case "com.amazonaws.sso#TooManyRequestsException":
throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
case "UnauthorizedException":
case "com.amazonaws.sso#UnauthorizedException":
throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
default:
const parsedBody = parsedOutput.body;
response = new SSOServiceException_1.SSOServiceException({
name: parsedBody.code || parsedBody.Code || errorCode,
$fault: "client",
$metadata: deserializeMetadata(output),
});
throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
}
};
const deserializeAws_restJson1ListAccountRolesCommand = async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return deserializeAws_restJson1ListAccountRolesCommandError(output, context);
}
const contents = {
$metadata: deserializeMetadata(output),
nextToken: undefined,
roleList: undefined,
};
const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
if (data.nextToken !== undefined && data.nextToken !== null) {
contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
}
if (data.roleList !== undefined && data.roleList !== null) {
contents.roleList = deserializeAws_restJson1RoleListType(data.roleList, context);
}
return Promise.resolve(contents);
};
exports.deserializeAws_restJson1ListAccountRolesCommand = deserializeAws_restJson1ListAccountRolesCommand;
const deserializeAws_restJson1ListAccountRolesCommandError = async (output, context) => {
const parsedOutput = {
...output,
body: await parseBody(output.body, context),
};
let response;
let errorCode = "UnknownError";
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
switch (errorCode) {
case "InvalidRequestException":
case "com.amazonaws.sso#InvalidRequestException":
throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
case "ResourceNotFoundException":
case "com.amazonaws.sso#ResourceNotFoundException":
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
case "TooManyRequestsException":
case "com.amazonaws.sso#TooManyRequestsException":
throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
case "UnauthorizedException":
case "com.amazonaws.sso#UnauthorizedException":
throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
default:
const parsedBody = parsedOutput.body;
response = new SSOServiceException_1.SSOServiceException({
name: parsedBody.code || parsedBody.Code || errorCode,
$fault: "client",
$metadata: deserializeMetadata(output),
});
throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
}
};
const deserializeAws_restJson1ListAccountsCommand = async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return deserializeAws_restJson1ListAccountsCommandError(output, context);
}
const contents = {
$metadata: deserializeMetadata(output),
accountList: undefined,
nextToken: undefined,
};
const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
if (data.accountList !== undefined && data.accountList !== null) {
contents.accountList = deserializeAws_restJson1AccountListType(data.accountList, context);
}
if (data.nextToken !== undefined && data.nextToken !== null) {
contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
}
return Promise.resolve(contents);
};
exports.deserializeAws_restJson1ListAccountsCommand = deserializeAws_restJson1ListAccountsCommand;
const deserializeAws_restJson1ListAccountsCommandError = async (output, context) => {
const parsedOutput = {
...output,
body: await parseBody(output.body, context),
};
let response;
let errorCode = "UnknownError";
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
switch (errorCode) {
case "InvalidRequestException":
case "com.amazonaws.sso#InvalidRequestException":
throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
case "ResourceNotFoundException":
case "com.amazonaws.sso#ResourceNotFoundException":
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
case "TooManyRequestsException":
case "com.amazonaws.sso#TooManyRequestsException":
throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
case "UnauthorizedException":
case "com.amazonaws.sso#UnauthorizedException":
throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
default:
const parsedBody = parsedOutput.body;
response = new SSOServiceException_1.SSOServiceException({
name: parsedBody.code || parsedBody.Code || errorCode,
$fault: "client",
$metadata: deserializeMetadata(output),
});
throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
}
};
const deserializeAws_restJson1LogoutCommand = async (output, context) => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return deserializeAws_restJson1LogoutCommandError(output, context);
}
const contents = {
$metadata: deserializeMetadata(output),
};
await collectBody(output.body, context);
return Promise.resolve(contents);
};
exports.deserializeAws_restJson1LogoutCommand = deserializeAws_restJson1LogoutCommand;
const deserializeAws_restJson1LogoutCommandError = async (output, context) => {
const parsedOutput = {
...output,
body: await parseBody(output.body, context),
};
let response;
let errorCode = "UnknownError";
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
switch (errorCode) {
case "InvalidRequestException":
case "com.amazonaws.sso#InvalidRequestException":
throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
case "TooManyRequestsException":
case "com.amazonaws.sso#TooManyRequestsException":
throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
case "UnauthorizedException":
case "com.amazonaws.sso#UnauthorizedException":
throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
default:
const parsedBody = parsedOutput.body;
response = new SSOServiceException_1.SSOServiceException({
name: parsedBody.code || parsedBody.Code || errorCode,
$fault: "client",
$metadata: deserializeMetadata(output),
});
throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
}
};
const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
const contents = {};
const data = parsedOutput.body;
if (data.message !== undefined && data.message !== null) {
contents.message = (0, smithy_client_1.expectString)(data.message);
}
const exception = new models_0_1.InvalidRequestException({
$metadata: deserializeMetadata(parsedOutput),
...contents,
});
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
};
const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
const contents = {};
const data = parsedOutput.body;
if (data.message !== undefined && data.message !== null) {
contents.message = (0, smithy_client_1.expectString)(data.message);
}
const exception = new models_0_1.ResourceNotFoundException({
$metadata: deserializeMetadata(parsedOutput),
...contents,
});
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
};
const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
const contents = {};
const data = parsedOutput.body;
if (data.message !== undefined && data.message !== null) {
contents.message = (0, smithy_client_1.expectString)(data.message);
}
const exception = new models_0_1.TooManyRequestsException({
$metadata: deserializeMetadata(parsedOutput),
...contents,
});
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
};
const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutput, context) => {
const contents = {};
const data = parsedOutput.body;
if (data.message !== undefined && data.message !== null) {
contents.message = (0, smithy_client_1.expectString)(data.message);
}
const exception = new models_0_1.UnauthorizedException({
$metadata: deserializeMetadata(parsedOutput),
...contents,
});
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
};
const deserializeAws_restJson1AccountInfo = (output, context) => {
return {
accountId: (0, smithy_client_1.expectString)(output.accountId),
accountName: (0, smithy_client_1.expectString)(output.accountName),
emailAddress: (0, smithy_client_1.expectString)(output.emailAddress),
};
};
const deserializeAws_restJson1AccountListType = (output, context) => {
const retVal = (output || [])
.filter((e) => e != null)
.map((entry) => {
if (entry === null) {
return null;
}
return deserializeAws_restJson1AccountInfo(entry, context);
});
return retVal;
};
const deserializeAws_restJson1RoleCredentials = (output, context) => {
return {
accessKeyId: (0, smithy_client_1.expectString)(output.accessKeyId),
expiration: (0, smithy_client_1.expectLong)(output.expiration),
secretAccessKey: (0, smithy_client_1.expectString)(output.secretAccessKey),
sessionToken: (0, smithy_client_1.expectString)(output.sessionToken),
};
};
const deserializeAws_restJson1RoleInfo = (output, context) => {
return {
accountId: (0, smithy_client_1.expectString)(output.accountId),
roleName: (0, smithy_client_1.expectString)(output.roleName),
};
};
const deserializeAws_restJson1RoleListType = (output, context) => {
const retVal = (output || [])
.filter((e) => e != null)
.map((entry) => {
if (entry === null) {
return null;
}
return deserializeAws_restJson1RoleInfo(entry, context);
});
return retVal;
};
const deserializeMetadata = (output) => {
var _a;
return ({
httpStatusCode: output.statusCode,
requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
extendedRequestId: output.headers["x-amz-id-2"],
cfId: output.headers["x-amz-cf-id"],
});
};
const collectBody = (streamBody = new Uint8Array(), context) => {
if (streamBody instanceof Uint8Array) {
return Promise.resolve(streamBody);
}
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
};
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
const isSerializableHeaderValue = (value) => value !== undefined &&
value !== null &&
value !== "" &&
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
if (encoded.length) {
return JSON.parse(encoded);
}
return {};
});
const loadRestJsonErrorCode = (output, data) => {
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
const sanitizeErrorCode = (rawValue) => {
let cleanValue = rawValue;
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
if (cleanValue.indexOf("#") >= 0) {
cleanValue = cleanValue.split("#")[1];
}
return cleanValue;
};
const headerKey = findKey(output.headers, "x-amzn-errortype");
if (headerKey !== undefined) {
return sanitizeErrorCode(output.headers[headerKey]);
}
if (data.code !== undefined) {
return sanitizeErrorCode(data.code);
}
if (data["__type"] !== undefined) {
return sanitizeErrorCode(data["__type"]);
}
return "";
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0053 ]-- |