components:
  schemas:
    BackendHealthStatsSchema:
      properties:
        delivers:
          type: integer
        failure_ratio:
          type: float
        last_moved_to_writetime:
          type: integer
        last_update:
          type: float
        lmtp_failures:
          type: float
        lmtp_successes:
          type: float
        login_failures:
          type: float
        login_successes:
          type: float
        logins:
          type: integer
        status_reason:
          type: string
        zscore:
          type: float
      type: object
    BackendSchema:
      properties:
        force_move_dest:
          type: string
        force_move_id:
          format: uuid
          type: string
        force_move_percentage:
          type: integer
        host:
          type: string
        id:
          format: uuid
          type: string
        load_factor:
          type: integer
        move_counter_cur:
          type: integer
        move_counter_max:
          type: integer
        move_id:
          format: uuid
          type: string
        site_id:
          format: uuid
          type: string
        status:
          enum:
            - standby
            - online
            - offline
          type: string
        status_reason:
          type: string
        user_count_approx:
          type: integer
        z_score:
          type: float
      type: object
    CassandraSiteReachablitySchema:
      properties:
        dest_site_id:
          format: uuid
          type: string
        reachable:
          type: integer
        src_site_id:
          format: uuid
          type: string
      type: object
    FeatureStateSchema:
      properties:
        backend_id:
          format: uuid
          type: string
        enabled:
          type: boolean
        enabled_verbose:
          type: string
        exists_in_db:
          type: boolean
        name:
          type: string
        section:
          enum:
            - controller
            - dovecot
          type: string
        site_id:
          format: uuid
          type: string
        state:
          type: string
        title:
          type: string
      type: object
    GlobalFeatureSettingCreate:
      properties:
        name:
          type: string
        value:
          enum:
            - yes
            - no
            - "true"
            - "false"
            - "True"
            - "False"
          type: string
      required: []
      type: object
    GlobalFeatureSettingUpdate:
      properties:
        name:
          type: string
        value:
          enum:
            - yes
            - no
            - "true"
            - "false"
            - "True"
            - "False"
          type: string
      required: []
      type: object
    NumberSchema:
      type: int64
    PingSchema:
      properties:
        ping:
          type: string
      type: object
    SiteBackendCreate:
      properties:
        force_move_dest:
          type: string
        force_move_id:
          type: string
        force_move_percentage:
          type: integer
        host:
          type: string
        id:
          type: string
        load_factor:
          default: 100
          type: integer
        move_counter_cur:
          type: integer
        move_counter_max:
          type: integer
        move_id:
          type: string
        status:
          default: standby
          enum:
            - online
            - standby
            - offline
          type: string
        user_count_approx:
          type: integer
      required:
        - host
      type: object
    SiteBackendUpdate:
      properties:
        force_move_dest:
          type: string
        force_move_id:
          type: string
        force_move_percentage:
          type: integer
        host:
          type: string
        load_factor:
          type: integer
        move_counter_cur:
          type: integer
        move_counter_max:
          type: integer
        move_id:
          type: string
        status:
          enum:
            - online
            - standby
            - offline
          type: string
        user_count_approx:
          type: integer
      required: []
      type: object
    SiteFeatureSettingCreate:
      properties:
        name:
          type: string
        value:
          enum:
            - yes
            - no
            - "true"
            - "false"
            - "True"
            - "False"
            - dryrun
          type: string
      required: []
      type: object
    SiteFeatureSettingUpdate:
      properties:
        name:
          type: string
        value:
          enum:
            - yes
            - no
            - "true"
            - "false"
            - "True"
            - "False"
            - dryrun
          type: string
      required: []
      type: object
    SiteForceMoveUsers:
      properties:
        dest_site_names:
          description: Name(s) of destination site(s) where users should be moved.
          items:
            type: string
          type: array
        percentage:
          default: 10
          description: Percentage of users to force-move from the source site (0-100)
          type: integer
      required: []
      type: object
    SiteForceMoveUsersUpdate:
      properties:
        dest_site_names:
          description: Name(s) of destination site(s) where users should be moved.
          items:
            type: string
          type: array
        percentage:
          default: 10
          description: Percentage of users to force-move from the source site (0-100)
          type: integer
      required: []
      type: object
    SiteModel:
      properties:
        id:
          type: string
        load_balancer:
          type: string
        name:
          type: string
        status:
          enum:
            - standby
            - online
            - offline
            - evacuate
          type: string
        tag_id:
          type: string
      required:
        - name
        - status
      type: object
    SiteReachabilitySchema:
      properties:
        delivers:
          type: integer
        imap_reachable:
          type: boolean
        lmtp_failures:
          type: integer
        lmtp_reachable:
          type: boolean
        lmtp_successes:
          type: integer
        login_failures:
          type: integer
        login_successes:
          type: integer
        logins:
          type: integer
        reachability_failures:
          type: integer
        reachability_reachable:
          type: integer
        reachability_unreachable:
          type: integer
        reachable:
          type: boolean
        remote_site_id:
          format: uuid
          type: string
      type: object
    SiteSchema:
      properties:
        id:
          format: uuid
          type: string
        load_balancer:
          type: string
        name:
          type: string
        status:
          enum:
            - standby
            - online
            - offline
            - evacuate
          type: string
        tag_id:
          format: uuid
          nullable: true
          type: string
      type: object
    SiteTagAdd:
      properties:
        site_id:
          type: string
        tag_id:
          type: string
      required:
        - tag_id
      type: object
    SiteTagRemove:
      properties:
        site_id:
          type: string
        tag_id:
          type: string
      required:
        - tag_id
      type: object
    SiteUserMoveHealth:
      properties:
        progressing_count:
          type: integer
        removed_count:
          type: integer
        site_id:
          format: uuid
          type: string
        stuck:
          items:
            properties:
              backend_host:
                type: string
              backend_id:
                format: uuid
                type: string
              move_id:
                format: uuid
                type: string
              reason:
                type: string
              since_secs:
                type: float
            type: object
          type: array
        stuck_count:
          type: integer
        total_active:
          type: integer
        ts:
          type: float
      type: object
    SitesModel:
      properties:
        load_balancer:
          type: string
        name:
          type: string
        status:
          enum:
            - standby
            - online
            - offline
            - evacuate
          type: string
        tag_id:
          type: string
      required: []
      type: object
    StatisticSchema:
      properties:
        key:
          type: string
        type:
          enum:
            - gauge
            - counter
          type: string
        value:
          type: double
      type: object
    TagModel:
      properties:
        id:
          type: string
        tag:
          type: string
      required:
        - tag
      type: object
    TagSchema:
      properties:
        id:
          format: uuid
          type: string
        tag:
          type: string
      type: object
    TaskIdSchema:
      properties:
        task_id:
          format: guid
          type: string
      type: object
    TaskSchema:
      properties:
        name:
          type: string
        received:
          format: double
          type: number
        state:
          type: string
        uuid:
          format: uuid
          type: string
        worker:
          type: string
      type: object
