{
  "schemaVersion": 1,
  "operation": {
    "operationId": "enableTargetConnectionBinding",
    "method": "POST",
    "path": "/api/v1/workspaces/{workspace}/targets/{target}/environments/{environment}/connection-bindings/{connection}/enable",
    "summary": "Enable a target connection binding",
    "description": "",
    "tags": [
      "Connections"
    ],
    "effect": "write",
    "confirmation": "conditional",
    "authorization": {
      "mode": "privilege",
      "privilege": "MANAGE_CONNECTION_METADATA"
    },
    "parameters": [
      {
        "name": "workspace",
        "in": "path",
        "required": true,
        "description": "",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "target",
        "in": "path",
        "required": true,
        "description": "",
        "schema": {
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        }
      },
      {
        "name": "environment",
        "in": "path",
        "required": true,
        "description": "",
        "schema": {
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        }
      },
      {
        "name": "connection",
        "in": "path",
        "required": true,
        "description": "",
        "schema": {
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        }
      },
      {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "",
        "schema": {
          "maxLength": 200,
          "minLength": 1,
          "type": "string"
        }
      }
    ],
    "responses": [
      {
        "status": "200",
        "description": "The request has succeeded.",
        "content": [
          {
            "contentType": "application/json",
            "schema": {
              "$ref": "#/components/schemas/TargetConnectionBindingResponse"
            }
          }
        ]
      },
      {
        "status": "400",
        "description": "The server could not understand the request due to invalid syntax.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "401",
        "description": "Access is unauthorized.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "403",
        "description": "Access is forbidden.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "404",
        "description": "The server cannot find the requested resource.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "409",
        "description": "The request conflicts with the current state of the server.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "412",
        "description": "Precondition failed.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "413",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "415",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "422",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "429",
        "description": "Client error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "500",
        "description": "Server error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "502",
        "description": "Server error",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      },
      {
        "status": "503",
        "description": "Service unavailable.",
        "content": [
          {
            "contentType": "application/problem+json",
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        ]
      }
    ]
  },
  "schemas": {
    "ProblemDetails": {
      "example": {
        "code": "example",
        "detail": "example",
        "errors": [
          {
            "code": "example",
            "detail": "example",
            "field": "example"
          }
        ],
        "instance": "example",
        "requestId": "example",
        "status": 1,
        "title": "example",
        "type": "example"
      },
      "properties": {
        "code": {
          "example": "example",
          "type": "string"
        },
        "detail": {
          "example": "example",
          "type": "string"
        },
        "errors": {
          "example": [
            {
              "code": "example",
              "detail": "example",
              "field": "example"
            }
          ],
          "items": {
            "$ref": "#/components/schemas/ProblemFieldError"
          },
          "type": "array"
        },
        "instance": {
          "example": "example",
          "type": "string"
        },
        "requestId": {
          "example": "example",
          "type": "string"
        },
        "status": {
          "example": 1,
          "format": "int32",
          "type": "integer"
        },
        "title": {
          "example": "example",
          "type": "string"
        },
        "type": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "type",
        "title",
        "status",
        "detail",
        "instance",
        "code",
        "requestId",
        "errors"
      ],
      "type": "object"
    },
    "ProblemFieldError": {
      "example": {
        "code": "example",
        "detail": "example",
        "field": "example"
      },
      "properties": {
        "code": {
          "example": "example",
          "type": "string"
        },
        "detail": {
          "example": "example",
          "type": "string"
        },
        "field": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "field",
        "code",
        "detail"
      ],
      "type": "object"
    },
    "TargetConnectionAuthenticationMode": {
      "enum": [
        "none",
        "external_bundle",
        "workload_identity"
      ],
      "example": "none",
      "type": "string"
    },
    "TargetConnectionBindingResponse": {
      "description": "Target binding metadata. Credential references identify provider objects but never contain secret values.",
      "example": {
        "authenticationMode": "none",
        "connectorKind": "example",
        "createdAt": "2026-01-02T15:04:05Z",
        "credentialReference": {
          "environment": "example",
          "projectId": "example",
          "secretKey": "example",
          "secretPath": "example"
        },
        "enabled": true,
        "endpoint": {
          "database": "example",
          "host": "example",
          "objectScope": "example",
          "options": {
            "key": "example"
          },
          "port": 1,
          "sourceIdentity": "example",
          "tlsMode": "example"
        },
        "environment": "example",
        "health": "pending",
        "id": "example",
        "lastValidatedAt": "2026-01-02T15:04:05Z",
        "logicalConnection": "example",
        "revision": 1,
        "targetId": "example",
        "updatedAt": "2026-01-02T15:04:05Z",
        "validatedVersion": "example",
        "workspaceId": "example"
      },
      "properties": {
        "authenticationMode": {
          "$ref": "#/components/schemas/TargetConnectionAuthenticationMode"
        },
        "connectorKind": {
          "example": "example",
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        },
        "createdAt": {
          "example": "2026-01-02T15:04:05Z",
          "format": "date-time",
          "type": "string"
        },
        "credentialReference": {
          "$ref": "#/components/schemas/TargetConnectionCredentialReference"
        },
        "enabled": {
          "example": true,
          "type": "boolean"
        },
        "endpoint": {
          "$ref": "#/components/schemas/TargetConnectionEndpoint"
        },
        "environment": {
          "example": "example",
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        },
        "health": {
          "$ref": "#/components/schemas/TargetConnectionHealth"
        },
        "id": {
          "example": "example",
          "type": "string"
        },
        "lastValidatedAt": {
          "example": "2026-01-02T15:04:05Z",
          "format": "date-time",
          "type": "string"
        },
        "logicalConnection": {
          "example": "example",
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        },
        "revision": {
          "example": 1,
          "format": "int64",
          "minimum": 1,
          "type": "integer"
        },
        "targetId": {
          "example": "example",
          "type": "string"
        },
        "updatedAt": {
          "example": "2026-01-02T15:04:05Z",
          "format": "date-time",
          "type": "string"
        },
        "validatedVersion": {
          "example": "example",
          "type": "string"
        },
        "workspaceId": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "id",
        "targetId",
        "logicalConnection",
        "connectorKind",
        "authenticationMode",
        "workspaceId",
        "environment",
        "endpoint",
        "enabled",
        "health",
        "createdAt",
        "updatedAt",
        "revision"
      ],
      "type": "object"
    },
    "TargetConnectionCredentialReference": {
      "description": "A provider-side reference only. LeapView never returns or accepts the referenced secret value.",
      "example": {
        "environment": "example",
        "projectId": "example",
        "secretKey": "example",
        "secretPath": "example"
      },
      "properties": {
        "environment": {
          "example": "example",
          "type": "string"
        },
        "projectId": {
          "example": "example",
          "type": "string"
        },
        "secretKey": {
          "example": "example",
          "type": "string"
        },
        "secretPath": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "projectId",
        "environment",
        "secretPath",
        "secretKey"
      ],
      "type": "object"
    },
    "TargetConnectionEndpoint": {
      "example": {
        "database": "example",
        "host": "example",
        "objectScope": "example",
        "options": {
          "key": "example"
        },
        "port": 1,
        "sourceIdentity": "example",
        "tlsMode": "example"
      },
      "properties": {
        "database": {
          "example": "example",
          "type": "string"
        },
        "host": {
          "example": "example",
          "type": "string"
        },
        "objectScope": {
          "example": "example",
          "type": "string"
        },
        "options": {
          "additionalProperties": {
            "type": "string"
          },
          "example": {
            "key": "example"
          },
          "type": "object"
        },
        "port": {
          "example": 1,
          "format": "int32",
          "type": "integer"
        },
        "sourceIdentity": {
          "example": "example",
          "type": "string"
        },
        "tlsMode": {
          "example": "example",
          "type": "string"
        }
      },
      "type": "object"
    },
    "TargetConnectionHealth": {
      "enum": [
        "pending",
        "healthy",
        "degraded",
        "disabled"
      ],
      "example": "pending",
      "type": "string"
    }
  }
}
