44 *
55 * Base class for AWS Lambda based collectors.
66 *
7+ * Last message ID: AWSC0010
78 * @end
89 * -----------------------------------------------------------------------------
910 */
@@ -124,7 +125,7 @@ class AlAwsCollector {
124125 return mapCallback ( null , resp ) ;
125126 } )
126127 . catch ( function ( exception ) {
127- return mapCallback ( `Endpoints ${ service } update failure ${ exception } ` ) ;
128+ return mapCallback ( `AWSC0001 Endpoints ${ service } update failure ${ exception } ` ) ;
128129 } ) ;
129130 } ,
130131 function ( mapErr , mapResult ) {
@@ -157,7 +158,7 @@ class AlAwsCollector {
157158 // register even if there is an error in getting the endpoints.
158159 this . updateEndpoints ( ( err , newConfig ) => {
159160 if ( err ) {
160- console . warn ( 'Error updating endpoints' , err ) ;
161+ console . warn ( 'AWSC0002 Error updating endpoints' , err ) ;
161162 } else {
162163 // reassign env vars because the config change occurs in the same run in registration.
163164 const {
@@ -183,7 +184,7 @@ class AlAwsCollector {
183184 asyncCallback ( null ) ;
184185 } )
185186 . catch ( exception => {
186- asyncCallback ( " registration error: " + exception ) ;
187+ asyncCallback ( 'AWSC0003 registration error: ' + exception ) ;
187188 } ) ;
188189 }
189190 ] ,
@@ -222,7 +223,7 @@ class AlAwsCollector {
222223 collector . _azcollectc . checkin ( checkin )
223224 . then ( resp => {
224225 if ( resp && resp . force_update === true ) {
225- console . info ( " Force update" ) ;
226+ console . info ( 'AWSC0004 Force update' ) ;
226227 return collector . update ( callback ) ;
227228 }
228229 else {
@@ -280,7 +281,7 @@ class AlAwsCollector {
280281 } ) ;
281282 break ;
282283 default :
283- return callback ( `Unknown Alertlogic ingestion type: ${ ingestType } ` ) ;
284+ return callback ( `AWSC0005 Unknown Alertlogic ingestion type: ${ ingestType } ` ) ;
284285 }
285286 }
286287 } ) ;
@@ -350,17 +351,32 @@ class AlAwsCollector {
350351 ] ,
351352 function ( err , config ) {
352353 if ( err ) {
353- console . info ( 'Lambda self-update config error: ' , err ) ;
354+ console . info ( 'AWSC0006 Lambda self-update config error: ' , err ) ;
354355 } else {
355356 if ( config !== undefined ) {
356- console . info ( 'Lambda self-update config successful. Config: ' , config ) ;
357+ console . info ( 'AWSC0007 Lambda self-update config successful. Config: ' , config ) ;
357358 } else {
358- console . info ( 'Lambda self-update config nothing to update' ) ;
359+ console . info ( 'AWSC0008 Lambda self-update config nothing to update' ) ;
359360 }
360361 }
361362 callback ( err , config ) ;
362363 } ) ;
363364 }
365+
366+ handleDefaultEvents ( scheduledEvent , callback ) {
367+ let collector = this ;
368+
369+ switch ( scheduledEvent . Type ) {
370+ case 'SelfUpdate' :
371+ return collector . update ( callback ) ;
372+ break ;
373+ case 'Checkin' :
374+ return collector . checkin ( callback ) ;
375+ break ;
376+ default :
377+ return callback ( 'AWSC0009 Unknown scheduled event detail type: ' + scheduledEvent . Type ) ;
378+ }
379+ }
364380
365381 _applyConfigChanges ( newValues , config , callback ) {
366382 var jsonConfig = JSON . stringify ( config ) ;
@@ -376,7 +392,7 @@ class AlAwsCollector {
376392 return callback ( null , newConfig ) ;
377393 }
378394 catch ( ex ) {
379- return callback ( 'Unable to apply new config values' ) ;
395+ return callback ( 'AWSC0010 Unable to apply new config values' ) ;
380396 }
381397 }
382398
0 commit comments