info:
  contact:
    email: info@dovecotpro.com
  description: "Dovecot Pro: Palomar Cluster Controller (REST API)"
  license:
    name: Dovecot Pro
    url: http://www.open-xchange.com/products/dovecot-pro/
  title: "Dovecot Pro: Palomar Cluster Controller"
  version: 1.0.0
openapi: 3.0.2
paths:
  /features:
    delete:
      parameters: []
      responses:
        "200":
          content:
            application/json:
              example:
                - backend_id: string
                  enabled: boolean
                  enabled_verbose: string
                  exists_in_db: boolean
                  name: string
                  section: string
                  site_id: string
                  state: string
                  title: string
              schema:
                $ref: "#/components/schemas/FeatureStateSchema"
          description: Delete global feature setting
        "404":
          content:
            application/json: {}
          description: Setting not found
        "424":
          content:
            application/json: {}
          description: Settings table does not exist in DB
      summary: Delete global feature setting
      tags:
        - Features
    get:
      parameters: []
      responses:
        "200":
          content:
            application/json:
              example:
                - backend_id: string
                  enabled: boolean
                  enabled_verbose: string
                  exists_in_db: boolean
                  name: string
                  section: string
                  site_id: string
                  state: string
                  title: string
              schema:
                $ref: "#/components/schemas/FeatureStateSchema"
          description: Returns global feature settings
      summary: Get all global feature settings
      tags:
        - Features
    post:
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GlobalFeatureSettingCreate"
        description: Request body
        required: true
      responses:
        "201":
          content:
            application/json:
              example:
                - backend_id: string
                  enabled: boolean
                  enabled_verbose: string
                  exists_in_db: boolean
                  name: string
                  section: string
                  site_id: string
                  state: string
                  title: string
              schema:
                $ref: "#/components/schemas/FeatureStateSchema"
          description: Create global feature setting
        "400":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/GlobalFeatureSettingCreate"
          description: Name and value must be specified
        "409":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/GlobalFeatureSettingCreate"
          description: Setting already exists
        "424":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/GlobalFeatureSettingCreate"
          description: Settings table does not exist in DB
      summary: Create global feature setting
      tags:
        - Features
    put:
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GlobalFeatureSettingUpdate"
        description: Request body
        required: true
      responses:
        "201":
          content:
            application/json:
              example:
                - backend_id: string
                  enabled: boolean
                  enabled_verbose: string
                  exists_in_db: boolean
                  name: string
                  section: string
                  site_id: string
                  state: string
                  title: string
              schema:
                $ref: "#/components/schemas/FeatureStateSchema"
          description: Update global feature settings
        "400":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/GlobalFeatureSettingUpdate"
          description: Name and value must be specified
        "404":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/GlobalFeatureSettingUpdate"
          description: Setting not found
        "424":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/GlobalFeatureSettingUpdate"
          description: Settings table does not exist in DB
      summary: Update global feature setting
      tags:
        - Features
  "/features/site/{site_id}":
    delete:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - backend_id: string
                  enabled: boolean
                  enabled_verbose: string
                  exists_in_db: boolean
                  name: string
                  section: string
                  site_id: string
                  state: string
                  title: string
              schema:
                $ref: "#/components/schemas/FeatureStateSchema"
          description: Delete site feature setting
        "404":
          content:
            application/json: {}
          description: Setting not found
        "424":
          content:
            application/json: {}
          description: Settings table does not exist in DB
      summary: Delete site feature setting
      tags:
        - Features
        - Sites
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - backend_id: string
                  enabled: boolean
                  enabled_verbose: string
                  exists_in_db: boolean
                  name: string
                  section: string
                  site_id: string
                  state: string
                  title: string
              schema:
                $ref: "#/components/schemas/FeatureStateSchema"
          description: Returns site feature settings
      summary: Get all site feature settings
      tags:
        - Features
        - Sites
    post:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteFeatureSettingCreate"
        description: Request body
        required: true
      responses:
        "201":
          content:
            application/json:
              example:
                - backend_id: string
                  enabled: boolean
                  enabled_verbose: string
                  exists_in_db: boolean
                  name: string
                  section: string
                  site_id: string
                  state: string
                  title: string
              schema:
                $ref: "#/components/schemas/FeatureStateSchema"
          description: Create site feature setting
        "400":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/SiteFeatureSettingCreate"
          description: Name and value must be specified or feature not recognized
        "409":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/SiteFeatureSettingCreate"
          description: Setting already exists
        "424":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/SiteFeatureSettingCreate"
          description: Settings table does not exist in DB
      summary: Create site feature setting
      tags:
        - Features
        - Sites
    put:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteFeatureSettingUpdate"
        description: Request body
        required: true
      responses:
        "201":
          content:
            application/json:
              example:
                - backend_id: string
                  enabled: boolean
                  enabled_verbose: string
                  exists_in_db: boolean
                  name: string
                  section: string
                  site_id: string
                  state: string
                  title: string
              schema:
                $ref: "#/components/schemas/FeatureStateSchema"
          description: Update site feature settings
        "400":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/SiteFeatureSettingUpdate"
          description: Name and value must be specified
        "404":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/SiteFeatureSettingUpdate"
          description: Setting not found
        "424":
          content:
            application/json:
              example:
                name: string
                value: string
              schema:
                $ref: "#/components/schemas/SiteFeatureSettingUpdate"
          description: Settings table does not exist in DB
      summary: Update site feature setting
      tags:
        - Features
        - Sites
  /ping:
    get:
      parameters: []
      responses:
        "200":
          content:
            application/json:
              example:
                - ping: string
              schema:
                $ref: "#/components/schemas/PingSchema"
          description: End point
      summary: Ping endpoint
      tags:
        - Status
  /sites:
    get:
      parameters: []
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  load_balancer: string
                  name: string
                  status: string
                  tag_id: string
              schema:
                $ref: "#/components/schemas/SiteSchema"
          description: Returns sites
      summary: Get all sites
      tags:
        - Sites
    put:
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteModel"
        description: Request body
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  load_balancer: string
                  name: string
                  status: string
                  tag_id: string
              schema:
                $ref: "#/components/schemas/SiteSchema"
          description: Creates site
        "400":
          content:
            application/json:
              example:
                id: string
                load_balancer: string
                name: string
                status: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SiteModel"
          description: Bad request (validation error)
        "409":
          content:
            application/json:
              example:
                id: string
                load_balancer: string
                name: string
                status: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SiteModel"
          description: Site name already exists or tag not found
      summary: Create a new site
      tags:
        - Sites
  "/sites/{site_id}":
    delete:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "200":
          description: Deletes site
        "404":
          content:
            application/json: {}
          description: Site not found
        "409":
          content:
            application/json: {}
          description: Site has backends, cannot delete
      summary: Delete site
      tags:
        - Sites
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  load_balancer: string
                  name: string
                  status: string
                  tag_id: string
              schema:
                $ref: "#/components/schemas/SiteSchema"
          description: Returns site
        "404":
          content:
            application/json: {}
          description: Site not found
      summary: Get site by ID
      tags:
        - Sites
    patch:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SitesModel"
        description: Request body
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  load_balancer: string
                  name: string
                  status: string
                  tag_id: string
              schema:
                $ref: "#/components/schemas/SiteSchema"
          description: Updates site
        "404":
          content:
            application/json:
              example:
                load_balancer: string
                name: string
                status: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SitesModel"
          description: Site not found
        "409":
          content:
            application/json:
              example:
                load_balancer: string
                name: string
                status: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SitesModel"
          description: Site name already exists
      summary: Update site
      tags:
        - Sites
  "/sites/{site_id}/backends":
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - force_move_dest: string
                  force_move_id: string
                  force_move_percentage: integer
                  host: string
                  id: string
                  load_factor: integer
                  move_counter_cur: integer
                  move_counter_max: integer
                  move_id: string
                  site_id: string
                  status: string
                  status_reason: string
                  user_count_approx: integer
                  z_score: float
              schema:
                $ref: "#/components/schemas/BackendSchema"
          description: Returns site backends
      summary: Get all backends for a site
      tags:
        - Sites
        - Backends
    put:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteBackendCreate"
        description: Request body
        required: true
      responses:
        "201":
          content:
            application/json:
              example:
                - force_move_dest: string
                  force_move_id: string
                  force_move_percentage: integer
                  host: string
                  id: string
                  load_factor: integer
                  move_counter_cur: integer
                  move_counter_max: integer
                  move_id: string
                  site_id: string
                  status: string
                  status_reason: string
                  user_count_approx: integer
                  z_score: float
              schema:
                $ref: "#/components/schemas/BackendSchema"
          description: Creates backend
        "400":
          content:
            application/json:
              example:
                force_move_dest: string
                force_move_id: string
                force_move_percentage: integer
                host: string
                id: string
                load_factor: integer
                move_counter_cur: integer
                move_counter_max: integer
                move_id: string
                status: string
                user_count_approx: integer
              schema:
                $ref: "#/components/schemas/SiteBackendCreate"
          description: Bad request (e.g. host is IP or UUID)
        "404":
          content:
            application/json:
              example:
                force_move_dest: string
                force_move_id: string
                force_move_percentage: integer
                host: string
                id: string
                load_factor: integer
                move_counter_cur: integer
                move_counter_max: integer
                move_id: string
                status: string
                user_count_approx: integer
              schema:
                $ref: "#/components/schemas/SiteBackendCreate"
          description: Site not found
        "409":
          content:
            application/json:
              example:
                force_move_dest: string
                force_move_id: string
                force_move_percentage: integer
                host: string
                id: string
                load_factor: integer
                move_counter_cur: integer
                move_counter_max: integer
                move_id: string
                status: string
                user_count_approx: integer
              schema:
                $ref: "#/components/schemas/SiteBackendCreate"
          description: Backend with same host already exists
      summary: Create a new backend
      tags:
        - Sites
        - Backends
  "/sites/{site_id}/backends/{backend_id}":
    delete:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
        - description: backend_id
          in: path
          name: backend_id
          required: "true"
      responses:
        "200":
          description: Deletes backend
        "404":
          content:
            application/json: {}
          description: Backend not found
        "409":
          content:
            application/json: {}
          description: Backend not in standby, cannot delete
      summary: Delete backend
      tags:
        - Sites
        - Backends
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
        - description: backend_id
          in: path
          name: backend_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - force_move_dest: string
                  force_move_id: string
                  force_move_percentage: integer
                  host: string
                  id: string
                  load_factor: integer
                  move_counter_cur: integer
                  move_counter_max: integer
                  move_id: string
                  site_id: string
                  status: string
                  status_reason: string
                  user_count_approx: integer
                  z_score: float
              schema:
                $ref: "#/components/schemas/BackendSchema"
          description: Returns site backends
        "404":
          content:
            application/json: {}
          description: Backend not found
      summary: Get backend by ID
      tags:
        - Sites
        - Backends
    patch:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
        - description: backend_id
          in: path
          name: backend_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteBackendUpdate"
        description: Request body
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                - force_move_dest: string
                  force_move_id: string
                  force_move_percentage: integer
                  host: string
                  id: string
                  load_factor: integer
                  move_counter_cur: integer
                  move_counter_max: integer
                  move_id: string
                  site_id: string
                  status: string
                  status_reason: string
                  user_count_approx: integer
                  z_score: float
              schema:
                $ref: "#/components/schemas/BackendSchema"
          description: Updates backend
        "404":
          content:
            application/json:
              example:
                force_move_dest: string
                force_move_id: string
                force_move_percentage: integer
                host: string
                load_factor: integer
                move_counter_cur: integer
                move_counter_max: integer
                move_id: string
                status: string
                user_count_approx: integer
              schema:
                $ref: "#/components/schemas/SiteBackendUpdate"
          description: Backend not found
      summary: Update backend
      tags:
        - Sites
        - Backends
  "/sites/{site_id}/backends/{backend_id}/health":
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
        - description: backend_id
          in: path
          name: backend_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - delivers: integer
                  failure_ratio: float
                  last_moved_to_writetime: integer
                  last_update: float
                  lmtp_failures: float
                  lmtp_successes: float
                  login_failures: float
                  login_successes: float
                  logins: integer
                  status_reason: string
                  zscore: float
              schema:
                $ref: "#/components/schemas/BackendHealthStatsSchema"
          description: Returns health data for backend
        "404":
          content:
            application/json: {}
          description: Backend not found
      summary: Get backend health statistics
      tags:
        - Sites
        - Backends
  "/sites/{site_id}/backends/{backend_id}/stats":
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
        - description: backend_id
          in: path
          name: backend_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - key: string
                  type: string
                  value: double
              schema:
                $ref: "#/components/schemas/StatisticSchema"
          description: Returns statistics for backend
      summary: Get backend statistics
      tags:
        - Sites
        - Backends
  "/sites/{site_id}/batch_move_users":
    post:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "202":
          content:
            application/json:
              example:
                task_id: string
              schema:
                $ref: "#/components/schemas/TaskIdSchema"
          description: Requests start of user batch-move to another site
        "400":
          content:
            application/json: {}
          description: Bad request (e.g. invalid percentage)
        "409":
          content:
            application/json: {}
          description: Site not found
      summary: Request batch-moving of users to another site
      tags:
        - Sites
  "/sites/{site_id}/desired_backends":
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example: int64
              schema:
                $ref: "#/components/schemas/NumberSchema"
          description: Returns number of wanted backends
        "404":
          content:
            application/json: {}
          description: Site not found
      summary: Get desired number of backends
      tags:
        - Sites
  "/sites/{site_id}/force_move_users":
    delete:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "202":
          content:
            application/json:
              example:
                task_id: string
              schema:
                $ref: "#/components/schemas/TaskIdSchema"
          description: Requests canceling force-move from a site
        "400":
          content:
            application/json: {}
          description: Bad request (no force-move in progress)
        "409":
          content:
            application/json: {}
          description: Site not found
      summary: Operations on sites
      tags:
        - Sites
    post:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteForceMoveUsers"
        description: Request body
        required: true
      responses:
        "202":
          content:
            application/json:
              example:
                task_id: string
              schema:
                $ref: "#/components/schemas/TaskIdSchema"
          description: Requests start of user force-move to another site
        "400":
          content:
            application/json:
              example:
                dest_site_names:
                  - string
                percentage: integer
              schema:
                $ref: "#/components/schemas/SiteForceMoveUsers"
          description: Bad request (e.g. invalid percentage)
        "409":
          content:
            application/json:
              example:
                dest_site_names:
                  - string
                percentage: integer
              schema:
                $ref: "#/components/schemas/SiteForceMoveUsers"
          description: Site not found
      summary: Request force-moving of users to another site
      tags:
        - Sites
    put:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteForceMoveUsersUpdate"
        description: Request body
        required: true
      responses:
        "202":
          content:
            application/json:
              example:
                task_id: string
              schema:
                $ref: "#/components/schemas/TaskIdSchema"
          description: Requests updating force-move from a site to a new percentage
        "400":
          content:
            application/json:
              example:
                dest_site_names:
                  - string
                percentage: integer
              schema:
                $ref: "#/components/schemas/SiteForceMoveUsersUpdate"
          description: Bad request (e.g. no force-move in progress)
        "409":
          content:
            application/json:
              example:
                dest_site_names:
                  - string
                percentage: integer
              schema:
                $ref: "#/components/schemas/SiteForceMoveUsersUpdate"
          description: Site not found
      summary: Operations on sites
      tags:
        - Sites
  "/sites/{site_id}/reachability/{dest_site_id}":
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
        - description: dest_site_id
          in: path
          name: dest_site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                delivers: integer
                imap_reachable: boolean
                lmtp_failures: integer
                lmtp_reachable: boolean
                lmtp_successes: integer
                login_failures: integer
                login_successes: integer
                logins: integer
                reachability_failures: integer
                reachability_reachable: integer
                reachability_unreachable: integer
                reachable: boolean
                remote_site_id: string
              schema:
                $ref: "#/components/schemas/SiteReachabilitySchema"
          description: Returns results of reachability checks towards a target site
        "422":
          content:
            application/json: {}
          description: Local site not found or invalid source/dest
      summary: Operations on sites, reachability
      tags:
        - Sites
        - Reachability
  "/sites/{site_id}/rebalance":
    post:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "202":
          content:
            application/json:
              example:
                task_id: string
              schema:
                $ref: "#/components/schemas/TaskIdSchema"
          description: Rebalances site
        "422":
          content:
            application/json: {}
          description: Specified site is not local site
      summary: Rebalance site
      tags:
        - Sites
  "/sites/{site_id}/site_user_move_stats":
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "200":
          content:
            application/json: {}
          description: Retrieve SiteUserMove health statistics
        "204":
          content:
            application/json: {}
          description: No SiteUserMove statistics found for this site
      summary: Get SiteUserMove health statistics
      tags:
        - Sites
  "/sites/{site_id}/split_brain/{dest_site_id}":
    delete:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
        - description: dest_site_id
          in: path
          name: dest_site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                dest_site_id: string
                reachable: integer
                src_site_id: string
              schema:
                $ref: "#/components/schemas/CassandraSiteReachablitySchema"
          description: Disable split brain mode from local site to a remote site
      summary: Operations on sites, split brain
      tags:
        - Sites
        - Split Brain
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
        - description: dest_site_id
          in: path
          name: dest_site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                dest_site_id: string
                reachable: integer
                src_site_id: string
              schema:
                $ref: "#/components/schemas/CassandraSiteReachablitySchema"
          description: Get split brain mode status from local site to a remote site
        "404":
          content:
            application/json: {}
          description: Site reachability record not found
      summary: Operations on sites, split brain
      tags:
        - Sites
        - Split Brain
    put:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
        - description: dest_site_id
          in: path
          name: dest_site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                dest_site_id: string
                reachable: integer
                src_site_id: string
              schema:
                $ref: "#/components/schemas/CassandraSiteReachablitySchema"
          description: Enable split brain mode from local site to a remote site
      summary: Operations on sites, split brain
      tags:
        - Sites
        - Split Brain
  "/sites/{site_id}/stats":
    get:
      parameters:
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - key: string
                  type: string
                  value: double
              schema:
                $ref: "#/components/schemas/StatisticSchema"
          description: Returns statistics for site
      summary: Get site statistics
      tags:
        - Sites
  /tags:
    get:
      parameters: []
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  tag: string
              schema:
                $ref: "#/components/schemas/TagSchema"
          description: Returns tags
      summary: Get all tags
      tags:
        - Tags
    put:
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TagModel"
        description: Request body
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  tag: string
              schema:
                $ref: "#/components/schemas/TagSchema"
          description: Creates tag
        "400":
          content:
            application/json:
              example:
                id: string
                tag: string
              schema:
                $ref: "#/components/schemas/TagModel"
          description: Bad request (validation error)
        "409":
          content:
            application/json:
              example:
                id: string
                tag: string
              schema:
                $ref: "#/components/schemas/TagModel"
          description: Tag already exists
      summary: Create a new tag
      tags:
        - Tags
  "/tags/{tag_id}":
    delete:
      parameters:
        - description: tag_id
          in: path
          name: tag_id
          required: "true"
      responses:
        "200":
          description: Deletes tag
        "404":
          content:
            application/json: {}
          description: Tag not found
        "409":
          content:
            application/json: {}
          description: Tag still in use by sites
      summary: Delete tag
      tags:
        - Tags
    get:
      parameters:
        - description: tag_id
          in: path
          name: tag_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  tag: string
              schema:
                $ref: "#/components/schemas/TagSchema"
          description: Returns tag by ID
        "404":
          content:
            application/json: {}
          description: Tag not found
      summary: Get tag by ID
      tags:
        - Tags
  "/tags/{tag_id}/sites":
    delete:
      parameters:
        - description: tag_id
          in: path
          name: tag_id
          required: "true"
        - description: site_id
          in: path
          name: site_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteTagRemove"
        description: Request body
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  load_balancer: string
                  name: string
                  status: string
                  tag_id: string
              schema:
                $ref: "#/components/schemas/SiteSchema"
          description: Remove a site tag
        "400":
          content:
            application/json:
              example:
                site_id: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SiteTagRemove"
          description: Bad request (site_id required)
        "409":
          content:
            application/json:
              example:
                site_id: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SiteTagRemove"
          description: Tag or site not found
      summary: Remove tag from site
      tags:
        - Tags
        - Sites
    get:
      parameters:
        - description: tag_id
          in: path
          name: tag_id
          required: "true"
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  load_balancer: string
                  name: string
                  status: string
                  tag_id: string
              schema:
                $ref: "#/components/schemas/SiteSchema"
          description: Returns tag sites
      summary: Get sites for a tag
      tags:
        - Tags
        - Sites
    put:
      parameters:
        - description: tag_id
          in: path
          name: tag_id
          required: "true"
        - description: site_id
          in: path
          name: site_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteTagAdd"
        description: Request body
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  load_balancer: string
                  name: string
                  status: string
                  tag_id: string
              schema:
                $ref: "#/components/schemas/SiteSchema"
          description: Tag a site with the UUID of the tag
        "400":
          content:
            application/json:
              example:
                site_id: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SiteTagAdd"
          description: Bad request (site_id required)
        "409":
          content:
            application/json:
              example:
                site_id: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SiteTagAdd"
          description: Tag or site not found
      summary: Add tag to site
      tags:
        - Tags
        - Sites
  "/tags/{tag_id}/sites/{site_id}":
    delete:
      parameters:
        - description: tag_id
          in: path
          name: tag_id
          required: "true"
        - description: site_id
          in: path
          name: site_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteTagRemove"
        description: Request body
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  load_balancer: string
                  name: string
                  status: string
                  tag_id: string
              schema:
                $ref: "#/components/schemas/SiteSchema"
          description: Remove a site tag
        "400":
          content:
            application/json:
              example:
                site_id: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SiteTagRemove"
          description: Bad request (site_id required)
        "409":
          content:
            application/json:
              example:
                site_id: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SiteTagRemove"
          description: Tag or site not found
      summary: Remove tag from site
      tags:
        - Tags
        - Sites
    get:
      parameters:
        - description: tag_id
          in: path
          name: tag_id
          required: "true"
        - description: site_id
          in: path
          name: site_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  load_balancer: string
                  name: string
                  status: string
                  tag_id: string
              schema:
                $ref: "#/components/schemas/SiteSchema"
          description: Returns tag sites
      summary: Get sites for a tag
      tags:
        - Tags
        - Sites
    put:
      parameters:
        - description: tag_id
          in: path
          name: tag_id
          required: "true"
        - description: site_id
          in: path
          name: site_id
          required: "true"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SiteTagAdd"
        description: Request body
        required: true
      responses:
        "200":
          content:
            application/json:
              example:
                - id: string
                  load_balancer: string
                  name: string
                  status: string
                  tag_id: string
              schema:
                $ref: "#/components/schemas/SiteSchema"
          description: Tag a site with the UUID of the tag
        "400":
          content:
            application/json:
              example:
                site_id: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SiteTagAdd"
          description: Bad request (site_id required)
        "409":
          content:
            application/json:
              example:
                site_id: string
                tag_id: string
              schema:
                $ref: "#/components/schemas/SiteTagAdd"
          description: Tag or site not found
      summary: Add tag to site
      tags:
        - Tags
        - Sites
  /tasks:
    get:
      parameters: []
      responses:
        "200":
          content:
            application/json:
              example:
                - name: string
                  received: number
                  state: string
                  uuid: string
                  worker: string
              schema:
                $ref: "#/components/schemas/TaskSchema"
          description: Returns tasks
        "500":
          content:
            application/json: {}
          description: Flower/Celery worker unreachable
      summary: Get all tasks
      tags:
        - Tasks
  "/tasks/{task_id}":
    get:
      parameters:
        - description: task_id
          in: path
          name: task_id
          required: "true"
      responses:
        "200":
          content:
            application/json:
              example:
                name: string
                received: number
                state: string
                uuid: string
                worker: string
              schema:
                $ref: "#/components/schemas/TaskSchema"
          description: Returns task
        "404":
          content:
            application/json: {}
          description: Task not found
        "500":
          content:
            application/json: {}
          description: Flower/Celery worker unreachable
      summary: Get task
      tags:
        - Tasks
security: []
servers:
  - description: Cluster Controller API
    url: http://localhost:8000/v1
tags: []
