{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/harness/main/json-schema/harness-cluster-link-request-schema.json",
  "title": "ClusterLinkRequest",
  "description": "Batch Request to link clusters to the environment in a batch",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/harness-clusters-api-openapi.yml#/components/schemas/ClusterLinkRequest",
  "required": [
    "envRef"
  ],
  "type": "object",
  "properties": {
    "orgIdentifier": {
      "type": "string",
      "description": "Organization identifier of the environment"
    },
    "projectIdentifier": {
      "type": "string",
      "description": "Project identifier of the environment"
    },
    "envRef": {
      "type": "string",
      "description": "Environment identifier for the cluster"
    },
    "clusters": {
      "maxItems": 1000,
      "minItems": 0,
      "type": "array",
      "description": "List of cluster identifiers and names",
      "items": {
        "$ref": "#/$defs/ClusterBasicDTO"
      }
    },
    "linkAllClusters": {
      "type": "boolean",
      "description": "Link all clusters to the environment. When true, links all clusters matching the searchTerm."
    },
    "searchTerm": {
      "type": "string",
      "description": "Search term to filter clusters when linkAllClusters is true. Only used with linkAllClusters=true."
    },
    "skipClusterValidation": {
      "type": "boolean",
      "description": "Skip cluster existence validation in GitOps service. When true, allows linking clusters without verifying they exist in GitOps. Useful for pre-provisioning scenarios or when clusters are being created asynchronously."
    }
  },
  "$defs": {
    "ClusterBasicDTO": {
      "type": "object",
      "properties": {
        "identifier": {
          "type": "string",
          "description": "identifier of the cluster"
        },
        "agentIdentifier": {
          "type": "string",
          "description": "agent identifier of the cluster"
        },
        "name": {
          "type": "string",
          "description": "name of the cluster"
        },
        "scope": {
          "type": "string",
          "description": "scope at which the cluster exists in harness gitops, project vs org vs account",
          "enum": [
            "ACCOUNT",
            "ORGANIZATION",
            "PROJECT"
          ]
        }
      },
      "description": "List of cluster identifiers and names"
    }
  }
}