---
policy: /ce/ca/aws/lambda/function-in-vpc
logic: /ce/ca/aws/lambda/function-in-vpc/prod.logic.yaml
executionTime: 2026-01-17T12:02:54.266128256Z
generationMs: 100
executionMs: 1126
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: CA10__AWS_Lambda_Function_Versions__r.has(COMPLIANT)
      actual: CA10__AWS_Lambda_Function_Versions__r.has(COMPLIANT)
    runtimeError: {}
  - id: test3
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: CA10__vpcId__c.isEmpty()
      actual: CA10__vpcId__c.isEmpty()
    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/lambda/function-in-vpc/policy.yaml
    md5Hash: 73EF365A92A37F231215FD6419C2782B
    content: "---\nnames:\n  full: \"AWS Lambda Function is not in a VPC\"\n  contextual:\
      \ \"Function is not in a VPC\"\ndescription: >\n  Ensure that AWS Lambda functions\
      \ are configured to connect to a Virtual Private Cloud (VPC). \n  This allows\
      \ the function to access private resources and leverage VPC security \n  controls\
      \ like Security Groups and Network ACLs.\ntype: \"COMPLIANCE_POLICY\"\ncategories:\n\
      \  - \"SECURITY\"\nframeworkMappings:\n  - \"/frameworks/cloudaware/resource-security/secure-access\"\
      \n  - \"/frameworks/pci-dss-v3.2.1/01/02/01\"\n  - \"/frameworks/pci-dss-v3.2.1/01/03/01\"\
      \n  - \"/frameworks/pci-dss-v3.2.1/01/03/02\"\n  - \"/frameworks/pci-dss-v3.2.1/01/03/04\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/ac/21\"\n  - \"/frameworks/nist-sp-800-53-r5/ac/03\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/ac/03/07\"\n  - \"/frameworks/nist-sp-800-53-r5/ac/04\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/ac/04/21\"\n  - \"/frameworks/nist-sp-800-53-r5/ac/06\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/sc/07\"\n  - \"/frameworks/nist-sp-800-53-r5/sc/07/11\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/sc/07/16\"\n  - \"/frameworks/nist-sp-800-53-r5/sc/07/20\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/sc/07/21\"\n  - \"/frameworks/nist-sp-800-53-r5/sc/07/03\"\
      \n  - \"/frameworks/nist-sp-800-53-r5/sc/07/04\"\n  - \"/frameworks/nist-sp-800-53-r5/sc/07/09\"\
      \nsimilarPolicies:\n  awsSecurityHub:\n    - name: \"[Lambda.3] Lambda functions\
      \ should be in a VPC\"\n      url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/lambda-controls.html#lambda-3\""
  - path: /ce/ca/aws/lambda/function-in-vpc/prod.logic.yaml
    md5Hash: 5F542DC6B79549AA398A670F80B61043
    content: "---\ninputType: \"CA10__CaAwsLambdaFunction__c\"\nimportExtracts:\n\
      \  - file: \"/types/CA10__CaAwsLambdaFunction__c/object.extracts.yaml\"\ntestData:\n\
      \  - file: \"test-data.json\"\nconditions:\n  - status: \"INAPPLICABLE\"\n \
      \   currentStateMessage: \"Lambda@Edge functions do not support VPC association.\"\
      \n    check:\n      RELATED_LIST_HAS:\n        status: \"COMPLIANT\"\n     \
      \   relationshipName: \"CA10__AWS_Lambda_Function_Versions__r\"\n  - status:\
      \ \"INCOMPLIANT\"\n    currentStateMessage: \"The Lambda function is not associated\
      \ with a VPC.\"\n    remediationMessage: \"Configure the Lambda function to\
      \ connect to a VPC.\"    \n    check:\n      IS_EMPTY:\n        arg:\n     \
      \     FIELD:\n            path: \"CA10__vpcId__c\"\notherwise:\n  status: \"\
      COMPLIANT\"\n  currentStateMessage: \"The Lambda function is associated with\
      \ a VPC.\"\nrelatedLists:\n  - relationshipName: \"CA10__AWS_Lambda_Function_Versions__r\"\
      \n    conditions:\n      - status: \"COMPLIANT\"\n        currentStateMessage:\
      \ \"This is Lambda@Edge function.\"\n        check:\n          RELATED_LIST_HAS:\n\
      \            status: \"COMPLIANT\"\n            relationshipName: \"CA10__AWS_CloudFront_Lambda_Func_Associations__r\"\
      \n    otherwise:\n      status: \"INAPPLICABLE\"\n      currentStateMessage:\
      \ \"This function version does not have an association with CloudFront.\"\n\
      \    relatedLists:\n      - relationshipName: \"CA10__AWS_CloudFront_Lambda_Func_Associations__r\"\
      \n        conditions: []\n        otherwise:\n          status: \"COMPLIANT\"\
      \n          currentStateMessage: \"This is Lambda@Edge function.\" "
  - path: /ce/ca/aws/lambda/function-in-vpc/test-data.json
    md5Hash: FB35F5D60E590F55578AD9A5F7D76125
    content: |-
      [
        {
          "CA10__AWS_Lambda_Function_Versions__r": [],
          "expectedResult": {
            "runtimeError": null,
            "conditionText": "isDisappeared(CA10__disappearanceTime__c)",
            "conditionIndex": 99,
            "status": "DISAPPEARED"
          },
          "context": {
            "snapshotTime": "2026-01-12T23:29:54Z"
          },
          "Id": "test1",
          "CA10__disappearanceTime__c": "2025-07-29T12:38:18Z",
          "CA10__vpcId__c": ""
        },
        {
          "CA10__AWS_Lambda_Function_Versions__r": [
            {
              "CA10__function__c": "test2",
              "CA10__AWS_CloudFront_Lambda_Func_Associations__r": [
                {
                  "Id": "test2_2",
                  "CA10__disappearanceTime__c": null,
                  "CA10__lambdaFunctionVersion__c": "test2_1"
                }
              ],
              "Id": "test2_1",
              "CA10__disappearanceTime__c": null
            }
          ],
          "expectedResult": {
            "runtimeError": null,
            "conditionText": "CA10__AWS_Lambda_Function_Versions__r.has(COMPLIANT)",
            "conditionIndex": 199,
            "status": "INAPPLICABLE"
          },
          "context": {
            "snapshotTime": "2026-01-12T23:29:54Z"
          },
          "Id": "test2",
          "CA10__disappearanceTime__c": null,
          "CA10__vpcId__c": ""
        },
        {
          "CA10__AWS_Lambda_Function_Versions__r": [
            {
              "CA10__function__c": "test3",
              "CA10__AWS_CloudFront_Lambda_Func_Associations__r": [],
              "Id": "test3_1",
              "CA10__disappearanceTime__c": null
            }
          ],
          "expectedResult": {
            "runtimeError": null,
            "conditionText": "CA10__vpcId__c.isEmpty()",
            "conditionIndex": 299,
            "status": "INCOMPLIANT"
          },
          "context": {
            "snapshotTime": "2026-01-12T23:29:54Z"
          },
          "Id": "test3",
          "CA10__disappearanceTime__c": null,
          "CA10__vpcId__c": ""
        },
        {
          "CA10__AWS_Lambda_Function_Versions__r": [
            {
              "CA10__function__c": "test4",
              "CA10__AWS_CloudFront_Lambda_Func_Associations__r": [],
              "Id": "test4_1",
              "CA10__disappearanceTime__c": null
            }
          ],
          "expectedResult": {
            "runtimeError": null,
            "conditionText": "otherwise",
            "conditionIndex": 300,
            "status": "COMPLIANT"
          },
          "context": {
            "snapshotTime": "2026-01-12T23:29:54Z"
          },
          "Id": "test4",
          "CA10__disappearanceTime__c": null,
          "CA10__vpcId__c": "vpcId"
        }
      ]
  - path: /types/CA10__CaAwsLambdaFunction__c/object.extracts.yaml
    md5Hash: AC42D0E20DDB5A13477C5EE7A9A969D6
    content: "---\nextracts:\n# Nullable. Can't have no access, retrieved via lambda:ListFunctions\n\
      \  - name: \"CA10__vpcId__c\"\n    value: \n      FIELD:\n        path: \"CA10__vpcId__c\"\
      \n"
