--- policy: /ce/ca/azure/mysql-database/flexible-server-audit-log-events-parameter logic: /ce/ca/azure/mysql-database/flexible-server-audit-log-events-parameter/prod.logic.yaml executionTime: 2026-02-10T22:33:31.649858793Z generationMs: 54 executionMs: 809 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10Z1__disappearanceTime__c) actual: isDisappeared(CA10Z1__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 499 actual: 499 conditionText: expected: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name ==\ \ \\'audit_log_enabled\\'].value | [0]') == 'on' && extract('caJsonFrom__configurations__c').jsonQueryText('[?\ \ name == \\'audit_log_events\\'].value | [0]') == 'CONNECTION'" actual: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name ==\ \ \\'audit_log_enabled\\'].value | [0]') == 'on' && extract('caJsonFrom__configurations__c').jsonQueryText('[?\ \ name == \\'audit_log_events\\'].value | [0]') == 'CONNECTION'" runtimeError: {} - id: test3 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name ==\ \ \\'audit_log_enabled\\'].value | [0]') == 'off'" actual: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name ==\ \ \\'audit_log_enabled\\'].value | [0]') == 'off'" runtimeError: {} - id: test4 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 500 actual: 500 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test5 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 201 actual: 201 conditionText: expected: CA10Z1__configurations__c.delegatedTo(CA10Z1__configurations__c).isEmpty() actual: CA10Z1__configurations__c.delegatedTo(CA10Z1__configurations__c).isEmpty() runtimeError: {} - id: test6 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10Z1__deploymentMode__c') != 'Flexible' actual: extract('CA10Z1__deploymentMode__c') != 'Flexible' runtimeError: {} - id: test7 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name ==\ \ \\'audit_log_enabled\\'].value | [0]') == 'on' && extract('caJsonFrom__configurations__c').jsonQueryText('[?\ \ name == \\'audit_log_events\\'].value | [0]') != 'CONNECTION'" actual: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name ==\ \ \\'audit_log_enabled\\'].value | [0]') == 'on' && extract('caJsonFrom__configurations__c').jsonQueryText('[?\ \ name == \\'audit_log_events\\'].value | [0]') != 'CONNECTION'" runtimeError: {} usedFiles: - path: /ce/ca/azure/mysql-database/flexible-server-audit-log-events-parameter/policy.yaml md5Hash: 08B32B3A47DDFBAEB5D38086EB367D91 content: | --- names: full: Azure MySQL Flexible Server audit_log_events Parameter is not set with the CONNECTION event contextual: Flexible Server audit_log_events Parameter is not set with the CONNECTION event description: Set audit_log_events to include CONNECTION on MySQL flexible servers. type: COMPLIANCE_POLICY categories: - RELIABILITY - PERFORMANCE frameworkMappings: - /frameworks/cis-azure-v3.0.0/05/03/04 - /frameworks/cloudaware/logging-and-monitoring/logging-and-monitoring-configuration - path: /ce/ca/azure/mysql-database/flexible-server-audit-log-events-parameter/prod.logic.yaml md5Hash: 63207E71EBF5523B3F863DE502E16CA1 content: "---\ninputType: \"CA10Z1__CaAzureMySqlServer__c\"\ntestData:\n - file:\ \ \"test-data.json\"\nimportExtracts:\n - file: \"/types/CA10Z1__CaAzureMySqlServer__c/object.extracts.yaml\"\ \nconditions:\n - status: \"INAPPLICABLE\"\n currentStateMessage: \"This\ \ is not the flexible server deployment mode.\"\n check:\n NOT_EQUAL:\n\ \ left:\n EXTRACT: \"CA10Z1__deploymentMode__c\"\n right:\n\ \ TEXT: \"Flexible\"\n - status: \"INCOMPLIANT\"\n currentStateMessage:\ \ \"MySQL Flexible Server audit_log_enabled configuration parameter is disabled.\"\ \n remediationMessage: \"Enable the audit_log_enabled parameter on the MySQL\ \ Flexible Server.\"\n check:\n IS_EQUAL:\n left:\n \ \ JSON_QUERY_TEXT:\n arg: \n EXTRACT: \"caJsonFrom__configurations__c\"\ \n expression: \"[? name == 'audit_log_enabled'].value | [0]\"\n\ \ undeterminedIf: \n evaluationError: \"The JSON\ \ query has failed.\"\n resultTypeMismatch: \"The JSON query\ \ did not return text type.\"\n right:\n TEXT: \"off\"\n -\ \ status: \"INCOMPLIANT\"\n currentStateMessage: \"MySQL Flexible Server\ \ audit_log_events configuration parameter is not set to CONNECTION.\"\n \ \ remediationMessage: \"Set the audit_log_events parameter to CONNECTION.\"\n\ \ check:\n AND:\n args:\n - IS_EQUAL:\n left:\n\ \ JSON_QUERY_TEXT:\n arg: \n \ \ EXTRACT: \"caJsonFrom__configurations__c\"\n expression:\ \ \"[? name == 'audit_log_enabled'].value | [0]\"\n undeterminedIf:\ \ \n evaluationError: \"The JSON query has failed.\"\n \ \ resultTypeMismatch: \"The JSON query did not return text\ \ type.\"\n right:\n TEXT: \"on\"\n - NOT_EQUAL:\n\ \ left:\n JSON_QUERY_TEXT:\n arg: \n\ \ EXTRACT: \"caJsonFrom__configurations__c\"\n \ \ expression: \"[? name == 'audit_log_events'].value | [0]\"\n \ \ undeterminedIf: \n evaluationError: \"The JSON\ \ query has failed.\"\n resultTypeMismatch: \"The JSON query\ \ did not return text type.\"\n right:\n TEXT: \"CONNECTION\"\ \n - status: \"COMPLIANT\"\n currentStateMessage: \"MySQL Flexible Server\ \ audit_log_events configuration parameter is set to CONNECTION.\"\n check:\n\ \ AND:\n args:\n - IS_EQUAL:\n left:\n \ \ JSON_QUERY_TEXT:\n arg: \n EXTRACT:\ \ \"caJsonFrom__configurations__c\"\n expression: \"[? name\ \ == 'audit_log_enabled'].value | [0]\"\n undeterminedIf: \n\ \ evaluationError: \"The JSON query has failed.\"\n \ \ resultTypeMismatch: \"The JSON query did not return text type.\"\ \n right:\n TEXT: \"on\"\n - IS_EQUAL:\n \ \ left:\n JSON_QUERY_TEXT:\n arg: \n \ \ EXTRACT: \"caJsonFrom__configurations__c\"\n \ \ expression: \"[? name == 'audit_log_events'].value | [0]\"\n \ \ undeterminedIf: \n evaluationError: \"The JSON\ \ query has failed.\"\n resultTypeMismatch: \"The JSON query\ \ did not return text type.\"\n right:\n TEXT: \"CONNECTION\"\ \notherwise:\n status: \"UNDETERMINED\"\n currentStateMessage: \"Unexpected\ \ value in the field.\"\n" - path: /ce/ca/azure/mysql-database/flexible-server-audit-log-events-parameter/test-data.json md5Hash: A820ED1D2BE98D6B54D79E291EC30D7E content: | [ { "expectedResult":{ "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10Z1__disappearanceTime__c)", "runtimeError": null }, "context":{ "snapshotTime": "2024-06-13T04:17:29Z" }, "Id": "test1", "CA10Z1__disappearanceTime__c": "2024-06-13T04:17:29Z", "CA10Z1__configurations__c": "[{\"name\":\"audit_log_enabled\",\"value\":\"on\"}]", "CA10Z1__deploymentMode__c": "Flexible" }, { "expectedResult":{ "status": "COMPLIANT", "conditionIndex": "499", "conditionText": "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]') == 'on' && extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_events\\'].value | [0]') == 'CONNECTION'", "runtimeError": null }, "context":{ "snapshotTime": "2024-06-13T04:17:29Z" }, "Id": "test2", "CA10Z1__disappearanceTime__c": null, "CA10Z1__configurations__c": "[{\"name\":\"audit_log_enabled\",\"value\":\"on\"}, {\"name\":\"audit_log_events\",\"value\":\"CONNECTION\"}]", "CA10Z1__deploymentMode__c": "Flexible" }, { "expectedResult":{ "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]') == 'off'", "runtimeError": null }, "context":{ "snapshotTime": "2024-06-13T04:17:29Z" }, "Id": "test3", "CA10Z1__disappearanceTime__c":null, "CA10Z1__configurations__c": "[{\"name\":\"audit_log_enabled\",\"value\":\"off\"}, {\"name\":\"audit_log_events\",\"value\":\"CONNECTION\"}]", "CA10Z1__deploymentMode__c": "Flexible" }, { "expectedResult":{ "status": "UNDETERMINED", "conditionIndex": "500", "conditionText": "otherwise", "runtimeError": null }, "context":{ "snapshotTime": "2024-06-13T04:17:29Z" }, "Id": "test4", "CA10Z1__disappearanceTime__c": null, "CA10Z1__configurations__c": "[]", "CA10Z1__deploymentMode__c": "Flexible" }, { "expectedResult":{ "status": "UNDETERMINED", "conditionIndex": "201", "conditionText": "CA10Z1__configurations__c.delegatedTo(CA10Z1__configurations__c).isEmpty()", "runtimeError": null }, "context":{ "snapshotTime": "2024-06-13T04:17:29Z" }, "Id": "test5", "CA10Z1__disappearanceTime__c": null, "CA10Z1__configurations__c": null, "CA10Z1__deploymentMode__c": "Flexible" }, { "expectedResult":{ "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "extract('CA10Z1__deploymentMode__c') != 'Flexible'", "runtimeError": null }, "context":{ "snapshotTime": "2024-06-13T04:17:29Z" }, "Id": "test6", "CA10Z1__disappearanceTime__c": null, "CA10Z1__configurations__c": "[{\"name\":\"audit_log_enabled\",\"value\":\"on\"}]", "CA10Z1__deploymentMode__c": "Single" }, { "expectedResult":{ "status": "INCOMPLIANT", "conditionIndex": "399", "conditionText": "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]') == 'on' && extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_events\\'].value | [0]') != 'CONNECTION'", "runtimeError": null }, "context":{ "snapshotTime": "2024-06-13T04:17:29Z" }, "Id": "test7", "CA10Z1__disappearanceTime__c":null, "CA10Z1__configurations__c": "[{\"name\":\"audit_log_enabled\",\"value\":\"on\"}, {\"name\":\"audit_log_events\",\"value\":\"GENERAL\"}]", "CA10Z1__deploymentMode__c": "Flexible" } ] - path: /types/CA10Z1__CaAzureMySqlServer__c/object.extracts.yaml md5Hash: 2B2178E89E751C1A0E34592D0E5F46C4 content: "---\nextracts:\n# Values: Enabled, Disabled. Not Nullable. Can't have\ \ no access, retrieved via Microsoft.DBforMySQL/servers/read\n - name: \"CA10Z1__sslEnforcement__c\"\ \n value: \n FIELD:\n path: \"CA10Z1__sslEnforcement__c\"\n \ \ undeterminedIf:\n isEmpty: \"Corrupted Data. MySQL Server SSL\ \ Enforcement cannot be empty.\"\n# Values: TLS1_0, TLS1_1, TLS1_2, TLSEnforcementDisabled.\ \ Not Nullable. Can't have no access, retrieved via Microsoft.DBforMySQL/servers/read\n\ \ - name: \"CA10Z1__minimalTlsVersion__c\"\n value: \n FIELD:\n \ \ path: \"CA10Z1__minimalTlsVersion__c\"\n undeterminedIf:\n \ \ isEmpty: \"Corrupted Data. MySQL Server Minimal TLS Version cannot be\ \ empty.\"\n - name: \"CA10Z1__deploymentMode__c\"\n value: \n FIELD:\n\ \ path: \"CA10Z1__deploymentMode__c\"\n undeterminedIf:\n \ \ isEmpty: \"Corrupted Data. MySQL Deployment Mode cannot be empty.\"\n\ # Not nullable\n - name: \"CA10Z1__configurations__c\"\n value:\n FIELD:\n\ \ path: \"CA10Z1__configurations__c\"\n returnType: BYTES\n \ \ undeterminedIf:\n noAccessDelegate:\n path: \"CA10Z1__configurations__c\"\ \n currentStateMessage: \"Unable to determine Server Configurations.\ \ Possible permission issue with Microsoft.DBforPostgreSQL/servers/configurations/read\"\ \n - name: \"caJsonFrom__configurations__c\"\n value: \n JSON_FROM:\n\ \ arg: \n EXTRACT: \"CA10Z1__configurations__c\"\n undeterminedIf:\n\ \ isInvalid: \"Configurations JSON is invalid.\"\n# Not nullable \n\ \ - name: \"CA10Z1__state__c\"\n value: \n FIELD:\n path: \"\ CA10Z1__state__c\"\n# Nullable \n - name: \"CA10Z1__monitorCpuPercentAvg30Day__c\"\ \n value: \n FIELD:\n path: \"CA10Z1__monitorCpuPercentAvg30Day__c\"\ \n# Nullable \n - name: \"CA10Z1__monitorMemoryPercentAvg30Day__c\"\n value:\ \ \n FIELD:\n path: \"CA10Z1__monitorMemoryPercentAvg30Day__c\"\n\ # Nullable \n - name: \"CA10Z1__monitorIoConsumptionPercentAvg30Day__c\"\n\ \ value: \n FIELD:\n path: \"CA10Z1__monitorIoConsumptionPercentAvg30Day__c\"\ \n - name: \"CA10Z1__locationName__c\"\n value: \n FIELD:\n \ \ path: \"CA10Z1__locationName__c\"\n\n" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10Z1__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "499", "conditionText" : "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]') == 'on' && extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_events\\'].value | [0]') == 'CONNECTION'", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "299", "conditionText" : "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]') == 'off'", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "500", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test5", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "201", "conditionText" : "CA10Z1__configurations__c.delegatedTo(CA10Z1__configurations__c).isEmpty()", "runtimeError" : null } }, { "Id" : "test6", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "extract('CA10Z1__deploymentMode__c') != 'Flexible'", "runtimeError" : null } }, { "Id" : "test7", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "399", "conditionText" : "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]') == 'on' && extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_events\\'].value | [0]') != 'CONNECTION'", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10Z1__CaAzureMySqlServer__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-06-13T04:17:29Z") }, "CA10Z1__disappearanceTime__c" : new Date("2024-06-13T04:17:29Z"), "CA10Z1__deploymentMode__c" : "Flexible", "CA10Z1__configurations__c" : "[{\"name\":\"audit_log_enabled\",\"value\":\"on\"}]", "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2024-06-13T04:17:29Z") }, "CA10Z1__deploymentMode__c" : "Flexible", "CA10Z1__configurations__c" : "[{\"name\":\"audit_log_enabled\",\"value\":\"on\"}, {\"name\":\"audit_log_events\",\"value\":\"CONNECTION\"}]", "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2024-06-13T04:17:29Z") }, "CA10Z1__deploymentMode__c" : "Flexible", "CA10Z1__configurations__c" : "[{\"name\":\"audit_log_enabled\",\"value\":\"off\"}, {\"name\":\"audit_log_events\",\"value\":\"CONNECTION\"}]", "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2024-06-13T04:17:29Z") }, "CA10Z1__deploymentMode__c" : "Flexible", "CA10Z1__configurations__c" : "[]", "Id" : "test4" }, { "context" : { "snapshotTime" : new Date("2024-06-13T04:17:29Z") }, "CA10Z1__deploymentMode__c" : "Flexible", "CA10Z1__configurations__c" : null, "Id" : "test5" }, { "context" : { "snapshotTime" : new Date("2024-06-13T04:17:29Z") }, "CA10Z1__deploymentMode__c" : "Single", "CA10Z1__configurations__c" : "[{\"name\":\"audit_log_enabled\",\"value\":\"on\"}]", "Id" : "test6" }, { "context" : { "snapshotTime" : new Date("2024-06-13T04:17:29Z") }, "CA10Z1__deploymentMode__c" : "Flexible", "CA10Z1__configurations__c" : "[{\"name\":\"audit_log_enabled\",\"value\":\"on\"}, {\"name\":\"audit_log_events\",\"value\":\"GENERAL\"}]", "Id" : "test7" } ]; """; CREATE TEMP FUNCTION process_CA10Z1__CaAzureMySqlServer__c( obj STRUCT< CA10Z1__disappearanceTime__c TIMESTAMP, CA10Z1__deploymentMode__c STRING, CA10Z1__configurations__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js OPTIONS (library=['gs://compliance-platform-public/jmespath.min.js']) AS r""" 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 Azure [CA10Z1__disappearanceTime__c]: ' + obj.CA10Z1__disappearanceTime__c); if (obj.CA10Z1__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10Z1__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.CA10Z1__deploymentMode__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10Z1__deploymentMode__c.isEmpty()", currentStateMessage: "Corrupted Data. MySQL Deployment Mode cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10Z1__deploymentMode__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; references1.push('Deployment Mode [obj.CA10Z1__deploymentMode__c]: ' + obj.CA10Z1__deploymentMode__c); try { if (TextLib.notEqual(extract3.call(extract3), 'Flexible')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10Z1__deploymentMode__c') != 'Flexible'", currentStateMessage: "This is not the flexible server deployment mode.", 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 jsonQueryChecked5() { var input = extract7.call(extract7); var out; try { out = jmespath.search(input, '[? name == \'audit_log_enabled\'].value | [0]'); if (out != null && typeof out != 'string') { throw new Error("UNDETERMINED condition:203", {cause: {status: 'UNDETERMINED', conditionIndex: 203, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]').isResultTypeMismatch()", currentStateMessage: "The JSON query did not return text type.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } } catch (e) { throw new Error("UNDETERMINED condition:204", {cause: {status: 'UNDETERMINED', conditionIndex: 204, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]').isEvaluationFailed()", currentStateMessage: "The JSON query has failed.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}}); } return out; } function jsonChecked8() { var input = extract10.call(extract10); input = TextLib.isEmpty(input) ? null : input; var out; try { out = JSON.parse(input); } catch (e) { throw new Error("UNDETERMINED condition:202", {cause: {status: 'UNDETERMINED', conditionIndex: 202, conditionText: "extract('CA10Z1__configurations__c').asJson().isInvalid()", currentStateMessage: "Configurations JSON is invalid.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}}); } return out; } function fieldChecked11() { if (BytesLib.isEmpty(obj.CA10Z1__configurations__c)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10Z1__configurations__c.delegatedTo(CA10Z1__configurations__c).isEmpty()", currentStateMessage: "Unable to determine Server Configurations. Possible permission issue with Microsoft.DBforPostgreSQL/servers/configurations/read", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10Z1__configurations__c; } function extract10() { if (!this.out) { this.out = fieldChecked11(); } return this.out; }; function extract7() { if (!this.out) { this.out = jsonChecked8(); } return this.out; }; references1.push('Configurations [obj.CA10Z1__configurations__c]: ' + obj.CA10Z1__configurations__c); try { if (TextLib.equal(jsonQueryChecked5(), 'off')) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]') == 'off'", currentStateMessage: "MySQL Flexible Server audit_log_enabled configuration parameter is disabled.", currentStateReferences: references1.join('\n'), remediation: "Enable the audit_log_enabled parameter on the MySQL Flexible Server.", runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[3], conditionIndex:[300..399] function jsonQueryChecked12() { var input = extract14.call(extract14); var out; try { out = jmespath.search(input, '[? name == \'audit_log_enabled\'].value | [0]'); if (out != null && typeof out != 'string') { throw new Error("UNDETERMINED condition:303", {cause: {status: 'UNDETERMINED', conditionIndex: 303, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]').isResultTypeMismatch()", currentStateMessage: "The JSON query did not return text type.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } } catch (e) { throw new Error("UNDETERMINED condition:304", {cause: {status: 'UNDETERMINED', conditionIndex: 304, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]').isEvaluationFailed()", currentStateMessage: "The JSON query has failed.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}}); } return out; } function jsonChecked15() { var input = extract17.call(extract17); input = TextLib.isEmpty(input) ? null : input; var out; try { out = JSON.parse(input); } catch (e) { throw new Error("UNDETERMINED condition:302", {cause: {status: 'UNDETERMINED', conditionIndex: 302, conditionText: "extract('CA10Z1__configurations__c').asJson().isInvalid()", currentStateMessage: "Configurations JSON is invalid.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}}); } return out; } function fieldChecked18() { if (BytesLib.isEmpty(obj.CA10Z1__configurations__c)) { throw new Error("UNDETERMINED condition:301", {cause: {status: 'UNDETERMINED', conditionIndex: 301, conditionText: "CA10Z1__configurations__c.delegatedTo(CA10Z1__configurations__c).isEmpty()", currentStateMessage: "Unable to determine Server Configurations. Possible permission issue with Microsoft.DBforPostgreSQL/servers/configurations/read", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10Z1__configurations__c; } function extract17() { if (!this.out) { this.out = fieldChecked18(); } return this.out; }; function extract14() { if (!this.out) { this.out = jsonChecked15(); } return this.out; }; function jsonQueryChecked19() { var input = extract14.call(extract14); var out; try { out = jmespath.search(input, '[? name == \'audit_log_events\'].value | [0]'); if (out != null && typeof out != 'string') { throw new Error("UNDETERMINED condition:305", {cause: {status: 'UNDETERMINED', conditionIndex: 305, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_events\\'].value | [0]').isResultTypeMismatch()", currentStateMessage: "The JSON query did not return text type.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } } catch (e) { throw new Error("UNDETERMINED condition:306", {cause: {status: 'UNDETERMINED', conditionIndex: 306, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_events\\'].value | [0]').isEvaluationFailed()", currentStateMessage: "The JSON query has failed.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}}); } return out; } try { if (TextLib.equal(jsonQueryChecked12(), 'on') && TextLib.notEqual(jsonQueryChecked19(), 'CONNECTION')) { return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]') == 'on' && extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_events\\'].value | [0]') != 'CONNECTION'", currentStateMessage: "MySQL Flexible Server audit_log_events configuration parameter is not set to CONNECTION.", currentStateReferences: references1.join('\n'), remediation: "Set the audit_log_events parameter to CONNECTION.", runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[4], conditionIndex:[400..499] function jsonQueryChecked21() { var input = extract23.call(extract23); var out; try { out = jmespath.search(input, '[? name == \'audit_log_enabled\'].value | [0]'); if (out != null && typeof out != 'string') { throw new Error("UNDETERMINED condition:403", {cause: {status: 'UNDETERMINED', conditionIndex: 403, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]').isResultTypeMismatch()", currentStateMessage: "The JSON query did not return text type.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } } catch (e) { throw new Error("UNDETERMINED condition:404", {cause: {status: 'UNDETERMINED', conditionIndex: 404, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]').isEvaluationFailed()", currentStateMessage: "The JSON query has failed.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}}); } return out; } function jsonChecked24() { var input = extract26.call(extract26); input = TextLib.isEmpty(input) ? null : input; var out; try { out = JSON.parse(input); } catch (e) { throw new Error("UNDETERMINED condition:402", {cause: {status: 'UNDETERMINED', conditionIndex: 402, conditionText: "extract('CA10Z1__configurations__c').asJson().isInvalid()", currentStateMessage: "Configurations JSON is invalid.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}}); } return out; } function fieldChecked27() { if (BytesLib.isEmpty(obj.CA10Z1__configurations__c)) { throw new Error("UNDETERMINED condition:401", {cause: {status: 'UNDETERMINED', conditionIndex: 401, conditionText: "CA10Z1__configurations__c.delegatedTo(CA10Z1__configurations__c).isEmpty()", currentStateMessage: "Unable to determine Server Configurations. Possible permission issue with Microsoft.DBforPostgreSQL/servers/configurations/read", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10Z1__configurations__c; } function extract26() { if (!this.out) { this.out = fieldChecked27(); } return this.out; }; function extract23() { if (!this.out) { this.out = jsonChecked24(); } return this.out; }; function jsonQueryChecked28() { var input = extract23.call(extract23); var out; try { out = jmespath.search(input, '[? name == \'audit_log_events\'].value | [0]'); if (out != null && typeof out != 'string') { throw new Error("UNDETERMINED condition:405", {cause: {status: 'UNDETERMINED', conditionIndex: 405, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_events\\'].value | [0]').isResultTypeMismatch()", currentStateMessage: "The JSON query did not return text type.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } } catch (e) { throw new Error("UNDETERMINED condition:406", {cause: {status: 'UNDETERMINED', conditionIndex: 406, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_events\\'].value | [0]').isEvaluationFailed()", currentStateMessage: "The JSON query has failed.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: e.message}}); } return out; } try { if (TextLib.equal(jsonQueryChecked21(), 'on') && TextLib.equal(jsonQueryChecked28(), 'CONNECTION')) { return {status: 'COMPLIANT', conditionIndex: 499, conditionText: "extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_enabled\\'].value | [0]') == 'on' && extract('caJsonFrom__configurations__c').jsonQueryText('[? name == \\'audit_log_events\\'].value | [0]') == 'CONNECTION'", currentStateMessage: "MySQL Flexible Server audit_log_events configuration parameter is set to CONNECTION.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } return {status: 'UNDETERMINED', conditionIndex: 500, conditionText: "otherwise", currentStateMessage: "Unexpected value in the field.", 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.CA10Z1__disappearanceTime__c AS CA10Z1__disappearanceTime__c, sObject.CA10Z1__deploymentMode__c AS CA10Z1__deploymentMode__c, sObject.CA10Z1__configurations__c AS CA10Z1__configurations__c, sObject.Id AS Id, process_CA10Z1__CaAzureMySqlServer__c( STRUCT( sObject.CA10Z1__disappearanceTime__c AS CA10Z1__disappearanceTime__c, sObject.CA10Z1__deploymentMode__c AS CA10Z1__deploymentMode__c, sObject.CA10Z1__configurations__c AS CA10Z1__configurations__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10Z1__CaAzureMySqlServer__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;