---
policy: /ce/ca/azure/sql-managed-instance/instance-underutilized
logic: /ce/ca/azure/sql-managed-instance/instance-underutilized/prod.logic.yaml
executionTime: 2025-10-01T12:47:14.164331041Z
generationMs: 92
executionMs: 1060
rows:
  - id: '001'
    match: true
    status:
      expected: DISAPPEARED
      actual: DISAPPEARED
    conditionIndex:
      expected: 99
      actual: 99
    conditionText:
      expected: isDisappeared(CA10Z1__disappearanceTime__c)
      actual: isDisappeared(CA10Z1__disappearanceTime__c)
    runtimeError: {}
  - id: '002'
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('CA10Z1__state__c') != 'Ready'
      actual: extract('CA10Z1__state__c') != 'Ready'
    runtimeError: {}
  - id: '003'
    match: true
    status:
      expected: UNDETERMINED
      actual: UNDETERMINED
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: extract('CA10Z1__monitorCpuPercentAvg30Day__c').isEmpty() || extract('CA10Z1__monitorIoWrittenMbAvg30Day__c').isEmpty()
        || extract('CA10Z1__monitorIoReadMbAvg30Day__c').isEmpty()
      actual: extract('CA10Z1__monitorCpuPercentAvg30Day__c').isEmpty() || extract('CA10Z1__monitorIoWrittenMbAvg30Day__c').isEmpty()
        || extract('CA10Z1__monitorIoReadMbAvg30Day__c').isEmpty()
    runtimeError: {}
  - id: '004'
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 399
      actual: 399
    conditionText:
      expected: extract('CA10Z1__monitorCpuPercentAvg30Day__c') < number(20.0) &&
        extract('CA10Z1__monitorIoWrittenMbAvg30Day__c') < number(50.0) && extract('CA10Z1__monitorIoReadMbAvg30Day__c')
        < number(50.0)
      actual: extract('CA10Z1__monitorCpuPercentAvg30Day__c') < number(20.0) && extract('CA10Z1__monitorIoWrittenMbAvg30Day__c')
        < number(50.0) && extract('CA10Z1__monitorIoReadMbAvg30Day__c') < number(50.0)
    runtimeError: {}
  - id: '005'
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 400
      actual: 400
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
usedFiles:
  - path: /ce/ca/azure/sql-managed-instance/instance-underutilized/policy.yaml
    md5Hash: 95DE7651211CAEFB5140C9EF32C5D671
    content: "---\nnames:\n  full: Azure SQL Managed Instance is underutilized\n \
      \ contextual: Managed Instance is underutilized\ndescription: >\n  Identify\
      \ underutilized Azure SQL Managed Instances to optimize costs by downscaling\
      \ \n  instances with low utilization. Instances are considered underutilized\
      \ \n  if their average CPU utilization is below 20%, and average disk I/O is\
      \ below \n  50 MB over a 30-day period.\ntype: \"COMPLIANCE_POLICY\"\ncategories:\n\
      \  - \"COST\"\n  - \"PERFORMANCE\"\nframeworkMappings:\n  - \"/frameworks/cloudaware/cost-efficiency-and-optimization/resource-right-sizing\"\
      \n  - \"/frameworks/cloudaware/resource-performance/workload-efficiency\""
  - path: /ce/ca/azure/sql-managed-instance/instance-underutilized/prod.logic.yaml
    md5Hash: 6C18CE72BCC777406A376BF4B0210BFB
    content: "---\ninputType: \"CA10Z1__CaAzureSqlManagedInstance__c\"\nimportExtracts:\n\
      \  - file: \"/types/CA10Z1__CaAzureSqlManagedInstance__c/object.extracts.yaml\"\
      \ntestData:\n  - file: 'test-data.json'\nconditions:\n  - status: \"INAPPLICABLE\"\
      \n    currentStateMessage: \"The instance is not ready.\"\n    check:\n    \
      \  NOT_EQUAL:\n        left:\n          EXTRACT: \"CA10Z1__state__c\"\n    \
      \    right:\n          TEXT: \"Ready\"\n  - status: UNDETERMINED\n    currentStateMessage:\
      \ \"There is not enough data in the CMDB to identify if the instance is underutilized.\"\
      \n    check:\n      OR:  \n        args:\n          - IS_EMPTY:\n          \
      \    arg:\n                EXTRACT: \"CA10Z1__monitorCpuPercentAvg30Day__c\"\
      \n          - IS_EMPTY:\n              arg:\n                EXTRACT: \"CA10Z1__monitorIoWrittenMbAvg30Day__c\"\
      \n          - IS_EMPTY:\n              arg:\n                EXTRACT: \"CA10Z1__monitorIoReadMbAvg30Day__c\"\
      \n  - status: \"INCOMPLIANT\"\n    currentStateMessage: \"The instance is underutilized\
      \ with Average CPU Utilization < 20%, Average \\\n      \\ Disk Read/Write IO\
      \ < 50 MB.\"\n    remediationMessage: \"Consider rightsizing, consolidating\
      \ or terminating the instance.\"\n    check:\n      AND:\n        args:\n  \
      \        - LESS_THAN:\n              left:\n                EXTRACT: \"CA10Z1__monitorCpuPercentAvg30Day__c\"\
      \n              right:\n                NUMBER: 20.0\n          - LESS_THAN:\n\
      \              left:\n                EXTRACT: \"CA10Z1__monitorIoWrittenMbAvg30Day__c\"\
      \n              right:\n                NUMBER: 50.0\n          - LESS_THAN:\n\
      \              left:\n                EXTRACT: \"CA10Z1__monitorIoReadMbAvg30Day__c\"\
      \n              right:\n                NUMBER: 50.0\notherwise:\n  status:\
      \ \"COMPLIANT\"\n  currentStateMessage: \"The instance is not underutilized.\""
  - path: /ce/ca/azure/sql-managed-instance/instance-underutilized/test-data.json
    md5Hash: 24A98AE982320883FAB55A919D887F01
    content: |-
      [
          {
              "expectedResult": {
                  "status": "DISAPPEARED",
                  "conditionIndex": "99",
                  "conditionText": "isDisappeared(CA10Z1__disappearanceTime__c)",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-16T11:43:03Z"
              },
              "Id": "001",
              "CA10Z1__disappearanceTime__c": "2025-09-16T11:43:03Z",
              "CA10Z1__state__c": "Ready",
              "CA10Z1__monitorCpuPercentAvg30Day__c": 0,
              "CA10Z1__monitorIoWrittenMbAvg30Day__c": 0,
              "CA10Z1__monitorIoReadMbAvg30Day__c": 0
          },
          {
              "expectedResult": {
                  "status": "INAPPLICABLE",
                  "conditionIndex": "199",
                  "conditionText": "extract('CA10Z1__state__c') != 'Ready'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-16T11:43:03Z"
              },
              "Id": "002",
              "CA10Z1__disappearanceTime__c": null,
              "CA10Z1__state__c": "Error",
              "CA10Z1__monitorCpuPercentAvg30Day__c": 2,
              "CA10Z1__monitorIoWrittenMbAvg30Day__c": 44,
              "CA10Z1__monitorIoReadMbAvg30Day__c": 160
          },
          {
              "expectedResult": {
                  "status": "UNDETERMINED",
                  "conditionIndex": "299",
                  "conditionText": "extract('CA10Z1__monitorCpuPercentAvg30Day__c').isEmpty() || extract('CA10Z1__monitorIoWrittenMbAvg30Day__c').isEmpty() || extract('CA10Z1__monitorIoReadMbAvg30Day__c').isEmpty()",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-16T11:43:03Z"
              },
              "Id": "003",
              "CA10Z1__disappearanceTime__c": null,
              "CA10Z1__state__c": "Ready",
              "CA10Z1__monitorCpuPercentAvg30Day__c": null,
              "CA10Z1__monitorIoWrittenMbAvg30Day__c": null,
              "CA10Z1__monitorIoReadMbAvg30Day__c": null
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "399",
                  "conditionText": "extract('CA10Z1__monitorCpuPercentAvg30Day__c') < number(20.0) && extract('CA10Z1__monitorIoWrittenMbAvg30Day__c') < number(50.0) && extract('CA10Z1__monitorIoReadMbAvg30Day__c') < number(50.0)",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-16T11:43:03Z"
              },
              "Id": "004",
              "CA10Z1__disappearanceTime__c": null,
              "CA10Z1__state__c": "Ready",
              "CA10Z1__monitorCpuPercentAvg30Day__c": 10,
              "CA10Z1__monitorIoWrittenMbAvg30Day__c": 10,
              "CA10Z1__monitorIoReadMbAvg30Day__c": 10
          },
          {
              "expectedResult": {
                  "status": "COMPLIANT",
                  "conditionIndex": "400",
                  "conditionText": "otherwise",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-16T11:43:03Z"
              },
              "Id": "005",
              "CA10Z1__disappearanceTime__c": null,
              "CA10Z1__state__c": "Ready",
              "CA10Z1__monitorCpuPercentAvg30Day__c": 15,
              "CA10Z1__monitorIoWrittenMbAvg30Day__c": 50,
              "CA10Z1__monitorIoReadMbAvg30Day__c": 150
          }
      ]
  - path: /types/CA10Z1__CaAzureSqlManagedInstance__c/object.extracts.yaml
    md5Hash: CEB619A9B852A33627260BC10279728E
    content: "---\nextracts:\n# Not nullable \n  - name: \"CA10Z1__state__c\"\n  \
      \  value: \n      FIELD:\n        path: \"CA10Z1__state__c\"\n# Nullable \n\
      \  - name: \"CA10Z1__monitorCpuPercentAvg30Day__c\"\n    value: \n      FIELD:\n\
      \        path: \"CA10Z1__monitorCpuPercentAvg30Day__c\"\n# Nullable \n  - name:\
      \ \"CA10Z1__monitorIoWrittenMbAvg30Day__c\"\n    value: \n      FIELD:\n   \
      \     path: \"CA10Z1__monitorIoWrittenMbAvg30Day__c\"\n# Nullable \n  - name:\
      \ \"CA10Z1__monitorIoReadMbAvg30Day__c\"\n    value: \n      FIELD:\n      \
      \  path: \"CA10Z1__monitorIoReadMbAvg30Day__c\"\n# Text \n  - name: \"CA10Z1__locationName__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10Z1__locationName__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" : "001",
    "expectedResult" : {
      "status" : "DISAPPEARED",
      "conditionIndex" : "99",
      "conditionText" : "isDisappeared(CA10Z1__disappearanceTime__c)",
      "runtimeError" : null
    }
  }, {
    "Id" : "002",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "199",
      "conditionText" : "extract('CA10Z1__state__c') != 'Ready'",
      "runtimeError" : null
    }
  }, {
    "Id" : "003",
    "expectedResult" : {
      "status" : "UNDETERMINED",
      "conditionIndex" : "299",
      "conditionText" : "extract('CA10Z1__monitorCpuPercentAvg30Day__c').isEmpty() || extract('CA10Z1__monitorIoWrittenMbAvg30Day__c').isEmpty() || extract('CA10Z1__monitorIoReadMbAvg30Day__c').isEmpty()",
      "runtimeError" : null
    }
  }, {
    "Id" : "004",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "399",
      "conditionText" : "extract('CA10Z1__monitorCpuPercentAvg30Day__c') < number(20.0) && extract('CA10Z1__monitorIoWrittenMbAvg30Day__c') < number(50.0) && extract('CA10Z1__monitorIoReadMbAvg30Day__c') < number(50.0)",
      "runtimeError" : null
    }
  }, {
    "Id" : "005",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "400",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10Z1__CaAzureSqlManagedInstance__c()
  RETURNS ARRAY<STRUCT<
      Id STRING,
      CA10Z1__disappearanceTime__c TIMESTAMP,
      CA10Z1__state__c STRING,
      CA10Z1__monitorCpuPercentAvg30Day__c FLOAT64,
      CA10Z1__monitorIoWrittenMbAvg30Day__c FLOAT64,
      CA10Z1__monitorIoReadMbAvg30Day__c FLOAT64,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2025-09-16T11:43:03Z")
    },
    "Id" : "001",
    "CA10Z1__disappearanceTime__c" : new Date("2025-09-16T11:43:03Z"),
    "CA10Z1__state__c" : "Ready",
    "CA10Z1__monitorCpuPercentAvg30Day__c" : 0,
    "CA10Z1__monitorIoWrittenMbAvg30Day__c" : 0,
    "CA10Z1__monitorIoReadMbAvg30Day__c" : 0
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-16T11:43:03Z")
    },
    "Id" : "002",
    "CA10Z1__state__c" : "Error",
    "CA10Z1__monitorCpuPercentAvg30Day__c" : 2,
    "CA10Z1__monitorIoWrittenMbAvg30Day__c" : 44,
    "CA10Z1__monitorIoReadMbAvg30Day__c" : 160
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-16T11:43:03Z")
    },
    "Id" : "003",
    "CA10Z1__state__c" : "Ready",
    "CA10Z1__monitorCpuPercentAvg30Day__c" : null,
    "CA10Z1__monitorIoWrittenMbAvg30Day__c" : null,
    "CA10Z1__monitorIoReadMbAvg30Day__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-16T11:43:03Z")
    },
    "Id" : "004",
    "CA10Z1__state__c" : "Ready",
    "CA10Z1__monitorCpuPercentAvg30Day__c" : 10,
    "CA10Z1__monitorIoWrittenMbAvg30Day__c" : 10,
    "CA10Z1__monitorIoReadMbAvg30Day__c" : 10
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-16T11:43:03Z")
    },
    "Id" : "005",
    "CA10Z1__state__c" : "Ready",
    "CA10Z1__monitorCpuPercentAvg30Day__c" : 15,
    "CA10Z1__monitorIoWrittenMbAvg30Day__c" : 50,
    "CA10Z1__monitorIoReadMbAvg30Day__c" : 150
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10Z1__CaAzureSqlManagedInstance__c(
      obj STRUCT<
          Id STRING,
          CA10Z1__disappearanceTime__c TIMESTAMP,
          CA10Z1__state__c STRING,
          CA10Z1__monitorCpuPercentAvg30Day__c FLOAT64,
          CA10Z1__monitorIoWrittenMbAvg30Day__c FLOAT64,
          CA10Z1__monitorIoReadMbAvg30Day__c FLOAT64
      >,
      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 IsEmptyLib = new function () {
          this.simpleIsEmpty = function(arg) {
              return arg == null;
          };
          this.simpleIsNotEmpty = function(arg) {
              return arg != null;
          };
      }();
      var references1 = [];
      // condition[0], conditionIndex:[0..99]
      references1.push('Deleted From Azure [CA10Z1__disappearanceTime__c]: ' + obj.CA10Z1__disappearanceTime__c);
      if (obj.CA10Z1__disappearanceTime__c != null) {
          return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10Z1__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.CA10Z1__state__c; } return this.out; };
      references1.push('State [obj.CA10Z1__state__c]: ' + obj.CA10Z1__state__c);
      if (TextLib.notEqual(extract3.call(extract3), 'Ready')) {
          return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10Z1__state__c') != 'Ready'", currentStateMessage: "The instance is not ready.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[2], conditionIndex:[200..299]
      function extract6() { if (!this.out) { this.out = obj.CA10Z1__monitorCpuPercentAvg30Day__c; } return this.out; };
      function extract9() { if (!this.out) { this.out = obj.CA10Z1__monitorIoWrittenMbAvg30Day__c; } return this.out; };
      function extract12() { if (!this.out) { this.out = obj.CA10Z1__monitorIoReadMbAvg30Day__c; } return this.out; };
      references1.push('Monitor: Average CPU Percent, 30-Day [obj.CA10Z1__monitorCpuPercentAvg30Day__c]: ' + obj.CA10Z1__monitorCpuPercentAvg30Day__c);
      references1.push('Monitor: IO Written, MB, 30-Day [obj.CA10Z1__monitorIoWrittenMbAvg30Day__c]: ' + obj.CA10Z1__monitorIoWrittenMbAvg30Day__c);
      references1.push('Monitor: IO Read, MB, 30-Day [obj.CA10Z1__monitorIoReadMbAvg30Day__c]: ' + obj.CA10Z1__monitorIoReadMbAvg30Day__c);
      if (IsEmptyLib.simpleIsEmpty(extract6.call(extract6)) || IsEmptyLib.simpleIsEmpty(extract9.call(extract9)) || IsEmptyLib.simpleIsEmpty(extract12.call(extract12))) {
          return {status: 'UNDETERMINED', conditionIndex: 299, conditionText: "extract('CA10Z1__monitorCpuPercentAvg30Day__c').isEmpty() || extract('CA10Z1__monitorIoWrittenMbAvg30Day__c').isEmpty() || extract('CA10Z1__monitorIoReadMbAvg30Day__c').isEmpty()", currentStateMessage: "There is not enough data in the CMDB to identify if the instance is underutilized.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[3], conditionIndex:[300..399]
      function extract16() { if (!this.out) { this.out = obj.CA10Z1__monitorCpuPercentAvg30Day__c; } return this.out; };
      function extract20() { if (!this.out) { this.out = obj.CA10Z1__monitorIoWrittenMbAvg30Day__c; } return this.out; };
      function extract24() { if (!this.out) { this.out = obj.CA10Z1__monitorIoReadMbAvg30Day__c; } return this.out; };
      if ((extract16.call(extract16) != null && 20.0 != null && extract16.call(extract16) < 20.0) && (extract20.call(extract20) != null && 50.0 != null && extract20.call(extract20) < 50.0) && (extract24.call(extract24) != null && 50.0 != null && extract24.call(extract24) < 50.0)) {
          return {status: 'INCOMPLIANT', conditionIndex: 399, conditionText: "extract('CA10Z1__monitorCpuPercentAvg30Day__c') < number(20.0) && extract('CA10Z1__monitorIoWrittenMbAvg30Day__c') < number(50.0) && extract('CA10Z1__monitorIoReadMbAvg30Day__c') < number(50.0)", currentStateMessage: "The instance is underutilized with Average CPU Utilization < 20%, Average  Disk Read/Write IO < 50 MB.", currentStateReferences: references1.join('\n'), remediation: "Consider rightsizing, consolidating or terminating the instance.", runtimeError: null};
      }
      return {status: 'COMPLIANT', conditionIndex: 400, conditionText: "otherwise", currentStateMessage: "The instance is not underutilized.", 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.CA10Z1__disappearanceTime__c AS CA10Z1__disappearanceTime__c,
          sObject.CA10Z1__state__c AS CA10Z1__state__c,
          sObject.CA10Z1__monitorCpuPercentAvg30Day__c AS CA10Z1__monitorCpuPercentAvg30Day__c,
          sObject.CA10Z1__monitorIoWrittenMbAvg30Day__c AS CA10Z1__monitorIoWrittenMbAvg30Day__c,
          sObject.CA10Z1__monitorIoReadMbAvg30Day__c AS CA10Z1__monitorIoReadMbAvg30Day__c,
          process_CA10Z1__CaAzureSqlManagedInstance__c(
              STRUCT(
                  sObject.Id AS Id,
                  sObject.CA10Z1__disappearanceTime__c AS CA10Z1__disappearanceTime__c,
                  sObject.CA10Z1__state__c AS CA10Z1__state__c,
                  sObject.CA10Z1__monitorCpuPercentAvg30Day__c AS CA10Z1__monitorCpuPercentAvg30Day__c,
                  sObject.CA10Z1__monitorIoWrittenMbAvg30Day__c AS CA10Z1__monitorIoWrittenMbAvg30Day__c,
                  sObject.CA10Z1__monitorIoReadMbAvg30Day__c AS CA10Z1__monitorIoReadMbAvg30Day__c
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10Z1__CaAzureSqlManagedInstance__c()) AS sObject
  ) sObject ON sObject.Id = expectedResult.Id;