script: |-
  CREATE TEMP FUNCTION mock_ExpectedResult()
  RETURNS ARRAY<STRUCT<
          Id STRING,
          expectedResult STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, runtimeError STRING>
      >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "Id" : "test1",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "isDisappeared(CA10__disappearanceTime__c)",
      "conditionIndex" : 99,
      "status" : "DISAPPEARED"
    }
  }, {
    "Id" : "test2",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "CA10__AWS_Lambda_Function_Versions__r.has(COMPLIANT)",
      "conditionIndex" : 199,
      "status" : "INAPPLICABLE"
    }
  }, {
    "Id" : "test3",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "CA10__vpcId__c.isEmpty()",
      "conditionIndex" : 299,
      "status" : "INCOMPLIANT"
    }
  }, {
    "Id" : "test4",
    "expectedResult" : {
      "runtimeError" : null,
      "conditionText" : "otherwise",
      "conditionIndex" : 300,
      "status" : "COMPLIANT"
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAwsLambdaFunction__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__vpcId__c STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T23:29:54Z")
    },
    "CA10__disappearanceTime__c" : new Date("2025-07-29T12:38:18Z"),
    "CA10__vpcId__c" : "",
    "Id" : "test1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T23:29:54Z")
    },
    "CA10__vpcId__c" : "",
    "Id" : "test2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T23:29:54Z")
    },
    "CA10__vpcId__c" : "",
    "Id" : "test3"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T23:29:54Z")
    },
    "CA10__vpcId__c" : "vpcId",
    "Id" : "test4"
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAwsLambdaFunctionVersion__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__function__c STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T23:29:54Z")
    },
    "CA10__function__c" : "test2",
    "Id" : "test2_1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T23:29:54Z")
    },
    "CA10__function__c" : "test3",
    "Id" : "test3_1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T23:29:54Z")
    },
    "CA10__function__c" : "test4",
    "Id" : "test4_1"
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAwsCloudFrontLambdaFunctionAssociation__c()
  RETURNS ARRAY<STRUCT<
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__lambdaFunctionVersion__c STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2026-01-12T23:29:54Z")
    },
    "CA10__lambdaFunctionVersion__c" : "test2_1",
    "Id" : "test2_2"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAwsLambdaFunction__c(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__vpcId__c STRING,
          Id STRING,
          CA10__AWS_Lambda_Function_Versions__r ARRAY<STRUCT<
              CA10__disappearanceTime__c TIMESTAMP,
              CA10__function__c STRING,
              Id STRING,
              CA10__AWS_CloudFront_Lambda_Func_Associations__r ARRAY<STRUCT<
                  CA10__disappearanceTime__c TIMESTAMP,
                  CA10__lambdaFunctionVersion__c STRING,
                  Id STRING,
                  result STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
              >>,
              result STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
          >>
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  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};
      }
      var count_CA10__AWS_Lambda_Function_Versions__r_COMPLIANT2 = 0;
      if (obj.CA10__AWS_Lambda_Function_Versions__r != null) {
          for (var i3 = 0; i3 < obj.CA10__AWS_Lambda_Function_Versions__r.length; i3++) {
              if (typeof(obj.CA10__AWS_Lambda_Function_Versions__r[i3].status) !== 'undefined') {
                  if (obj.CA10__AWS_Lambda_Function_Versions__r[i3].status == 'COMPLIANT') {
                      count_CA10__AWS_Lambda_Function_Versions__r_COMPLIANT2 += obj.CA10__AWS_Lambda_Function_Versions__r[i3].count;
                  }
              } else  {
                  if (obj.CA10__AWS_Lambda_Function_Versions__r[i3].result.status == 'COMPLIANT') {
                      count_CA10__AWS_Lambda_Function_Versions__r_COMPLIANT2 += 1;
                  }
              }
          }
      }
      // condition[1], conditionIndex:[100..199]
      references1.push('Related list [CA10__AWS_Lambda_Function_Versions__r] ' + (count_CA10__AWS_Lambda_Function_Versions__r_COMPLIANT2 > 0 ? 'has' : 'does not have') + ' objects in COMPLIANT status');
      if (count_CA10__AWS_Lambda_Function_Versions__r_COMPLIANT2 > 0) {
          return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "CA10__AWS_Lambda_Function_Versions__r.has(COMPLIANT)", currentStateMessage: "Lambda@Edge functions do not support VPC association.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[2], conditionIndex:[200..299]
      references1.push('VPC ID [obj.CA10__vpcId__c]: ' + obj.CA10__vpcId__c);
      if (TextLib.isEmpty(obj.CA10__vpcId__c)) {
          return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "CA10__vpcId__c.isEmpty()", currentStateMessage: "The Lambda function is not associated with a VPC.", currentStateReferences: references1.join('\n'), remediation: "Configure the Lambda function to connect to a VPC.", runtimeError: null};
      }
      return {status: 'COMPLIANT', conditionIndex: 300, conditionText: "otherwise", currentStateMessage: "The Lambda function is associated with a VPC.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
  """;

  CREATE TEMP FUNCTION process_CA10__AWS_Lambda_Function_Versions__r(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__function__c STRING,
          Id STRING,
          CA10__AWS_CloudFront_Lambda_Func_Associations__r ARRAY<STRUCT<
              CA10__disappearanceTime__c TIMESTAMP,
              CA10__lambdaFunctionVersion__c STRING,
              Id STRING,
              result STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
          >>
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  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_CloudFront_Lambda_Func_Associations__r_COMPLIANT2 = 0;
      if (obj.CA10__AWS_CloudFront_Lambda_Func_Associations__r != null) {
          for (var i3 = 0; i3 < obj.CA10__AWS_CloudFront_Lambda_Func_Associations__r.length; i3++) {
              if (typeof(obj.CA10__AWS_CloudFront_Lambda_Func_Associations__r[i3].status) !== 'undefined') {
                  if (obj.CA10__AWS_CloudFront_Lambda_Func_Associations__r[i3].status == 'COMPLIANT') {
                      count_CA10__AWS_CloudFront_Lambda_Func_Associations__r_COMPLIANT2 += obj.CA10__AWS_CloudFront_Lambda_Func_Associations__r[i3].count;
                  }
              } else  {
                  if (obj.CA10__AWS_CloudFront_Lambda_Func_Associations__r[i3].result.status == 'COMPLIANT') {
                      count_CA10__AWS_CloudFront_Lambda_Func_Associations__r_COMPLIANT2 += 1;
                  }
              }
          }
      }
      // condition[1], conditionIndex:[100..199]
      references1.push('Related list [CA10__AWS_CloudFront_Lambda_Func_Associations__r] ' + (count_CA10__AWS_CloudFront_Lambda_Func_Associations__r_COMPLIANT2 > 0 ? 'has' : 'does not have') + ' objects in COMPLIANT status');
      if (count_CA10__AWS_CloudFront_Lambda_Func_Associations__r_COMPLIANT2 > 0) {
          return {status: 'COMPLIANT', conditionIndex: 199, conditionText: "CA10__AWS_CloudFront_Lambda_Func_Associations__r.has(COMPLIANT)", currentStateMessage: "This is Lambda@Edge function.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      return {status: 'INAPPLICABLE', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "This function version does not have an association with CloudFront.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
  """;

  CREATE TEMP FUNCTION process_CA10__AWS_Lambda_Function_Versions__r_CA10__AWS_CloudFront_Lambda_Func_Associations__r(
      obj STRUCT<
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__lambdaFunctionVersion__c STRING,
          Id STRING
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  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};
      }
      return {status: 'COMPLIANT', conditionIndex: 100, conditionText: "otherwise", currentStateMessage: "This is Lambda@Edge function.", 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__vpcId__c AS CA10__vpcId__c,
          sObject.Id AS Id,
          `CA10__AWS_Lambda_Function_Versions__r`.arr AS CA10__AWS_Lambda_Function_Versions__r,
          process_CA10__CaAwsLambdaFunction__c(
              STRUCT(
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.CA10__vpcId__c AS CA10__vpcId__c,
                  sObject.Id AS Id,
                  `CA10__AWS_Lambda_Function_Versions__r`.arr AS CA10__AWS_Lambda_Function_Versions__r
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAwsLambdaFunction__c()) AS sObject
      LEFT JOIN (
          SELECT
              sObject.CA10__function__c,
              ARRAY_AGG(
                  STRUCT(
                      sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                      sObject.CA10__function__c AS CA10__function__c,
                      sObject.Id AS Id,
                      `CA10__AWS_CloudFront_Lambda_Func_Associations__r`.arr AS CA10__AWS_CloudFront_Lambda_Func_Associations__r,
                      process_CA10__AWS_Lambda_Function_Versions__r(
                          STRUCT(
                              sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                              sObject.CA10__function__c AS CA10__function__c,
                              sObject.Id AS Id,
                              `CA10__AWS_CloudFront_Lambda_Func_Associations__r`.arr AS CA10__AWS_CloudFront_Lambda_Func_Associations__r
                          ),
                          sObject.context.snapshotTime
                      ) as result
                  )
              ) AS arr
          FROM UNNEST(mock_CA10__CaAwsLambdaFunctionVersion__c()) AS sObject
          LEFT JOIN (
              SELECT
                  sObject.CA10__lambdaFunctionVersion__c,
                  ARRAY_AGG(
                      STRUCT(
                          sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                          sObject.CA10__lambdaFunctionVersion__c AS CA10__lambdaFunctionVersion__c,
                          sObject.Id AS Id,
                          process_CA10__AWS_Lambda_Function_Versions__r_CA10__AWS_CloudFront_Lambda_Func_Associations__r(
                              STRUCT(
                                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                                  sObject.CA10__lambdaFunctionVersion__c AS CA10__lambdaFunctionVersion__c,
                                  sObject.Id AS Id
                              ),
                              sObject.context.snapshotTime
                          ) as result
                      )
                  ) AS arr
              FROM UNNEST(mock_CA10__CaAwsCloudFrontLambdaFunctionAssociation__c()) AS sObject
              GROUP BY sObject.CA10__lambdaFunctionVersion__c
          ) AS `CA10__AWS_CloudFront_Lambda_Func_Associations__r`
              ON sObject.Id = `CA10__AWS_CloudFront_Lambda_Func_Associations__r`.CA10__lambdaFunctionVersion__c
          GROUP BY sObject.CA10__function__c
      ) AS `CA10__AWS_Lambda_Function_Versions__r`
          ON sObject.Id = `CA10__AWS_Lambda_Function_Versions__r`.CA10__function__c
  ) sObject ON sObject.Id = expectedResult.Id;
