--- policy: /ce/ca/azure/sql-database/database-cost-effective-region logic: /ce/ca/azure/sql-database/database-cost-effective-region/prod.logic.yaml executionTime: 2026-02-10T22:33:35.194902914Z generationMs: 76 executionMs: 912 rows: - id: '001' 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: '002' match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 899 actual: 899 conditionText: expected: extract('CA10__locationName__c') == 'uksouth' actual: extract('CA10__locationName__c') == 'uksouth' runtimeError: {} - id: '003' match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1199 actual: 1199 conditionText: expected: extract('CA10__locationName__c') == 'westeurope' actual: extract('CA10__locationName__c') == 'westeurope' runtimeError: {} - id: '004' match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 2499 actual: 2499 conditionText: expected: extract('CA10__locationName__c') == 'japaneast' actual: extract('CA10__locationName__c') == 'japaneast' runtimeError: {} - id: '005' match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 2700 actual: 2700 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/azure/sql-database/database-cost-effective-region/policy.yaml md5Hash: 4E9F0AC1D3F876A06B4AAD1A48D11EBF content: | --- names: full: "Azure SQL Database is located in a less cost-effective region" contextual: "Database is located in a less cost-effective region" description: "This policy flags SQL Database that are running in Azure regions\ \ with higher pricing and could potentially be migrated to more cost-effective regions." type: "BEST_PRACTICE" categories: - "COST" frameworkMappings: - "/frameworks/cloudaware/cost-efficiency-and-optimization/resource-optimization" - path: /ce/ca/azure/sql-database/database-cost-effective-region/prod.logic.yaml md5Hash: 3F67339C28643085E39055CBBF4287C6 content: |+ --- inputType: "CA10__CaAzureSqlDatabase__c" importExtracts: - file: "/types/CA10__CaAzureSqlDatabase__c/object.extracts.yaml" testData: - file: 'test-data.json' conditions: - status: "INCOMPLIANT" currentStateMessage: "The database is running in westus which is more expensive than westus3 or westus2." remediationMessage: "Migrate the database to westus3 or westus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "westus" - status: "INCOMPLIANT" currentStateMessage: "The database is running in westcentralus which is more expensive than westus3 or westus2." remediationMessage: "Migrate the database to westus3 or westus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "westcentralus" - status: "INCOMPLIANT" currentStateMessage: "The database is running in southcentralus which is more expensive than northcentralus, westus3 or westus2." remediationMessage: "Migrate the database to northcentralus, westus3 or westus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "southcentralus" - status: "INCOMPLIANT" currentStateMessage: "The database is running in centralus which is more expensive than northcentralus, westus3 or westus2." remediationMessage: "Migrate the database to northcentralus, westus3 or westus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "centralus" - status: "INCOMPLIANT" currentStateMessage: "The database is running in canadaeast which is more expensive than eastus or eastus2." remediationMessage: "Migrate the database to eastus or eastus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "canadaeast" - status: "INCOMPLIANT" currentStateMessage: "The database is running in canadacentral which is more expensive than eastus or eastus2." remediationMessage: "Migrate the database to eastus or eastus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "canadacentral" - status: "INCOMPLIANT" currentStateMessage: "The database is running in ukwest which is more expensive than eu-west-1, eu-north-1, or eu-south-2." remediationMessage: "Migrate the database to eu-west-1, eu-north-1, or eu-south-2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "ukwest" - status: "INCOMPLIANT" currentStateMessage: "The database is running in uksouth which is more expensive than eu-west-1, eu-north-1, or eu-south-2." remediationMessage: "Migrate the database to eu-west-1, eu-north-1, or eu-south-2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "uksouth" - status: "INCOMPLIANT" currentStateMessage: "The database is running in francecentral which is more expensive than eu-west-1, eu-north-1, or eu-south-2." remediationMessage: "Migrate the database to eu-west-1, eu-north-1, or eu-south-2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "francecentral" - status: "INCOMPLIANT" currentStateMessage: "The database is running in francesouth which is more expensive than eu-west-1, eu-north-1, or eu-south-2." remediationMessage: "Migrate the database to eu-west-1, eu-north-1, or eu-south-2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "francesouth" - status: "INCOMPLIANT" currentStateMessage: "The database is running in westeurope which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "westeurope" - status: "INCOMPLIANT" currentStateMessage: "The database is running in germanywestcentral which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "germanywestcentral" - status: "INCOMPLIANT" currentStateMessage: "The database is running in germanynorth which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "germanynorth" - status: "INCOMPLIANT" currentStateMessage: "The database is running in switzerlandnorth which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "switzerlandnorth" - status: "INCOMPLIANT" currentStateMessage: "The database is running in switzerlandwest which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "switzerlandwest" - status: "INCOMPLIANT" currentStateMessage: "The database is running in italynorth which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "italynorth" - status: "INCOMPLIANT" currentStateMessage: "The database is running in polandcentral which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "polandcentral" - status: "INCOMPLIANT" currentStateMessage: "The database is running in norwayeast which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "norwayeast" - status: "INCOMPLIANT" currentStateMessage: "The database is running in norwaywest which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "norwaywest" - status: "INCOMPLIANT" currentStateMessage: "The database is running in swedensouth which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "swedensouth" - status: "INCOMPLIANT" currentStateMessage: "The database is running in spaincentral which is more expensive than swedencentral or northeurope." remediationMessage: "Migrate the database to swedencentral or northeurope." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "spaincentral" - status: "INCOMPLIANT" currentStateMessage: "The database is running in australiaeast which is more expensive than australiacentral or australiacentral2." remediationMessage: "Migrate the database to australiacentral or australiacentral2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "australiaeast" - status: "INCOMPLIANT" currentStateMessage: "The database is running in australiasoutheast which is more expensive than australiacentral or australiacentral2." remediationMessage: "Migrate the database to australiacentral or australiacentral2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "australiasoutheast" - status: "INCOMPLIANT" currentStateMessage: "The database is running in japaneast which is more expensive than koreasouth." remediationMessage: "Migrate the database to koreasouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "japaneast" - status: "INCOMPLIANT" currentStateMessage: "The database is running in japanwest which is more expensive than koreasouth." remediationMessage: "Migrate the database to koreasouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "japanwest" - status: "INCOMPLIANT" currentStateMessage: "The database is running in koreacentral which is more expensive than koreasouth." remediationMessage: "Migrate the database to koreasouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "koreacentral" otherwise: status: "COMPLIANT" currentStateMessage: "The database is located in a cost-effective region." - path: /ce/ca/azure/sql-database/database-cost-effective-region/test-data.json md5Hash: 475FD25A6E0B499882D1D44B239355B1 content: | [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-09-24T02:10:07Z" }, "Id": "001", "CA10__disappearanceTime__c": "2025-09-15T13:54:40Z", "CA10__locationName__c": "westeurope" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "899", "conditionText": "extract('CA10__locationName__c') == 'uksouth'", "runtimeError": null }, "context": { "snapshotTime": "2025-09-24T02:10:07Z" }, "Id": "002", "CA10__disappearanceTime__c": null, "CA10__locationName__c": "uksouth" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1199", "conditionText": "extract('CA10__locationName__c') == 'westeurope'", "runtimeError": null }, "context": { "snapshotTime": "2025-09-24T02:10:07Z" }, "Id": "003", "CA10__disappearanceTime__c": null, "CA10__locationName__c": "westeurope" }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "2499", "conditionText": "extract('CA10__locationName__c') == 'japaneast'", "runtimeError": null }, "context": { "snapshotTime": "2025-09-24T02:10:07Z" }, "Id": "004", "CA10__disappearanceTime__c": null, "CA10__locationName__c": "japaneast" }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "2700", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-09-24T02:10:07Z" }, "Id": "005", "CA10__disappearanceTime__c": null, "CA10__locationName__c": "eastus2" } ] - path: /types/CA10__CaAzureSqlDatabase__c/object.extracts.yaml md5Hash: B4BDC0B62AEF4B03FB276D037CE05688 content: "---\nextracts:\n# Not Nullable. Can't have no access, retrieved via\ \ Microsoft.Sql/servers/databases/read\n - name: \"CA10__name__c\"\n value:\ \ \n FIELD:\n path: \"CA10__name__c\"\n undeterminedIf:\n\ \ isEmpty: \"Corrupted Data. Database Name cannot be empty.\"\n# Not\ \ Nullable. Can't have no access, retrieved via Microsoft.Sql/servers/databases/read\n\ \ - name: \"CA10__kind__c\"\n value: \n FIELD:\n path: \"CA10__kind__c\"\ \n undeterminedIf:\n isEmpty: \"Corrupted Data. Database Kind\ \ cannot be empty.\"\n# Values: Enabled, Disabled. Not Nullable. \n - name:\ \ \"CA10__dataEncryption__c\"\n value: \n FIELD:\n path: \"CA10__dataEncryption__c\"\ \n undeterminedIf:\n noAccessDelegate:\n path: \"\ CA10__dataEncryption__c\"\n currentStateMessage: \"Unable to determine\ \ Transparent Data Encryption. Possible permission issue with Microsoft.Sql/servers/databases/transparentDataEncryption/read.\"\ \n isEmpty: \"SQL Database Transparent Data Encryption is not populated\ \ yet.\"\n# Not nullable \n - name: \"CA10__satus__c\"\n value: \n \ \ FIELD:\n path: \"CA10__satus__c\"\n# Nullable \n - name: \"CA10__monitorCpuPercentAvg30Day__c\"\ \n value: \n FIELD:\n path: \"CA10__monitorCpuPercentAvg30Day__c\"\ \n# Nullable \n - name: \"CA10__monitorStoragePercentMax30Day__c\"\n value:\ \ \n FIELD:\n path: \"CA10__monitorStoragePercentMax30Day__c\"\n\ # Nullable \n - name: \"CA10__monitorDtuConsumptionPercentAvg30Day__c\"\n \ \ value: \n FIELD:\n path: \"CA10__monitorDtuConsumptionPercentAvg30Day__c\"\ \n# Nullable \n - name: \"CA10__monitorAppMemoryPercentAvg30Day__c\"\n value:\ \ \n FIELD:\n path: \"CA10__monitorAppMemoryPercentAvg30Day__c\"\ \n# Not Nullable \n - name: \"CA10__creationDate__c\"\n value: \n FIELD:\n\ \ path: \"CA10__creationDate__c\"\n# Nullable \n - name: \"CA10__pausedDate__c\"\ \n value: \n FIELD:\n path: \"CA10__pausedDate__c\"\n# Not Nullable\ \ \n - name: \"CA10__skuName__c\"\n value: \n FIELD:\n path:\ \ \"CA10__skuName__c\"\n# Text. Not Nullable \n - name: \"CA10__locationName__c\"\ \n value: \n FIELD:\n path: \"CA10__locationName__c\"\n" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "001", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "002", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "899", "conditionText" : "extract('CA10__locationName__c') == 'uksouth'", "runtimeError" : null } }, { "Id" : "003", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1199", "conditionText" : "extract('CA10__locationName__c') == 'westeurope'", "runtimeError" : null } }, { "Id" : "004", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "2499", "conditionText" : "extract('CA10__locationName__c') == 'japaneast'", "runtimeError" : null } }, { "Id" : "005", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "2700", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAzureSqlDatabase__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-09-24T02:10:07Z") }, "CA10__disappearanceTime__c" : new Date("2025-09-15T13:54:40Z"), "CA10__locationName__c" : "westeurope", "Id" : "001" }, { "context" : { "snapshotTime" : new Date("2025-09-24T02:10:07Z") }, "CA10__locationName__c" : "uksouth", "Id" : "002" }, { "context" : { "snapshotTime" : new Date("2025-09-24T02:10:07Z") }, "CA10__locationName__c" : "westeurope", "Id" : "003" }, { "context" : { "snapshotTime" : new Date("2025-09-24T02:10:07Z") }, "CA10__locationName__c" : "japaneast", "Id" : "004" }, { "context" : { "snapshotTime" : new Date("2025-09-24T02:10:07Z") }, "CA10__locationName__c" : "eastus2", "Id" : "005" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAzureSqlDatabase__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__locationName__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" 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 [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 extract3() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; references1.push('Location Name [obj.CA10__locationName__c]: ' + obj.CA10__locationName__c); if (TextLib.equal(extract3.call(extract3), 'westus')) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__locationName__c') == 'westus'", currentStateMessage: "The database is running in westus which is more expensive than westus3 or westus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to westus3 or westus2.", runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract6.call(extract6), 'westcentralus')) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__locationName__c') == 'westcentralus'", currentStateMessage: "The database is running in westcentralus which is more expensive than westus3 or westus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to westus3 or westus2.", runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extract9() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract9.call(extract9), 'southcentralus')) { return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__locationName__c') == 'southcentralus'", currentStateMessage: "The database is running in southcentralus which is more expensive than northcentralus, westus3 or westus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to northcentralus, westus3 or westus2.", runtimeError: null}; } // condition[4], conditionIndex:[400..499] function extract12() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract12.call(extract12), 'centralus')) { return {status: 'INCOMPLIANT', conditionIndex: 499, conditionText: "extract('CA10__locationName__c') == 'centralus'", currentStateMessage: "The database is running in centralus which is more expensive than northcentralus, westus3 or westus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to northcentralus, westus3 or westus2.", runtimeError: null}; } // condition[5], conditionIndex:[500..599] function extract15() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract15.call(extract15), 'canadaeast')) { return {status: 'INCOMPLIANT', conditionIndex: 599, conditionText: "extract('CA10__locationName__c') == 'canadaeast'", currentStateMessage: "The database is running in canadaeast which is more expensive than eastus or eastus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to eastus or eastus2.", runtimeError: null}; } // condition[6], conditionIndex:[600..699] function extract18() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract18.call(extract18), 'canadacentral')) { return {status: 'INCOMPLIANT', conditionIndex: 699, conditionText: "extract('CA10__locationName__c') == 'canadacentral'", currentStateMessage: "The database is running in canadacentral which is more expensive than eastus or eastus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to eastus or eastus2.", runtimeError: null}; } // condition[7], conditionIndex:[700..799] function extract21() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract21.call(extract21), 'ukwest')) { return {status: 'INCOMPLIANT', conditionIndex: 799, conditionText: "extract('CA10__locationName__c') == 'ukwest'", currentStateMessage: "The database is running in ukwest which is more expensive than eu-west-1, eu-north-1, or eu-south-2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to eu-west-1, eu-north-1, or eu-south-2.", runtimeError: null}; } // condition[8], conditionIndex:[800..899] function extract24() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract24.call(extract24), 'uksouth')) { return {status: 'INCOMPLIANT', conditionIndex: 899, conditionText: "extract('CA10__locationName__c') == 'uksouth'", currentStateMessage: "The database is running in uksouth which is more expensive than eu-west-1, eu-north-1, or eu-south-2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to eu-west-1, eu-north-1, or eu-south-2.", runtimeError: null}; } // condition[9], conditionIndex:[900..999] function extract27() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract27.call(extract27), 'francecentral')) { return {status: 'INCOMPLIANT', conditionIndex: 999, conditionText: "extract('CA10__locationName__c') == 'francecentral'", currentStateMessage: "The database is running in francecentral which is more expensive than eu-west-1, eu-north-1, or eu-south-2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to eu-west-1, eu-north-1, or eu-south-2.", runtimeError: null}; } // condition[10], conditionIndex:[1000..1099] function extract30() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract30.call(extract30), 'francesouth')) { return {status: 'INCOMPLIANT', conditionIndex: 1099, conditionText: "extract('CA10__locationName__c') == 'francesouth'", currentStateMessage: "The database is running in francesouth which is more expensive than eu-west-1, eu-north-1, or eu-south-2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to eu-west-1, eu-north-1, or eu-south-2.", runtimeError: null}; } // condition[11], conditionIndex:[1100..1199] function extract33() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract33.call(extract33), 'westeurope')) { return {status: 'INCOMPLIANT', conditionIndex: 1199, conditionText: "extract('CA10__locationName__c') == 'westeurope'", currentStateMessage: "The database is running in westeurope which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[12], conditionIndex:[1200..1299] function extract36() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract36.call(extract36), 'germanywestcentral')) { return {status: 'INCOMPLIANT', conditionIndex: 1299, conditionText: "extract('CA10__locationName__c') == 'germanywestcentral'", currentStateMessage: "The database is running in germanywestcentral which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[13], conditionIndex:[1300..1399] function extract39() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract39.call(extract39), 'germanynorth')) { return {status: 'INCOMPLIANT', conditionIndex: 1399, conditionText: "extract('CA10__locationName__c') == 'germanynorth'", currentStateMessage: "The database is running in germanynorth which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[14], conditionIndex:[1400..1499] function extract42() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract42.call(extract42), 'switzerlandnorth')) { return {status: 'INCOMPLIANT', conditionIndex: 1499, conditionText: "extract('CA10__locationName__c') == 'switzerlandnorth'", currentStateMessage: "The database is running in switzerlandnorth which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[15], conditionIndex:[1500..1599] function extract45() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract45.call(extract45), 'switzerlandwest')) { return {status: 'INCOMPLIANT', conditionIndex: 1599, conditionText: "extract('CA10__locationName__c') == 'switzerlandwest'", currentStateMessage: "The database is running in switzerlandwest which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[16], conditionIndex:[1600..1699] function extract48() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract48.call(extract48), 'italynorth')) { return {status: 'INCOMPLIANT', conditionIndex: 1699, conditionText: "extract('CA10__locationName__c') == 'italynorth'", currentStateMessage: "The database is running in italynorth which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[17], conditionIndex:[1700..1799] function extract51() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract51.call(extract51), 'polandcentral')) { return {status: 'INCOMPLIANT', conditionIndex: 1799, conditionText: "extract('CA10__locationName__c') == 'polandcentral'", currentStateMessage: "The database is running in polandcentral which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[18], conditionIndex:[1800..1899] function extract54() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract54.call(extract54), 'norwayeast')) { return {status: 'INCOMPLIANT', conditionIndex: 1899, conditionText: "extract('CA10__locationName__c') == 'norwayeast'", currentStateMessage: "The database is running in norwayeast which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[19], conditionIndex:[1900..1999] function extract57() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract57.call(extract57), 'norwaywest')) { return {status: 'INCOMPLIANT', conditionIndex: 1999, conditionText: "extract('CA10__locationName__c') == 'norwaywest'", currentStateMessage: "The database is running in norwaywest which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[20], conditionIndex:[2000..2099] function extract60() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract60.call(extract60), 'swedensouth')) { return {status: 'INCOMPLIANT', conditionIndex: 2099, conditionText: "extract('CA10__locationName__c') == 'swedensouth'", currentStateMessage: "The database is running in swedensouth which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[21], conditionIndex:[2100..2199] function extract63() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract63.call(extract63), 'spaincentral')) { return {status: 'INCOMPLIANT', conditionIndex: 2199, conditionText: "extract('CA10__locationName__c') == 'spaincentral'", currentStateMessage: "The database is running in spaincentral which is more expensive than swedencentral or northeurope.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to swedencentral or northeurope.", runtimeError: null}; } // condition[22], conditionIndex:[2200..2299] function extract66() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract66.call(extract66), 'australiaeast')) { return {status: 'INCOMPLIANT', conditionIndex: 2299, conditionText: "extract('CA10__locationName__c') == 'australiaeast'", currentStateMessage: "The database is running in australiaeast which is more expensive than australiacentral or australiacentral2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to australiacentral or australiacentral2.", runtimeError: null}; } // condition[23], conditionIndex:[2300..2399] function extract69() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract69.call(extract69), 'australiasoutheast')) { return {status: 'INCOMPLIANT', conditionIndex: 2399, conditionText: "extract('CA10__locationName__c') == 'australiasoutheast'", currentStateMessage: "The database is running in australiasoutheast which is more expensive than australiacentral or australiacentral2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to australiacentral or australiacentral2.", runtimeError: null}; } // condition[24], conditionIndex:[2400..2499] function extract72() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract72.call(extract72), 'japaneast')) { return {status: 'INCOMPLIANT', conditionIndex: 2499, conditionText: "extract('CA10__locationName__c') == 'japaneast'", currentStateMessage: "The database is running in japaneast which is more expensive than koreasouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to koreasouth.", runtimeError: null}; } // condition[25], conditionIndex:[2500..2599] function extract75() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract75.call(extract75), 'japanwest')) { return {status: 'INCOMPLIANT', conditionIndex: 2599, conditionText: "extract('CA10__locationName__c') == 'japanwest'", currentStateMessage: "The database is running in japanwest which is more expensive than koreasouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to koreasouth.", runtimeError: null}; } // condition[26], conditionIndex:[2600..2699] function extract78() { if (!this.out) { this.out = obj.CA10__locationName__c; } return this.out; }; if (TextLib.equal(extract78.call(extract78), 'koreacentral')) { return {status: 'INCOMPLIANT', conditionIndex: 2699, conditionText: "extract('CA10__locationName__c') == 'koreacentral'", currentStateMessage: "The database is running in koreacentral which is more expensive than koreasouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the database to koreasouth.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 2700, conditionText: "otherwise", currentStateMessage: "The database is located in a cost-effective region.", 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__locationName__c AS CA10__locationName__c, sObject.Id AS Id, process_CA10__CaAzureSqlDatabase__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__locationName__c AS CA10__locationName__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAzureSqlDatabase__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;