--- policy: /ce/ca/aws/account/iam-external-access-analyzer-for-all-regions logic: /ce/ca/aws/account/iam-external-access-analyzer-for-all-regions/prod.logic.yaml executionTime: 2026-06-06T12:02:25.454467333Z generationMs: 93 executionMs: 1562 rows: - id: test1 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 200 actual: 200 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test2 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10A1__AWS_IAM_Access_Analyzers__r.count(COMPLIANT) == CA10__AWS_Account_Regions__r.count(COMPLIANT) actual: CA10A1__AWS_IAM_Access_Analyzers__r.count(COMPLIANT) == CA10__AWS_Account_Regions__r.count(COMPLIANT) runtimeError: {} usedFiles: - path: /ce/ca/aws/account/iam-external-access-analyzer-for-all-regions/policy.yaml md5Hash: 0405663C0F3E8B3BB0B51F8DA3722AB1 content: | --- names: full: AWS Account IAM Access Analyzer is not enabled for all regions contextual: IAM Access Analyzer is not enabled for all regions description: "Enable IAM Access analyzer for IAM policies about all resources in each\ \ active AWS region. IAM Access Analyzer is a technology introduced at AWS reinvent\ \ 2019. After the Analyzer is enabled in IAM, scan results are displayed on the\ \ console showing the accessible resources. Scans show resources that other accounts\ \ and federated users can access, such as KMS keys and IAM roles. So the results\ \ allow you to determine if an unintended user is allowed, making it easier for\ \ administrators to monitor least privileges access. Access Analyzer analyzes only\ \ policies that are applied to resources in the same AWS Region." type: COMPLIANCE_POLICY categories: - "SECURITY" frameworkMappings: - "/frameworks/cis-aws-v7.0.0/02/18" - "/frameworks/cloudaware/resource-security/secure-access" similarPolicies: internal: - dec-x-ab7fc52e cloudConformity: - url: https://www.trendmicro.com/cloudoneconformity/knowledge-base/aws/IAM/access-analyzer-in-use.html name: IAM Access Analyzer in Use - path: /ce/ca/aws/account/iam-external-access-analyzer-for-all-regions/prod.logic.yaml md5Hash: 0EC599241D40FBD684F78DE275C701B6 content: "---\ninputType: \"CA10__CaAwsAccount__c\"\ntestData:\n - file: test-data.json\n\ importExtracts:\n - file: /types/CA10__CaAwsAccount__c/object.extracts.yaml\n\ conditions:\n - status: \"COMPLIANT\"\n currentStateMessage: \"IAM Access\ \ Analyzer is enabled in all regions.\"\n check:\n IS_EQUAL:\n \ \ left:\n RELATED_LIST_COUNT:\n status:\ \ \"COMPLIANT\"\n relationshipName: \"CA10A1__AWS_IAM_Access_Analyzers__r\"\ \n right:\n RELATED_LIST_COUNT:\n status:\ \ \"COMPLIANT\"\n relationshipName: \"CA10__AWS_Account_Regions__r\"\ \notherwise:\n status: \"INCOMPLIANT\"\n currentStateMessage: \"IAM Access\ \ Analyzer is not enabled in all regions.\"\n remediationMessage: \"Enable\ \ IAM Access Analyzer in each active region.\"\nrelatedLists:\n - relationshipName:\ \ \"CA10A1__AWS_IAM_Access_Analyzers__r\"\n importExtracts:\n - file:\ \ /types/CA10A1__CaAwsIamAccessAnalyzer__c/object.extracts.yaml\n conditions:\ \ \n - status: \"INAPPLICABLE\"\n currentStateMessage: \"This\ \ is not an external access analyzer.\"\n check:\n AND:\n \ \ args:\n - NOT_EQUAL:\n left:\n \ \ EXTRACT: \"CA10A1__type__c\"\n right:\n \ \ TEXT: \"ACCOUNT\"\n - NOT_EQUAL:\n \ \ left:\n EXTRACT: \"CA10A1__type__c\"\n \ \ right:\n TEXT: \"ORGANIZATION\"\n - status:\ \ \"COMPLIANT\"\n currentStateMessage: \"Active IAM external access analyzer.\"\ \n check:\n IS_EQUAL:\n left:\n \ \ EXTRACT: \"CA10A1__status__c\"\n right:\n TEXT:\ \ \"ACTIVE\"\n otherwise:\n status: \"INAPPLICABLE\"\n currentStateMessage:\ \ \"There is no active IAM external access analyzer.\"\n - relationshipName:\ \ \"CA10__AWS_Account_Regions__r\"\n importExtracts:\n - file: /types/CA10__CaAwsAccountRegion__c/object.extracts.yaml\n\ \ conditions: \n - status: \"COMPLIANT\"\n currentStateMessage:\ \ \"Active AWS account region.\"\n check:\n NOT_EQUAL:\n \ \ left:\n EXTRACT: \"CA10__status__c\"\n right:\n\ \ TEXT: \"not-opted-in\"\n otherwise:\n status: \"INAPPLICABLE\"\ \n currentStateMessage: \"This AWS account region is not active.\"\n" - path: /ce/ca/aws/account/iam-external-access-analyzer-for-all-regions/test-data.json md5Hash: 98EEF7F281AADBE8F102C11F1CDE7AB7 content: |- [ { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "200", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2024-07-10T20:44:00Z" }, "Id": "test1", "CA10A1__AWS_IAM_Access_Analyzers__r": [ { "Id": "test1_1", "CA10A1__status__c": "ACTIVE", "CA10A1__type__c": "ACCOUNT", "CA10A1__account__c": "test1", "CA10A1__disappearanceTime__c": null } ], "CA10__AWS_Account_Regions__r": [ { "Id": "test1_2", "CA10__status__c": "opt-in-not-required", "CA10__account__c": "test1" }, { "Id": "test1_3", "CA10__status__c": "opt-in-not-required", "CA10__account__c": "test1" }, { "Id": "test1_4", "CA10__status__c": "opt-in-not-required", "CA10__account__c": "test1" } ] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "199", "conditionText": "CA10A1__AWS_IAM_Access_Analyzers__r.count(COMPLIANT) == CA10__AWS_Account_Regions__r.count(COMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2024-07-10T20:44:00Z" }, "Id": "test2", "CA10A1__AWS_IAM_Access_Analyzers__r": [ { "Id": "test2_1", "CA10A1__status__c": "ACTIVE", "CA10A1__type__c": "ACCOUNT", "CA10A1__account__c": "test2", "CA10A1__disappearanceTime__c": null }, { "Id": "test2_2", "CA10A1__status__c": "ACTIVE", "CA10A1__type__c": "ACCOUNT", "CA10A1__account__c": "test2", "CA10A1__disappearanceTime__c": null }, { "Id": "test2_3", "CA10A1__status__c": "ACTIVE", "CA10A1__type__c": "ACCOUNT", "CA10A1__account__c": "test2", "CA10A1__disappearanceTime__c": null } ], "CA10__AWS_Account_Regions__r": [ { "Id": "test2_4", "CA10__status__c": "opt-in-not-required", "CA10__account__c": "test2" }, { "Id": "test2_5", "CA10__status__c": "opt-in-not-required", "CA10__account__c": "test2" }, { "Id": "test2_6", "CA10__status__c": "opt-in-not-required", "CA10__account__c": "test2" } ] } ] - path: /types/CA10__CaAwsAccount__c/object.extracts.yaml md5Hash: 926999C100E8C1066EC8BD4B82B0F362 content: "---\nextracts:\n - name: CA10__accountId__c\n value: \n FIELD:\n\ \ path: CA10__accountId__c\n undeterminedIf:\n isEmpty:\ \ \"Account ID can not be empty. Possibly corrupted data.\"\n# Not nullable\n\ \ - name: \"CA10__shieldAdvancedState__c\"\n value: \n FIELD:\n \ \ path: \"CA10__shieldAdvancedState__c\"\n undeterminedIf:\n \ \ noAccessDelegate:\n path: \"CA10__shieldAdvancedState__c\"\ \n currentStateMessage: \"Shield Advanced subscription state cannot\ \ be empty. Possible permission issue with shield:GetSubscriptionState\"\n#\ \ Not nullable\n - name: \"CA10__shieldAdvancedSrtSupportConfigured__c\"\n\ \ value: \n FIELD:\n path: \"CA10__shieldAdvancedSrtSupportConfigured__c\"\ \n undeterminedIf:\n noAccessDelegate:\n path: \"\ CA10__shieldAdvancedSrtSupportConfigured__c\"\n currentStateMessage:\ \ \"Shield Advanced SRT Access state cannot be empty. Possible permission issue\ \ with shield:DescribeDRTAccess\"\n# Not nullable\n - name: \"CA10__status__c\"\ \n value: \n FIELD:\n path: \"CA10__status__c\"\n - name: \"\ CA10__inspectorStatus__c\"\n value: \n FIELD:\n path: \"CA10__inspectorStatus__c\"\ \n - name: \"CA10__inspectorEc2Status__c\"\n value: \n FIELD:\n \ \ path: \"CA10__inspectorEc2Status__c\"\n - name: \"CA10__inspectorEcrStatus__c\"\ \n value: \n FIELD:\n path: \"CA10__inspectorEcrStatus__c\"\n\ \ - name: \"CA10__inspectorLambdaCodeStatus__c\"\n value: \n FIELD:\n\ \ path: \"CA10__inspectorLambdaCodeStatus__c\"\n - name: \"CA10__inspectorLambdaStatus__c\"\ \n value: \n FIELD:\n path: \"CA10__inspectorLambdaStatus__c\"\ \n" - path: /types/CA10__CaAwsAccountRegion__c/object.extracts.yaml md5Hash: B5D54D4844B8E77238E14E730ABEE3C4 content: "---\nextracts:\n - name: CA10__status__c\n value: \n FIELD:\n\ \ path: CA10__status__c\n undeterminedIf:\n isEmpty:\ \ \"Account Region status must be specified \"\n - name: CA10__ebsStorageEncryption__c\n\ \ value: \n FIELD:\n path: CA10__ebsStorageEncryption__c\n \ \ undeterminedIf:\n isEmpty: \"EBS Storage Encryption can not\ \ be empty. Possibly corrupted data.\"" - path: /types/CA10A1__CaAwsIamAccessAnalyzer__c/object.extracts.yaml md5Hash: 72D380FE6BF927AAF32782CD4F6277F7 content: "---\nextracts:\n - name: CA10A1__status__c\n value:\n FIELD:\ \ \n path: CA10A1__status__c\n undeterminedIf:\n isEmpty:\ \ Possibly corrupted data. Status should not be empty.\n - name: CA10A1__type__c\n\ \ value:\n FIELD: \n path: CA10A1__type__c\n undeterminedIf:\n\ \ isEmpty: Possibly corrupted data. Type should not be empty." script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "200", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "199", "conditionText" : "CA10A1__AWS_IAM_Access_Analyzers__r.count(COMPLIANT) == CA10__AWS_Account_Regions__r.count(COMPLIANT)", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10A1__CaAwsIamAccessAnalyzer__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "CA10A1__type__c" : "ACCOUNT", "CA10A1__status__c" : "ACTIVE", "CA10A1__account__c" : "test1", "Id" : "test1_1" }, { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "CA10A1__type__c" : "ACCOUNT", "CA10A1__status__c" : "ACTIVE", "CA10A1__account__c" : "test2", "Id" : "test2_1" }, { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "CA10A1__type__c" : "ACCOUNT", "CA10A1__status__c" : "ACTIVE", "CA10A1__account__c" : "test2", "Id" : "test2_2" }, { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "CA10A1__type__c" : "ACCOUNT", "CA10A1__status__c" : "ACTIVE", "CA10A1__account__c" : "test2", "Id" : "test2_3" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsAccountRegion__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "CA10__status__c" : "opt-in-not-required", "CA10__account__c" : "test1", "Id" : "test1_2" }, { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "CA10__status__c" : "opt-in-not-required", "CA10__account__c" : "test1", "Id" : "test1_3" }, { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "CA10__status__c" : "opt-in-not-required", "CA10__account__c" : "test1", "Id" : "test1_4" }, { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "CA10__status__c" : "opt-in-not-required", "CA10__account__c" : "test2", "Id" : "test2_4" }, { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "CA10__status__c" : "opt-in-not-required", "CA10__account__c" : "test2", "Id" : "test2_5" }, { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "CA10__status__c" : "opt-in-not-required", "CA10__account__c" : "test2", "Id" : "test2_6" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsAccount__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2024-07-10T20:44:00Z") }, "Id" : "test2" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsAccount__c( obj STRUCT< CA10A1__AWS_IAM_Access_Analyzers__r ARRAY >>, CA10__AWS_Account_Regions__r ARRAY >>, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var references1 = []; // condition[0], conditionIndex:[0..99] if (false) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared()", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10A1__AWS_IAM_Access_Analyzers__r_COMPLIANT2 = 0; if (obj.CA10A1__AWS_IAM_Access_Analyzers__r != null) { for (var i4 = 0; i4 < obj.CA10A1__AWS_IAM_Access_Analyzers__r.length; i4++) { if (typeof(obj.CA10A1__AWS_IAM_Access_Analyzers__r[i4].status) !== 'undefined') { if (obj.CA10A1__AWS_IAM_Access_Analyzers__r[i4].status == 'COMPLIANT') { count_CA10A1__AWS_IAM_Access_Analyzers__r_COMPLIANT2 += obj.CA10A1__AWS_IAM_Access_Analyzers__r[i4].count; } } else { if (obj.CA10A1__AWS_IAM_Access_Analyzers__r[i4].result.status == 'COMPLIANT') { count_CA10A1__AWS_IAM_Access_Analyzers__r_COMPLIANT2 += 1; } } } } var count_CA10__AWS_Account_Regions__r_COMPLIANT3 = 0; if (obj.CA10__AWS_Account_Regions__r != null) { for (var i5 = 0; i5 < obj.CA10__AWS_Account_Regions__r.length; i5++) { if (typeof(obj.CA10__AWS_Account_Regions__r[i5].status) !== 'undefined') { if (obj.CA10__AWS_Account_Regions__r[i5].status == 'COMPLIANT') { count_CA10__AWS_Account_Regions__r_COMPLIANT3 += obj.CA10__AWS_Account_Regions__r[i5].count; } } else { if (obj.CA10__AWS_Account_Regions__r[i5].result.status == 'COMPLIANT') { count_CA10__AWS_Account_Regions__r_COMPLIANT3 += 1; } } } } // condition[1], conditionIndex:[100..199] references1.push('Related list [CA10A1__AWS_IAM_Access_Analyzers__r] has ' + count_CA10A1__AWS_IAM_Access_Analyzers__r_COMPLIANT2 + ' objects in COMPLIANT status'); references1.push('Related list [CA10__AWS_Account_Regions__r] has ' + count_CA10__AWS_Account_Regions__r_COMPLIANT3 + ' objects in COMPLIANT status'); if (count_CA10A1__AWS_IAM_Access_Analyzers__r_COMPLIANT2 == count_CA10__AWS_Account_Regions__r_COMPLIANT3) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "CA10A1__AWS_IAM_Access_Analyzers__r.count(COMPLIANT) == CA10__AWS_Account_Regions__r.count(COMPLIANT)", currentStateMessage: "IAM Access Analyzer is enabled in all regions.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'INCOMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "IAM Access Analyzer is not enabled in all regions.", currentStateReferences: references1.join('\n'), remediation: "Enable IAM Access Analyzer in each active region.", runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10A1__AWS_IAM_Access_Analyzers__r( obj STRUCT< CA10A1__disappearanceTime__c TIMESTAMP, CA10A1__type__c STRING, CA10A1__status__c STRING, CA10A1__account__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 AWS [CA10A1__disappearanceTime__c]: ' + obj.CA10A1__disappearanceTime__c); if (obj.CA10A1__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10A1__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.CA10A1__type__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10A1__type__c.isEmpty()", currentStateMessage: "Possibly corrupted data. Type should not be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10A1__type__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; references1.push('Type [obj.CA10A1__type__c]: ' + obj.CA10A1__type__c); try { if (TextLib.notEqual(extract3.call(extract3), 'ACCOUNT') && TextLib.notEqual(extract3.call(extract3), 'ORGANIZATION')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10A1__type__c') != 'ACCOUNT' && extract('CA10A1__type__c') != 'ORGANIZATION'", currentStateMessage: "This is not an external access analyzer.", 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 fieldChecked8() { if (TextLib.isEmpty(obj.CA10A1__status__c)) { throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10A1__status__c.isEmpty()", currentStateMessage: "Possibly corrupted data. Status should not be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10A1__status__c; } function extract7() { if (!this.out) { this.out = fieldChecked8(); } return this.out; }; references1.push('Status [obj.CA10A1__status__c]: ' + obj.CA10A1__status__c); try { if (TextLib.equal(extract7.call(extract7), 'ACTIVE')) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "extract('CA10A1__status__c') == 'ACTIVE'", currentStateMessage: "Active IAM external access analyzer.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } return {status: 'INAPPLICABLE', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "There is no active IAM external access analyzer.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10__AWS_Account_Regions__r( obj STRUCT< CA10__status__c STRING, CA10__account__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] if (false) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared()", 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__status__c; } return this.out; }; references1.push('Status [obj.CA10__status__c]: ' + obj.CA10__status__c); if (TextLib.notEqual(extract3.call(extract3), 'not-opted-in')) { return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__status__c') != 'not-opted-in'", currentStateMessage: "Active AWS account region.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'INAPPLICABLE', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "This AWS account region is not active.", 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 `CA10A1__AWS_IAM_Access_Analyzers__r`.arr AS CA10A1__AWS_IAM_Access_Analyzers__r, `CA10__AWS_Account_Regions__r`.arr AS CA10__AWS_Account_Regions__r, sObject.Id AS Id, process_CA10__CaAwsAccount__c( STRUCT( `CA10A1__AWS_IAM_Access_Analyzers__r`.arr AS CA10A1__AWS_IAM_Access_Analyzers__r, `CA10__AWS_Account_Regions__r`.arr AS CA10__AWS_Account_Regions__r, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsAccount__c()) AS sObject LEFT JOIN ( SELECT sObject.CA10A1__account__c, ARRAY_AGG( STRUCT( sObject.CA10A1__disappearanceTime__c AS CA10A1__disappearanceTime__c, sObject.CA10A1__type__c AS CA10A1__type__c, sObject.CA10A1__status__c AS CA10A1__status__c, sObject.CA10A1__account__c AS CA10A1__account__c, sObject.Id AS Id, process_CA10A1__AWS_IAM_Access_Analyzers__r( STRUCT( sObject.CA10A1__disappearanceTime__c AS CA10A1__disappearanceTime__c, sObject.CA10A1__type__c AS CA10A1__type__c, sObject.CA10A1__status__c AS CA10A1__status__c, sObject.CA10A1__account__c AS CA10A1__account__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10A1__CaAwsIamAccessAnalyzer__c()) AS sObject GROUP BY sObject.CA10A1__account__c ) AS `CA10A1__AWS_IAM_Access_Analyzers__r` ON sObject.Id = `CA10A1__AWS_IAM_Access_Analyzers__r`.CA10A1__account__c LEFT JOIN ( SELECT sObject.CA10__account__c, ARRAY_AGG( STRUCT( sObject.CA10__status__c AS CA10__status__c, sObject.CA10__account__c AS CA10__account__c, sObject.Id AS Id, process_CA10__AWS_Account_Regions__r( STRUCT( sObject.CA10__status__c AS CA10__status__c, sObject.CA10__account__c AS CA10__account__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10__CaAwsAccountRegion__c()) AS sObject GROUP BY sObject.CA10__account__c ) AS `CA10__AWS_Account_Regions__r` ON sObject.Id = `CA10__AWS_Account_Regions__r`.CA10__account__c ) sObject ON sObject.Id = expectedResult.Id;