33 amazonAuth ,
44 dryRunCheckBox ,
55 getAwsAccountsSingleSelectDropdown ,
6- getCredentialsListFromAuth ,
6+ getCredentialsForAccount ,
77 getRegionsDropdownState ,
88 listAthenaDatabases ,
99 runAndWaitForQueryResult ,
@@ -16,7 +16,7 @@ export const runAthenaQueryAction = createAction({
1616 displayName : 'Query Athena database' ,
1717 isWriteAction : false ,
1818 props : {
19- accounts : getAwsAccountsSingleSelectDropdown ( ) . accounts ,
19+ account : getAwsAccountsSingleSelectDropdown ( ) . accounts ,
2020 region : Property . StaticDropdown ( {
2121 displayName : 'Region' ,
2222 description :
@@ -33,10 +33,9 @@ export const runAthenaQueryAction = createAction({
3333 database : Property . Dropdown < string > ( {
3434 displayName : 'Database' ,
3535 description : 'Database that contains the table to query on' ,
36-
37- refreshers : [ 'auth' , 'accounts' , 'region' ] ,
36+ refreshers : [ 'auth' , 'account' , 'region' ] ,
3837 required : true ,
39- options : async ( { auth, accounts , region } ) => {
38+ options : async ( { auth, account , region } : any ) => {
4039 if ( ! auth ) {
4140 return {
4241 disabled : true ,
@@ -51,18 +50,13 @@ export const runAthenaQueryAction = createAction({
5150 secretAccessKey : string ;
5251 defaultRegion : string ;
5352 } ;
54- const selectedAccounts = (
55- accounts as unknown as {
56- accounts ?: string [ ] ;
57- }
58- ) ?. accounts ;
59- const credentialsList = await getCredentialsListFromAuth (
53+ const credentials = await getCredentialsForAccount (
6054 authProp ,
61- selectedAccounts ,
55+ account ?. [ 'accounts' ] ,
6256 ) ;
6357
6458 const databases = await listAthenaDatabases (
65- credentialsList [ 0 ] ,
59+ credentials ,
6660 ( region as string | undefined ) ?? authProp . defaultRegion ,
6761 ) ;
6862
@@ -119,14 +113,13 @@ export const runAthenaQueryAction = createAction({
119113 }
120114
121115 try {
122- const selectedAccounts = context . propsValue . accounts ?. [ 'accounts' ] ;
123- const credentialsList = await getCredentialsListFromAuth (
116+ const credentials = await getCredentialsForAccount (
124117 context . auth ,
125- selectedAccounts ,
118+ context . propsValue . account ?. [ 'accounts' ] ,
126119 ) ;
127120
128121 return await runAndWaitForQueryResult (
129- credentialsList [ 0 ] ,
122+ credentials ,
130123 context . propsValue . region ?? context . auth . defaultRegion ,
131124 query ,
132125 database ,
0 commit comments