Skip to content

Commit 201725d

Browse files
authored
Merge pull request #341 from eagletmt/aws-profile
Support AWS profile for Athena/Timestream
2 parents 387017d + cac4e32 commit 201725d

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/lib/AthenaClient.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import retry from "./Util/retry";
33

44
interface AthenaClientConfig {
55
region: string;
6+
profile?: string;
67
accessKeyId?: string;
78
secretAccessKey?: string;
89
database: string;
@@ -17,11 +18,15 @@ export default class AthenaClient {
1718
executionId: string;
1819

1920
constructor(config: AthenaClientConfig) {
20-
const { region, accessKeyId, secretAccessKey } = config;
21+
const { region, profile, accessKeyId, secretAccessKey } = config;
2122
this.config = config;
2223

2324
const clientConfig: any = { region };
2425

26+
if (profile) {
27+
clientConfig.profile = profile;
28+
}
29+
2530
// Only add credentials if BOTH accessKeyId and secretAccessKey are provided.
2631
if (accessKeyId && secretAccessKey) {
2732
clientConfig.credentials = { accessKeyId, secretAccessKey };

src/lib/DataSourceDefinition/Athena.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ export default class Athena extends Base {
2020
placeholder: "us-east-1",
2121
required: true,
2222
},
23+
{
24+
name: "profile",
25+
label: "Profile",
26+
type: "string",
27+
placeholder: "Optional - uses AWS default profile if empty",
28+
},
2329
{
2430
name: "accessKeyId",
2531
label: "Access key ID",

src/lib/DataSourceDefinition/Timestream.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export default class Timestream extends Base {
2424
placeholder: "us-east-1",
2525
required: true,
2626
},
27+
{
28+
name: "profile",
29+
label: "Profile",
30+
type: "string",
31+
placeholder: "Optional - uses AWS default profile if empty",
32+
},
2733
{
2834
name: "accessKeyId",
2935
label: "Access key ID",
@@ -50,6 +56,10 @@ export default class Timestream extends Base {
5056

5157
const clientConfig: any = { region: config.region };
5258

59+
if (config.profile) {
60+
clientConfig.profile = config.profile;
61+
}
62+
5363
// Only add credentials if BOTH accessKeyId and secretAccessKey are provided.
5464
if (config.accessKeyId && config.secretAccessKey) {
5565
clientConfig.credentials = {

0 commit comments

Comments
 (0)