@@ -7,6 +7,7 @@ import { SubAccountInfo } from 'tencentcloud-sdk-nodejs/tencentcloud/services/ca
77import loggerText from '../../properties/logger'
88import { TencentServiceInput } from '../../types'
99import { initTestEndpoint , generateTencentErrorLog } from '../../utils'
10+ import { regionMap } from '../../enums/regions'
1011
1112const lt = { ...loggerText }
1213const { logger } = CloudGraph
@@ -19,35 +20,33 @@ export interface RawTencentCamUser extends SubAccountInfo {
1920}
2021
2122export default async ( {
22- regions,
2323 config,
2424} : TencentServiceInput ) : Promise < {
2525 [ region : string ] : RawTencentCamUser [ ]
2626} > =>
2727 new Promise ( async resolve => {
2828 const camUserList : RawTencentCamUser [ ] = [ ]
2929
30- for ( const region of regions . split ( ',' ) ) {
31- try {
32- const CamClient = tencentcloud . cam . v20190116 . Client
33- const clientConfig : ClientConfig = { credential : config , region, profile : { httpProfile : { endpoint : apiEndpoint } } }
34- const cam = new CamClient ( clientConfig )
30+ try {
31+ const CamClient = tencentcloud . cam . v20190116 . Client
32+ const clientConfig : ClientConfig = { credential : config , profile : { httpProfile : { endpoint : apiEndpoint } } }
33+ const cam = new CamClient ( clientConfig )
3534
36- const response = await cam . ListUsers ( null )
35+ const response = await cam . ListUsers ( null )
3736
38- if ( response && ! isEmpty ( response . Data ) ) {
39- for ( const instance of response . Data ) {
40- camUserList . push ( {
41- id : `${ region } -${ instance . Uid } ` ,
42- ...instance ,
43- region,
44- } )
45- }
37+ if ( response && ! isEmpty ( response . Data ) ) {
38+ for ( const instance of response . Data ) {
39+ camUserList . push ( {
40+ id : `${ instance . Uid } ` ,
41+ ...instance ,
42+ region : regionMap . global ,
43+ } )
4644 }
47- } catch ( error ) {
48- generateTencentErrorLog ( serviceName , 'cam:ListUsers' , error )
4945 }
46+ } catch ( error ) {
47+ generateTencentErrorLog ( serviceName , 'cam:ListUsers' , error )
5048 }
49+
5150 logger . debug ( lt . foundResources ( serviceName , camUserList . length ) )
5251 resolve ( groupBy ( camUserList , 'region' ) )
5352 } )
0 commit comments