{
  "schemaVersion": 1,
  "operation": {
    "operationId": "planTargetConnectionBindingChange",
    "method": "POST",
    "path": "/api/v1/workspaces/{workspace}/targets/{target}/environments/{environment}/connection-bindings/{connection}/plan",
    "summary": "Plan a dependency-aware target connection change",
    "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"
        }
      }
    ],
    "requestBody": {
      "required": true,
      "description": "",
      "content": [
        {
          "contentType": "application/json",
          "schema": {
            "$ref": "#/components/schemas/TargetConnectionBindingPlanRequest"
          }
        }
      ]
    },
    "responses": [
      {
        "status": "200",
        "description": "The request has succeeded.",
        "content": [
          {
            "contentType": "application/json",
            "schema": {
              "$ref": "#/components/schemas/TargetConnectionBindingChangePlanResponse"
            }
          }
        ]
      },
      {
        "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"
    },
    "TargetConnectionBindingChangePlanResponse": {
      "example": {
        "bindingId": "example",
        "confirmationToken": "example",
        "dependencies": [
          {
            "id": "example",
            "kind": "example",
            "label": "example"
          }
        ],
        "expectedRevision": 1,
        "requiresConfirmation": true
      },
      "properties": {
        "bindingId": {
          "example": "example",
          "type": "string"
        },
        "confirmationToken": {
          "example": "example",
          "type": "string"
        },
        "dependencies": {
          "example": [
            {
              "id": "example",
              "kind": "example",
              "label": "example"
            }
          ],
          "items": {
            "$ref": "#/components/schemas/TargetConnectionDependency"
          },
          "type": "array"
        },
        "expectedRevision": {
          "example": 1,
          "format": "int64",
          "minimum": 1,
          "type": "integer"
        },
        "requiresConfirmation": {
          "example": true,
          "type": "boolean"
        }
      },
      "required": [
        "bindingId",
        "expectedRevision",
        "requiresConfirmation",
        "dependencies"
      ],
      "type": "object"
    },
    "TargetConnectionBindingPlanRequest": {
      "example": {
        "configuration": {
          "authenticationMode": "none",
          "connectorKind": "example",
          "credentialReference": {
            "environment": "example",
            "projectId": "example",
            "secretKey": "example",
            "secretPath": "example"
          },
          "endpoint": {
            "database": "example",
            "host": "example",
            "objectScope": "example",
            "options": {
              "key": "example"
            },
            "port": 1,
            "sourceIdentity": "example",
            "tlsMode": "example"
          }
        }
      },
      "properties": {
        "configuration": {
          "$ref": "#/components/schemas/TargetConnectionConfiguration"
        }
      },
      "required": [
        "configuration"
      ],
      "type": "object"
    },
    "TargetConnectionConfiguration": {
      "example": {
        "authenticationMode": "none",
        "connectorKind": "example",
        "credentialReference": {
          "environment": "example",
          "projectId": "example",
          "secretKey": "example",
          "secretPath": "example"
        },
        "endpoint": {
          "database": "example",
          "host": "example",
          "objectScope": "example",
          "options": {
            "key": "example"
          },
          "port": 1,
          "sourceIdentity": "example",
          "tlsMode": "example"
        }
      },
      "properties": {
        "authenticationMode": {
          "$ref": "#/components/schemas/TargetConnectionAuthenticationMode"
        },
        "connectorKind": {
          "example": "example",
          "maxLength": 128,
          "minLength": 1,
          "type": "string"
        },
        "credentialReference": {
          "$ref": "#/components/schemas/TargetConnectionCredentialReference"
        },
        "endpoint": {
          "$ref": "#/components/schemas/TargetConnectionEndpoint"
        }
      },
      "required": [
        "connectorKind",
        "authenticationMode",
        "endpoint"
      ],
      "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"
    },
    "TargetConnectionDependency": {
      "example": {
        "id": "example",
        "kind": "example",
        "label": "example"
      },
      "properties": {
        "id": {
          "example": "example",
          "type": "string"
        },
        "kind": {
          "example": "example",
          "type": "string"
        },
        "label": {
          "example": "example",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "id",
        "label"
      ],
      "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"
    }
  }
}
