{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cockroach-labs/json-schema/cockroach-labs-physical-replication-stream-schema.json",
  "title": "PhysicalReplicationStream",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cockroach-labs-physical-cluster-replication-api-openapi.yml#/components/schemas/PhysicalReplicationStream",
  "type": "object",
  "properties": {
    "activated_at": {
      "description": "activated_at is the crdb system time at which failover is\nfinalized. This may differ from the time for which failover was\nrequested. This field will be present when a replication stream is\nin the COMPLETED state.",
      "type": "string",
      "format": "date-time"
    },
    "canceled_at": {
      "description": "canceled_at is the timestamp at which the replication stream was canceled.",
      "type": "string",
      "format": "date-time"
    },
    "created_at": {
      "description": "created_at is the timestamp at which the replication stream was\ncreated.",
      "type": "string",
      "format": "date-time"
    },
    "failover_at": {
      "description": "failover_at is the time for which failover is requested. If the user\nsets the status to 'FAILING_OVER' but omits failover_at, the failover\ntime will default to the latest consistent replicated time.\nOtherwise, the user can pick a time up to one hour in the future to\nschedule a failover, or a time in the past to restore the cluster to\na recent state. This field will be present if the user has\nrequested failover at a future time.",
      "type": "string",
      "format": "date-time"
    },
    "id": {
      "description": "id is the UUID of the replication stream.",
      "type": "string"
    },
    "primary_cluster_id": {
      "description": "primary_cluster_id is the ID of the cluster that is being replicated.",
      "type": "string"
    },
    "replicated_time": {
      "description": "replicated_time is the timestamp indicating the point up to which\ndata has been replicated. The window between replicated_time and\nthe actual time is known as replication lag. This field will be\npresent when a replication stream is in the REPLICATING state.",
      "type": "string",
      "format": "date-time"
    },
    "replication_lag_seconds": {
      "description": "replication_lag_seconds is the replication lag (current time minus\nreplicated time) in seconds. This field will be present when a\nreplication stream is in the REPLICATING state.",
      "type": "integer",
      "format": "int32"
    },
    "retained_time": {
      "description": "retained_time is the timestamp indicating the lower bound that the\nreplication stream can failover to. This field will be present\nwhen a replication stream is in the REPLICATING state.",
      "type": "string",
      "format": "date-time"
    },
    "standby_cluster_id": {
      "description": "standby_cluster_id is the ID of the standby cluster that data is being\nreplicated to.",
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/ReplicationStreamStatus.Type"
    }
  },
  "required": [
    "id",
    "status",
    "primary_cluster_id",
    "standby_cluster_id",
    "created_at"
  ],
  "$defs": {
    "ReplicationStreamStatus.Type": {
      "description": "status describes the desired status of the replication stream.\n\n - STARTING: signifies that a stream is starting\n - REPLICATING: during an update request, status 'REPLICATING' is allowed to transition to 'FAILING_OVER' or 'CANCELED'.\nOther status transitions are not supported.\n - FAILING_OVER: used to trigger a failover, or to signify that a failover is occurring.\n - COMPLETED: signifies that a failover is complete.\n - CANCELED: signifies that a stream is canceled.",
      "type": "string",
      "enum": [
        "STARTING",
        "REPLICATING",
        "FAILING_OVER",
        "COMPLETED",
        "CANCELED"
      ]
    }
  }
}