--- policy: /ce/ca/aws/apigateway/api-access-logging logic: /ce/ca/aws/apigateway/api-access-logging/prod.logic.yaml executionTime: 2026-02-10T22:32:30.91998336Z generationMs: 86 executionMs: 880 rows: - id: test1 match: true status: expected: DISAPPEARED actual: DISAPPEARED conditionIndex: expected: 99 actual: 99 conditionText: expected: isDisappeared(CA10__disappearanceTime__c) actual: isDisappeared(CA10__disappearanceTime__c) runtimeError: {} - id: test2 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT) actual: CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT) runtimeError: {} - id: test3 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT) actual: CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT) runtimeError: {} - id: test4 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 199 actual: 199 conditionText: expected: CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT) actual: CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT) runtimeError: {} - id: test5 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 200 actual: 200 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test6 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 200 actual: 200 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/aws/apigateway/api-access-logging/policy.yaml md5Hash: 27EB0EAEDBCF4B965C9DEB6AB46A20B3 content: "---\nnames:\n full: AWS API Gateway API Access Logging in CloudWatch\ \ is not enabled\n contextual: API Access Logging in CloudWatch is not enabled\n\ description: >\n Ensure that access logging is enabled on API Gateway APIs,\ \ capturing essential \n details about API usage and access in Amazon CloudWatch\ \ Logs. This enables \n monitoring, troubleshooting, and auditing of API calls.\n\ categories:\n - \"SECURITY\"\ntype: \"COMPLIANCE_POLICY\"\nframeworkMappings:\n\ \ - \"/frameworks/cloudaware/logging-and-monitoring/logging-and-monitoring-configuration\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/api-gateway/09\"\nsimilarPolicies:\n internal:\n\ \ - \"dec-x-d75f6d86\"" - path: /ce/ca/aws/apigateway/api-access-logging/prod.logic.yaml md5Hash: 1ABB2ACC246430536AF8AB2D9DFB22FD content: | --- inputType: "CA10__CaAwsApiGatewayRestApi__c" testData: - file: test-data.json conditions: - status: "INCOMPLIANT" currentStateMessage: "At least one API stage does not have CloudWatch access logs enabled." remediationMessage: "Enable CloudWatch access logs for the API stage." check: RELATED_LIST_HAS: relationshipName: "CA10__AWS_API_Gateway_Stages__r" status: "INCOMPLIANT" otherwise: status: "COMPLIANT" currentStateMessage: "All API stages have CloudWatch access logs enabled." relatedLists: - relationshipName: "CA10__AWS_API_Gateway_Stages__r" conditions: - status: "INCOMPLIANT" currentStateMessage: "CloudWatch access logs are not enabled for this API stage." remediationMessage: "Enable CloudWatch access logs for this API stage." check: IS_EMPTY_LOOKUP: "CA10__accessLoggingDestination__r" otherwise: status: "COMPLIANT" currentStateMessage: "CloudWatch access logs are enabled for this API stage." - path: /ce/ca/aws/apigateway/api-access-logging/test-data.json md5Hash: 80C72546B58BBFE5F161E6CFC7DED26B content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-05T19:15:56Z" }, "Id": "test1", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": "2024-11-05T19:15:56Z", "RecordType": { "DeveloperName": "restApi", "Id": "RecordType" }, "CA10__AWS_API_Gateway_Stages__r": [ { "Id": "test1_1", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "CA10__accessLoggingDestination__c": "", "CA10__accessLoggingDestinationArn__c": "", "CA10__restApi__c": "test1", "RecordType": { "DeveloperName": "restApiStage", "Id": "RecordType" }, "CA10__accessLoggingDestination__r": { "Id": null, "CA10__disappearanceTime__c": null } } ] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-05T19:15:56Z" }, "Id": "test2", "RecordTypeId": "restApiRecordType", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "restApi", "Id": "restApiRecordType" }, "CA10__AWS_API_Gateway_Stages__r": [ { "Id": "test2_1", "RecordTypeId": "restApiStageRecordType", "CA10__disappearanceTime__c": null, "CA10__accessLoggingDestination__c": "", "CA10__accessLoggingDestinationArn__c": "", "CA10__restApi__c": "test2", "RecordType": { "DeveloperName": "restApiStage", "Id": "restApiStageRecordType" }, "CA10__accessLoggingDestination__r": { "Id": null, "CA10__disappearanceTime__c": null } } ] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-05T19:15:56Z" }, "Id": "test3", "RecordTypeId": "restApiRecordType", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "restApi", "Id": "restApiRecordType" }, "CA10__AWS_API_Gateway_Stages__r": [ { "Id": "test3_1", "RecordTypeId": "restApiStageRecordType", "CA10__disappearanceTime__c": null, "CA10__accessLoggingDestination__c": "", "CA10__accessLoggingDestinationArn__c": "accessLoggingDestinationArn", "CA10__restApi__c": "test3", "RecordType": { "DeveloperName": "restApiStage", "Id": "restApiStageRecordType" }, "CA10__accessLoggingDestination__r": { "Id": null, "CA10__disappearanceTime__c": null } } ] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "199", "conditionText": "CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-05T19:15:56Z" }, "Id": "test4", "RecordTypeId": "restApiRecordType", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "restApi", "Id": "restApiRecordType" }, "CA10__AWS_API_Gateway_Stages__r": [ { "Id": "test4_1", "RecordTypeId": "restApiStageRecordType", "CA10__disappearanceTime__c": null, "CA10__accessLoggingDestination__c": "test4_2", "CA10__accessLoggingDestinationArn__c": "accessLoggingDestinationArn", "CA10__restApi__c": "test4", "RecordType": { "DeveloperName": "restApiStage", "Id": "restApiStageRecordType" }, "CA10__accessLoggingDestination__r": { "Id": "test4_2", "CA10__disappearanceTime__c": "2024-11-05T19:15:56Z" } } ] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "200", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2024-11-05T19:15:56Z" }, "Id": "test5", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "restApi", "Id": "RecordType" }, "CA10__AWS_API_Gateway_Stages__r": [] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "200", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2024-11-05T19:15:56Z" }, "Id": "test6", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "RecordType": { "DeveloperName": "restApi", "Id": "RecordType" }, "CA10__AWS_API_Gateway_Stages__r": [ { "Id": "test6_1", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "CA10__accessLoggingDestination__c": "test6_2", "CA10__accessLoggingDestinationArn__c": "accessLoggingDestinationArn", "CA10__restApi__c": "test6", "RecordType": { "DeveloperName": "restApiStage", "Id": "RecordType" }, "CA10__accessLoggingDestination__r": { "Id": "test6_2", "CA10__disappearanceTime__c": null } } ] } ] script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "199", "conditionText" : "CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT)", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "199", "conditionText" : "CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT)", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "199", "conditionText" : "CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT)", "runtimeError" : null } }, { "Id" : "test5", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "200", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test6", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "200", "conditionText" : "otherwise", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsApiGatewayRestApi__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "CA10__disappearanceTime__c" : new Date("2024-11-05T19:15:56Z"), "Id" : "test1", "RecordTypeId" : "RecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : "test2", "RecordTypeId" : "restApiRecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : "test3", "RecordTypeId" : "restApiRecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : "test4", "RecordTypeId" : "restApiRecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : "test5", "RecordTypeId" : "RecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : "test6", "RecordTypeId" : "RecordType" } ]; """; CREATE TEMP FUNCTION mock_RecordType() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : "RecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : "restApiRecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : "restApiStageRecordType" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsApiGatewayStage__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "CA10__accessLoggingDestination__c" : "", "CA10__accessLoggingDestinationArn__c" : "", "CA10__restApi__c" : "test1", "Id" : "test1_1", "RecordTypeId" : "RecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "CA10__accessLoggingDestination__c" : "", "CA10__accessLoggingDestinationArn__c" : "", "CA10__restApi__c" : "test2", "Id" : "test2_1", "RecordTypeId" : "restApiStageRecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "CA10__accessLoggingDestination__c" : "", "CA10__accessLoggingDestinationArn__c" : "accessLoggingDestinationArn", "CA10__restApi__c" : "test3", "Id" : "test3_1", "RecordTypeId" : "restApiStageRecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "CA10__accessLoggingDestination__c" : "test4_2", "CA10__accessLoggingDestinationArn__c" : "accessLoggingDestinationArn", "CA10__restApi__c" : "test4", "Id" : "test4_1", "RecordTypeId" : "restApiStageRecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "CA10__accessLoggingDestination__c" : "test6_2", "CA10__accessLoggingDestinationArn__c" : "accessLoggingDestinationArn", "CA10__restApi__c" : "test6", "Id" : "test6_1", "RecordTypeId" : "RecordType" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsCloudWatchLogsLogGroup__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : null }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : "test4_2", "CA10__disappearanceTime__c" : new Date("2024-11-05T19:15:56Z") }, { "context" : { "snapshotTime" : new Date("2024-11-05T19:15:56Z") }, "Id" : "test6_2" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsApiGatewayRestApi__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, Id STRING, RecordTypeId STRING, RecordType STRUCT< Id STRING >, CA10__AWS_API_Gateway_Stages__r ARRAY, RecordType STRUCT< Id STRING >, result STRUCT >> >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10__AWS_API_Gateway_Stages__r_INCOMPLIANT2 = 0; if (obj.CA10__AWS_API_Gateway_Stages__r != null) { for (var i3 = 0; i3 < obj.CA10__AWS_API_Gateway_Stages__r.length; i3++) { if (typeof(obj.CA10__AWS_API_Gateway_Stages__r[i3].status) !== 'undefined') { if (obj.CA10__AWS_API_Gateway_Stages__r[i3].status == 'INCOMPLIANT') { count_CA10__AWS_API_Gateway_Stages__r_INCOMPLIANT2 += obj.CA10__AWS_API_Gateway_Stages__r[i3].count; } } else { if (obj.CA10__AWS_API_Gateway_Stages__r[i3].result.status == 'INCOMPLIANT') { count_CA10__AWS_API_Gateway_Stages__r_INCOMPLIANT2 += 1; } } } } // condition[1], conditionIndex:[100..199] references1.push('Related list [CA10__AWS_API_Gateway_Stages__r] ' + (count_CA10__AWS_API_Gateway_Stages__r_INCOMPLIANT2 > 0 ? 'has' : 'does not have') + ' objects in INCOMPLIANT status'); if (count_CA10__AWS_API_Gateway_Stages__r_INCOMPLIANT2 > 0) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT)", currentStateMessage: "At least one API stage does not have CloudWatch access logs enabled.", currentStateReferences: references1.join('\n'), remediation: "Enable CloudWatch access logs for the API stage.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "All API stages have CloudWatch access logs enabled.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10__AWS_API_Gateway_Stages__r( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__accessLoggingDestination__c STRING, CA10__accessLoggingDestinationArn__c STRING, CA10__restApi__c STRING, Id STRING, RecordTypeId STRING, CA10__accessLoggingDestination__r STRUCT< Id STRING, CA10__disappearanceTime__c TIMESTAMP >, 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 AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] if (TextLib.isEmpty(obj.CA10__accessLoggingDestinationArn__c) || TextLib.isEmpty(obj.CA10__accessLoggingDestination__c) || obj.CA10__accessLoggingDestination__r.CA10__disappearanceTime__c != null) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "isEmptyLookup('CA10__accessLoggingDestination__r')", currentStateMessage: "CloudWatch access logs are not enabled for this API stage.", currentStateReferences: references1.join('\n'), remediation: "Enable CloudWatch access logs for this API stage.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "CloudWatch access logs are enabled for this API stage.", 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.Id AS Id, sObject.RecordTypeId AS RecordTypeId, STRUCT ( `RecordType`.Id AS Id ) AS RecordType, `CA10__AWS_API_Gateway_Stages__r`.arr AS CA10__AWS_API_Gateway_Stages__r, process_CA10__CaAwsApiGatewayRestApi__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, STRUCT ( `RecordType`.Id AS Id ) AS RecordType, `CA10__AWS_API_Gateway_Stages__r`.arr AS CA10__AWS_API_Gateway_Stages__r ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsApiGatewayRestApi__c()) AS sObject LEFT JOIN UNNEST(mock_RecordType()) AS `RecordType` ON sObject.RecordTypeId = `RecordType`.Id LEFT JOIN ( SELECT sObject.CA10__restApi__c, ARRAY_AGG( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__accessLoggingDestination__c AS CA10__accessLoggingDestination__c, sObject.CA10__accessLoggingDestinationArn__c AS CA10__accessLoggingDestinationArn__c, sObject.CA10__restApi__c AS CA10__restApi__c, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, STRUCT ( `CA10__accessLoggingDestination__r`.Id AS Id, `CA10__accessLoggingDestination__r`.CA10__disappearanceTime__c AS CA10__disappearanceTime__c ) AS CA10__accessLoggingDestination__r, STRUCT ( `RecordType`.Id AS Id ) AS RecordType, process_CA10__AWS_API_Gateway_Stages__r( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__accessLoggingDestination__c AS CA10__accessLoggingDestination__c, sObject.CA10__accessLoggingDestinationArn__c AS CA10__accessLoggingDestinationArn__c, sObject.CA10__restApi__c AS CA10__restApi__c, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, STRUCT ( `CA10__accessLoggingDestination__r`.Id AS Id, `CA10__accessLoggingDestination__r`.CA10__disappearanceTime__c AS CA10__disappearanceTime__c ) AS CA10__accessLoggingDestination__r, STRUCT ( `RecordType`.Id AS Id ) AS RecordType ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10__CaAwsApiGatewayStage__c()) AS sObject LEFT JOIN UNNEST(mock_CA10__CaAwsCloudWatchLogsLogGroup__c()) AS `CA10__accessLoggingDestination__r` ON sObject.CA10__accessLoggingDestination__c = `CA10__accessLoggingDestination__r`.Id LEFT JOIN UNNEST(mock_RecordType()) AS `RecordType` ON sObject.RecordTypeId = `RecordType`.Id GROUP BY sObject.CA10__restApi__c ) AS `CA10__AWS_API_Gateway_Stages__r` ON sObject.Id = `CA10__AWS_API_Gateway_Stages__r`.CA10__restApi__c ) sObject ON sObject.Id = expectedResult.Id;