--- policy: /ce/ca/azure/storage/account-cost-effective-region logic: /ce/ca/azure/storage/account-cost-effective-region/prod.logic.yaml executionTime: 2026-02-10T22:33:38.261271432Z generationMs: 109 executionMs: 590 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: 199 actual: 199 conditionText: expected: extract('CA10__locationName__c') == 'westus' actual: extract('CA10__locationName__c') == 'westus' runtimeError: {} - id: '003' match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 2700 actual: 2700 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/azure/storage/account-cost-effective-region/policy.yaml md5Hash: 599BDDFE3844B2FEE9A61279FB5B2616 content: | --- names: full: "Azure Storage Account is located in a less cost-effective region" contextual: "Storage Account is located in a less cost-effective region" description: "This policy flags Storage Accounts 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/storage/account-cost-effective-region/prod.logic.yaml md5Hash: 1C0BB4F7C7CD390CF0C07EB3195B0E3E content: | --- inputType: "CA10__CaAzureStorageAccount__c" importExtracts: - file: "/types/CA10__CaAzureStorageAccount__c/object.extracts.yaml" testData: - file: 'test-data.json' conditions: - status: "INCOMPLIANT" currentStateMessage: "The account is running in westus which is more expensive than westus3 or westus2." remediationMessage: "Migrate the account to westus3 or westus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "westus" - status: "INCOMPLIANT" currentStateMessage: "The account is running in northcentralus which is more expensive than centralus or eastus2." remediationMessage: "Migrate the account to centralus or eastus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "northcentralus" - status: "INCOMPLIANT" currentStateMessage: "The account is running in southcentralus which is more expensive than westus3 or westus2." remediationMessage: "Migrate the account to westus3 or westus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "southcentralus" - status: "INCOMPLIANT" currentStateMessage: "The account is running in canadaeast which is more expensive than eastus2." remediationMessage: "Migrate the account to eastus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "canadaeast" - status: "INCOMPLIANT" currentStateMessage: "The account is running in canadacentral which is more expensive than eastus2." remediationMessage: "Migrate the account to eastus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "canadacentral" - status: "INCOMPLIANT" currentStateMessage: "The account is running in eastus which is more expensive than eastus2." remediationMessage: "Migrate the account to eastus2." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "eastus" - status: "INCOMPLIANT" currentStateMessage: "The account is running in ukwest which is more expensive than eu-west-1, eu-north-1, or eu-south-2." remediationMessage: "Migrate the account 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 account is running in uksouth which is more expensive than eu-west-1, eu-north-1, or eu-south-2." remediationMessage: "Migrate the account 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 account is running in francecentral which is more expensive than eu-west-1, eu-north-1, or eu-south-2." remediationMessage: "Migrate the account 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 account is running in francesouth which is more expensive than eu-west-1, eu-north-1, or eu-south-2." remediationMessage: "Migrate the account 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 account is running in westeurope which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "westeurope" - status: "INCOMPLIANT" currentStateMessage: "The account is running in northeurope which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "northeurope" - status: "INCOMPLIANT" currentStateMessage: "The account is running in germanywestcentral which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "germanywestcentral" - status: "INCOMPLIANT" currentStateMessage: "The account is running in germanynorth which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "germanynorth" - status: "INCOMPLIANT" currentStateMessage: "The account is running in switzerlandnorth which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "switzerlandnorth" - status: "INCOMPLIANT" currentStateMessage: "The account is running in switzerlandwest which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "switzerlandwest" - status: "INCOMPLIANT" currentStateMessage: "The account is running in italynorth which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "italynorth" - status: "INCOMPLIANT" currentStateMessage: "The account is running in polandcentral which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "polandcentral" - status: "INCOMPLIANT" currentStateMessage: "The account is running in norwayeast which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "norwayeast" - status: "INCOMPLIANT" currentStateMessage: "The account is running in norwaywest which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "norwaywest" - status: "INCOMPLIANT" currentStateMessage: "The account is running in spaincentral which is more expensive than swedencentral or swedensouth." remediationMessage: "Migrate the account to swedencentral or swedensouth." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "spaincentral" - status: "INCOMPLIANT" currentStateMessage: "The account is running in southindia which is more expensive than centralindia." remediationMessage: "Migrate the account to centralindia." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "southindia" - status: "INCOMPLIANT" currentStateMessage: "The account is running in westindia which is more expensive than centralindia." remediationMessage: "Migrate the account to centralindia." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "westindia" - status: "INCOMPLIANT" currentStateMessage: "The account is running in australiasoutheast which is more expensive than australiaeast." remediationMessage: "Migrate the account to australiaeast." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "australiasoutheast" - status: "INCOMPLIANT" currentStateMessage: "The account is running in australiacentral2 which is more expensive than australiaeast." remediationMessage: "Migrate the account to australiaeast." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "australiacentral2" - status: "INCOMPLIANT" currentStateMessage: "The account is running in koreasouth which is more expensive than japaneast, japanwest or koreacentral." remediationMessage: "Migrate the account to japaneast, japanwest or koreacentral." check: IS_EQUAL: left: EXTRACT: CA10__locationName__c right: TEXT: "koreasouth" otherwise: status: "COMPLIANT" currentStateMessage: "The account is located in a cost-effective region." - path: /ce/ca/azure/storage/account-cost-effective-region/test-data.json md5Hash: 074915AED0D3F0F9227AB392BFDD0854 content: | [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-09-25T05:52:33Z" }, "Id": "001", "RecordTypeId": "testTipe1", "CA10__disappearanceTime__c": "2025-09-15T05:58:55Z", "CA10__locationName__c": "westeurope", "RecordType": { "DeveloperName": "tStorageAccount", "Id": "testTipe1" } }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "extract('CA10__locationName__c') == 'westus'", "runtimeError": null }, "context": { "snapshotTime": "2025-09-25T05:52:33Z" }, "Id": "002", "RecordTypeId": "testTipe1", "CA10__disappearanceTime__c": null, "CA10__locationName__c": "westus", "RecordType": { "DeveloperName": "tStorageAccount", "Id": "testTipe1" } }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "2700", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-09-25T05:52:33Z" }, "Id": "003", "RecordTypeId": "testTipe1", "CA10__disappearanceTime__c": null, "CA10__locationName__c": "westus2", "RecordType": { "DeveloperName": "tStorageAccount", "Id": "testTipe1" } } ] - path: /types/CA10__CaAzureStorageAccount__c/object.extracts.yaml md5Hash: 2FD9F962F192FC3E335D23D11315B8F9 content: "---\nextracts:\n# This is a checkbox. Not nullable. Can't have no access,\ \ retrieved via Microsoft.Storage/storageAccounts\n - name: \"CA10__secureTransferRequired__c\"\ \n value: \n FIELD:\n path: \"CA10__secureTransferRequired__c\"\ \n# Values: Enabled, Disabled. Not Nullable. Can't have no access, retrieved\ \ via Microsoft.Storage/storageAccounts\n - name: \"CA10__requireInfrastructureEncryptionState__c\"\ \n value: \n FIELD:\n path: \"CA10__requireInfrastructureEncryptionState__c\"\ \n undeterminedIf:\n isEmpty: \"Corrupted data. Require Infrastructure\ \ Encryption setting cannot be empty.\"\n# Values: Enabled, Disabled. Not Nullable.\ \ Can't have no access, retrieved via Microsoft.Storage/storageAccounts\n -\ \ name: \"CA10__publicNetworkAccessState__c\"\n value: \n FIELD:\n \ \ path: \"CA10__publicNetworkAccessState__c\"\n undeterminedIf:\n\ \ isEmpty: \"Corrupted data. Public Network Access cannot be empty.\"\ \n# Values: Allow, Deny. Not nullable. Can't have no access, retrieved via Microsoft.Storage/storageAccounts.\n\ \ - name: \"CA10__networkAclsDefaultAction__c\"\n value: \n FIELD:\n\ \ path: \"CA10__networkAclsDefaultAction__c\"\n undeterminedIf:\n\ \ isEmpty: \"Corrupted data. Default Network Action cannot be empty.\"\ \n# Values: any combination of Logging|Metrics|AzureServices or None. Not nullable.\ \ \n# Can't have no access, retrieved via Microsoft.Storage/storageAccounts.\n\ \ - name: \"CA10__networkAclsBypass__c\"\n value: \n FIELD:\n \ \ path: \"CA10__networkAclsBypass__c\"\n undeterminedIf:\n \ \ isEmpty: \"Corrupted data. Network Bypass cannot be empty.\"\n# Values TLS1_0,\ \ TLS1_1, TLS1_2. Not nullable. Can't have no access, retrieved via Microsoft.Storage/storageAccounts.\n\ \ - name: \"CA10__minimumTlsVersion__c\"\n value: \n FIELD:\n \ \ path: \"CA10__minimumTlsVersion__c\"\n undeterminedIf:\n \ \ isEmpty: \"Corrupted data. TLS Version cannot be empty.\"\n# Values: Allow,\ \ Deny, null (Old storage accounts can have null, which means that the account\ \ can still have replication). \n# Nullable. Can't have no access, retrieved\ \ via Microsoft.Storage/storageAccounts.\n - name: \"CA10__crossTenantReplication__c\"\ \n value: \n FIELD:\n path: \"CA10__crossTenantReplication__c\"\ \n# Values: Allow, Deny. Not nullable. Can't have no access, retrieved via Microsoft.Storage/storageAccounts.\n\ \ - name: \"CA10__blobPublicAccess__c\"\n value: \n FIELD:\n \ \ path: \"CA10__blobPublicAccess__c\"\n undeterminedIf:\n isEmpty:\ \ \"Corrupted data. Allow Blob Anonymous Access cannot be empty.\"\n# Values\ \ Enabled, Disabled. Not Nullable\n - name: \"CA10__blobLoggingReadState__c\"\ \n value: \n FIELD:\n path: \"CA10__blobLoggingReadState__c\"\ \n undeterminedIf:\n noAccessDelegate:\n path: \"\ CA10__blobLoggingReadState__c\"\n currentStateMessage: \"Unable to\ \ determine Blob Container Logging Read property. Possible permission issue\ \ with Microsoft.Storage/storageAccounts/blobServices/containers/read\"\n \ \ isEmpty: \"Storage Blob Logging is not populated yet.\"\n# Values Enabled,\ \ Disabled. Not Nullable\n - name: \"CA10__blobLoggingWriteState__c\"\n \ \ value: \n FIELD:\n path: \"CA10__blobLoggingWriteState__c\"\n\ \ undeterminedIf:\n noAccessDelegate:\n path: \"\ CA10__blobLoggingWriteState__c\"\n currentStateMessage: \"Unable\ \ to determine Blob Container Logging Write property. Possible permission issue\ \ with Microsoft.Storage/storageAccounts/blobServices/containers/read\"\n \ \ isEmpty: \"Storage Blob Logging is not populated yet.\"\n # Values\ \ Enabled, Disabled. Not Nullable\n - name: \"CA10__blobLoggingDeleteState__c\"\ \n value: \n FIELD:\n path: \"CA10__blobLoggingDeleteState__c\"\ \n undeterminedIf:\n noAccessDelegate:\n path: \"\ CA10__blobLoggingDeleteState__c\"\n currentStateMessage: \"Unable\ \ to determine Blob Container Logging Delete property. Possible permission issue\ \ with Microsoft.Storage/storageAccounts/blobServices/containers/read\"\n \ \ isEmpty: \"Storage Blob Logging is not populated yet.\"\n# Values Enabled,\ \ Disabled. Not Nullable\n - name: \"CA10__queueLoggingReadState__c\"\n \ \ value: \n FIELD:\n path: \"CA10__queueLoggingReadState__c\"\n\ \ undeterminedIf:\n noAccessDelegate:\n path: \"\ CA10__queueLoggingReadState__c\"\n currentStateMessage: \"Unable\ \ to determine Queue Logging Read property. Possible permission issue with Microsoft.Storage/storageAccounts/queueServices/queues/read\"\ \n isEmpty: \"Storage Queue Logging is not populated yet.\"\n# Values\ \ Enabled, Disabled. Not Nullable\n - name: \"CA10__queueLoggingWriteState__c\"\ \n value: \n FIELD:\n path: \"CA10__queueLoggingWriteState__c\"\ \n undeterminedIf:\n noAccessDelegate:\n path: \"\ CA10__queueLoggingWriteState__c\"\n currentStateMessage: \"Unable\ \ to determine Queue Logging Write property. Possible permission issue with\ \ Microsoft.Storage/storageAccounts/queueServices/queues/read\"\n isEmpty:\ \ \"Storage Queue Logging is not populated yet.\"\n# Values Enabled, Disabled.\ \ Not Nullable\n - name: \"CA10__queueLoggingDeleteState__c\"\n value: \n\ \ FIELD:\n path: \"CA10__queueLoggingDeleteState__c\"\n undeterminedIf:\n\ \ noAccessDelegate:\n path: \"CA10__queueLoggingDeleteState__c\"\ \n currentStateMessage: \"Unable to determine Queue Logging Delete\ \ property. Possible permission issue with Microsoft.Storage/storageAccounts/queueServices/queues/read\"\ \n isEmpty: \"Storage Queue Logging is not populated yet.\"\n# Values\ \ Enabled, Disabled. Not Nullable\n - name: \"CA10__tableLoggingReadState__c\"\ \n value: \n FIELD:\n path: \"CA10__tableLoggingReadState__c\"\ \n undeterminedIf:\n noAccessDelegate:\n path: \"\ CA10__tableLoggingReadState__c\"\n currentStateMessage: \"Unable\ \ to determine Table Logging Read property. Possible permission issue with Microsoft.Storage/storageAccounts/tableServices/tables/read\"\ \n isEmpty: \"Storage Table Logging is not populated yet.\"\n# Values\ \ Enabled, Disabled. Not Nullable\n - name: \"CA10__tableLoggingWriteState__c\"\ \n value: \n FIELD:\n path: \"CA10__tableLoggingWriteState__c\"\ \n undeterminedIf:\n noAccessDelegate:\n path: \"\ CA10__tableLoggingWriteState__c\"\n currentStateMessage: \"Unable\ \ to determine Table Logging Write property. Possible permission issue with\ \ Microsoft.Storage/storageAccounts/tableServices/tables/read\"\n isEmpty:\ \ \"Storage Table Logging is not populated yet.\"\n# Values Enabled, Disabled.\ \ Not Nullable\n - name: \"CA10__tableLoggingDeleteState__c\"\n value: \n\ \ FIELD:\n path: \"CA10__tableLoggingDeleteState__c\"\n undeterminedIf:\n\ \ noAccessDelegate:\n path: \"CA10__tableLoggingDeleteState__c\"\ \n currentStateMessage: \"Unable to determine Table Logging Delete\ \ property. Possible permission issue with Microsoft.Storage/storageAccounts/tableServices/tables/read\"\ \n isEmpty: \"Storage Table Logging is not populated yet.\"\n# Values\ \ Microsoft.Storage, Microsoft.Keyvault. Not Nullable. Can't have no access,\ \ retrieved via Microsoft.Storage/storageAccounts\n - name: \"CA10__encryptionKeySource__c\"\ \n value: \n FIELD:\n path: \"CA10__encryptionKeySource__c\"\n\ \ undeterminedIf:\n isEmpty: \"Corrupted data. Encryption Key\ \ Source cannot be empty.\"\n# Nullable. Can't have no access, retrieved via\ \ Microsoft.Storage/storageAccounts\n - name: \"CA10__encryptionKeyVaultUri__c\"\ \n value: \n FIELD:\n path: \"CA10__encryptionKeyVaultUri__c\"\ \n# Nullable. \n - name: \"CA10__blobRetentionPolicyDays__c\"\n value: \n\ \ FIELD:\n path: \"CA10__blobRetentionPolicyDays__c\"\n# Values:\ \ Enabled, Disabled. Nullable. \n - name: \"CA10__blobRetentionPolicyState__c\"\ \n value: \n FIELD:\n path: \"CA10__blobRetentionPolicyState__c\"\ \n# Nullable. \n - name: \"CA10__containerRetentionPolicyDays__c\"\n value:\ \ \n FIELD:\n path: \"CA10__containerRetentionPolicyDays__c\"\n\ # Values: Enabled, Disabled. Nullable. \n - name: \"CA10__containerRetentionPolicyState__c\"\ \n value: \n FIELD:\n path: \"CA10__containerRetentionPolicyState__c\"\ \n# Nullable. Text field.\n - name: \"CA10__skuName__c\"\n value:\n \ \ FIELD:\n path: \"CA10__skuName__c\"\n# Nullable. Text field.\n -\ \ name: \"CA10__defaultToOAuthAuthentication__c\"\n value:\n FIELD:\n\ \ path: \"CA10__defaultToOAuthAuthentication__c\"\n# Nullable. Text field.\n\ \ - name: \"CA10__sharedKeyAccess__c\"\n value:\n FIELD:\n path:\ \ \"CA10__sharedKeyAccess__c\"\n# Nullable. Text field.\n - name: \"CA10__blobVersioning__c\"\ \n value:\n FIELD:\n path: \"CA10__blobVersioning__c\"\n# Text\ \ field.\n - name: \"CA10__locationName__c\"\n value:\n FIELD:\n \ \ path: \"CA10__locationName__c\"\n# Date/Time field.\n - name: \"CA10__primaryKeyCreationTime__c\"\ \n value:\n FIELD:\n path: \"CA10__primaryKeyCreationTime__c\"\ \n# Date/Time field.\n - name: \"CA10__secondaryKeyCreationTime__c\"\n value:\n\ \ FIELD:\n path: \"CA10__secondaryKeyCreationTime__c\"\n# Nullable.\ \ Number field.\n - name: \"CA10__keyExpirationPeriodDays__c\"\n value:\n\ \ FIELD:\n path: \"CA10__keyExpirationPeriodDays__c\"\n\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" : "199", "conditionText" : "extract('CA10__locationName__c') == 'westus'", "runtimeError" : null } }, { "Id" : "003", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "2700", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAzureStorageAccount__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-09-25T05:52:33Z") }, "CA10__disappearanceTime__c" : new Date("2025-09-15T05:58:55Z"), "CA10__locationName__c" : "westeurope", "Id" : "001", "RecordTypeId" : "testTipe1" }, { "context" : { "snapshotTime" : new Date("2025-09-25T05:52:33Z") }, "CA10__locationName__c" : "westus", "Id" : "002", "RecordTypeId" : "testTipe1" }, { "context" : { "snapshotTime" : new Date("2025-09-25T05:52:33Z") }, "CA10__locationName__c" : "westus2", "Id" : "003", "RecordTypeId" : "testTipe1" } ]; """; CREATE TEMP FUNCTION mock_RecordType() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-09-25T05:52:33Z") }, "Id" : "testTipe1" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAzureStorageAccount__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__locationName__c STRING, Id STRING, RecordTypeId STRING, RecordType STRUCT< 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 account is running in westus which is more expensive than westus3 or westus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account 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), 'northcentralus')) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__locationName__c') == 'northcentralus'", currentStateMessage: "The account is running in northcentralus which is more expensive than centralus or eastus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to centralus or eastus2.", 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 account is running in southcentralus which is more expensive than westus3 or westus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to 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), 'canadaeast')) { return {status: 'INCOMPLIANT', conditionIndex: 499, conditionText: "extract('CA10__locationName__c') == 'canadaeast'", currentStateMessage: "The account is running in canadaeast which is more expensive than eastus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to eastus2.", 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), 'canadacentral')) { return {status: 'INCOMPLIANT', conditionIndex: 599, conditionText: "extract('CA10__locationName__c') == 'canadacentral'", currentStateMessage: "The account is running in canadacentral which is more expensive than eastus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to 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), 'eastus')) { return {status: 'INCOMPLIANT', conditionIndex: 699, conditionText: "extract('CA10__locationName__c') == 'eastus'", currentStateMessage: "The account is running in eastus which is more expensive than eastus2.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to 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 account 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 account 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 account 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 account 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 account 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 account 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 account 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 account 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 account is running in westeurope which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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), 'northeurope')) { return {status: 'INCOMPLIANT', conditionIndex: 1299, conditionText: "extract('CA10__locationName__c') == 'northeurope'", currentStateMessage: "The account is running in northeurope which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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), 'germanywestcentral')) { return {status: 'INCOMPLIANT', conditionIndex: 1399, conditionText: "extract('CA10__locationName__c') == 'germanywestcentral'", currentStateMessage: "The account is running in germanywestcentral which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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), 'germanynorth')) { return {status: 'INCOMPLIANT', conditionIndex: 1499, conditionText: "extract('CA10__locationName__c') == 'germanynorth'", currentStateMessage: "The account is running in germanynorth which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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), 'switzerlandnorth')) { return {status: 'INCOMPLIANT', conditionIndex: 1599, conditionText: "extract('CA10__locationName__c') == 'switzerlandnorth'", currentStateMessage: "The account is running in switzerlandnorth which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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), 'switzerlandwest')) { return {status: 'INCOMPLIANT', conditionIndex: 1699, conditionText: "extract('CA10__locationName__c') == 'switzerlandwest'", currentStateMessage: "The account is running in switzerlandwest which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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), 'italynorth')) { return {status: 'INCOMPLIANT', conditionIndex: 1799, conditionText: "extract('CA10__locationName__c') == 'italynorth'", currentStateMessage: "The account is running in italynorth which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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), 'polandcentral')) { return {status: 'INCOMPLIANT', conditionIndex: 1899, conditionText: "extract('CA10__locationName__c') == 'polandcentral'", currentStateMessage: "The account is running in polandcentral which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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), 'norwayeast')) { return {status: 'INCOMPLIANT', conditionIndex: 1999, conditionText: "extract('CA10__locationName__c') == 'norwayeast'", currentStateMessage: "The account is running in norwayeast which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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), 'norwaywest')) { return {status: 'INCOMPLIANT', conditionIndex: 2099, conditionText: "extract('CA10__locationName__c') == 'norwaywest'", currentStateMessage: "The account is running in norwaywest which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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 account is running in spaincentral which is more expensive than swedencentral or swedensouth.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to swedencentral or swedensouth.", 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), 'southindia')) { return {status: 'INCOMPLIANT', conditionIndex: 2299, conditionText: "extract('CA10__locationName__c') == 'southindia'", currentStateMessage: "The account is running in southindia which is more expensive than centralindia.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to centralindia.", 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), 'westindia')) { return {status: 'INCOMPLIANT', conditionIndex: 2399, conditionText: "extract('CA10__locationName__c') == 'westindia'", currentStateMessage: "The account is running in westindia which is more expensive than centralindia.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to centralindia.", 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), 'australiasoutheast')) { return {status: 'INCOMPLIANT', conditionIndex: 2499, conditionText: "extract('CA10__locationName__c') == 'australiasoutheast'", currentStateMessage: "The account is running in australiasoutheast which is more expensive than australiaeast.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to australiaeast.", 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), 'australiacentral2')) { return {status: 'INCOMPLIANT', conditionIndex: 2599, conditionText: "extract('CA10__locationName__c') == 'australiacentral2'", currentStateMessage: "The account is running in australiacentral2 which is more expensive than australiaeast.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to australiaeast.", 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), 'koreasouth')) { return {status: 'INCOMPLIANT', conditionIndex: 2699, conditionText: "extract('CA10__locationName__c') == 'koreasouth'", currentStateMessage: "The account is running in koreasouth which is more expensive than japaneast, japanwest or koreacentral.", currentStateReferences: references1.join('\n'), remediation: "Migrate the account to japaneast, japanwest or koreacentral.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 2700, conditionText: "otherwise", currentStateMessage: "The account 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, sObject.RecordTypeId AS RecordTypeId, STRUCT ( `RecordType`.Id AS Id ) AS RecordType, process_CA10__CaAzureStorageAccount__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__locationName__c AS CA10__locationName__c, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, STRUCT ( `RecordType`.Id AS Id ) AS RecordType ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAzureStorageAccount__c()) AS sObject LEFT JOIN UNNEST(mock_RecordType()) AS `RecordType` ON sObject.RecordTypeId = `RecordType`.Id ) sObject ON sObject.Id = expectedResult.Id;