function isApplicable()

in blogs/awsconfig-docdb/lib/functions/cluster-backup-retention-rule/index.js [75:93]


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::DBCluster' || configurationItem.configuration.engine !== 'docdb') {
    console.log('This is not a DocumentDB cluster');
    return false;
  }

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