@@ -54,33 +54,40 @@ const getElbTags = async (
5454 )
5555 } )
5656
57- const listElbData = async (
58- elb : ELB
59- ) : Promise < LoadBalancerDescription [ ] > =>
60- new Promise < LoadBalancerDescription [ ] > ( resolve => {
61- let loadBalancerData : LoadBalancerDescription [ ] = [ ]
62- elb . describeLoadBalancers (
63- ( err : AWSError , data : DescribeAccessPointsOutput ) => {
64- if ( err ) {
65- errorLog . generateAwsErrorLog ( {
66- functionName : 'elb:describeLoadBalancers' ,
67- err,
68- } )
69- }
70- if ( ! isEmpty ( data ) ) {
71- const { LoadBalancerDescriptions : loadBalancerDescriptions = [ ] } =
72- data
73- logger . debug ( lt . fetchedElbs ( loadBalancerDescriptions . length ) )
74- loadBalancerData = loadBalancerDescriptions . map ( lbDescription => ( {
75- ...lbDescription ,
76- } ) )
77- resolve ( loadBalancerData )
57+ const listElbData = async ( elb : ELB ) : Promise < LoadBalancerDescription [ ] > => {
58+ const loadBalancerData : LoadBalancerDescription [ ] = [ ]
59+ return new Promise < LoadBalancerDescription [ ] > ( resolve => {
60+ const listAllData = ( nextToken ?: string ) : void => {
61+ elb . describeLoadBalancers (
62+ { Marker : nextToken } ,
63+ ( err : AWSError , data : DescribeAccessPointsOutput ) => {
64+ if ( err ) {
65+ errorLog . generateAwsErrorLog ( {
66+ functionName : 'elb:describeLoadBalancers' ,
67+ err,
68+ } )
69+ }
70+ if ( ! isEmpty ( data ) ) {
71+ const { LoadBalancerDescriptions : loadBalancerDescriptions = [ ] } =
72+ data
73+ logger . debug ( lt . fetchedElbs ( loadBalancerDescriptions . length ) )
74+ loadBalancerData . push (
75+ ...loadBalancerDescriptions . map ( lbDescription => ( {
76+ ...lbDescription ,
77+ } ) )
78+ )
79+ }
80+ if ( data . NextMarker ) {
81+ listAllData ( data . NextMarker )
82+ } else {
83+ resolve ( loadBalancerData )
84+ }
7885 }
79-
80- resolve ( loadBalancerData )
81- }
82- )
86+ )
87+ }
88+ listAllData ( )
8389 } )
90+ }
8491
8592const listElbAttributes = async (
8693 elb : ELB ,
@@ -127,7 +134,7 @@ export interface RawAwsElb extends LoadBalancerDescription {
127134export default async ( {
128135 regions,
129136 config,
130- account
137+ account,
131138} : {
132139 regions : string
133140 account : string
@@ -143,7 +150,9 @@ export default async ({
143150 return new Promise < void > ( async resolveElbData => {
144151 // Get Load Balancer Data
145152 const elbDescriptionData = await listElbData ( elbInstance )
146- const elbNames : string [ ] = elbDescriptionData . map ( elb => elb . LoadBalancerName )
153+ const elbNames : string [ ] = elbDescriptionData . map (
154+ elb => elb . LoadBalancerName
155+ )
147156
148157 if ( ! isEmpty ( elbNames ) ) {
149158 // Get Tags
0 commit comments