---
inputType: "CA10__CaGoogleGceInstance__c"
testData:
  - file: test-data.json
importExtracts:
  - file: /types/CA10__CaGoogleGceInstance__c/object.extracts.yaml
conditions:
  - status: "INAPPLICABLE"
    currentStateMessage: "The instance is created by GKE."
    check:
      STARTS_WITH:
        arg:
          EXTRACT: "Name"
        prefix:
          TEXT: 'gke-'
  - status: "INCOMPLIANT"
    currentStateMessage: "The instance is configured to use the default service account with full access to all Cloud APIs."
    remediationMessage: "Update the instance to use a user-managed service account."
    check:
      RELATED_LIST_HAS:
        status: "INCOMPLIANT"
        relationshipName: "CA10__Google_Instance_Service_Account_Links__r"
otherwise:
  status: "COMPLIANT"
  currentStateMessage: "Instance is not configured to use the default service account with full access to all Cloud APIs."
relatedLists:
  - relationshipName: "CA10__Google_Instance_Service_Account_Links__r"
    importExtracts:
      - file: /types/CA10__CaGoogleGceInstanceServiceAccountLink__c/object.extracts.yaml
    conditions:
    - status: "INCOMPLIANT"
      currentStateMessage: "Scopes is set to Allow full access to all Cloud APIs."
      check:
        CONTAINS:
          arg:
            EXTRACT: "CA10__scopes__c"
          substring:
            TEXT: 'https://www.googleapis.com/auth/cloud-platform'
    otherwise:
      status: "COMPLIANT"
      currentStateMessage: "Scopes is not set to Allow full access to all Cloud APIs."