function isApplicable()

in blogs/awsconfig-docdb/lib/functions/instances-homogeneous-rule/index.js [76:94]


function isApplicable(configurationItem, event) {
  checkDefined(configurationItem, 'configurationItem');
  
  // if eventLeftScope is true the resource to be evaluated has been removed
  // https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_develop-rules_example-events.html
  const eventLeftScope = event.eventLeftScope;
  if (eventLeftScope) {
    return false;
  }

  checkDefined(configurationItem.configuration, 'configurationItem.configuration');
  if (configurationItem.resourceType !== 'AWS::RDS::DBInstance' || configurationItem.configuration.engine !== 'docdb') {
    console.log('This is not a DocumentDB instance');
    return false;
  }

  const status = configurationItem.configurationItemStatus;  
  return (status === 'OK' || status === 'ResourceDiscovered') && eventLeftScope === false;
}