<commit_before>coreo_aws_rule "rds-inventory" do
  action :define
  service :rds
  # link "http://kb.cloudcoreo.com/mydoc_ec2-inventory.html"
  include_violations_in_count false
  display_name "RDS Instance Inventory"
  description "This rule performs an inventory on all RDS DB instances in the target AWS account."
  category "Inventory"
  suggested_action "None."
  level "Informational"
  objectives ["db_instances"]
  audit_objects ["object.db_instances.db_instance_identifier"]
  operators ["=~"]
  raise_when [//]
  id_map "object.db_instances.db_instance_identifier"
end

coreo_aws_rule_runner "advise-rds" do
  service :rds
  rules ${AUDIT_AWS_RDS_ALERT_LIST}
  action :run
  regions ${AUDIT_AWS_RDS_REGIONS}
end


coreo_uni_util_variables "rds-update-planwide-1" do
  action :set
  variables([
                {'GLOBAL::results' => 'COMPOSITE::coreo_aws_rule_runner.advise-rds.report'}
            ])
end


coreo_uni_util_variables "test-global" do
  action :set
  variables([
                {'GLOBAL::test_var' => 'lalalala'},
                {'GLOBAL::test2' => 'coreo_uni_util_variables'},
            ])
end<commit_msg>test global<commit_after>coreo_uni_util_jsrunner "tags-to-notifiers-array-rds" do
  action :run
  data_type "json"
  provide_composite_access true
  packages([
               {
                   :name => "cloudcoreo-jsrunner-commons",
                   :version => "1.10.7-9"
               },
               {
                   :name => "js-yaml",
                   :version => "3.7.0"
               }
                  ])
  json_input '{}'
  function <<-EOH
function setTableAndSuppression() {
  let table;
  let suppression;
  const fs = require('fs');
  const yaml = require('js-yaml');
  try {
      suppression = yaml.safeLoad(fs.readFileSync('./suppression.yaml', 'utf8'));
  } catch (e) {
      console.log("Error reading suppression.yaml file: " , e);
      suppression = {};
  }
  try {
      table = yaml.safeLoad(fs.readFileSync('./table.yaml', 'utf8'));
  } catch (e) {
      console.log("Error reading table.yaml file: ", e);
      table = {};
  }
  coreoExport('table', JSON.stringify(table));
  coreoExport('suppression', JSON.stringify(suppression));
}
setTableAndSuppression();
  EOH
end

coreo_uni_util_variables "test" do
  action :set
  variables([
                {'GLOBAL::results' => 'should be updated'},
                {'GLOBAL::table' => 'COMPOSITE::coreo_uni_util_jsrunner.tags-to-notifiers-array-rds.table'}
            ])
end

coreo_uni_util_variables "test-global" do
  action :set
  variables([
                {'GLOBAL::results' => 'new value'}
            ])
end
{'fraction_non_alphanumeric': 0.13012139605462822, 'fraction_numerical': 0.004931714719271623, 'mean_word_length': 2.761768901569187, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2440270', 'n_tokens_mistral': 875, 'n_tokens_neox': 861, 'n_words': 165}