--- policy: /ce/ca/aws/rds/cluster-backup-retention logic: /ce/ca/aws/rds/cluster-backup-retention/prod.logic.yaml executionTime: 2026-04-25T12:03:34.243682495Z generationMs: 59 executionMs: 2245 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10__disappearanceTime__c) actual: isDisappeared(CA10__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10__status__c') != 'available' actual: extract('CA10__status__c') != 'available' runtimeError: {} - id: test3 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 299 actual: 299 conditionText: expected: "not(setOfText(['aurora-postgresql', 'aurora-mysql', 'mysql', 'postgres',\ \ 'docdb', 'neptune']).contains(extract('CA10__engine__c')))" actual: "not(setOfText(['aurora-postgresql', 'aurora-mysql', 'mysql', 'postgres',\ \ 'docdb', 'neptune']).contains(extract('CA10__engine__c')))" runtimeError: {} - id: test4 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10__backupRetentionPeriod__c') < number(7.0) actual: extract('CA10__backupRetentionPeriod__c') < number(7.0) runtimeError: {} - id: test5 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: extract('CA10__backupRetentionPeriod__c') >= number(7.0) actual: extract('CA10__backupRetentionPeriod__c') >= number(7.0) runtimeError: {} - id: test6 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10__backupRetentionPeriod__c') < number(7.0) actual: extract('CA10__backupRetentionPeriod__c') < number(7.0) runtimeError: {} - id: test7 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: extract('CA10__backupRetentionPeriod__c') >= number(7.0) actual: extract('CA10__backupRetentionPeriod__c') >= number(7.0) runtimeError: {} - id: test8 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: extract('CA10__backupRetentionPeriod__c') < number(7.0) actual: extract('CA10__backupRetentionPeriod__c') < number(7.0) runtimeError: {} - id: test9 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: extract('CA10__backupRetentionPeriod__c') >= number(7.0) actual: extract('CA10__backupRetentionPeriod__c') >= number(7.0) runtimeError: {} usedFiles: - path: /ce/ca/aws/rds/cluster-backup-retention/policy.yaml md5Hash: 3BEF0C58A4F5CEA8FB7DB468CB94D6DA content: | --- names: full: "AWS RDS Cluster Backup Retention Period is less than 7 days" contextual: "Cluster Backup Retention Period is less than 7 days" description: > Ensure that AWS RDS DB clusters retain automated backups for at least 7 days. Adequate backup retention improves point-in-time recovery and reduces the risk of data loss during operational failures or security incidents. type: "COMPLIANCE_POLICY" categories: - "SECURITY" frameworkMappings: - "/frameworks/cloudaware/resource-security/data-protection-and-recovery" - "/frameworks/aws-fsbp-v1.0.0/documentdb/02" - "/frameworks/aws-fsbp-v1.0.0/neptune/05" similarPolicies: awsSecurityHub: - name: "[RDS.50] RDS DB clusters should have enough backup retention period set" url: "https://docs.aws.amazon.com/securityhub/latest/userguide/rds-controls.html#rds-50" - name: "[DocumentDB.2] Amazon DocumentDB clusters should have an adequate backup retention period" url: "https://docs.aws.amazon.com/securityhub/latest/userguide/documentdb-controls.html#documentdb-2" - name: "[Neptune.5] Neptune DB clusters should have automated backups enabled" url: "https://docs.aws.amazon.com/securityhub/latest/userguide/neptune-controls.html#neptune-5" - path: /ce/ca/aws/rds/cluster-backup-retention/prod.logic.yaml md5Hash: F350BE8BD4F46BE118AAEBDCCAC22DF1 content: | --- inputType: "CA10__CaAwsDbCluster__c" testData: - file: "test-data.json" importExtracts: - file: "/types/CA10__CaAwsDbCluster__c/object.extracts.yaml" conditions: - status: "INAPPLICABLE" currentStateMessage: "The cluster is not available." check: NOT_EQUAL: left: EXTRACT: "CA10__status__c" right: TEXT: "available" - status: "INAPPLICABLE" currentStateMessage: "This policy applies only to Aurora, RDS Multi-AZ MySQL and PostgreSQL, DocumentDB, and Neptune clusters." check: NOT: arg: CONTAINS: arg: SET: itemType: "TEXT" items: - "aurora-postgresql" - "aurora-mysql" - "mysql" - "postgres" - "docdb" - "neptune" search: EXTRACT: "CA10__engine__c" - status: "INCOMPLIANT" currentStateMessage: "The cluster backup retention period is less than 7 days." remediationMessage: "Set the cluster backup retention period to at least 7 days." check: LESS_THAN: left: EXTRACT: "CA10__backupRetentionPeriod__c" right: NUMBER: 7.0 - status: "COMPLIANT" currentStateMessage: "The cluster backup retention period is at least 7 days." check: GREATER_THAN_EQUAL: left: EXTRACT: "CA10__backupRetentionPeriod__c" right: NUMBER: 7.0 otherwise: status: "UNDETERMINED" currentStateMessage: "Unexpected values were found in the cluster status, engine, or backup retention period." - path: /ce/ca/aws/rds/cluster-backup-retention/test-data.json md5Hash: A53966258148EB3F17C7A02A31C430AC content: | [ { "expectedResult": { "runtimeError": null, "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "conditionIndex": 99, "status": "DISAPPEARED" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "CA10__status__c": "available", "CA10__engine__c": "aurora-mysql", "CA10__backupRetentionPeriod__c": 7, "Id": "test1", "CA10__disappearanceTime__c": "2026-01-20T22:12:18Z" }, { "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__status__c') != 'available'", "conditionIndex": 199, "status": "INAPPLICABLE" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "CA10__disappearanceTime__c": null, "CA10__status__c": "creating", "CA10__engine__c": "aurora-postgresql", "CA10__backupRetentionPeriod__c": 7, "Id": "test2" }, { "expectedResult": { "runtimeError": null, "conditionText": "not(setOfText(['aurora-postgresql', 'aurora-mysql', 'mysql', 'postgres', 'docdb', 'neptune']).contains(extract('CA10__engine__c')))", "conditionIndex": 299, "status": "INAPPLICABLE" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "CA10__disappearanceTime__c": null, "CA10__status__c": "available", "CA10__engine__c": "custom-engine", "CA10__backupRetentionPeriod__c": 7, "Id": "test3" }, { "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__backupRetentionPeriod__c') < number(7.0)", "conditionIndex": 399, "status": "INCOMPLIANT" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "CA10__disappearanceTime__c": null, "CA10__status__c": "available", "CA10__engine__c": "aurora-mysql", "CA10__backupRetentionPeriod__c": 1, "Id": "test4" }, { "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__backupRetentionPeriod__c') >= number(7.0)", "conditionIndex": 499, "status": "COMPLIANT" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "CA10__disappearanceTime__c": null, "CA10__status__c": "available", "CA10__engine__c": "aurora-postgresql", "CA10__backupRetentionPeriod__c": 7, "Id": "test5" }, { "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__backupRetentionPeriod__c') < number(7.0)", "conditionIndex": 399, "status": "INCOMPLIANT" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "CA10__disappearanceTime__c": null, "CA10__status__c": "available", "CA10__engine__c": "mysql", "CA10__backupRetentionPeriod__c": 3, "Id": "test6" }, { "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__backupRetentionPeriod__c') >= number(7.0)", "conditionIndex": 499, "status": "COMPLIANT" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "CA10__disappearanceTime__c": null, "CA10__status__c": "available", "CA10__engine__c": "postgres", "CA10__backupRetentionPeriod__c": 14, "Id": "test7" }, { "expectedResult": { "runtimeError": null, "conditionText": "extract('CA10__backupRetentionPeriod__c') < number(7.0)", "conditionIndex": 399, "status": "INCOMPLIANT" }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "CA10__disappearanceTime__c": null, "CA10__status__c": "available", "CA10__engine__c": "docdb", "CA10__backupRetentionPeriod__c": 1, "Id": "test8" }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": 499, "conditionText": "extract('CA10__backupRetentionPeriod__c') >= number(7.0)", "runtimeError": null }, "context": { "snapshotTime": "2026-01-30T10:53:34Z" }, "CA10__disappearanceTime__c": null, "CA10__status__c": "available", "CA10__engine__c": "neptune", "CA10__backupRetentionPeriod__c": 7, "Id": "test9" } ] - path: /types/CA10__CaAwsDbCluster__c/object.extracts.yaml md5Hash: 8AACD486F39325BBBA7FE4FA3BE340E9 content: | --- extracts: - name: CA10__engine__c value: FIELD: path: CA10__engine__c undeterminedIf: # https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-clusters.html # "Engine" attribute represents a non-nullable string. isEmpty: DB Engine value cannot be empty. Potential data corruption. # Values: Yes | No. Not nullable. Cannot have no access, retrieved via rds:DescribeDBClusters - name: CA10__autoMinorVersionUpgrade__c value: FIELD: path: CA10__autoMinorVersionUpgrade__c # Number. Can't have no access, retrieved via rds:DescribeDBClusters - name: CA10__backupRetentionPeriod__c value: FIELD: path: CA10__backupRetentionPeriod__c # Number. Can't have no access, retrieved via rds:DescribeDBClusters - name: CA10__backtrackWindow__c value: FIELD: path: CA10__backtrackWindow__c # Checkbox. - name: CA10__multiAZ__c value: FIELD: path: CA10__multiAZ__c # Checkbox. - name: CA10__storageEncrypted__c value: FIELD: path: CA10__storageEncrypted__c # Text. - name: CA10__masterUsername__c value: FIELD: path: CA10__masterUsername__c # Checkbox. - name: CA10__iamDatabaseAuthenticationEnabled__c value: FIELD: path: CA10__iamDatabaseAuthenticationEnabled__c - name: CA10__status__c value: FIELD: path: CA10__status__c undeterminedIf: # https://docs.aws.amazon.com/cli/latest/reference/rds/describe-db-clusters.html # "Engine" attribute represents a non-nullable string. isEmpty: DB Status value cannot be empty. Potential data corruption. # Nullable. Can't have no access, retrieved via rds:DescribeDBClusters - name: CA10__enabledCloudwatchLogsExports__c value: FIELD: path: CA10__enabledCloudwatchLogsExports__c # Checkbox. - name: CA10__copyTagsToSnapshot__c value: FIELD: path: CA10__copyTagsToSnapshot__c script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "runtimeError" : null, "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "conditionIndex" : 99, "status" : "DISAPPEARED" } }, { "Id" : "test2", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__status__c') != 'available'", "conditionIndex" : 199, "status" : "INAPPLICABLE" } }, { "Id" : "test3", "expectedResult" : { "runtimeError" : null, "conditionText" : "not(setOfText(['aurora-postgresql', 'aurora-mysql', 'mysql', 'postgres', 'docdb', 'neptune']).contains(extract('CA10__engine__c')))", "conditionIndex" : 299, "status" : "INAPPLICABLE" } }, { "Id" : "test4", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__backupRetentionPeriod__c') < number(7.0)", "conditionIndex" : 399, "status" : "INCOMPLIANT" } }, { "Id" : "test5", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__backupRetentionPeriod__c') >= number(7.0)", "conditionIndex" : 499, "status" : "COMPLIANT" } }, { "Id" : "test6", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__backupRetentionPeriod__c') < number(7.0)", "conditionIndex" : 399, "status" : "INCOMPLIANT" } }, { "Id" : "test7", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__backupRetentionPeriod__c') >= number(7.0)", "conditionIndex" : 499, "status" : "COMPLIANT" } }, { "Id" : "test8", "expectedResult" : { "runtimeError" : null, "conditionText" : "extract('CA10__backupRetentionPeriod__c') < number(7.0)", "conditionIndex" : 399, "status" : "INCOMPLIANT" } }, { "Id" : "test9", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : 499, "conditionText" : "extract('CA10__backupRetentionPeriod__c') >= number(7.0)", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsDbCluster__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__disappearanceTime__c" : new Date("2026-01-20T22:12:18Z"), "CA10__status__c" : "available", "CA10__engine__c" : "aurora-mysql", "CA10__backupRetentionPeriod__c" : 7, "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "creating", "CA10__engine__c" : "aurora-postgresql", "CA10__backupRetentionPeriod__c" : 7, "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "custom-engine", "CA10__backupRetentionPeriod__c" : 7, "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "aurora-mysql", "CA10__backupRetentionPeriod__c" : 1, "Id" : "test4" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "aurora-postgresql", "CA10__backupRetentionPeriod__c" : 7, "Id" : "test5" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "mysql", "CA10__backupRetentionPeriod__c" : 3, "Id" : "test6" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "postgres", "CA10__backupRetentionPeriod__c" : 14, "Id" : "test7" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "docdb", "CA10__backupRetentionPeriod__c" : 1, "Id" : "test8" }, { "context" : { "snapshotTime" : new Date("2026-01-30T10:53:34Z") }, "CA10__status__c" : "available", "CA10__engine__c" : "neptune", "CA10__backupRetentionPeriod__c" : 7, "Id" : "test9" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsDbCluster__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__status__c STRING, CA10__engine__c STRING, CA10__backupRetentionPeriod__c FLOAT64, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var CollectionLib = new function () { this.parse = function(arg, separator, skipEmpty, skipDuplicates, sort, normalize) { if (arg == null) return []; let parts = arg.split(separator); return this.fromArray(parts, skipEmpty, skipDuplicates, sort, normalize); }; this.fromArray = function(arr, skipEmpty, skipDuplicates, sort, normalize) { if (arr == null) return []; let result = []; let seen = new Set(); arr.forEach(el => { let normalized = normalize ? TextLib.normalize(el) : BytesLib.normalize(el); if (!skipEmpty || (normalize ? TextLib.isNotEmpty(el) : BytesLib.isNotEmpty(el))) { if (!skipDuplicates || !seen.has(normalized)) { if (skipDuplicates) seen.add(normalized); result.push(normalized); } } }); if (sort) result.sort(); return result; }; this.equal = function(left, right) { left = left == null ? [] : left; right = right == null ? [] : right; if (left.length !== right.length) return false; for (let i = 0; i < left.length; i++) { if (left[i] !== right[i]) return false; } return true; }; this.notEqual = function(left, right) { return !this.equal(left, right); }; this.size = function(collection) { return collection == null ? 0 : collection.length; }; this.startsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[0] === normalizedSearch; }; this.endsWith = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; let normalizedSearch = normalize ? TextLib.normalize(search) : BytesLib.normalize(search); return collection[collection.length - 1] === normalizedSearch; }; this.contains = function(collection, search, normalize) { if (collection == null || collection.length === 0) return false; return collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search)); }; this.containsAll = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.every(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; this.containsAny = function(collection, searchArray, normalize) { if (collection == null || collection.length === 0 || searchArray == null || searchArray.length === 0) return false; return searchArray.some(search => collection.includes(normalize ? TextLib.normalize(search) : BytesLib.normalize(search))); }; }(); var BytesLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg; }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var TextLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase(); }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] function fieldChecked4() { if (TextLib.isEmpty(obj.CA10__status__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__status__c.isEmpty()", currentStateMessage: "DB Status value cannot be empty. Potential data corruption.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__status__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; references1.push('Status [obj.CA10__status__c]: ' + obj.CA10__status__c); try { if (TextLib.notEqual(extract3.call(extract3), 'available')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__status__c') != 'available'", currentStateMessage: "The cluster is not available.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[2], conditionIndex:[200..299] function fieldChecked7() { if (TextLib.isEmpty(obj.CA10__engine__c)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10__engine__c.isEmpty()", currentStateMessage: "DB Engine value cannot be empty. Potential data corruption.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__engine__c; } function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; }; references1.push('Engine [obj.CA10__engine__c]: ' + obj.CA10__engine__c); try { if (!CollectionLib.contains(CollectionLib.fromArray(['aurora-postgresql', 'aurora-mysql', 'mysql', 'postgres', 'docdb', 'neptune'], true, true, true, true), extract6.call(extract6), true)) { return {status: 'INAPPLICABLE', conditionIndex: 299, conditionText: "not(setOfText(['aurora-postgresql', 'aurora-mysql', 'mysql', 'postgres', 'docdb', 'neptune']).contains(extract('CA10__engine__c')))", currentStateMessage: "This policy applies only to Aurora, RDS Multi-AZ MySQL and PostgreSQL, DocumentDB, and Neptune clusters.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[3], conditionIndex:[300..399] function extract10() { if (!this.out) { this.out = obj.CA10__backupRetentionPeriod__c; } return this.out; }; references1.push('Backup Retention Period [obj.CA10__backupRetentionPeriod__c]: ' + obj.CA10__backupRetentionPeriod__c); if (extract10.call(extract10) != null && 7.0 != null && extract10.call(extract10) < 7.0) { return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__backupRetentionPeriod__c') < number(7.0)", currentStateMessage: "The cluster backup retention period is less than 7 days.", currentStateReferences: references1.join('\n'), remediation: "Set the cluster backup retention period to at least 7 days.", runtimeError: null}; } // condition[4], conditionIndex:[400..499] function extract14() { if (!this.out) { this.out = obj.CA10__backupRetentionPeriod__c; } return this.out; }; if (extract14.call(extract14) != null && 7.0 != null && extract14.call(extract14) >= 7.0) { return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "extract('CA10__backupRetentionPeriod__c') >= number(7.0)", currentStateMessage: "The cluster backup retention period is at least 7 days.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 500, conditionText: "otherwise", currentStateMessage: "Unexpected values were found in the cluster status, engine, or backup retention period.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; SELECT expectedResult.Id as Id, IF ( IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '') AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1) AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '') AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''), "MATCH", "FAIL" ) as match, expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus, expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex, expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText, expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError FROM UNNEST(mock_ExpectedResult()) expectedResult LEFT JOIN ( SELECT sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__status__c AS CA10__status__c, sObject.CA10__engine__c AS CA10__engine__c, sObject.CA10__backupRetentionPeriod__c AS CA10__backupRetentionPeriod__c, sObject.Id AS Id, process_CA10__CaAwsDbCluster__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__status__c AS CA10__status__c, sObject.CA10__engine__c AS CA10__engine__c, sObject.CA10__backupRetentionPeriod__c AS CA10__backupRetentionPeriod__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsDbCluster__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;