---
policy: /ce/ca/google/storage/storage-bucket-public-access
logic: /ce/ca/google/storage/storage-bucket-public-access/prod.logic.yaml
executionTime: 2025-04-24T23:47:38.001090756Z
rows:
  - id: a8O0
    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: a8O1
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: CA10__Google_IAM_Policy_Bindings__r.has(INCOMPLIANT)
      actual: CA10__Google_IAM_Policy_Bindings__r.has(INCOMPLIANT)
    runtimeError: {}
  - id: a8O2
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 200
      actual: 200
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
usedFiles:
  - path: /ce/ca/google/storage/storage-bucket-public-access/policy.yaml
    md5Hash: 631DA796165D55E888FC4E945CF337EC
    content: "---\nnames: \n  full: \"Google Storage Bucket is anonymously or publicly\
      \ accessible\"\n  contextual: \"Bucket is anonymously or publicly accessible\"\
      \ndescription: \"It is recommended that IAM policy on Cloud Storage bucket does\
      \ not allows anonymous or public access.\"\ntype: COMPLIANCE_POLICY\ncategories:\n\
      \  - \"SECURITY\"\nframeworkMappings:\n  - /frameworks/cis-gcp-v3.0.0/05/01\n\
      \  - /frameworks/cloudaware/resource-security/public-and-anonymous-access\n\
      similarPolicies:\n  cloudConformity:\n    - url: \"https://www.trendmicro.com/cloudoneconformity-staging/knowledge-base/gcp/CloudStorage/publicly-accessible-storage-buckets.html\"\
      \n      name: \"Check for Publicly Accessible Cloud Storage Buckets\"\n"
  - path: /ce/ca/google/storage/storage-bucket-public-access/prod.logic.yaml
    md5Hash: 38692490C01B1C7328C80B49151B7CC3
    content: "---\n\ninputType: \"CA10__CaGoogleStorageBucket__c\"\ntestData:\n  -\
      \ file: test-data.json\nconditions:\n  - status: \"INCOMPLIANT\"\n    currentStateMessage:\
      \ \"IAM policy on Cloud Storage bucket allows anonymous or public access.\"\n\
      \    check:\n      RELATED_LIST_HAS:\n        status: \"INCOMPLIANT\"\n    \
      \    relationshipName: \"CA10__Google_IAM_Policy_Bindings__r\"\notherwise:\n\
      \  status: \"COMPLIANT\"\n  currentStateMessage: \"IAM policy on Cloud Storage\
      \ bucket does not allow anonymous or public access.\"\nrelatedLists:\n  - relationshipName:\
      \ \"CA10__Google_IAM_Policy_Bindings__r\"\n    importExtracts:\n      - file:\
      \ /types/CA10__CaGoogleIamPolicyBinding__c/object.extracts.yaml\n    conditions:\n\
      \      - status: \"INCOMPLIANT\"\n        currentStateMessage: \"IAM policy\
      \ allows anonymous or public access.\"\n        check:\n         OR:\n     \
      \      args:\n             - NOT_EQUAL:\n                left: \n          \
      \        EXTRACT: \"CA10__membersAllUsers__c\"\n                right:\n   \
      \               TEXT: \"No\"\n             - NOT_EQUAL:\n                left:\
      \ \n                  EXTRACT: \"CA10__membersAllAuthenticatedUsers__c\"\n \
      \               right:\n                  TEXT: \"No\"\n    otherwise:\n   \
      \   status: \"COMPLIANT\" \n      currentStateMessage: \"IAM policy does not\
      \ allow anonymous or public access.\"\n"
  - path: /ce/ca/google/storage/storage-bucket-public-access/test-data.json
    md5Hash: E57C61D8050562CBBB90590A2A0BD0B6
    content: |
      [
        {
          "expectedResult": {
            "status": "DISAPPEARED",
            "conditionIndex": "99",
            "conditionText": "isDisappeared(CA10__disappearanceTime__c)",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2024-09-03T17:55:55Z" },
          "Id": "a8O0",
          "CA10__disappearanceTime__c": "2024-09-02T17:02:49Z",
          "CA10__Google_IAM_Policy_Bindings__r": [
            {
              "Id": "aAI70",
              "RecordTypeId": "0120e0000009hWaAAI",
              "CA10__disappearanceTime__c": "2024-09-02T17:03:47Z",
              "CA10__membersAllUsers__c": "No",
              "CA10__membersAllAuthenticatedUsers__c": "No",
              "CA10__storageBucket__c": "a8O0",
              "RecordType": {
                "DeveloperName": "caGoogleIamPolicyBindingStorageBucket",
                "Id": "0120e0000009hWaAAI"
              }
            }
          ]
        },
        {
          "expectedResult": {
            "status": "INCOMPLIANT",
            "conditionIndex": "199",
            "conditionText": "CA10__Google_IAM_Policy_Bindings__r.has(INCOMPLIANT)",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2024-09-03T17:55:55Z" },
          "Id": "a8O1",
          "CA10__disappearanceTime__c": null,
          "CA10__Google_IAM_Policy_Bindings__r": [
            {
              "Id": "aAIV2",
              "RecordTypeId": "0120e0000009hWaAAI",
              "CA10__disappearanceTime__c": null,
              "CA10__membersAllUsers__c": "Yes",
              "CA10__membersAllAuthenticatedUsers__c": "No",
              "CA10__storageBucket__c": "a8O1",
              "RecordType": {
                "DeveloperName": "caGoogleIamPolicyBindingStorageBucket",
                "Id": "0120e0000009hWaAAI"
              }
            },
            {
              "Id": "aAIVU2",
              "RecordTypeId": "0120e0000009hWaAAI",
              "CA10__disappearanceTime__c": null,
              "CA10__membersAllUsers__c": "No",
              "CA10__membersAllAuthenticatedUsers__c": "No",
              "CA10__storageBucket__c": "a8O1",
              "RecordType": {
                "DeveloperName": "caGoogleIamPolicyBindingStorageBucket",
                "Id": "0120e0000009hWaAAI"
              }
            }
          ]
        },
        {
          "expectedResult": {
            "status": "COMPLIANT",
            "conditionIndex": "200",
            "conditionText": "otherwise",
            "runtimeError": null
          },
          "context": { "snapshotTime": "2024-09-03T17:55:55Z" },
          "Id": "a8O2",
          "CA10__disappearanceTime__c": null,
          "CA10__Google_IAM_Policy_Bindings__r": [
            {
              "Id": "aAI73",
              "RecordTypeId": "0120e0000009hWaAAI",
              "CA10__disappearanceTime__c": null,
              "CA10__membersAllUsers__c": "No",
              "CA10__membersAllAuthenticatedUsers__c": "No",
              "CA10__storageBucket__c": "a8O2",
              "RecordType": {
                "DeveloperName": "caGoogleIamPolicyBindingStorageBucket",
                "Id": "0120e0000009hWaAAI"
              }
            },
            {
              "Id": "aAI3",
              "RecordTypeId": "0120e0000009hWaAAI",
              "CA10__disappearanceTime__c": null,
              "CA10__membersAllUsers__c": "No",
              "CA10__membersAllAuthenticatedUsers__c": "No",
              "CA10__storageBucket__c": "a8O2",
              "RecordType": {
                "DeveloperName": "caGoogleIamPolicyBindingStorageBucket",
                "Id": "0120e0000009hWaAAI"
              }
            }
          ]
        }
      ]
  - path: /types/CA10__CaGoogleIamPolicyBinding__c/object.extracts.yaml
    md5Hash: DA65DB880E2440923287921FF4E70B30
    content: "---\nextracts:\n  - name: \"Name\"\n    value: \n      FIELD:\n    \
      \    path: \"Name\"\n        undeterminedIf:\n          isEmpty:  \"Name should\
      \ not be empty\"\n  - name: \"CA10__membersAllUsers__c\"\n    value: \n    \
      \  FIELD:\n        path: \"CA10__membersAllUsers__c\"\n        undeterminedIf:\n\
      \          isEmpty:  \"Field should not be empty\"\n  - name: \"CA10__membersAllAuthenticatedUsers__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__membersAllAuthenticatedUsers__c\"\
      \n        undeterminedIf:\n          isEmpty:  \"Field should not be empty\"\
      \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" : "a8O0",
    "expectedResult" : {
      "status" : "DISAPPEARED",
      "conditionIndex" : "99",
      "conditionText" : "isDisappeared(CA10__disappearanceTime__c)",
      "runtimeError" : null
    }
  }, {
    "Id" : "a8O1",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "199",
      "conditionText" : "CA10__Google_IAM_Policy_Bindings__r.has(INCOMPLIANT)",
      "runtimeError" : null
    }
  }, {
    "Id" : "a8O2",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "200",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaGoogleStorageBucket__c()
  RETURNS ARRAY<STRUCT<
      Id STRING,
      CA10__disappearanceTime__c TIMESTAMP,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2024-09-03T17:55:55Z")
    },
    "Id" : "a8O0",
    "CA10__disappearanceTime__c" : new Date("2024-09-02T17:02:49Z")
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-09-03T17:55:55Z")
    },
    "Id" : "a8O1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-09-03T17:55:55Z")
    },
    "Id" : "a8O2"
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaGoogleIamPolicyBinding__c()
  RETURNS ARRAY<STRUCT<
      Id STRING,
      RecordTypeId STRING,
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__membersAllUsers__c STRING,
      CA10__membersAllAuthenticatedUsers__c STRING,
      CA10__storageBucket__c STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2024-09-03T17:55:55Z")
    },
    "Id" : "aAI70",
    "RecordTypeId" : "0120e0000009hWaAAI",
    "CA10__disappearanceTime__c" : new Date("2024-09-02T17:03:47Z"),
    "CA10__membersAllUsers__c" : "No",
    "CA10__membersAllAuthenticatedUsers__c" : "No",
    "CA10__storageBucket__c" : "a8O0"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-09-03T17:55:55Z")
    },
    "Id" : "aAIV2",
    "RecordTypeId" : "0120e0000009hWaAAI",
    "CA10__membersAllUsers__c" : "Yes",
    "CA10__membersAllAuthenticatedUsers__c" : "No",
    "CA10__storageBucket__c" : "a8O1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-09-03T17:55:55Z")
    },
    "Id" : "aAIVU2",
    "RecordTypeId" : "0120e0000009hWaAAI",
    "CA10__membersAllUsers__c" : "No",
    "CA10__membersAllAuthenticatedUsers__c" : "No",
    "CA10__storageBucket__c" : "a8O1"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-09-03T17:55:55Z")
    },
    "Id" : "aAI73",
    "RecordTypeId" : "0120e0000009hWaAAI",
    "CA10__membersAllUsers__c" : "No",
    "CA10__membersAllAuthenticatedUsers__c" : "No",
    "CA10__storageBucket__c" : "a8O2"
  }, {
    "context" : {
      "snapshotTime" : new Date("2024-09-03T17:55:55Z")
    },
    "Id" : "aAI3",
    "RecordTypeId" : "0120e0000009hWaAAI",
    "CA10__membersAllUsers__c" : "No",
    "CA10__membersAllAuthenticatedUsers__c" : "No",
    "CA10__storageBucket__c" : "a8O2"
  } ];
  """;

  CREATE TEMP FUNCTION mock_RecordType()
  RETURNS ARRAY<STRUCT<
      DeveloperName STRING,
      Id STRING,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2024-09-03T17:55:55Z")
    },
    "DeveloperName" : "caGoogleIamPolicyBindingStorageBucket",
    "Id" : "0120e0000009hWaAAI"
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaGoogleStorageBucket__c(
      obj STRUCT<
          Id STRING,
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__Google_IAM_Policy_Bindings__r ARRAY<STRUCT<
              Id STRING,
              RecordTypeId STRING,
              CA10__disappearanceTime__c TIMESTAMP,
              CA10__membersAllUsers__c STRING,
              CA10__membersAllAuthenticatedUsers__c STRING,
              CA10__storageBucket__c STRING,
              RecordType STRUCT<
                  DeveloperName 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 Google [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__Google_IAM_Policy_Bindings__r_INCOMPLIANT2 = 0;
      if (obj.CA10__Google_IAM_Policy_Bindings__r != null) {
          for (var i3 = 0; i3 < obj.CA10__Google_IAM_Policy_Bindings__r.length; i3++) {
              if (obj.CA10__Google_IAM_Policy_Bindings__r[i3].result.status == 'INCOMPLIANT') {
                  count_CA10__Google_IAM_Policy_Bindings__r_INCOMPLIANT2 += 1;
              }
          }
      }
      // condition[1], conditionIndex:[100..199]
      references1.push('Related list [CA10__Google_IAM_Policy_Bindings__r] ' + (count_CA10__Google_IAM_Policy_Bindings__r_INCOMPLIANT2 > 0 ? 'has' : 'does not have') + ' objects in INCOMPLIANT status');
      if (count_CA10__Google_IAM_Policy_Bindings__r_INCOMPLIANT2 > 0) {
          return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "CA10__Google_IAM_Policy_Bindings__r.has(INCOMPLIANT)", currentStateMessage: "IAM policy on Cloud Storage bucket allows anonymous or public access.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      return {status: 'COMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "IAM policy on Cloud Storage bucket does not allow anonymous or public access.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
  """;

  CREATE TEMP FUNCTION process_CA10__Google_IAM_Policy_Bindings__r(
      obj STRUCT<
          Id STRING,
          RecordTypeId STRING,
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__membersAllUsers__c STRING,
          CA10__membersAllAuthenticatedUsers__c STRING,
          CA10__storageBucket__c STRING,
          RecordType STRUCT<
              DeveloperName 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 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));
          };
      }();
      var references1 = [];
      // condition[0], conditionIndex:[0..99]
      references1.push('Deleted From Google [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 fieldChecked4() {
          if (TextLib.isEmpty(obj.CA10__membersAllUsers__c)) {
              throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__membersAllUsers__c.isEmpty()", currentStateMessage: "Field should not be empty", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__membersAllUsers__c;
      }
      function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; };
      function fieldChecked7() {
          if (TextLib.isEmpty(obj.CA10__membersAllAuthenticatedUsers__c)) {
              throw new Error("UNDETERMINED condition:102", {cause: {status: 'UNDETERMINED', conditionIndex: 102, conditionText: "CA10__membersAllAuthenticatedUsers__c.isEmpty()", currentStateMessage: "Field should not be empty", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__membersAllAuthenticatedUsers__c;
      }
      function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; };
      references1.push('Members: All Users [obj.CA10__membersAllUsers__c]: ' + obj.CA10__membersAllUsers__c);
      references1.push('Members: All Authenticated Users [obj.CA10__membersAllAuthenticatedUsers__c]: ' + obj.CA10__membersAllAuthenticatedUsers__c);
      try {
          if (TextLib.notEqual(extract3.call(extract3), 'No') || TextLib.notEqual(extract6.call(extract6), 'No')) {
              return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "extract('CA10__membersAllUsers__c') != 'No' || extract('CA10__membersAllAuthenticatedUsers__c') != 'No'", currentStateMessage: "IAM policy allows anonymous or public access.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      return {status: 'COMPLIANT', conditionIndex: 200, conditionText: "otherwise", currentStateMessage: "IAM policy does not allow anonymous or public access.", 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.Id AS Id,
          sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
          `CA10__Google_IAM_Policy_Bindings__r`.arr AS CA10__Google_IAM_Policy_Bindings__r,
          process_CA10__CaGoogleStorageBucket__c(
              STRUCT(
                  sObject.Id AS Id,
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  `CA10__Google_IAM_Policy_Bindings__r`.arr AS CA10__Google_IAM_Policy_Bindings__r
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaGoogleStorageBucket__c()) AS sObject
      LEFT JOIN (
          SELECT
              sObject.CA10__storageBucket__c,
              ARRAY_AGG(
                  STRUCT(
                      sObject.Id AS Id,
                      sObject.RecordTypeId AS RecordTypeId,
                      sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                      sObject.CA10__membersAllUsers__c AS CA10__membersAllUsers__c,
                      sObject.CA10__membersAllAuthenticatedUsers__c AS CA10__membersAllAuthenticatedUsers__c,
                      sObject.CA10__storageBucket__c AS CA10__storageBucket__c,
                      STRUCT (
                          `RecordType`.DeveloperName AS DeveloperName,
                          `RecordType`.Id AS Id
                      ) AS RecordType,
                      process_CA10__Google_IAM_Policy_Bindings__r(
                          STRUCT(
                              sObject.Id AS Id,
                              sObject.RecordTypeId AS RecordTypeId,
                              sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                              sObject.CA10__membersAllUsers__c AS CA10__membersAllUsers__c,
                              sObject.CA10__membersAllAuthenticatedUsers__c AS CA10__membersAllAuthenticatedUsers__c,
                              sObject.CA10__storageBucket__c AS CA10__storageBucket__c,
                              STRUCT (
                                  `RecordType`.DeveloperName AS DeveloperName,
                                  `RecordType`.Id AS Id
                              ) AS RecordType
                          ),
                          sObject.context.snapshotTime
                      ) as result
                  )
              ) AS arr
          FROM UNNEST(mock_CA10__CaGoogleIamPolicyBinding__c()) AS sObject
          LEFT JOIN UNNEST(mock_RecordType()) AS `RecordType`
              ON sObject.RecordTypeId = `RecordType`.Id
          GROUP BY sObject.CA10__storageBucket__c
      ) AS `CA10__Google_IAM_Policy_Bindings__r`
          ON sObject.Id = `CA10__Google_IAM_Policy_Bindings__r`.CA10__storageBucket__c
  ) sObject ON sObject.Id = expectedResult.Id;
