basePath: /
definitions:
  api.Action:
    properties:
      kind:
        enum:
        - pod_shutdown
        type: string
      pod_shutdown:
        $ref: '#/definitions/api.PodShutdown'
    type: object
  api.ActionSchema:
    properties:
      component:
        items:
          type: string
        type: array
      kind:
        type: string
    type: object
  api.BackendStatus:
    properties:
      message:
        type: string
      status:
        enum:
        - ready
        - disabled
        - installing
        - uninstalling
        - install_failed
        type: string
      updated_at:
        type: integer
      updated_by:
        $ref: '#/definitions/session.CtxUser'
    type: object
  api.Component:
    properties:
      pd:
        items:
          $ref: '#/definitions/api.PodInfo'
        type: array
      tidb:
        items:
          $ref: '#/definitions/api.PodInfo'
        type: array
      tiflash:
        items:
          $ref: '#/definitions/api.PodInfo'
        type: array
      tikv:
        items:
          $ref: '#/definitions/api.PodInfo'
        type: array
    type: object
  api.CreateExperimentRequest:
    properties:
      action:
        $ref: '#/definitions/api.Action'
      summary:
        type: string
    type: object
  api.Experiment:
    properties:
      action:
        $ref: '#/definitions/api.Action'
      approved_by:
        $ref: '#/definitions/session.CtxUser'
      cluster_id:
        type: integer
      completed_at:
        type: integer
      created_at:
        type: integer
      created_by:
        $ref: '#/definitions/session.CtxUser'
      deleted_at:
        type: integer
      draft:
        type: boolean
      experiment_id:
        type: integer
      message:
        type: string
      report_link:
        type: string
      started_at:
        type: integer
      status:
        enum:
        - Waiting Approve
        - Draft
        - Running
        - Done
        - Failed
        - Deleted
        type: string
      summary:
        type: string
    type: object
  api.ExperimentInfo:
    properties:
      report_link:
        type: string
      summary:
        type: string
    type: object
  api.ExperimentResponse:
    properties:
      experiments:
        items:
          $ref: '#/definitions/api.Experiment'
        type: array
      total:
        description: Total number of experiments
        type: integer
    type: object
  api.PodInfo:
    properties:
      name:
        type: string
    type: object
  api.PodShutdown:
    properties:
      target:
        $ref: '#/definitions/api.Target'
    type: object
  api.Target:
    properties:
      component:
        enum:
        - tidb
        - tikv
        - pd
        type: string
      mode:
        enum:
        - random
        - specified
        type: string
      name:
        type: string
    type: object
  session.CtxUser:
    properties:
      email:
        type: string
      internal:
        type: boolean
      org_id:
        type: integer
      user_id:
        type: integer
      username:
        type: string
    type: object
info:
  contact: {}
  description: This is a server of API to inject fault into tidb cluster.
  title: Chaos API
  version: "1.0"
paths:
  /chaos/api/actions/schema:
    get:
      description: List experiment actions
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            items:
              $ref: '#/definitions/api.ActionSchema'
            type: array
      summary: List experiment actions
      tags:
      - Chaos
  /chaos/api/approve/orgs/{oid}/clusters/{cid}/experiments/{eid}:
    post:
      description: Approve a draft chaos experiment
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      - description: experiment id
        in: path
        name: eid
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: Approve a draft chaos experiment
      tags:
      - Chaos
  /chaos/api/components/orgs/{oid}/clusters/{cid}:
    get:
      description: List components
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.Component'
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: List components
      tags:
      - Chaos
  /chaos/api/draft/orgs/{oid}/clusters/{cid}:
    post:
      description: Create draft chaos experiment
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      - description: create draft experiment
        in: body
        name: experiment
        required: true
        schema:
          $ref: '#/definitions/api.CreateExperimentRequest'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.Experiment'
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: Create draft chaos experiment
      tags:
      - Chaos
  /chaos/api/orgs/{oid}/clusters/{cid}:
    get:
      description: List chaos experiments
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      - default: 1
        description: the page index
        in: query
        minimum: 1
        name: page
        type: integer
      - default: 10
        description: the page size
        in: query
        minimum: 1
        name: size
        type: integer
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.ExperimentResponse'
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: List chaos experiments
      tags:
      - Chaos
  /chaos/api/orgs/{oid}/clusters/{cid}/experiments/{eid}:
    delete:
      description: Delete chaos experiment
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      - description: experiment id
        in: path
        name: eid
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: Delete chaos experiment
      tags:
      - Chaos
    get:
      description: Get chaos experiment
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      - description: experiment id
        in: path
        name: eid
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.Experiment'
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: Get chaos experiment
      tags:
      - Chaos
  /chaos/api/start/orgs/{oid}/clusters/{cid}/experiments/{eid}:
    post:
      description: Start chaos experiment
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      - description: experiment id
        in: path
        name: eid
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.Experiment'
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: Start chaos experiment
      tags:
      - Chaos
  /chaos/api/summary/orgs/{oid}/clusters/{cid}/experiments/{eid}:
    post:
      description: Update experiment info
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      - description: experiment id
        in: path
        name: eid
        required: true
        type: string
      - description: experiment info
        in: body
        name: Info
        required: true
        schema:
          $ref: '#/definitions/api.ExperimentInfo'
      produces:
      - application/json
      responses:
        "200":
          description: OK
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: Update experiment info
      tags:
      - Chaos
  /fault/api/orgs/{oid}/clusters/{cid}:
    delete:
      description: Disable fault drill
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: Disable fault drill
      tags:
      - Chaos
    get:
      description: Get fault drill backend status
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.BackendStatus'
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: Get fault drill backend status
      tags:
      - Chaos
    post:
      description: Enable fault drill
      parameters:
      - description: organization id
        in: path
        name: oid
        required: true
        type: string
      - description: cluster id
        in: path
        name: cid
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
        "400":
          description: Bad Request
          schema: {}
        "500":
          description: Internal Server Error
          schema: {}
      summary: Enable fault drill
      tags:
      - Chaos
  /fault/api/ping:
    get:
      description: Ping chaos backend
      produces:
      - application/json
      responses:
        "200":
          description: OK
      summary: Ping chaos backend
      tags:
      - Chaos
swagger: "2.0"
