--- policy: /ce/ca/aws/redshift/cluster-ecryption-in-transit logic: /ce/ca/aws/redshift/cluster-ecryption-in-transit/prod.logic.yaml executionTime: 2026-02-10T22:33:14.82214155Z generationMs: 104 executionMs: 1046 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: INCOMPLIANT actual: INCOMPLIANT conditionIndex: expected: 299 actual: 299 conditionText: expected: CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(INCOMPLIANT) actual: CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(INCOMPLIANT) runtimeError: {} - id: test3 match: true status: expected: COMPLIANT actual: COMPLIANT conditionIndex: expected: 399 actual: 399 conditionText: expected: CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(COMPLIANT) actual: CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(COMPLIANT) runtimeError: {} - id: test4 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 599 actual: 599 conditionText: expected: CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(INAPPLICABLE) actual: CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(INAPPLICABLE) runtimeError: {} - id: test5 match: true status: expected: UNDETERMINED actual: UNDETERMINED conditionIndex: expected: 600 actual: 600 conditionText: expected: otherwise actual: otherwise runtimeError: {} - id: test6 match: true status: expected: INAPPLICABLE actual: INAPPLICABLE conditionIndex: expected: 199 actual: 199 conditionText: expected: extract('CA10__status__c') != 'available' actual: extract('CA10__status__c') != 'available' runtimeError: {} usedFiles: - path: /ce/ca/aws/redshift/cluster-ecryption-in-transit/policy.yaml md5Hash: 6FBAB805A930963C771DF5C706E07F01 content: "---\nnames:\n full: \"AWS Redshift Cluster is not required to use encryption\ \ in transit\"\n contextual: \"Cluster is not required to use encryption in\ \ transit\"\ndescription: >\n Ensure that AWS Redshift Clusters are configured\ \ to enforce SSL/TLS encryption \n for all connections to protect data in transit.\n\ type: \"COMPLIANCE_POLICY\"\ncategories:\n - \"SECURITY\"\nframeworkMappings:\n\ \ - \"/frameworks/cloudaware/resource-security/data-encryption\"\n - \"/frameworks/aws-fsbp-v1.0.0/redshift/02\"\ \n - \"/frameworks/aws-well-architected/sec/09/03\"\nsimilarPolicies:\n awsSecurityHub:\n\ \ - name: \"[Redshift.2] Connections to Amazon Redshift clusters should be\ \ encrypted in transit\"\n url: \"https://docs.aws.amazon.com/securityhub/latest/userguide/redshift-controls.html#redshift-2\"\ \n " - path: /ce/ca/aws/redshift/cluster-ecryption-in-transit/prod.logic.yaml md5Hash: EB5E9B6EB9EC8F06ECD821650E568D0D content: "---\ninputType: \"CA10__CaAwsRedshiftCluster__c\"\nimportExtracts:\n\ \ - file: \"/types/CA10__CaAwsRedshiftClusterParameter__c/object.extracts.yaml\"\ \n - file: \"/types/CA10__CaAwsRedshiftCluster__c/object.extracts.yaml\"\n\ testData:\n - file: \"test-data.json\"\nconditions:\n - status: \"INAPPLICABLE\"\ \n currentStateMessage: \"The cluster is not available.\"\n check:\n \ \ NOT_EQUAL:\n left:\n EXTRACT: \"CA10__status__c\"\n \ \ right:\n TEXT: \"available\"\n - status: \"INCOMPLIANT\"\n\ \ currentStateMessage: \"The Redshift cluster require_ssl parameter is set\ \ to false.\"\n remediationMessage: \"Enable the require_ssl parameter for\ \ the cluster.\"\n check:\n RELATED_LIST_HAS:\n status: \"INCOMPLIANT\"\ \n relationshipName: \"CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r\"\ \n - status: \"COMPLIANT\"\n currentStateMessage: \"The Redshift cluster\ \ require_ssl parameter is set to true.\"\n check:\n RELATED_LIST_HAS:\n\ \ status: \"COMPLIANT\"\n relationshipName: \"CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r\"\ \n - status: \"UNDETERMINED\"\n currentStateMessage: \"Unexpected value\ \ for the require_ssl parameter. It is not set to true/false.\"\n check:\n\ \ RELATED_LIST_HAS:\n status: \"UNDETERMINED\"\n relationshipName:\ \ \"CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r\"\n - status: \"UNDETERMINED\"\ \n currentStateMessage: \"The require_ssl parameter does not exist in the\ \ CMDB.\"\n check:\n RELATED_LIST_HAS:\n status: \"INAPPLICABLE\"\ \n relationshipName: \"CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r\"\ \notherwise:\n status: \"UNDETERMINED\"\n currentStateMessage: \"The Redshift\ \ cluster parameters do not exist in the CMDB.\"\nrelatedLists:\n - relationshipName:\ \ \"CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r\"\n conditions: \n\ \ - status: \"INCOMPLIANT\"\n currentStateMessage: \"The require_ssl\ \ parameter is set to false.\"\n remediationMessage: \"Enable the require_ssl\ \ parameter.\"\n check:\n RELATED_LIST_HAS:\n status:\ \ \"INCOMPLIANT\"\n relationshipName: \"CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r\"\ \n - status: \"COMPLIANT\"\n currentStateMessage: \"The require_ssl\ \ parameter is set to true.\"\n check:\n RELATED_LIST_HAS:\n\ \ status: \"COMPLIANT\"\n relationshipName: \"CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r\"\ \n - status: \"UNDETERMINED\"\n currentStateMessage: \"Unexpected\ \ value for the require_ssl parameter. It is not set to true/false.\"\n \ \ check:\n RELATED_LIST_HAS:\n status: \"UNDETERMINED\"\ \n relationshipName: \"CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r\"\ \n otherwise:\n status: \"INAPPLICABLE\"\n currentStateMessage:\ \ \"The require_ssl parameter does not exist in the CMDB.\"\n relatedLists:\n\ \ - relationshipName: \"CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r\"\ \n conditions:\n - status: \"INAPPLICABLE\"\n currentStateMessage:\ \ \"This is an unrelated parameter.\"\n check:\n NOT_EQUAL:\n\ \ left:\n EXTRACT: \"CA10__parameterName__c\"\ \n right:\n TEXT: \"require_ssl\"\n \ \ - status: \"INCOMPLIANT\"\n currentStateMessage: \"The require_ssl\ \ parameter is set to false.\"\n check:\n IS_EQUAL:\n\ \ left:\n EXTRACT: \"CA10__parameterValue__c\"\ \n right:\n TEXT: \"false\"\n - status:\ \ \"COMPLIANT\"\n currentStateMessage: \"The require_ssl parameter\ \ is set to true.\"\n check:\n IS_EQUAL:\n \ \ left:\n EXTRACT: \"CA10__parameterValue__c\"\n \ \ right:\n TEXT: \"true\"\n otherwise:\n\ \ status: \"UNDETERMINED\"\n currentStateMessage: \"Unexpected\ \ values in the fields.\"\n" - path: /ce/ca/aws/redshift/cluster-ecryption-in-transit/test-data.json md5Hash: BE37B50E659B401ABE07D1C957671EDA content: |- [ { "expectedResult": { "status": "DISAPPEARED", "conditionIndex": "99", "conditionText": "isDisappeared(CA10__disappearanceTime__c)", "runtimeError": null }, "context": { "snapshotTime": "2025-11-10T22:46:35Z" }, "CA10__disappearanceTime__c": "2025-11-05T18:46:31Z", "Id": "test1", "CA10__status__c": "available", "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r": [ { "CA10A2__disappearanceTime__c": "2025-11-05T18:46:31Z", "CA10A2__cluster__c": "test1", "Id": "test1_1", "CA10A2__parameterGroup__c": "test1_2", "CA10A2__parameterGroup__r": { "Id": "test1_2", "CA10__AWS_Redshift_Cluster_Parameters__r": [ { "CA10__disappearanceTime__c": null, "CA10__parameterName__c": "require_ssl", "CA10__parameterValue__c": "false", "CA10__group__c": "test1_2", "Id": "test1_3" } ] } } ] }, { "expectedResult": { "status": "INCOMPLIANT", "conditionIndex": "299", "conditionText": "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(INCOMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2025-11-10T22:46:35Z" }, "CA10__disappearanceTime__c": null, "Id": "test2", "CA10__status__c": "available", "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r": [ { "CA10A2__disappearanceTime__c": null, "CA10A2__cluster__c": "test2", "Id": "test2_1", "CA10A2__parameterGroup__c": "test2_2", "CA10A2__parameterGroup__r": { "Id": "test2_2", "CA10__AWS_Redshift_Cluster_Parameters__r": [ { "CA10__disappearanceTime__c": null, "CA10__parameterName__c": "require_ssl", "CA10__parameterValue__c": "false", "CA10__group__c": "test2_2", "Id": "test2_3" } ] } } ] }, { "expectedResult": { "status": "COMPLIANT", "conditionIndex": "399", "conditionText": "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(COMPLIANT)", "runtimeError": null }, "context": { "snapshotTime": "2025-11-10T22:46:35Z" }, "CA10__disappearanceTime__c": null, "Id": "test3", "CA10__status__c": "available", "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r": [ { "CA10A2__disappearanceTime__c": null, "CA10A2__cluster__c": "test3", "Id": "test3_1", "CA10A2__parameterGroup__c": "test3_2", "CA10A2__parameterGroup__r": { "Id": "test3_2", "CA10__AWS_Redshift_Cluster_Parameters__r": [ { "CA10__disappearanceTime__c": null, "CA10__parameterName__c": "require_ssl", "CA10__parameterValue__c": "true", "CA10__group__c": "test3_2", "Id": "test3_3" } ] } } ] }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "599", "conditionText": "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(INAPPLICABLE)", "runtimeError": null }, "context": { "snapshotTime": "2025-11-10T22:46:35Z" }, "CA10__disappearanceTime__c": null, "Id": "test4", "CA10__status__c": "available", "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r": [ { "CA10A2__disappearanceTime__c": null, "CA10A2__cluster__c": "test4", "Id": "test4_1", "CA10A2__parameterGroup__c": "test4_2", "CA10A2__parameterGroup__r": { "Id": "test4_2", "CA10__AWS_Redshift_Cluster_Parameters__r": [] } } ] }, { "expectedResult": { "status": "UNDETERMINED", "conditionIndex": "600", "conditionText": "otherwise", "runtimeError": null }, "context": { "snapshotTime": "2025-11-10T22:46:35Z" }, "CA10__disappearanceTime__c": null, "Id": "test5", "CA10__status__c": "available", "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r": [] }, { "expectedResult": { "status": "INAPPLICABLE", "conditionIndex": "199", "conditionText": "extract('CA10__status__c') != 'available'", "runtimeError": null }, "context": { "snapshotTime": "2025-11-10T22:46:35Z" }, "CA10__disappearanceTime__c": null, "Id": "test6", "CA10__status__c": "paused", "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r": [] } ] - path: /types/CA10__CaAwsRedshiftCluster__c/object.extracts.yaml md5Hash: 978033E93A3BC4EEE31B6916039330FF content: | --- extracts: # Nullable. Values: available, modifying, creating ... - name: "CA10__status__c" value: FIELD: path: "CA10__status__c" # Nullable. - name: "CA10__createTime__c" value: FIELD: path: "CA10__createTime__c" # Nullable. - name: "CA10__cpuUtilizationAvg30d__c" value: FIELD: path: "CA10__cpuUtilizationAvg30d__c" # Nullable. - name: "CA10__diskReadIopsAvg30d__c" value: FIELD: path: "CA10__diskReadIopsAvg30d__c" # Nullable. - name: "CA10__diskWriteIopsAvg30d__c" value: FIELD: path: "CA10__diskWriteIopsAvg30d__c" # Nullable. - name: "CA10__logging__c" value: FIELD: path: "CA10__logging__c" # Nullable. - name: "CA10__automatedSnapshotRetentionPeriod__c" value: FIELD: path: "CA10__automatedSnapshotRetentionPeriod__c" # Text. - name: "CA10__encryption__c" value: FIELD: path: "CA10__encryption__c" # Text. - name: "CA10__masterUsername__c" value: FIELD: path: "CA10__masterUsername__c" # Text. - name: "CA10__versionUpgrade__c" value: FIELD: path: "CA10__versionUpgrade__c" # Values: Yes | No. Not nullable. Can't have no access, retrieved via redshift:DescribeClusters - name: "CA10__publiclyAccessible__c" value: FIELD: path: "CA10__publiclyAccessible__c" # Values: Enabled | Disabled. Not nullable. Can't have no access, retrieved via redshift:DescribeClusters - name: "CA10__enhancedVpcRouting2__c" value: FIELD: path: "CA10__enhancedVpcRouting2__c" # Number - name: "CA10__endpointPort2__c" value: FIELD: path: "CA10__endpointPort2__c" - path: /types/CA10__CaAwsRedshiftClusterParameter__c/object.extracts.yaml md5Hash: 624055E6B8A930F67D8AD5CE51291BB0 content: |- --- extracts: # Not nullable. Can't have no access, retrieved via redshift:DescribeClusterParameters - name: "CA10__parameterName__c" value: FIELD: path: "CA10__parameterName__c" # Can't have no access, retrieved via redshift:DescribeClusterParameters - name: "CA10__parameterValue__c" value: FIELD: path: "CA10__parameterValue__c" script: |- CREATE TEMP FUNCTION mock_ExpectedResult() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "Id" : "test1", "expectedResult" : { "status" : "DISAPPEARED", "conditionIndex" : "99", "conditionText" : "isDisappeared(CA10__disappearanceTime__c)", "runtimeError" : null } }, { "Id" : "test2", "expectedResult" : { "status" : "INCOMPLIANT", "conditionIndex" : "299", "conditionText" : "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(INCOMPLIANT)", "runtimeError" : null } }, { "Id" : "test3", "expectedResult" : { "status" : "COMPLIANT", "conditionIndex" : "399", "conditionText" : "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(COMPLIANT)", "runtimeError" : null } }, { "Id" : "test4", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "599", "conditionText" : "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(INAPPLICABLE)", "runtimeError" : null } }, { "Id" : "test5", "expectedResult" : { "status" : "UNDETERMINED", "conditionIndex" : "600", "conditionText" : "otherwise", "runtimeError" : null } }, { "Id" : "test6", "expectedResult" : { "status" : "INAPPLICABLE", "conditionIndex" : "199", "conditionText" : "extract('CA10__status__c') != 'available'", "runtimeError" : null } } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsRedshiftCluster__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10__disappearanceTime__c" : new Date("2025-11-05T18:46:31Z"), "CA10__status__c" : "available", "Id" : "test1" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10__status__c" : "available", "Id" : "test2" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10__status__c" : "available", "Id" : "test3" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10__status__c" : "available", "Id" : "test4" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10__status__c" : "available", "Id" : "test5" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10__status__c" : "paused", "Id" : "test6" } ]; """; CREATE TEMP FUNCTION mock_CA10A2__CaAwsRedshiftClusterParameterGroupLink__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10A2__disappearanceTime__c" : new Date("2025-11-05T18:46:31Z"), "CA10A2__cluster__c" : "test1", "Id" : "test1_1", "CA10A2__parameterGroup__c" : "test1_2" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10A2__cluster__c" : "test2", "Id" : "test2_1", "CA10A2__parameterGroup__c" : "test2_2" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10A2__cluster__c" : "test3", "Id" : "test3_1", "CA10A2__parameterGroup__c" : "test3_2" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10A2__cluster__c" : "test4", "Id" : "test4_1", "CA10A2__parameterGroup__c" : "test4_2" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsRedshiftClusterParameterGroup__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "Id" : "test1_2" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "Id" : "test2_2" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "Id" : "test3_2" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "Id" : "test4_2" } ]; """; CREATE TEMP FUNCTION mock_CA10__CaAwsRedshiftClusterParameter__c() RETURNS ARRAY >> DETERMINISTIC LANGUAGE js AS r""" return [ { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10__parameterName__c" : "require_ssl", "CA10__parameterValue__c" : "false", "CA10__group__c" : "test1_2", "Id" : "test1_3" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10__parameterName__c" : "require_ssl", "CA10__parameterValue__c" : "false", "CA10__group__c" : "test2_2", "Id" : "test2_3" }, { "context" : { "snapshotTime" : new Date("2025-11-10T22:46:35Z") }, "CA10__parameterName__c" : "require_ssl", "CA10__parameterValue__c" : "true", "CA10__group__c" : "test3_2", "Id" : "test3_3" } ]; """; CREATE TEMP FUNCTION process_CA10__CaAwsRedshiftCluster__c( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__status__c STRING, Id STRING, CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r ARRAY >> >, result STRUCT >> >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var TextLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase(); }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] function extract3() { if (!this.out) { this.out = obj.CA10__status__c; } return this.out; }; references1.push('Status [obj.CA10__status__c]: ' + obj.CA10__status__c); if (TextLib.notEqual(extract3.call(extract3), 'available')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__status__c') != 'available'", currentStateMessage: "The cluster is not available.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_INCOMPLIANT5 = 0; if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r != null) { for (var i6 = 0; i6 < obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.length; i6++) { if (typeof(obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i6].status) !== 'undefined') { if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i6].status == 'INCOMPLIANT') { count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_INCOMPLIANT5 += obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i6].count; } } else { if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i6].result.status == 'INCOMPLIANT') { count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_INCOMPLIANT5 += 1; } } } } // condition[2], conditionIndex:[200..299] references1.push('Related list [CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r] ' + (count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_INCOMPLIANT5 > 0 ? 'has' : 'does not have') + ' objects in INCOMPLIANT status'); if (count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_INCOMPLIANT5 > 0) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(INCOMPLIANT)", currentStateMessage: "The Redshift cluster require_ssl parameter is set to false.", currentStateReferences: references1.join('\n'), remediation: "Enable the require_ssl parameter for the cluster.", runtimeError: null}; } var count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_COMPLIANT7 = 0; if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r != null) { for (var i8 = 0; i8 < obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.length; i8++) { if (typeof(obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i8].status) !== 'undefined') { if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i8].status == 'COMPLIANT') { count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_COMPLIANT7 += obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i8].count; } } else { if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i8].result.status == 'COMPLIANT') { count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_COMPLIANT7 += 1; } } } } // condition[3], conditionIndex:[300..399] if (count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_COMPLIANT7 > 0) { return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(COMPLIANT)", currentStateMessage: "The Redshift cluster require_ssl parameter is set to true.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_UNDETERMINED9 = 0; if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r != null) { for (var i10 = 0; i10 < obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.length; i10++) { if (typeof(obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i10].status) !== 'undefined') { if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i10].status == 'UNDETERMINED') { count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_UNDETERMINED9 += obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i10].count; } } else { if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i10].result.status == 'UNDETERMINED') { count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_UNDETERMINED9 += 1; } } } } // condition[4], conditionIndex:[400..499] if (count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_UNDETERMINED9 > 0) { return {status: 'UNDETERMINED', conditionIndex: 499, conditionText: "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(UNDETERMINED)", currentStateMessage: "Unexpected value for the require_ssl parameter. It is not set to true/false.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_INAPPLICABLE11 = 0; if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r != null) { for (var i12 = 0; i12 < obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.length; i12++) { if (typeof(obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i12].status) !== 'undefined') { if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i12].status == 'INAPPLICABLE') { count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_INAPPLICABLE11 += obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i12].count; } } else { if (obj.CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r[i12].result.status == 'INAPPLICABLE') { count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_INAPPLICABLE11 += 1; } } } } // condition[5], conditionIndex:[500..599] if (count_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_INAPPLICABLE11 > 0) { return {status: 'UNDETERMINED', conditionIndex: 599, conditionText: "CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r.has(INAPPLICABLE)", currentStateMessage: "The require_ssl parameter does not exist in the CMDB.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 600, conditionText: "otherwise", currentStateMessage: "The Redshift cluster parameters do not exist in the CMDB.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r( obj STRUCT< CA10__disappearanceTime__c TIMESTAMP, CA10__parameterName__c STRING, CA10__parameterValue__c STRING, CA10__group__c STRING, Id STRING >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var TextLib = new function () { this.normalize = function(arg) { return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase(); }; this.isEmpty = function(arg) { return this.normalize(arg) == ''; }; this.isNotEmpty = function(arg) { return this.normalize(arg) != ''; }; this.equal = function(left, right) { return this.normalize(left) == this.normalize(right); }; this.notEqual = function(left, right) { return this.normalize(left) != this.normalize(right); }; this.startsWith = function(arg, substring) { return this.normalize(arg).startsWith(this.normalize(substring)); }; this.endsWith = function(arg, substring) { return this.normalize(arg).endsWith(this.normalize(substring)); }; this.contains = function(arg, substring) { return this.normalize(arg).includes(this.normalize(substring)); }; this.containsAll = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.every(sub => normalizedArg.includes(this.normalize(sub))); }; this.containsAny = function(arg, substrings) { if (substrings == null || substrings.length === 0) return false; let normalizedArg = this.normalize(arg); return substrings.some(sub => normalizedArg.includes(this.normalize(sub))); }; }(); var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c); if (obj.CA10__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[1], conditionIndex:[100..199] function extract3() { if (!this.out) { this.out = obj.CA10__parameterName__c; } return this.out; }; references1.push('Parameter Name [obj.CA10__parameterName__c]: ' + obj.CA10__parameterName__c); if (TextLib.notEqual(extract3.call(extract3), 'require_ssl')) { return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__parameterName__c') != 'require_ssl'", currentStateMessage: "This is an unrelated parameter.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[2], conditionIndex:[200..299] function extract6() { if (!this.out) { this.out = obj.CA10__parameterValue__c; } return this.out; }; references1.push('Parameter Value [obj.CA10__parameterValue__c]: ' + obj.CA10__parameterValue__c); if (TextLib.equal(extract6.call(extract6), 'false')) { return {status: 'INCOMPLIANT', conditionIndex: 299, conditionText: "extract('CA10__parameterValue__c') == 'false'", currentStateMessage: "The require_ssl parameter is set to false.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } // condition[3], conditionIndex:[300..399] function extract9() { if (!this.out) { this.out = obj.CA10__parameterValue__c; } return this.out; }; if (TextLib.equal(extract9.call(extract9), 'true')) { return {status: 'COMPLIANT', conditionIndex: 399, conditionText: "extract('CA10__parameterValue__c') == 'true'", currentStateMessage: "The require_ssl parameter is set to true.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'UNDETERMINED', conditionIndex: 400, conditionText: "otherwise", currentStateMessage: "Unexpected values in the fields.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; """; CREATE TEMP FUNCTION process_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r( obj STRUCT< CA10A2__disappearanceTime__c TIMESTAMP, CA10A2__cluster__c STRING, Id STRING, CA10A2__parameterGroup__c STRING, CA10A2__parameterGroup__r STRUCT< Id STRING, CA10__AWS_Redshift_Cluster_Parameters__r ARRAY >> > >, snapshotTime TIMESTAMP ) RETURNS STRUCT DETERMINISTIC LANGUAGE js AS r""" var references1 = []; // condition[0], conditionIndex:[0..99] references1.push('Deleted From AWS [CA10A2__disappearanceTime__c]: ' + obj.CA10A2__disappearanceTime__c); if (obj.CA10A2__disappearanceTime__c != null) { return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10A2__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_INCOMPLIANT2 = 0; if (obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r != null) { for (var i3 = 0; i3 < obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r.length; i3++) { if (typeof(obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i3].status) !== 'undefined') { if (obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i3].status == 'INCOMPLIANT') { count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_INCOMPLIANT2 += obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i3].count; } } else { if (obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i3].result.status == 'INCOMPLIANT') { count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_INCOMPLIANT2 += 1; } } } } // condition[1], conditionIndex:[100..199] references1.push('Related list [CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r] ' + (count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_INCOMPLIANT2 > 0 ? 'has' : 'does not have') + ' objects in INCOMPLIANT status'); if (count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_INCOMPLIANT2 > 0) { return {status: 'INCOMPLIANT', conditionIndex: 199, conditionText: "CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r.has(INCOMPLIANT)", currentStateMessage: "The require_ssl parameter is set to false.", currentStateReferences: references1.join('\n'), remediation: "Enable the require_ssl parameter.", runtimeError: null}; } var count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_COMPLIANT4 = 0; if (obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r != null) { for (var i5 = 0; i5 < obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r.length; i5++) { if (typeof(obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i5].status) !== 'undefined') { if (obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i5].status == 'COMPLIANT') { count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_COMPLIANT4 += obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i5].count; } } else { if (obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i5].result.status == 'COMPLIANT') { count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_COMPLIANT4 += 1; } } } } // condition[2], conditionIndex:[200..299] if (count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_COMPLIANT4 > 0) { return {status: 'COMPLIANT', conditionIndex: 299, conditionText: "CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r.has(COMPLIANT)", currentStateMessage: "The require_ssl parameter is set to true.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } var count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_UNDETERMINED6 = 0; if (obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r != null) { for (var i7 = 0; i7 < obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r.length; i7++) { if (typeof(obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i7].status) !== 'undefined') { if (obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i7].status == 'UNDETERMINED') { count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_UNDETERMINED6 += obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i7].count; } } else { if (obj.CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r[i7].result.status == 'UNDETERMINED') { count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_UNDETERMINED6 += 1; } } } } // condition[3], conditionIndex:[300..399] if (count_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r_UNDETERMINED6 > 0) { return {status: 'UNDETERMINED', conditionIndex: 399, conditionText: "CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r.has(UNDETERMINED)", currentStateMessage: "Unexpected value for the require_ssl parameter. It is not set to true/false.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}; } return {status: 'INAPPLICABLE', conditionIndex: 400, conditionText: "otherwise", currentStateMessage: "The require_ssl parameter does not exist in the CMDB.", 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__status__c AS CA10__status__c, sObject.Id AS Id, `CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r`.arr AS CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r, process_CA10__CaAwsRedshiftCluster__c( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__status__c AS CA10__status__c, sObject.Id AS Id, `CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r`.arr AS CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r ), sObject.context.snapshotTime ) as result FROM UNNEST(mock_CA10__CaAwsRedshiftCluster__c()) AS sObject LEFT JOIN ( SELECT sObject.CA10A2__cluster__c, ARRAY_AGG( STRUCT( sObject.CA10A2__disappearanceTime__c AS CA10A2__disappearanceTime__c, sObject.CA10A2__cluster__c AS CA10A2__cluster__c, sObject.Id AS Id, sObject.CA10A2__parameterGroup__c AS CA10A2__parameterGroup__c, STRUCT ( `CA10A2__parameterGroup__r`.Id AS Id, `CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r`.arr AS CA10__AWS_Redshift_Cluster_Parameters__r ) AS CA10A2__parameterGroup__r, process_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r( STRUCT( sObject.CA10A2__disappearanceTime__c AS CA10A2__disappearanceTime__c, sObject.CA10A2__cluster__c AS CA10A2__cluster__c, sObject.Id AS Id, sObject.CA10A2__parameterGroup__c AS CA10A2__parameterGroup__c, STRUCT ( `CA10A2__parameterGroup__r`.Id AS Id, `CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r`.arr AS CA10__AWS_Redshift_Cluster_Parameters__r ) AS CA10A2__parameterGroup__r ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10A2__CaAwsRedshiftClusterParameterGroupLink__c()) AS sObject LEFT JOIN UNNEST(mock_CA10__CaAwsRedshiftClusterParameterGroup__c()) AS `CA10A2__parameterGroup__r` ON sObject.CA10A2__parameterGroup__c = `CA10A2__parameterGroup__r`.Id LEFT JOIN ( SELECT sObject.CA10__group__c, ARRAY_AGG( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__parameterName__c AS CA10__parameterName__c, sObject.CA10__parameterValue__c AS CA10__parameterValue__c, sObject.CA10__group__c AS CA10__group__c, sObject.Id AS Id, process_CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r_CA10A2__parameterGroup__r_CA10__AWS_Redshift_Cluster_Parameters__r( STRUCT( sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c, sObject.CA10__parameterName__c AS CA10__parameterName__c, sObject.CA10__parameterValue__c AS CA10__parameterValue__c, sObject.CA10__group__c AS CA10__group__c, sObject.Id AS Id ), sObject.context.snapshotTime ) as result ) ) AS arr FROM UNNEST(mock_CA10__CaAwsRedshiftClusterParameter__c()) AS sObject GROUP BY sObject.CA10__group__c ) AS `CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r` ON `CA10A2__parameterGroup__r`.Id = `CA10A2__parameterGroup__r.CA10__AWS_Redshift_Cluster_Parameters__r`.CA10__group__c GROUP BY sObject.CA10A2__cluster__c ) AS `CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r` ON sObject.Id = `CA10A2__AWS_Redshift_Cluster_ParameterGroup_Link__r`.CA10A2__cluster__c ) sObject ON sObject.Id = expectedResult.Id;