---
inputType: "CA10__CaAwsLoadBalancer__c"
importExtracts:
  - file: "/types/CA10__CaAwsLoadBalancer__c/object.extracts.yaml"
testData:
  - file: "test-data.json"
conditions:
  - status: "INAPPLICABLE"
    currentStateMessage: "Deletion Protection only supports Application, Network and Gateway Load Balancers."
    check:
      AND:
        args:
          - NOT_EQUAL:
              left:
                EXTRACT: "CA10__type__c"
              right:
                TEXT: "application"
          - NOT_EQUAL:
              left:
                EXTRACT: "CA10__type__c"
              right:
                TEXT: "gateway"
          - NOT_EQUAL:
              left:
                EXTRACT: "CA10__type__c"
              right:
                TEXT: "network"
  - status: "INCOMPLIANT"
    currentStateMessage: "Load Balancer Deletion Protection is not enabled."
    remediationMessage: "Enable Load Balancer Deletion Protection."
    check:
      CONTAINS:
        arg:
          EXTRACT: "caSetFrom_additionalAttributes__c"
        search:
          TEXT: "deletion_protection.enabled: false"
  - status: "COMPLIANT"
    currentStateMessage: "Load Balancer Deletion Protection is enabled."
    check:
      CONTAINS:
        arg:
          EXTRACT: "caSetFrom_additionalAttributes__c"
        search:
          TEXT: "deletion_protection.enabled: true"
otherwise:
  status: "UNDETERMINED"
  currentStateMessage: "Unexpected value in the field."
