--- policy: /ce/ca/aws/ec2/instance-underutilized logic: /ce/ca/aws/ec2/instance-underutilized/prod.logic.yaml executionTime: 2026-06-06T12:02:44.157235967Z generationMs: 104 executionMs: 993 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__stateName__c') != 'running' actual: extract('CA10__stateName__c') != 'running' runtimeError: {} - id: test3 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 299 actual: 299 conditionText: expected: extract('CA10__currentRunningTime__c') < number(14.0) actual: extract('CA10__currentRunningTime__c') < number(14.0) runtimeError: {} - id: test4 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 899 actual: 899 conditionText: expected: extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0) actual: extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0) runtimeError: {} - id: test5 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 799 actual: 799 conditionText: expected: extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0) actual: extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0) runtimeError: {} - id: test6 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 499 actual: 499 conditionText: expected: extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(20.0) && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0) && extract('CA10N__newRelicHostDiskReadUtilization__c') < number(5.0) && extract('CA10N__newRelicHostDiskWriteUtilization__c') < number(5.0) actual: extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(20.0) && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0) && extract('CA10N__newRelicHostDiskReadUtilization__c') < number(5.0) && extract('CA10N__newRelicHostDiskWriteUtilization__c') < number(5.0) runtimeError: {} - id: test7 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 899 actual: 899 conditionText: expected: extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0) actual: extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0) runtimeError: {} - id: test8 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 999 actual: 999 conditionText: expected: extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__averageMemoryUsedTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0) actual: extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__averageMemoryUsedTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0) runtimeError: {} - id: test9 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1099 actual: 1099 conditionText: expected: extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c') < number(40.0) && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0) actual: extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c') < number(40.0) && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0) runtimeError: {} - id: test10 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 1200 actual: 1200 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test11 match: true status: expected: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 1199 actual: 1199 conditionText: expected: extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0) actual: extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0) runtimeError: {} usedFiles: - path: /ce/ca/aws/ec2/instance-underutilized/policy.yaml md5Hash: 5B7F82CE5F9DCC9A57B8FFC2A79B9B18 content: "---\nnames:\n full: AWS EC2 Instance is underutilized\n contextual:\ \ Instance is underutilized\ndescription: >\n Identify and address underutilized\ \ Amazon EC2 instances to optimize costs and \n improve efficiency. Instances\ \ are considered underutilized if their average \n CPU and memory utilization\ \ is consistently below 40% and maximum CPU \n utilization does not spike above\ \ 50% over a 14-day period. These instances \n might be oversized for their\ \ workload.\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\"\n" - path: /ce/ca/aws/ec2/instance-underutilized/prod.logic.yaml md5Hash: E71D70104F9E49675B788A05399509D9 content: | --- inputType: "CA10__CaAwsInstance__c" importExtracts: - file: "/types/CA10__CaAwsInstance__c/object.extracts.yaml" testData: - file: 'test-data.json' conditions: - status: "INAPPLICABLE" currentStateMessage: "The instance is not running." check: NOT_EQUAL: left: EXTRACT: "CA10__stateName__c" right: TEXT: "running" - status: "INAPPLICABLE" currentStateMessage: "The instance has been running for less than 14 days." check: LESS_THAN: left: EXTRACT: "CA10__currentRunningTime__c" right: NUMBER: 14.0 - status: UNDETERMINED currentStateMessage: "There is not enough CMDB data to determine whether the instance is underutilized." check: OR: args: - IS_EMPTY: arg: EXTRACT: "CA10__averageCpuTwoWeeks__c" - IS_EMPTY: arg: EXTRACT: "CA10__maxCpuTwoWeeks__c" - AND: args: - NOT_EMPTY: arg: EXTRACT: "CA10N__newRelicHost__c" - IS_EMPTY: arg: EXTRACT: "CA10N__newRelicHostMemoryUsed14Day__c" - status: INAPPLICABLE currentStateMessage: "The instance is idle and considered by the 'AWS EC2 Instance is idle' policy." check: AND: args: - NOT_EMPTY: arg: EXTRACT: "CA10N__newRelicHost__c" - LESS_THAN: left: EXTRACT: CA10N__newRelicHostMemoryUsed14Day__c right: NUMBER: 20.0 - LESS_THAN: left: EXTRACT: CA10__averageCpuTwoWeeks__c right: NUMBER: 5.0 - LESS_THAN: left: EXTRACT: CA10__maxCpuTwoWeeks__c right: NUMBER: 15.0 - LESS_THAN: left: EXTRACT: CA10__sumTwoWeekNetworkInMb__c right: NUMBER: 100.0 - LESS_THAN: left: EXTRACT: CA10__sumTwoWeekNetworkOutMb__c right: NUMBER: 100.0 - LESS_THAN: left: EXTRACT: CA10N__newRelicHostDiskReadUtilization__c right: NUMBER: 5.0 - LESS_THAN: left: EXTRACT: CA10N__newRelicHostDiskWriteUtilization__c right: NUMBER: 5.0 - status: INAPPLICABLE currentStateMessage: "The instance is idle and considered by the 'AWS EC2 Instance is idle' policy." check: AND: args: - IS_EMPTY: arg: EXTRACT: "CA10N__newRelicHost__c" - LESS_THAN: left: EXTRACT: CA10__averageMemoryUsedTwoWeeks__c right: NUMBER: 20.0 - LESS_THAN: left: EXTRACT: CA10__averageCpuTwoWeeks__c right: NUMBER: 5.0 - LESS_THAN: left: EXTRACT: CA10__maxCpuTwoWeeks__c right: NUMBER: 15.0 - LESS_THAN: left: EXTRACT: CA10__sumTwoWeekNetworkInMb__c right: NUMBER: 100.0 - LESS_THAN: left: EXTRACT: CA10__sumTwoWeekNetworkOutMb__c right: NUMBER: 100.0 - status: INAPPLICABLE currentStateMessage: "The instance is idle and considered by the 'AWS EC2 Instance is idle' policy." check: AND: args: - IS_EMPTY: arg: EXTRACT: "CA10N__newRelicHost__c" - IS_EMPTY: arg: EXTRACT: "CA10__averageMemoryUsedTwoWeeks__c" - LESS_THAN: left: EXTRACT: CA10__nagiosMemoryUtilization__c right: NUMBER: 20.0 - LESS_THAN: left: EXTRACT: CA10__averageCpuTwoWeeks__c right: NUMBER: 5.0 - LESS_THAN: left: EXTRACT: CA10__maxCpuTwoWeeks__c right: NUMBER: 15.0 - LESS_THAN: left: EXTRACT: CA10__sumTwoWeekNetworkInMb__c right: NUMBER: 100.0 - LESS_THAN: left: EXTRACT: CA10__sumTwoWeekNetworkOutMb__c right: NUMBER: 100.0 - status: INAPPLICABLE currentStateMessage: "The instance is idle and considered by the 'AWS EC2 Instance is idle' policy." check: AND: args: - IS_EMPTY: arg: EXTRACT: "CA10N__newRelicHost__c" - IS_EMPTY: arg: EXTRACT: "CA10__averageMemoryUsedTwoWeeks__c" - IS_EMPTY: arg: EXTRACT: "CA10__nagiosMemoryUtilization__c" - LESS_THAN: left: EXTRACT: CA10__averageCpuTwoWeeks__c right: NUMBER: 5.0 - LESS_THAN: left: EXTRACT: CA10__maxCpuTwoWeeks__c right: NUMBER: 15.0 - LESS_THAN: left: EXTRACT: CA10__sumTwoWeekNetworkInMb__c right: NUMBER: 100.0 - LESS_THAN: left: EXTRACT: CA10__sumTwoWeekNetworkOutMb__c right: NUMBER: 100.0 - status: "INCOMPLIANT" currentStateMessage: "The instance is underutilized with average CPU below 40%, memory below 40%, and maximum CPU below 50%." remediationMessage: "Rightsize, consolidate, or terminate the instance." check: AND: args: - NOT_EMPTY: arg: EXTRACT: "CA10N__newRelicHost__c" - LESS_THAN: left: EXTRACT: CA10__averageCpuTwoWeeks__c right: NUMBER: 40.0 - LESS_THAN: left: EXTRACT: CA10N__newRelicHostMemoryUsed14Day__c right: NUMBER: 40.0 - LESS_THAN: left: EXTRACT: CA10__maxCpuTwoWeeks__c right: NUMBER: 50.0 - status: "INCOMPLIANT" currentStateMessage: "The instance is underutilized with average CPU below 40%, memory below 40%, and maximum CPU below 50%." remediationMessage: "Rightsize, consolidate, or terminate the instance." check: AND: args: - IS_EMPTY: arg: EXTRACT: "CA10N__newRelicHost__c" - LESS_THAN: left: EXTRACT: CA10__averageCpuTwoWeeks__c right: NUMBER: 40.0 - LESS_THAN: left: EXTRACT: CA10__averageMemoryUsedTwoWeeks__c right: NUMBER: 40.0 - LESS_THAN: left: EXTRACT: CA10__maxCpuTwoWeeks__c right: NUMBER: 50.0 - status: "INCOMPLIANT" currentStateMessage: "The instance is underutilized with average CPU below 40%, memory below 40%, and maximum CPU below 50%." remediationMessage: "Rightsize, consolidate, or terminate the instance." check: AND: args: - IS_EMPTY: arg: EXTRACT: "CA10N__newRelicHost__c" - IS_EMPTY: arg: EXTRACT: "CA10__averageMemoryUsedTwoWeeks__c" - LESS_THAN: left: EXTRACT: CA10__nagiosMemoryUtilization__c right: NUMBER: 40.0 - LESS_THAN: left: EXTRACT: CA10__averageCpuTwoWeeks__c right: NUMBER: 40.0 - LESS_THAN: left: EXTRACT: CA10__maxCpuTwoWeeks__c right: NUMBER: 50.0 - status: "INCOMPLIANT" currentStateMessage: "The instance is underutilized with average CPU below 40% and maximum CPU below 50%." remediationMessage: "Rightsize, consolidate, or terminate the instance." check: AND: args: - IS_EMPTY: arg: EXTRACT: "CA10N__newRelicHost__c" - IS_EMPTY: arg: EXTRACT: "CA10__averageMemoryUsedTwoWeeks__c" - IS_EMPTY: arg: EXTRACT: "CA10__nagiosMemoryUtilization__c" - LESS_THAN: left: EXTRACT: CA10__averageCpuTwoWeeks__c right: NUMBER: 40.0 - LESS_THAN: left: EXTRACT: CA10__maxCpuTwoWeeks__c right: NUMBER: 50.0 otherwise: status: "COMPLIANT" currentStateMessage: "The instance is not underutilized." - path: /ce/ca/aws/ec2/instance-underutilized/test-data.json md5Hash: C0CBC0D6F38515E489088BEFD4D0F1B4 content: | [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test1", "CA10__disappearanceTime__c": "2024-11-20T17:14:43Z", "CA10__stateName__c": "running", "CA10__currentRunningTime__c": 100.0, "CA10__averageCpuTwoWeeks__c": 10.0, "CA10__maxCpuTwoWeeks__c": 30.0, "CA10__sumTwoWeekNetworkInMb__c": 1000.0, "CA10__sumTwoWeekNetworkOutMb__c": 1000.0, "CA10N__newRelicHostMemoryUsed14Day__c": null, "CA10__averageMemoryUsedTwoWeeks__c": null, "CA10__nagiosMemoryUtilization__c": null, "CA10N__newRelicHostDiskReadUtilization__c": null, "CA10N__newRelicHostDiskWriteUtilization__c": null }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "extract('CA10__stateName__c') != 'running'", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test2", "CA10__disappearanceTime__c": null, "CA10__stateName__c": "stopped", "CA10__currentRunningTime__c": 100.0, "CA10__averageCpuTwoWeeks__c": 10.0, "CA10__maxCpuTwoWeeks__c": 30.0, "CA10__sumTwoWeekNetworkInMb__c": 1000.0, "CA10__sumTwoWeekNetworkOutMb__c": 1000.0, "CA10N__newRelicHostMemoryUsed14Day__c": null, "CA10__averageMemoryUsedTwoWeeks__c": null, "CA10__nagiosMemoryUtilization__c": null, "CA10N__newRelicHostDiskReadUtilization__c": null, "CA10N__newRelicHostDiskWriteUtilization__c": null }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "299", "conditionText": "extract('CA10__currentRunningTime__c') < number(14.0)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test3", "CA10__disappearanceTime__c": null, "CA10__stateName__c": "running", "CA10__currentRunningTime__c": 1.0, "CA10__averageCpuTwoWeeks__c": 10.0, "CA10__maxCpuTwoWeeks__c": 30.0, "CA10__sumTwoWeekNetworkInMb__c": 1000.0, "CA10__sumTwoWeekNetworkOutMb__c": 1000.0, "CA10N__newRelicHostMemoryUsed14Day__c": null, "CA10__averageMemoryUsedTwoWeeks__c": null, "CA10__nagiosMemoryUtilization__c": null, "CA10N__newRelicHostDiskReadUtilization__c": null, "CA10N__newRelicHostDiskWriteUtilization__c": null }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "899", "conditionText": "extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test4", "CA10__disappearanceTime__c": null, "CA10__stateName__c": "running", "CA10__currentRunningTime__c": 100.0, "CA10__averageCpuTwoWeeks__c": 10.0, "CA10__maxCpuTwoWeeks__c": 30.0, "CA10__sumTwoWeekNetworkInMb__c": null, "CA10__sumTwoWeekNetworkOutMb__c": 1000.0, "CA10N__newRelicHost__c": "newRelicHost", "CA10N__newRelicHostMemoryUsed14Day__c": 10.0, "CA10__averageMemoryUsedTwoWeeks__c": null, "CA10__nagiosMemoryUtilization__c": null, "CA10N__newRelicHostDiskReadUtilization__c": 1.0, "CA10N__newRelicHostDiskWriteUtilization__c": 1.0 }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "799", "conditionText": "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test5", "CA10__disappearanceTime__c": null, "CA10__stateName__c": "running", "CA10__currentRunningTime__c": 100.0, "CA10__averageCpuTwoWeeks__c": 1.0, "CA10__maxCpuTwoWeeks__c": 10.0, "CA10__sumTwoWeekNetworkInMb__c": 10.0, "CA10__sumTwoWeekNetworkOutMb__c": 10.0, "CA10N__newRelicHostMemoryUsed14Day__c": null, "CA10__averageMemoryUsedTwoWeeks__c": null, "CA10__nagiosMemoryUtilization__c": null, "CA10N__newRelicHostDiskReadUtilization__c": null, "CA10N__newRelicHostDiskWriteUtilization__c": null }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "499", "conditionText": "extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(20.0) && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0) && extract('CA10N__newRelicHostDiskReadUtilization__c') < number(5.0) && extract('CA10N__newRelicHostDiskWriteUtilization__c') < number(5.0)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test6", "CA10__disappearanceTime__c": null, "CA10__stateName__c": "running", "CA10__currentRunningTime__c": 100.0, "CA10__averageCpuTwoWeeks__c": 1.0, "CA10__maxCpuTwoWeeks__c": 10.0, "CA10__sumTwoWeekNetworkInMb__c": 10.0, "CA10__sumTwoWeekNetworkOutMb__c": 10.0, "CA10N__newRelicHost__c": "newRelicHost", "CA10N__newRelicHostMemoryUsed14Day__c": 10.0, "CA10__averageMemoryUsedTwoWeeks__c": 30.0, "CA10__nagiosMemoryUtilization__c": 30.0, "CA10N__newRelicHostDiskReadUtilization__c": 1.0, "CA10N__newRelicHostDiskWriteUtilization__c": 1.0 }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "899", "conditionText": "extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test7", "CA10__disappearanceTime__c": null, "CA10__stateName__c": "running", "CA10__currentRunningTime__c": 100.0, "CA10__averageCpuTwoWeeks__c": 10.0, "CA10__maxCpuTwoWeeks__c": 30.0, "CA10__sumTwoWeekNetworkInMb__c": 1000.0, "CA10__sumTwoWeekNetworkOutMb__c": 1000.0, "CA10N__newRelicHost__c": "newRelicHost", "CA10N__newRelicHostMemoryUsed14Day__c": 20.0, "CA10__averageMemoryUsedTwoWeeks__c": 10.0, "CA10__nagiosMemoryUtilization__c": 10.0, "CA10N__newRelicHostDiskReadUtilization__c": 10.0, "CA10N__newRelicHostDiskWriteUtilization__c": 10.0 }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "999", "conditionText": "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__averageMemoryUsedTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test8", "CA10__disappearanceTime__c": null, "CA10__stateName__c": "running", "CA10__currentRunningTime__c": 100.0, "CA10__averageCpuTwoWeeks__c": 10.0, "CA10__maxCpuTwoWeeks__c": 30.0, "CA10__sumTwoWeekNetworkInMb__c": 1000.0, "CA10__sumTwoWeekNetworkOutMb__c": 1000.0, "CA10N__newRelicHostMemoryUsed14Day__c": null, "CA10__averageMemoryUsedTwoWeeks__c": 20.0, "CA10__nagiosMemoryUtilization__c": 10.0, "CA10N__newRelicHostDiskReadUtilization__c": null, "CA10N__newRelicHostDiskWriteUtilization__c": null }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1099", "conditionText": "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c') < number(40.0) && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test9", "CA10__disappearanceTime__c": null, "CA10__stateName__c": "running", "CA10__currentRunningTime__c": 100.0, "CA10__averageCpuTwoWeeks__c": 10.0, "CA10__maxCpuTwoWeeks__c": 30.0, "CA10__sumTwoWeekNetworkInMb__c": 1000.0, "CA10__sumTwoWeekNetworkOutMb__c": 1000.0, "CA10N__newRelicHostMemoryUsed14Day__c": null, "CA10__averageMemoryUsedTwoWeeks__c": null, "CA10__nagiosMemoryUtilization__c": 20.0, "CA10N__newRelicHostDiskReadUtilization__c": null, "CA10N__newRelicHostDiskWriteUtilization__c": null }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "1200", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test10", "CA10__disappearanceTime__c": null, "CA10__stateName__c": "running", "CA10__currentRunningTime__c": 100.0, "CA10__averageCpuTwoWeeks__c": 10.0, "CA10__maxCpuTwoWeeks__c": 30.0, "CA10__sumTwoWeekNetworkInMb__c": 1000.0, "CA10__sumTwoWeekNetworkOutMb__c": 1000.0, "CA10N__newRelicHost__c": "newRelicHost", "CA10N__newRelicHostMemoryUsed14Day__c": 50.0, "CA10__averageMemoryUsedTwoWeeks__c": 10.0, "CA10__nagiosMemoryUtilization__c": 10.0, "CA10N__newRelicHostDiskReadUtilization__c": 10.0, "CA10N__newRelicHostDiskWriteUtilization__c": 10.0 }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "1199", "conditionText": "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", "runtimeError": null }, "context": { "snapshotTime": "2024-11-20T20:12:30Z" }, "Id": "test11", "CA10__disappearanceTime__c": null, "CA10__stateName__c": "running", "CA10__currentRunningTime__c": 100.0, "CA10__averageCpuTwoWeeks__c": 10.0, "CA10__maxCpuTwoWeeks__c": 30.0, "CA10__sumTwoWeekNetworkInMb__c": 1000.0, "CA10__sumTwoWeekNetworkOutMb__c": 1000.0, "CA10N__newRelicHostMemoryUsed14Day__c": null, "CA10__averageMemoryUsedTwoWeeks__c": null, "CA10__nagiosMemoryUtilization__c": null, "CA10N__newRelicHostDiskReadUtilization__c": 10.0, "CA10N__newRelicHostDiskWriteUtilization__c": 10.0 } ] - path: /types/CA10__CaAwsInstance__c/object.extracts.yaml md5Hash: 91EF62776BC2E60A02CA42F4B2811688 content: "---\nextracts:\n# Values pending, applied. Not nullable. Can't have\ \ no access, retrieved via ec2:DescribeInstances\n - name: \"CA10__metadataState__c\"\ \n value: \n FIELD:\n path: \"CA10__metadataState__c\"\n \ \ undeterminedIf:\n isEmpty: \"Corrupted data. EC2 Instances Metadata\ \ State cannot be empty.\"\n# Values: optional, required. Not nullable. Can't\ \ have no access, retrieved via ec2:DescribeInstances\n - name: \"CA10__metadataHttpTokens__c\"\ \n value: \n FIELD:\n path: \"CA10__metadataHttpTokens__c\"\n\ \ undeterminedIf:\n isEmpty: \"Corrupted data. EC2 Instances\ \ Metadata Http Token cannot be empty.\"\n - name: CA10__iamInstanceProfileArn__c\n\ \ value:\n FIELD: \n path: CA10__iamInstanceProfileArn__c\n#\ \ Nullable. Can't have no access, retrieved via ec2:DescribeInstances\n - name:\ \ \"CA10__publicIpAddress__c\"\n value: \n FIELD:\n path: \"\ CA10__publicIpAddress__c\"\n# Values: enabled, disabled. Not nullable. Can't\ \ have no access, retrieved via ec2:DescribeInstances\n - name: \"CA10__monitoringState__c\"\ \n value: \n FIELD:\n path: \"CA10__monitoringState__c\"\n \ \ undeterminedIf:\n isEmpty: \"Corrupted data. EC2 Instances Detailed\ \ Monitoring State cannot be empty.\"\n# Values: pending | running | shutting-down\ \ | terminated | stopping | stopped. Not nullable.\n - name: \"CA10__stateName__c\"\ \n value: \n FIELD:\n path: \"CA10__stateName__c\"\n undeterminedIf:\n\ \ noAccessDelegate:\n path: \"CA10__stateName__c\"\n \ \ currentStateMessage: \"Unable to determine EC2 Instances State Name.\ \ Possible permission issue with ec2:DescribeInstanceStatus\"\n# Number of Days.\ \ Nullable. Can't have no access, retrieved via ec2:DescribeInstances\n - name:\ \ \"CA10__currentRunningTime__c\"\n value: \n FIELD:\n path:\ \ \"CA10__currentRunningTime__c\" \n# Nullable.\n - name: \"CA10__averageCpuTwoWeeks__c\"\ \n value: \n FIELD:\n path: \"CA10__averageCpuTwoWeeks__c\" \ \ \n# Nullable.\n - name: \"CA10__maxCpuTwoWeeks__c\"\n value: \n \ \ FIELD:\n path: \"CA10__maxCpuTwoWeeks__c\" \n# Nullable.\n\ \ - name: \"CA10__sumTwoWeekNetworkOutMb__c\"\n value: \n FIELD:\n\ \ path: \"CA10__sumTwoWeekNetworkOutMb__c\" \n# Nullable.\n - name:\ \ \"CA10__sumTwoWeekNetworkInMb__c\"\n value: \n FIELD:\n path:\ \ \"CA10__sumTwoWeekNetworkInMb__c\" \n # Nullable.\n - name: \"CA10N__newRelicHost__c\"\ \n value:\n FIELD:\n path: \"CA10N__newRelicHost__c\"\n # Nullable.\ \ \n - name: \"CA10N__newRelicHostCpuUsed__c\"\n value:\n FIELD:\n\ \ path: \"CA10N__newRelicHostCpuUsed__c\"\n # Nullable.\n - name: \"\ CA10N__newRelicHostMemoryUsed14Day__c\"\n value:\n FIELD:\n path:\ \ \"CA10N__newRelicHostMemoryUsed14Day__c\"\n # Nullable.\n - name: \"CA10__averageMemoryUsedTwoWeeks__c\"\ \n value:\n FIELD:\n path: \"CA10__averageMemoryUsedTwoWeeks__c\"\ \n # Nullable.\n - name: \"CA10__nagiosMemoryUtilization__c\"\n value:\n\ \ FIELD:\n path: \"CA10__nagiosMemoryUtilization__c\"\n # Nullable.\n\ \ - name: \"CA10N__newRelicHostDiskUtilization__c\"\n value:\n FIELD:\n\ \ path: \"CA10N__newRelicHostDiskUtilization__c\"\n # Nullable.\n -\ \ name: \"CA10N__newRelicHostDiskReadUtilization__c\"\n value:\n FIELD:\n\ \ path: \"CA10N__newRelicHostDiskReadUtilization__c\"\n # Nullable.\n\ \ - name: \"CA10N__newRelicHostDiskWriteUtilization__c\"\n value:\n \ \ FIELD:\n path: \"CA10N__newRelicHostDiskWriteUtilization__c\"\n #\ \ Nullable.\n - name: \"CA10__regionName__c\"\n value:\n FIELD:\n \ \ path: \"CA10__regionName__c\"\n# Values: paravirtual | hvm. Not nullable.\ \ Can't have no access, retrieved via ec2:DescribeInstances\n - name: \"CA10__virtualizationType__c\"\ \n value: \n FIELD:\n path: \"CA10__virtualizationType__c\"\n\ \ undeterminedIf:\n isEmpty: \"Corrupted data. EC2 Instances\ \ Virtualization Type cannot be empty.\"\n" 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__stateName__c') != 'running'", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "299", "conditionText" : "extract('CA10__currentRunningTime__c') < number(14.0)", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "899", "conditionText" : "extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", "runtimeError" : null } }, { "Id" : "test5", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "799", "conditionText" : "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0)", "runtimeError" : null } }, { "Id" : "test6", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "499", "conditionText" : "extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(20.0) && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0) && extract('CA10N__newRelicHostDiskReadUtilization__c') < number(5.0) && extract('CA10N__newRelicHostDiskWriteUtilization__c') < number(5.0)", "runtimeError" : null } }, { "Id" : "test7", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "899", "conditionText" : "extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", "runtimeError" : null } }, { "Id" : "test8", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "999", "conditionText" : "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__averageMemoryUsedTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", "runtimeError" : null } }, { "Id" : "test9", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1099", "conditionText" : "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c') < number(40.0) && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", "runtimeError" : null } }, { "Id" : "test10", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "1200", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test11", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "1199", "conditionText" : "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsInstance__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__disappearanceTime__c" : new Date("2024-11-20T17:14:43Z"), "CA10__stateName__c" : "running", "CA10__currentRunningTime__c" : 100.0, "CA10__averageCpuTwoWeeks__c" : 10.0, "CA10__maxCpuTwoWeeks__c" : 30.0, "CA10N__newRelicHost__c" : null, "CA10N__newRelicHostMemoryUsed14Day__c" : null, "CA10__sumTwoWeekNetworkInMb__c" : 1000.0, "CA10__sumTwoWeekNetworkOutMb__c" : 1000.0, "CA10N__newRelicHostDiskReadUtilization__c" : null, "CA10N__newRelicHostDiskWriteUtilization__c" : null, "CA10__averageMemoryUsedTwoWeeks__c" : null, "CA10__nagiosMemoryUtilization__c" : null, "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__stateName__c" : "stopped", "CA10__currentRunningTime__c" : 100.0, "CA10__averageCpuTwoWeeks__c" : 10.0, "CA10__maxCpuTwoWeeks__c" : 30.0, "CA10N__newRelicHost__c" : null, "CA10N__newRelicHostMemoryUsed14Day__c" : null, "CA10__sumTwoWeekNetworkInMb__c" : 1000.0, "CA10__sumTwoWeekNetworkOutMb__c" : 1000.0, "CA10N__newRelicHostDiskReadUtilization__c" : null, "CA10N__newRelicHostDiskWriteUtilization__c" : null, "CA10__averageMemoryUsedTwoWeeks__c" : null, "CA10__nagiosMemoryUtilization__c" : null, "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__stateName__c" : "running", "CA10__currentRunningTime__c" : 1.0, "CA10__averageCpuTwoWeeks__c" : 10.0, "CA10__maxCpuTwoWeeks__c" : 30.0, "CA10N__newRelicHost__c" : null, "CA10N__newRelicHostMemoryUsed14Day__c" : null, "CA10__sumTwoWeekNetworkInMb__c" : 1000.0, "CA10__sumTwoWeekNetworkOutMb__c" : 1000.0, "CA10N__newRelicHostDiskReadUtilization__c" : null, "CA10N__newRelicHostDiskWriteUtilization__c" : null, "CA10__averageMemoryUsedTwoWeeks__c" : null, "CA10__nagiosMemoryUtilization__c" : null, "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__stateName__c" : "running", "CA10__currentRunningTime__c" : 100.0, "CA10__averageCpuTwoWeeks__c" : 10.0, "CA10__maxCpuTwoWeeks__c" : 30.0, "CA10N__newRelicHost__c" : "newRelicHost", "CA10N__newRelicHostMemoryUsed14Day__c" : 10.0, "CA10__sumTwoWeekNetworkInMb__c" : null, "CA10__sumTwoWeekNetworkOutMb__c" : 1000.0, "CA10N__newRelicHostDiskReadUtilization__c" : 1.0, "CA10N__newRelicHostDiskWriteUtilization__c" : 1.0, "CA10__averageMemoryUsedTwoWeeks__c" : null, "CA10__nagiosMemoryUtilization__c" : null, "Id" : "test4" }, { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__stateName__c" : "running", "CA10__currentRunningTime__c" : 100.0, "CA10__averageCpuTwoWeeks__c" : 1.0, "CA10__maxCpuTwoWeeks__c" : 10.0, "CA10N__newRelicHost__c" : null, "CA10N__newRelicHostMemoryUsed14Day__c" : null, "CA10__sumTwoWeekNetworkInMb__c" : 10.0, "CA10__sumTwoWeekNetworkOutMb__c" : 10.0, "CA10N__newRelicHostDiskReadUtilization__c" : null, "CA10N__newRelicHostDiskWriteUtilization__c" : null, "CA10__averageMemoryUsedTwoWeeks__c" : null, "CA10__nagiosMemoryUtilization__c" : null, "Id" : "test5" }, { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__stateName__c" : "running", "CA10__currentRunningTime__c" : 100.0, "CA10__averageCpuTwoWeeks__c" : 1.0, "CA10__maxCpuTwoWeeks__c" : 10.0, "CA10N__newRelicHost__c" : "newRelicHost", "CA10N__newRelicHostMemoryUsed14Day__c" : 10.0, "CA10__sumTwoWeekNetworkInMb__c" : 10.0, "CA10__sumTwoWeekNetworkOutMb__c" : 10.0, "CA10N__newRelicHostDiskReadUtilization__c" : 1.0, "CA10N__newRelicHostDiskWriteUtilization__c" : 1.0, "CA10__averageMemoryUsedTwoWeeks__c" : 30.0, "CA10__nagiosMemoryUtilization__c" : 30.0, "Id" : "test6" }, { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__stateName__c" : "running", "CA10__currentRunningTime__c" : 100.0, "CA10__averageCpuTwoWeeks__c" : 10.0, "CA10__maxCpuTwoWeeks__c" : 30.0, "CA10N__newRelicHost__c" : "newRelicHost", "CA10N__newRelicHostMemoryUsed14Day__c" : 20.0, "CA10__sumTwoWeekNetworkInMb__c" : 1000.0, "CA10__sumTwoWeekNetworkOutMb__c" : 1000.0, "CA10N__newRelicHostDiskReadUtilization__c" : 10.0, "CA10N__newRelicHostDiskWriteUtilization__c" : 10.0, "CA10__averageMemoryUsedTwoWeeks__c" : 10.0, "CA10__nagiosMemoryUtilization__c" : 10.0, "Id" : "test7" }, { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__stateName__c" : "running", "CA10__currentRunningTime__c" : 100.0, "CA10__averageCpuTwoWeeks__c" : 10.0, "CA10__maxCpuTwoWeeks__c" : 30.0, "CA10N__newRelicHost__c" : null, "CA10N__newRelicHostMemoryUsed14Day__c" : null, "CA10__sumTwoWeekNetworkInMb__c" : 1000.0, "CA10__sumTwoWeekNetworkOutMb__c" : 1000.0, "CA10N__newRelicHostDiskReadUtilization__c" : null, "CA10N__newRelicHostDiskWriteUtilization__c" : null, "CA10__averageMemoryUsedTwoWeeks__c" : 20.0, "CA10__nagiosMemoryUtilization__c" : 10.0, "Id" : "test8" }, { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__stateName__c" : "running", "CA10__currentRunningTime__c" : 100.0, "CA10__averageCpuTwoWeeks__c" : 10.0, "CA10__maxCpuTwoWeeks__c" : 30.0, "CA10N__newRelicHost__c" : null, "CA10N__newRelicHostMemoryUsed14Day__c" : null, "CA10__sumTwoWeekNetworkInMb__c" : 1000.0, "CA10__sumTwoWeekNetworkOutMb__c" : 1000.0, "CA10N__newRelicHostDiskReadUtilization__c" : null, "CA10N__newRelicHostDiskWriteUtilization__c" : null, "CA10__averageMemoryUsedTwoWeeks__c" : null, "CA10__nagiosMemoryUtilization__c" : 20.0, "Id" : "test9" }, { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__stateName__c" : "running", "CA10__currentRunningTime__c" : 100.0, "CA10__averageCpuTwoWeeks__c" : 10.0, "CA10__maxCpuTwoWeeks__c" : 30.0, "CA10N__newRelicHost__c" : "newRelicHost", "CA10N__newRelicHostMemoryUsed14Day__c" : 50.0, "CA10__sumTwoWeekNetworkInMb__c" : 1000.0, "CA10__sumTwoWeekNetworkOutMb__c" : 1000.0, "CA10N__newRelicHostDiskReadUtilization__c" : 10.0, "CA10N__newRelicHostDiskWriteUtilization__c" : 10.0, "CA10__averageMemoryUsedTwoWeeks__c" : 10.0, "CA10__nagiosMemoryUtilization__c" : 10.0, "Id" : "test10" }, { "context" : { "snapshotTime" : new Date("2024-11-20T20:12:30Z") }, "CA10__stateName__c" : "running", "CA10__currentRunningTime__c" : 100.0, "CA10__averageCpuTwoWeeks__c" : 10.0, "CA10__maxCpuTwoWeeks__c" : 30.0, "CA10N__newRelicHost__c" : null, "CA10N__newRelicHostMemoryUsed14Day__c" : null, "CA10__sumTwoWeekNetworkInMb__c" : 1000.0, "CA10__sumTwoWeekNetworkOutMb__c" : 1000.0, "CA10N__newRelicHostDiskReadUtilization__c" : 10.0, "CA10N__newRelicHostDiskWriteUtilization__c" : 10.0, "CA10__averageMemoryUsedTwoWeeks__c" : null, "CA10__nagiosMemoryUtilization__c" : null, "Id" : "test11" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsInstance__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__stateName__c STRING, CA10__currentRunningTime__c FLOAT64, CA10__averageCpuTwoWeeks__c FLOAT64, CA10__maxCpuTwoWeeks__c FLOAT64, CA10N__newRelicHost__c STRING, CA10N__newRelicHostMemoryUsed14Day__c FLOAT64, CA10__sumTwoWeekNetworkInMb__c FLOAT64, CA10__sumTwoWeekNetworkOutMb__c FLOAT64, CA10N__newRelicHostDiskReadUtilization__c FLOAT64, CA10N__newRelicHostDiskWriteUtilization__c FLOAT64, CA10__averageMemoryUsedTwoWeeks__c FLOAT64, CA10__nagiosMemoryUtilization__c FLOAT64, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var IsEmptyLib = new function () { this.simpleIsEmpty = function(arg) { return arg == null; }; this.simpleIsNotEmpty = function(arg) { return arg != null; }; }(); 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 fieldChecked4() { if (TextLib.isEmpty(obj.CA10__stateName__c)) { throw new Error("UNDETERMINED condition:101", {cause: {status: 'UNDETERMINED', conditionIndex: 101, conditionText: "CA10__stateName__c.delegatedTo(CA10__stateName__c).isEmpty()", currentStateMessage: "Unable to determine EC2 Instances State Name. Possible permission issue with ec2:DescribeInstanceStatus", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}}); } return obj.CA10__stateName__c; } function extract3() { if (!this.out) { this.out = fieldChecked4(); } return this.out; }; references1.push('State Name [obj.CA10__stateName__c]: ' + obj.CA10__stateName__c); try { if (TextLib.notEqual(extract3.call(extract3), 'running')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__stateName__c') != 'running'", currentStateMessage: "The instance is not running.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } } catch (err) { if (err.cause && err.cause.status) { return err.cause; } else { throw err; } } // condition[2], conditionIndex:[200..299] function extract7() { if (!this.out) { this.out = obj.CA10__currentRunningTime__c; } return this.out; }; references1.push('Current Running Time [obj.CA10__currentRunningTime__c]: ' + obj.CA10__currentRunningTime__c); if (extract7.call(extract7) != null && 14.0 != null && extract7.call(extract7) < 14.0) { return {status: 'INAPPLICABLE', conditionIndex: 299, conditionText: "extract('CA10__currentRunningTime__c') < number(14.0)", currentStateMessage: "The instance has been running for less than 14 days.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extract10() { if (!this.out) { this.out = obj.CA10__averageCpuTwoWeeks__c; } return this.out; }; function extract13() { if (!this.out) { this.out = obj.CA10__maxCpuTwoWeeks__c; } return this.out; }; function extract16() { if (!this.out) { this.out = obj.CA10N__newRelicHost__c; } return this.out; }; function extract19() { if (!this.out) { this.out = obj.CA10N__newRelicHostMemoryUsed14Day__c; } return this.out; }; references1.push('CloudWatch: CPU, 14-Day [obj.CA10__averageCpuTwoWeeks__c]: ' + obj.CA10__averageCpuTwoWeeks__c); references1.push('CloudWatch: CPU Max, 14-Day [obj.CA10__maxCpuTwoWeeks__c]: ' + obj.CA10__maxCpuTwoWeeks__c); references1.push('New Relic Host [obj.CA10N__newRelicHost__c]: ' + obj.CA10N__newRelicHost__c); references1.push('New Relic Host: Memory Used, 14-Day [obj.CA10N__newRelicHostMemoryUsed14Day__c]: ' + obj.CA10N__newRelicHostMemoryUsed14Day__c); if (IsEmptyLib.simpleIsEmpty(extract10.call(extract10)) || IsEmptyLib.simpleIsEmpty(extract13.call(extract13)) || (TextLib.isNotEmpty(extract16.call(extract16)) && IsEmptyLib.simpleIsEmpty(extract19.call(extract19)))) { return {status: 'UNDETERMINED', conditionIndex: 399, conditionText: "extract('CA10__averageCpuTwoWeeks__c').isEmpty() || extract('CA10__maxCpuTwoWeeks__c').isEmpty() || (extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10N__newRelicHostMemoryUsed14Day__c').isEmpty())", currentStateMessage: "There is not enough CMDB data to determine whether the instance is underutilized.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[4], conditionIndex:[400..499] function extract22() { if (!this.out) { this.out = obj.CA10N__newRelicHost__c; } return this.out; }; function extract26() { if (!this.out) { this.out = obj.CA10N__newRelicHostMemoryUsed14Day__c; } return this.out; }; function extract30() { if (!this.out) { this.out = obj.CA10__averageCpuTwoWeeks__c; } return this.out; }; function extract34() { if (!this.out) { this.out = obj.CA10__maxCpuTwoWeeks__c; } return this.out; }; function extract38() { if (!this.out) { this.out = obj.CA10__sumTwoWeekNetworkInMb__c; } return this.out; }; function extract42() { if (!this.out) { this.out = obj.CA10__sumTwoWeekNetworkOutMb__c; } return this.out; }; function extract46() { if (!this.out) { this.out = obj.CA10N__newRelicHostDiskReadUtilization__c; } return this.out; }; function extract50() { if (!this.out) { this.out = obj.CA10N__newRelicHostDiskWriteUtilization__c; } return this.out; }; references1.push('CloudWatch: Network In, MB, 14-Day [obj.CA10__sumTwoWeekNetworkInMb__c]: ' + obj.CA10__sumTwoWeekNetworkInMb__c); references1.push('CloudWatch: Network Out, MB, 14-Day [obj.CA10__sumTwoWeekNetworkOutMb__c]: ' + obj.CA10__sumTwoWeekNetworkOutMb__c); references1.push('New Relic Host: Disk Read Utilization [obj.CA10N__newRelicHostDiskReadUtilization__c]: ' + obj.CA10N__newRelicHostDiskReadUtilization__c); references1.push('New Relic Host: Disk Write Utilization [obj.CA10N__newRelicHostDiskWriteUtilization__c]: ' + obj.CA10N__newRelicHostDiskWriteUtilization__c); if (TextLib.isNotEmpty(extract22.call(extract22)) && (extract26.call(extract26) != null && 20.0 != null && extract26.call(extract26) < 20.0) && (extract30.call(extract30) != null && 5.0 != null && extract30.call(extract30) < 5.0) && (extract34.call(extract34) != null && 15.0 != null && extract34.call(extract34) < 15.0) && (extract38.call(extract38) != null && 100.0 != null && extract38.call(extract38) < 100.0) && (extract42.call(extract42) != null && 100.0 != null && extract42.call(extract42) < 100.0) && (extract46.call(extract46) != null && 5.0 != null && extract46.call(extract46) < 5.0) && (extract50.call(extract50) != null && 5.0 != null && extract50.call(extract50) < 5.0)) { return {status: 'INAPPLICABLE', conditionIndex: 499, conditionText: "extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(20.0) && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0) && extract('CA10N__newRelicHostDiskReadUtilization__c') < number(5.0) && extract('CA10N__newRelicHostDiskWriteUtilization__c') < number(5.0)", currentStateMessage: "The instance is idle and considered by the 'AWS EC2 Instance is idle' policy.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[5], conditionIndex:[500..599] function extract53() { if (!this.out) { this.out = obj.CA10N__newRelicHost__c; } return this.out; }; function extract57() { if (!this.out) { this.out = obj.CA10__averageMemoryUsedTwoWeeks__c; } return this.out; }; function extract61() { if (!this.out) { this.out = obj.CA10__averageCpuTwoWeeks__c; } return this.out; }; function extract65() { if (!this.out) { this.out = obj.CA10__maxCpuTwoWeeks__c; } return this.out; }; function extract69() { if (!this.out) { this.out = obj.CA10__sumTwoWeekNetworkInMb__c; } return this.out; }; function extract73() { if (!this.out) { this.out = obj.CA10__sumTwoWeekNetworkOutMb__c; } return this.out; }; references1.push('CloudWatch (Agent): Memory Used, 14-Day [obj.CA10__averageMemoryUsedTwoWeeks__c]: ' + obj.CA10__averageMemoryUsedTwoWeeks__c); if (TextLib.isEmpty(extract53.call(extract53)) && (extract57.call(extract57) != null && 20.0 != null && extract57.call(extract57) < 20.0) && (extract61.call(extract61) != null && 5.0 != null && extract61.call(extract61) < 5.0) && (extract65.call(extract65) != null && 15.0 != null && extract65.call(extract65) < 15.0) && (extract69.call(extract69) != null && 100.0 != null && extract69.call(extract69) < 100.0) && (extract73.call(extract73) != null && 100.0 != null && extract73.call(extract73) < 100.0)) { return {status: 'INAPPLICABLE', conditionIndex: 599, conditionText: "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c') < number(20.0) && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0)", currentStateMessage: "The instance is idle and considered by the 'AWS EC2 Instance is idle' policy.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[6], conditionIndex:[600..699] function extract76() { if (!this.out) { this.out = obj.CA10N__newRelicHost__c; } return this.out; }; function extract79() { if (!this.out) { this.out = obj.CA10__averageMemoryUsedTwoWeeks__c; } return this.out; }; function extract83() { if (!this.out) { this.out = obj.CA10__nagiosMemoryUtilization__c; } return this.out; }; function extract87() { if (!this.out) { this.out = obj.CA10__averageCpuTwoWeeks__c; } return this.out; }; function extract91() { if (!this.out) { this.out = obj.CA10__maxCpuTwoWeeks__c; } return this.out; }; function extract95() { if (!this.out) { this.out = obj.CA10__sumTwoWeekNetworkInMb__c; } return this.out; }; function extract99() { if (!this.out) { this.out = obj.CA10__sumTwoWeekNetworkOutMb__c; } return this.out; }; references1.push('Nagios: Memory Utilization [obj.CA10__nagiosMemoryUtilization__c]: ' + obj.CA10__nagiosMemoryUtilization__c); if (TextLib.isEmpty(extract76.call(extract76)) && IsEmptyLib.simpleIsEmpty(extract79.call(extract79)) && (extract83.call(extract83) != null && 20.0 != null && extract83.call(extract83) < 20.0) && (extract87.call(extract87) != null && 5.0 != null && extract87.call(extract87) < 5.0) && (extract91.call(extract91) != null && 15.0 != null && extract91.call(extract91) < 15.0) && (extract95.call(extract95) != null && 100.0 != null && extract95.call(extract95) < 100.0) && (extract99.call(extract99) != null && 100.0 != null && extract99.call(extract99) < 100.0)) { return {status: 'INAPPLICABLE', conditionIndex: 699, conditionText: "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c') < number(20.0) && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0)", currentStateMessage: "The instance is idle and considered by the 'AWS EC2 Instance is idle' policy.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[7], conditionIndex:[700..799] function extract102() { if (!this.out) { this.out = obj.CA10N__newRelicHost__c; } return this.out; }; function extract105() { if (!this.out) { this.out = obj.CA10__averageMemoryUsedTwoWeeks__c; } return this.out; }; function extract108() { if (!this.out) { this.out = obj.CA10__nagiosMemoryUtilization__c; } return this.out; }; function extract112() { if (!this.out) { this.out = obj.CA10__averageCpuTwoWeeks__c; } return this.out; }; function extract116() { if (!this.out) { this.out = obj.CA10__maxCpuTwoWeeks__c; } return this.out; }; function extract120() { if (!this.out) { this.out = obj.CA10__sumTwoWeekNetworkInMb__c; } return this.out; }; function extract124() { if (!this.out) { this.out = obj.CA10__sumTwoWeekNetworkOutMb__c; } return this.out; }; if (TextLib.isEmpty(extract102.call(extract102)) && IsEmptyLib.simpleIsEmpty(extract105.call(extract105)) && IsEmptyLib.simpleIsEmpty(extract108.call(extract108)) && (extract112.call(extract112) != null && 5.0 != null && extract112.call(extract112) < 5.0) && (extract116.call(extract116) != null && 15.0 != null && extract116.call(extract116) < 15.0) && (extract120.call(extract120) != null && 100.0 != null && extract120.call(extract120) < 100.0) && (extract124.call(extract124) != null && 100.0 != null && extract124.call(extract124) < 100.0)) { return {status: 'INAPPLICABLE', conditionIndex: 799, conditionText: "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(5.0) && extract('CA10__maxCpuTwoWeeks__c') < number(15.0) && extract('CA10__sumTwoWeekNetworkInMb__c') < number(100.0) && extract('CA10__sumTwoWeekNetworkOutMb__c') < number(100.0)", currentStateMessage: "The instance is idle and considered by the 'AWS EC2 Instance is idle' policy.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[8], conditionIndex:[800..899] function extract127() { if (!this.out) { this.out = obj.CA10N__newRelicHost__c; } return this.out; }; function extract131() { if (!this.out) { this.out = obj.CA10__averageCpuTwoWeeks__c; } return this.out; }; function extract135() { if (!this.out) { this.out = obj.CA10N__newRelicHostMemoryUsed14Day__c; } return this.out; }; function extract139() { if (!this.out) { this.out = obj.CA10__maxCpuTwoWeeks__c; } return this.out; }; if (TextLib.isNotEmpty(extract127.call(extract127)) && (extract131.call(extract131) != null && 40.0 != null && extract131.call(extract131) < 40.0) && (extract135.call(extract135) != null && 40.0 != null && extract135.call(extract135) < 40.0) && (extract139.call(extract139) != null && 50.0 != null && extract139.call(extract139) < 50.0)) { return {status: 'INCOMPLIANT', conditionIndex: 899, conditionText: "extract('CA10N__newRelicHost__c').isNotEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10N__newRelicHostMemoryUsed14Day__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", currentStateMessage: "The instance is underutilized with average CPU below 40%, memory below 40%, and maximum CPU below 50%.", currentStateReferences: references1.join('\n'), remediation: "Rightsize, consolidate, or terminate the instance.", runtimeError: null}; } // condition[9], conditionIndex:[900..999] function extract142() { if (!this.out) { this.out = obj.CA10N__newRelicHost__c; } return this.out; }; function extract146() { if (!this.out) { this.out = obj.CA10__averageCpuTwoWeeks__c; } return this.out; }; function extract150() { if (!this.out) { this.out = obj.CA10__averageMemoryUsedTwoWeeks__c; } return this.out; }; function extract154() { if (!this.out) { this.out = obj.CA10__maxCpuTwoWeeks__c; } return this.out; }; if (TextLib.isEmpty(extract142.call(extract142)) && (extract146.call(extract146) != null && 40.0 != null && extract146.call(extract146) < 40.0) && (extract150.call(extract150) != null && 40.0 != null && extract150.call(extract150) < 40.0) && (extract154.call(extract154) != null && 50.0 != null && extract154.call(extract154) < 50.0)) { return {status: 'INCOMPLIANT', conditionIndex: 999, conditionText: "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__averageMemoryUsedTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", currentStateMessage: "The instance is underutilized with average CPU below 40%, memory below 40%, and maximum CPU below 50%.", currentStateReferences: references1.join('\n'), remediation: "Rightsize, consolidate, or terminate the instance.", runtimeError: null}; } // condition[10], conditionIndex:[1000..1099] function extract157() { if (!this.out) { this.out = obj.CA10N__newRelicHost__c; } return this.out; }; function extract160() { if (!this.out) { this.out = obj.CA10__averageMemoryUsedTwoWeeks__c; } return this.out; }; function extract164() { if (!this.out) { this.out = obj.CA10__nagiosMemoryUtilization__c; } return this.out; }; function extract168() { if (!this.out) { this.out = obj.CA10__averageCpuTwoWeeks__c; } return this.out; }; function extract172() { if (!this.out) { this.out = obj.CA10__maxCpuTwoWeeks__c; } return this.out; }; if (TextLib.isEmpty(extract157.call(extract157)) && IsEmptyLib.simpleIsEmpty(extract160.call(extract160)) && (extract164.call(extract164) != null && 40.0 != null && extract164.call(extract164) < 40.0) && (extract168.call(extract168) != null && 40.0 != null && extract168.call(extract168) < 40.0) && (extract172.call(extract172) != null && 50.0 != null && extract172.call(extract172) < 50.0)) { return {status: 'INCOMPLIANT', conditionIndex: 1099, conditionText: "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c') < number(40.0) && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", currentStateMessage: "The instance is underutilized with average CPU below 40%, memory below 40%, and maximum CPU below 50%.", currentStateReferences: references1.join('\n'), remediation: "Rightsize, consolidate, or terminate the instance.", runtimeError: null}; } // condition[11], conditionIndex:[1100..1199] function extract175() { if (!this.out) { this.out = obj.CA10N__newRelicHost__c; } return this.out; }; function extract178() { if (!this.out) { this.out = obj.CA10__averageMemoryUsedTwoWeeks__c; } return this.out; }; function extract181() { if (!this.out) { this.out = obj.CA10__nagiosMemoryUtilization__c; } return this.out; }; function extract185() { if (!this.out) { this.out = obj.CA10__averageCpuTwoWeeks__c; } return this.out; }; function extract189() { if (!this.out) { this.out = obj.CA10__maxCpuTwoWeeks__c; } return this.out; }; if (TextLib.isEmpty(extract175.call(extract175)) && IsEmptyLib.simpleIsEmpty(extract178.call(extract178)) && IsEmptyLib.simpleIsEmpty(extract181.call(extract181)) && (extract185.call(extract185) != null && 40.0 != null && extract185.call(extract185) < 40.0) && (extract189.call(extract189) != null && 50.0 != null && extract189.call(extract189) < 50.0)) { return {status: 'INCOMPLIANT', conditionIndex: 1199, conditionText: "extract('CA10N__newRelicHost__c').isEmpty() && extract('CA10__averageMemoryUsedTwoWeeks__c').isEmpty() && extract('CA10__nagiosMemoryUtilization__c').isEmpty() && extract('CA10__averageCpuTwoWeeks__c') < number(40.0) && extract('CA10__maxCpuTwoWeeks__c') < number(50.0)", currentStateMessage: "The instance is underutilized with average CPU below 40% and maximum CPU below 50%.", currentStateReferences: references1.join('\n'), remediation: "Rightsize, consolidate, or terminate the instance.", runtimeError: null}; } return {status: 'COMPLIANT', conditionIndex: 1200, 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.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__stateName__c AS CA10__stateName__c, sObject.CA10__currentRunningTime__c AS CA10__currentRunningTime__c, sObject.CA10__averageCpuTwoWeeks__c AS CA10__averageCpuTwoWeeks__c, sObject.CA10__maxCpuTwoWeeks__c AS CA10__maxCpuTwoWeeks__c, sObject.CA10N__newRelicHost__c AS CA10N__newRelicHost__c, sObject.CA10N__newRelicHostMemoryUsed14Day__c AS CA10N__newRelicHostMemoryUsed14Day__c, sObject.CA10__sumTwoWeekNetworkInMb__c AS CA10__sumTwoWeekNetworkInMb__c, sObject.CA10__sumTwoWeekNetworkOutMb__c AS CA10__sumTwoWeekNetworkOutMb__c, sObject.CA10N__newRelicHostDiskReadUtilization__c AS CA10N__newRelicHostDiskReadUtilization__c, sObject.CA10N__newRelicHostDiskWriteUtilization__c AS CA10N__newRelicHostDiskWriteUtilization__c, sObject.CA10__averageMemoryUsedTwoWeeks__c AS CA10__averageMemoryUsedTwoWeeks__c, sObject.CA10__nagiosMemoryUtilization__c AS CA10__nagiosMemoryUtilization__c, sObject.Id AS Id, process_CA10__CaAwsInstance__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__stateName__c AS CA10__stateName__c, sObject.CA10__currentRunningTime__c AS CA10__currentRunningTime__c, sObject.CA10__averageCpuTwoWeeks__c AS CA10__averageCpuTwoWeeks__c, sObject.CA10__maxCpuTwoWeeks__c AS CA10__maxCpuTwoWeeks__c, sObject.CA10N__newRelicHost__c AS CA10N__newRelicHost__c, sObject.CA10N__newRelicHostMemoryUsed14Day__c AS CA10N__newRelicHostMemoryUsed14Day__c, sObject.CA10__sumTwoWeekNetworkInMb__c AS CA10__sumTwoWeekNetworkInMb__c, sObject.CA10__sumTwoWeekNetworkOutMb__c AS CA10__sumTwoWeekNetworkOutMb__c, sObject.CA10N__newRelicHostDiskReadUtilization__c AS CA10N__newRelicHostDiskReadUtilization__c, sObject.CA10N__newRelicHostDiskWriteUtilization__c AS CA10N__newRelicHostDiskWriteUtilization__c, sObject.CA10__averageMemoryUsedTwoWeeks__c AS CA10__averageMemoryUsedTwoWeeks__c, sObject.CA10__nagiosMemoryUtilization__c AS CA10__nagiosMemoryUtilization__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsInstance__c()) AS sObject ) sObject ON sObject.Id = expectedResult.Id;