import { STSClient, AssumeRoleWithSAMLCommand } from "@aws-sdk/client-sts"; // ES Modules import
// const { STSClient, AssumeRoleWithSAMLCommand } = require("@aws-sdk/client-sts"); // CommonJS import
const client = new STSClient(config);
const command = new AssumeRoleWithSAMLCommand(input);
const response = await client.send(command);
import { fromTemporaryCredentials } from "@aws-sdk/credential-providers"; // ES6 import
// const { fromTemporaryCredentials } = require("@aws-sdk/credential-providers"); // CommonJS import
const client = new FooClient({
region,
credentials: fromTemporaryCredentials(
// Optional. The master credentials used to get and refresh temporary credentials from AWS STS. If skipped, it uses
// the default credential resolved by internal STS client.
masterCredentials: fromTemporaryCredentials({
params: { RoleArn: "arn:aws:iam::1234567890:role/RoleA" }
}),
// Required. Options passed to STS AssumeRole operation.
params: {
// Required. ARN of role to assume.
RoleArn: "arn:aws:iam::1234567890:role/RoleB",
// Optional. An identifier for the assumed role session. If skipped, it generates a random session name with
// prefix of 'aws-sdk-js-'.
RoleSessionName: "aws-sdk-js-123",
// Optional. The duration, in seconds, of the role session.
DurationSeconds: 3600
//... For more options see https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html
},
// Optional. Custom STS client configurations overriding the default ones.
clientConfig: { region },
// Optional. A function that returns a promise fulfilled with an MFA token code for the provided MFA Serial code.
// Required if `params` has `SerialNumber` config.
mfaCodeProvider: async mfaSerial => {
return "token"
}
),
});
import { ACMPCAClient, ListPermissionsCommand } from "@aws-sdk/client-acm-pca"; // ES Modules import
// const { ACMPCAClient, ListPermissionsCommand } = require("@aws-sdk/client-acm-pca"); // CommonJS import
const client = new ACMPCAClient(config);
const command = new ListPermissionsCommand(input);
const response = await client.send(command);
import { ACMPCAClient, GetCertificateAuthorityCsrCommand } from "@aws-sdk/client-acm-pca"; // ES Modules import
// const { ACMPCAClient, GetCertificateAuthorityCsrCommand } = require("@aws-sdk/client-acm-pca"); // CommonJS import
const client = new ACMPCAClient(config);
const command = new GetCertificateAuthorityCsrCommand(input);
const response = await client.send(command);
import { ACMClient, ListCertificatesCommand } from "@aws-sdk/client-acm"; // ES Modules import
// const { ACMClient, ListCertificatesCommand } = require("@aws-sdk/client-acm"); // CommonJS import
const client = new ACMClient(config);
const command = new ListCertificatesCommand(input);
const response = await client.send(command);