--- policy: /ce/ca/aws/apigateway/api-execution-logging logic: /ce/ca/aws/apigateway/api-execution-logging/prod.logic.yaml executionTime: 2026-06-06T12:02:28.714121958Z generationMs: 75 executionMs: 1146 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: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10__protocolType__c') == 'HTTP' actual: extract('CA10__protocolType__c') == 'HTTP' runtimeError: {} - id: test3 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 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: COMPLIANT actual: COMPLIANT conditionIndex: expected: 300 actual: 300 conditionText: expected: otherwise actual: otherwise runtimeError: {} usedFiles: - path: /ce/ca/aws/apigateway/api-execution-logging/policy.yaml md5Hash: B6E6008D7B1E4CE46EAB8065F5F7A6E8 content: "---\nnames:\n full: AWS API Gateway API Execution Logging in CloudWatch\ \ is not enabled\n contextual: API Execution Logging in CloudWatch is not enabled\n\ description: >\n Ensure that CloudWatch execution logging is enabled for APIs\ \ in API Gateway.\n Execution logging for API Gateway allows tracking of API\ \ requests and responses \n in CloudWatch, providing insights into API usage\ \ and facilitating troubleshooting.\ncategories:\n - \"PERFORMANCE\"\n - \"\ RELIABILITY\"\ntype: \"COMPLIANCE_POLICY\"\nframeworkMappings:\n - \"/frameworks/cloudaware/logging-and-monitoring/logging-and-monitoring-configuration\"\ \n - \"/frameworks/aws-fsbp-v1.0.0/api-gateway/01\"\nsimilarPolicies:\n internal:\n\ \ - \"dec-x-2ac6c302\"\n" - path: /ce/ca/aws/apigateway/api-execution-logging/prod.logic.yaml md5Hash: 99A4D96F4631D05420881A0D6E4873A4 content: | --- inputType: "CA10__CaAwsApiGatewayRestApi__c" importExtracts: - file: "/types/CA10__CaAwsApiGatewayStage__c/object.extracts.yaml" - file: "/types/CA10__CaAwsApiGatewayRestApi__c/object.extracts.yaml" testData: - file: test-data.json conditions: - status: "INAPPLICABLE" currentStateMessage: "HTTP APIs do not support execution logs." check: IS_EQUAL: left: EXTRACT: "CA10__protocolType__c" right: TEXT: "HTTP" - status: "INCOMPLIANT" currentStateMessage: "At least one API stage does not have CloudWatch execution logs enabled." remediationMessage: "Enable CloudWatch execution 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 execution logs enabled." relatedLists: - relationshipName: "CA10__AWS_API_Gateway_Stages__r" conditions: - status: "INCOMPLIANT" currentStateMessage: "CloudWatch execution logs are not enabled for this API stage." remediationMessage: "Enable CloudWatch execution logs for this API stage." check: IS_EMPTY: arg: EXTRACT: "CA10__cloudWatchLogLevel__c" - status: "INCOMPLIANT" currentStateMessage: "CloudWatch execution logs are turned off for this API stage." remediationMessage: "Enable CloudWatch execution logs for this API stage." check: IS_EQUAL: left: EXTRACT: "CA10__cloudWatchLogLevel__c" right: TEXT: "OFF" otherwise: status: "COMPLIANT" currentStateMessage: "CloudWatch execution logs are enabled for this API stage." - path: /ce/ca/aws/apigateway/api-execution-logging/test-data.json md5Hash: F06FEB4B3D78B3C2B7BB9C6183F63E22 content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-04T19:27:53Z" }, "Id": "test1", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": "2024-11-04T19:27:53Z", "CA10__protocolType__c": "", "RecordType": { "DeveloperName": "restApi", "Id": "RecordType" }, "CA10__AWS_API_Gateway_Stages__r": [ { "Id": "test1_1", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "CA10__cloudWatchLogLevel__c": "OFF", "CA10__restApi__c": "test1", "RecordType": { "DeveloperName": "restApiStage", "Id": "RecordType" } } ] }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "extract('CA10__protocolType__c') == 'HTTP'", "runtimeError": null }, "context": { "snapshotTime": "2024-11-04T19:27:53Z" }, "Id": "test2", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "CA10__protocolType__c": "HTTP", "RecordType": { "DeveloperName": "restApi", "Id": "RecordType" }, "CA10__AWS_API_Gateway_Stages__r": [ { "Id": "test2_1", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "CA10__cloudWatchLogLevel__c": "OFF", "CA10__restApi__c": "test2", "RecordType": { "DeveloperName": "restApiStage", "Id": "RecordType" } } ] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-04T19:27:53Z" }, "Id": "test3", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "CA10__protocolType__c": "", "RecordType": { "DeveloperName": "restApi", "Id": "RecordType" }, "CA10__AWS_API_Gateway_Stages__r": [ { "Id": "test3_1", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "CA10__cloudWatchLogLevel__c": "OFF", "CA10__restApi__c": "test3", "RecordType": { "DeveloperName": "restApiStage", "Id": "RecordType" } } ] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "300", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2024-11-04T19:27:53Z" }, "Id": "test4", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "CA10__protocolType__c": "", "RecordType": { "DeveloperName": "restApi", "Id": "RecordType" }, "CA10__AWS_API_Gateway_Stages__r": [ { "Id": "test4_1", "RecordTypeId": "RecordType", "CA10__disappearanceTime__c": null, "CA10__cloudWatchLogLevel__c": "INFO", "CA10__restApi__c": "test4", "RecordType": { "DeveloperName": "restApiStage", "Id": "RecordType" } } ] } ] - path: /types/CA10__CaAwsApiGatewayRestApi__c/object.extracts.yaml md5Hash: 746F09341E8149BAD88C53E274DB1DD5 content: "---\nextracts:\n# Values: HTTP | WEBSOCKET. Nullable. Can't have no\ \ access, retrieved via apigateway:GetApis.\n# Null value indicates REST type\n\ \ - name: CA10__protocolType__c\n value: \n FIELD:\n path: CA10__protocolType__c\n\ # Values: REGIONAL | EDGE | PRIVATE. Not Nullable. Can't have no access, retrieved\ \ via apigateway:GetRestApis.\n - name: CA10__endpointType__c\n value: \n\ \ FIELD:\n path: CA10__endpointType__c" - path: /types/CA10__CaAwsApiGatewayStage__c/object.extracts.yaml md5Hash: 4C63240D980BDDAFE321E6FFAC8F9034 content: "---\nextracts:\n# Values: OFF | INFO | ERROR. Nullable. Can't have no\ \ access, retrieved via apigateway:GetStages.\n - name: CA10__cloudWatchLogLevel__c\n\ \ value: \n FIELD:\n path: CA10__cloudWatchLogLevel__c\n# Values:\ \ Yes | No. Not nullable. Can't have no access, retrieved via apigateway:GetStages.\n\ \ - name: CA10__xrayTracingEnabled__c\n value: \n FIELD:\n path:\ \ CA10__xrayTracingEnabled__c\n# Nullable. Can't have no access, retrieved via\ \ apigateway:GetStages.\n - name: CA10__webAclArn__c\n value: \n FIELD:\n\ \ path: CA10__webAclArn__c\n# Nullable. Checkbox\n - name: CA10__cloudWatchMetricsEnabled__c\n\ \ value: \n FIELD:\n path: CA10__cloudWatchMetricsEnabled__c" 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" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "extract('CA10__protocolType__c') == 'HTTP'", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "299", "conditionText" : "CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT)", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "300", "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-04T19:27:53Z") }, "CA10__disappearanceTime__c" : new Date("2024-11-04T19:27:53Z"), "CA10__protocolType__c" : "", "Id" : "test1", "RecordTypeId" : "RecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-04T19:27:53Z") }, "CA10__protocolType__c" : "HTTP", "Id" : "test2", "RecordTypeId" : "RecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-04T19:27:53Z") }, "CA10__protocolType__c" : "", "Id" : "test3", "RecordTypeId" : "RecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-04T19:27:53Z") }, "CA10__protocolType__c" : "", "Id" : "test4", "RecordTypeId" : "RecordType" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsApiGatewayStage__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-11-04T19:27:53Z") }, "CA10__cloudWatchLogLevel__c" : "OFF", "CA10__restApi__c" : "test1", "Id" : "test1_1", "RecordTypeId" : "RecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-04T19:27:53Z") }, "CA10__cloudWatchLogLevel__c" : "OFF", "CA10__restApi__c" : "test2", "Id" : "test2_1", "RecordTypeId" : "RecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-04T19:27:53Z") }, "CA10__cloudWatchLogLevel__c" : "OFF", "CA10__restApi__c" : "test3", "Id" : "test3_1", "RecordTypeId" : "RecordType" }, { "context" : { "snapshotTime" : new Date("2024-11-04T19:27:53Z") }, "CA10__cloudWatchLogLevel__c" : "INFO", "CA10__restApi__c" : "test4", "Id" : "test4_1", "RecordTypeId" : "RecordType" } ]; """; CREATE TEMP FUNCTION mock_RecordType() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-11-04T19:27:53Z") }, "Id" : "RecordType" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsApiGatewayRestApi__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__protocolType__c STRING, CA10__AWS_API_Gateway_Stages__r ARRAY, result STRUCT >>, 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 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] function extract3() { if (!this.out) { this.out = obj.CA10__protocolType__c; } return this.out; }; references1.push('Protocol Type [obj.CA10__protocolType__c]: ' + obj.CA10__protocolType__c); if (TextLib.equal(extract3.call(extract3), 'HTTP')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__protocolType__c') == 'HTTP'", currentStateMessage: "HTTP APIs do not support execution logs.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10__AWS_API_Gateway_Stages__r_INCOMPLIANT5 = 0; if (obj.CA10__AWS_API_Gateway_Stages__r != null) { for (var i6 = 0; i6 < obj.CA10__AWS_API_Gateway_Stages__r.length; i6++) { if (typeof(obj.CA10__AWS_API_Gateway_Stages__r[i6].status) !== 'undefined') { if (obj.CA10__AWS_API_Gateway_Stages__r[i6].status == 'INCOMPLIANT') { count_CA10__AWS_API_Gateway_Stages__r_INCOMPLIANT5 += obj.CA10__AWS_API_Gateway_Stages__r[i6].count; } } else { if (obj.CA10__AWS_API_Gateway_Stages__r[i6].result.status == 'INCOMPLIANT') { count_CA10__AWS_API_Gateway_Stages__r_INCOMPLIANT5 += 1; } } } } // condition[2], conditionIndex:[200..299] references1.push('Related list [CA10__AWS_API_Gateway_Stages__r] ' + (count_CA10__AWS_API_Gateway_Stages__r_INCOMPLIANT5 > 0 ? 'has' : 'does not have') + ' objects in INCOMPLIANT status'); if (count_CA10__AWS_API_Gateway_Stages__r_INCOMPLIANT5 > 0) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "CA10__AWS_API_Gateway_Stages__r.has(INCOMPLIANT)", currentStateMessage: "At least one API stage does not have CloudWatch execution logs enabled.", currentStateReferences: references1.join('\n'), remediation: "Enable CloudWatch execution logs for the API stage.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "All API stages have CloudWatch execution 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__cloudWatchLogLevel__c STRING, CA10__restApi__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 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] function extract3() { if (!this.out) { this.out = obj.CA10__cloudWatchLogLevel__c; } return this.out; }; references1.push('CloudWatch Logging Level [obj.CA10__cloudWatchLogLevel__c]: ' + obj.CA10__cloudWatchLogLevel__c); if (TextLib.isEmpty(extract3.call(extract3))) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__cloudWatchLogLevel__c').isEmpty()", currentStateMessage: "CloudWatch execution logs are not enabled for this API stage.", currentStateReferences: references1.join('\n'), remediation: "Enable CloudWatch execution logs for this API stage.", runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10__cloudWatchLogLevel__c; } return this.out; }; if (TextLib.equal(extract6.call(extract6), 'OFF')) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__cloudWatchLogLevel__c') == 'OFF'", currentStateMessage: "CloudWatch execution logs are turned off for this API stage.", currentStateReferences: references1.join('\n'), remediation: "Enable CloudWatch execution logs for this API stage.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "CloudWatch execution 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.CA10__protocolType__c AS CA10__protocolType__c, `CA10__AWS_API_Gateway_Stages__r`.arr AS CA10__AWS_API_Gateway_Stages__r, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, STRUCT ( `RecordType`.Id AS Id ) AS RecordType, process_CA10__CaAwsApiGatewayRestApi__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__protocolType__c AS CA10__protocolType__c, `CA10__AWS_API_Gateway_Stages__r`.arr AS CA10__AWS_API_Gateway_Stages__r, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, STRUCT ( `RecordType`.Id AS Id ) AS RecordType ), 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__cloudWatchLogLevel__c AS CA10__cloudWatchLogLevel__c, sObject.CA10__restApi__c AS CA10__restApi__c, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, 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__cloudWatchLogLevel__c AS CA10__cloudWatchLogLevel__c, sObject.CA10__restApi__c AS CA10__restApi__c, sObject.Id AS Id, sObject.RecordTypeId AS RecordTypeId, 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_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;