-
-
Save madan712/2c195dfe36726221472a0d9692b79f1d to your computer and use it in GitHub Desktop.
AWS SDK javascript v3 register new quicksight user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const registerUser = async (qsClient, email) => { | |
console.log(`Registering user`); | |
const param = { | |
IdentityType: "IAM", | |
Email: email, | |
UserRole: "READER", | |
IamArn: QUICKSIGHT_ROLE_ARN, | |
SessionName: email, | |
AwsAccountId: AWS_ACCOUNT_ID, | |
Namespace: "default" | |
}; | |
const command = new RegisterUserCommand(param); | |
try { | |
const response = await qsClient.send(command); | |
console.log(JSON.stringify(response)); | |
return response; | |
} catch (error) { | |
// registerUser need to be called only once on subsequent hit it will give error httpStatusCode: 409, | |
console.log(JSON.stringify(error)); | |
return {}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment