definitions:
  constant.WorkloadParamName:
    enum:
    - br_storage_url
    - br_storage_url
    - data_source
    - duration
    - max_connection_number
    - min_ru
    - max_ru
    - thread
    - client_cnt
    - client_resource
    - cluster_type
    - workload_name
    - sql_statement
    - inject_failure
    - rollback_failure
    type: string
    x-enum-varnames:
    - BrStorageURL
    - ImportStorageURL
    - DataSource
    - Duration
    - MaxConnectionNumber
    - MinRU
    - MaxRU
    - Thread
    - ClientCount
    - ClientResource
    - ClusterType
    - WorkloadName
    - SQLStatement
    - InjectFailure
    - RollbackFailure
  dto.DownloadTestReportReq:
    properties:
      address:
        type: string
      height:
        type: number
      localStoragesJson:
        type: string
      readySelector:
        type: string
      width:
        type: number
    type: object
  dto.InjectFailureReq:
    properties:
      duration:
        type: string
    type: object
  dto.ListAuditLogResp:
    properties:
      auditLogs:
        items:
          $ref: '#/definitions/model.AuditLog'
        type: array
      page:
        type: integer
      pageSize:
        type: integer
      totalSize:
        type: integer
    type: object
  dto.ListScriptResp:
    properties:
      page:
        type: integer
      pageSize:
        type: integer
      scripts:
        items:
          $ref: '#/definitions/dto.ScriptResp'
        type: array
      totalSize:
        type: integer
    type: object
  dto.ListScriptTemplatesResp:
    properties:
      page:
        type: integer
      pageSize:
        type: integer
      templates:
        items:
          $ref: '#/definitions/dto.ScriptTemplateResp'
        type: array
      totalSize:
        type: integer
    type: object
  dto.ListWorkloadResp:
    properties:
      page:
        type: integer
      pageSize:
        type: integer
      totalSize:
        type: integer
      workloads:
        items:
          $ref: '#/definitions/dto.WorkloadResp'
        type: array
    type: object
  dto.ListWorkloadTestResp:
    properties:
      page:
        type: integer
      pageSize:
        type: integer
      tests:
        items:
          $ref: '#/definitions/dto.WorkloadTestResp'
        type: array
      totalSize:
        type: integer
    type: object
  dto.RunWorkloadReq:
    properties:
      isAuto:
        type: boolean
      name:
        type: string
      params:
        items:
          $ref: '#/definitions/model.WorkloadParam'
        type: array
      workloadID:
        type: integer
      workloadName:
        description: '@deprecated'
        type: string
    type: object
  dto.SampleDBReq:
    properties:
      db_limit:
        type: integer
      row_options:
        $ref: '#/definitions/model.SampleDataOptions'
      table_limit:
        type: integer
      with_data:
        type: boolean
    type: object
  dto.SampleDBResp:
    properties:
      databases:
        items:
          $ref: '#/definitions/model.DataBase'
        type: array
      db_count:
        description: |-
          StartTime   time.Time
          EndTime     time.Time
          ExecuteTime float64
        type: integer
      options:
        $ref: '#/definitions/model.SampleDBOptions'
      version:
        type: integer
    type: object
  dto.SampleDataReq:
    properties:
      cutoff:
        description: |-
          SampleMethod SampleMethod `json:"sample_method,omitempty"` // Not supported now
          Cutoff is the max lenght of the string
        type: integer
      db_name:
        type: string
      limit:
        description: Max rows per table
        type: integer
      table_name:
        type: string
    type: object
  dto.SampleDataResp:
    properties:
      columns:
        items:
          $ref: '#/definitions/model.Column'
        type: array
      create_statement:
        type: string
      error_message:
        type: string
      name:
        type: string
      options:
        $ref: '#/definitions/model.SampleDataOptions'
      row_count:
        description: |-
          StartTime   time.Time
          EndTime     time.Time
          ExecuteTime float64
        type: integer
      rows:
        items:
          items:
            type: string
          type: array
        type: array
      type:
        type: string
    type: object
  dto.ScaleClusterReq:
    properties:
      replicas:
        type: integer
    type: object
  dto.ScriptPhaseResp:
    properties:
      description:
        type: string
      message:
        type: string
      mutations:
        items:
          $ref: '#/definitions/model.ScriptMutation'
        type: array
      name:
        type: string
      startDuration:
        format: int64
        type: integer
      state:
        type: string
      typeDetail:
        $ref: '#/definitions/model.ScriptTypeDetail'
    type: object
  dto.ScriptResp:
    properties:
      clusterType:
        $ref: '#/definitions/model.ClusterType'
      createdAt:
        type: string
      creatorEmail:
        type: string
      description:
        type: string
      id:
        type: integer
      name:
        type: string
      phases:
        items:
          $ref: '#/definitions/dto.ScriptPhaseResp'
        type: array
      templateId:
        type: integer
      totalDuration:
        format: int64
        type: integer
      updatedAt:
        type: string
      workloadID:
        type: integer
      workloadName:
        type: string
    type: object
  dto.ScriptTemplateResp:
    properties:
      createdAt:
        type: string
      creatorEmail:
        type: string
      description:
        type: string
      id:
        type: integer
      name:
        type: string
      phases:
        items:
          $ref: '#/definitions/dto.ScriptPhaseResp'
        type: array
      totalDuration:
        format: int64
        type: integer
      updatedAt:
        type: string
      version:
        type: integer
    type: object
  dto.UpdateClusterRUReq:
    properties:
      maxRU:
        type: integer
      minRU:
        type: integer
    type: object
  dto.UpdateWorkloadTestMaxConnReq:
    properties:
      maxConnectionNumber:
        type: integer
    type: object
  dto.UpdateWorkloadTestReq:
    properties:
      maxConnectionNumber:
        type: integer
      maxRU:
        type: integer
      minRU:
        type: integer
    type: object
  dto.WorkloadResp:
    properties:
      description:
        type: string
      id:
        type: integer
      name:
        type: string
      paramsTemplate:
        items:
          $ref: '#/definitions/model.WorkloadField'
        type: array
      tags:
        items:
          type: string
        type: array
      testCount:
        type: integer
      type:
        $ref: '#/definitions/model.WorkloadType'
    type: object
  dto.WorkloadTestResp:
    properties:
      cluster:
        $ref: '#/definitions/model.TiDBCluster'
      createdAt:
        type: string
      finishedAt:
        type: string
      id:
        description: 'TODO: leave the database to generate the ID'
        type: string
      isAuto:
        type: boolean
      message:
        type: string
      name:
        type: string
      params:
        items:
          $ref: '#/definitions/model.WorkloadParam'
        type: array
      phase:
        $ref: '#/definitions/model.WorkloadTestPhase'
      progress:
        description: Progress is the ratio of completed tasks/total tasks
        type: number
      startedAt:
        type: string
      startedBy:
        description: User who started this workload test
        type: string
      status:
        $ref: '#/definitions/model.ExecStatus'
      tasks:
        items:
          properties:
            ID:
              description: 'ID: leave the database to generate the ID'
              type: integer
            createdAt:
              type: string
            estimatedDurationMin:
              type: integer
            finishedAt:
              type: string
            message:
              type: string
            phase:
              allOf:
              - $ref: '#/definitions/model.WorkloadTaskPhase'
              description: Phase tracks the internal phase of the task for better
                recovery and concurrency control
            progress:
              type: number
            startedAt:
              type: string
            status:
              $ref: '#/definitions/model.ExecStatus'
            type:
              allOf:
              - $ref: '#/definitions/model.WorkloadTaskType'
              description: WorkloadID int64 `json:"workloadID"`
            updatedAt:
              type: string
          type: object
        type: array
      updatedAt:
        type: string
      workloadID:
        description: Original fields from tcms workflow
        type: integer
      workloadName:
        type: string
    type: object
  model.AuditLog:
    properties:
      detail:
        description: detail is formatted in json currently.
        type: string
      id:
        type: string
      objectId:
        description: |-
          Object ID is the object being operated, object type could be inferred
          from type.
          Object is the object users can feel, like workloadID/ workload test ID
          So if a user triggers cluster scaling during a workload test, the object id should be the workload test ID
          maybe add SubObjectID if needed.
        type: string
      operateAt:
        type: string
      operator:
        allOf:
        - $ref: '#/definitions/model.OperatorMeta'
        description: Operator Meta, the operator could be service or user...
      readableType:
        description: ReadableType is a readable string for the operate type
        type: string
      type:
        allOf:
        - $ref: '#/definitions/model.OperateType'
        description: |-
          Type should be unique between different object types.
          Like create_cluster and create_workload
    type: object
  model.ClusterType:
    enum:
    - tidbcloud-premium
    - tidbcloud-essential
    type: string
    x-enum-varnames:
    - ClusterTypeTiDBCloudPremium
    - ClusterTypeTiDBCloudEssential
  model.Column:
    properties:
      col:
        type: string
      constraints:
        items:
          $ref: '#/definitions/model.ColumnConstraint'
        type: array
      data_type:
        type: string
      default:
        type: string
      extra:
        type: string
      key:
        type: string
      main_type:
        type: string
      "null":
        type: string
      type_desc:
        type: string
    type: object
  model.ColumnConstraint:
    properties:
      column_name:
        type: string
      constraint_name:
        type: string
      ref_table_column_name:
        type: string
      ref_table_name:
        type: string
    type: object
  model.DataBase:
    properties:
      error_message:
        type: string
      name:
        type: string
      tables:
        items:
          $ref: '#/definitions/model.Table'
        type: array
    type: object
  model.ExecStatus:
    enum:
    - pending
    - running
    - completed
    - failed
    - stopping
    - stopped
    type: string
    x-enum-varnames:
    - ExecStatusPending
    - ExecStatusRunning
    - ExecStatusCompleted
    - ExecStatusFailed
    - ExecStatusStopping
    - ExecStatusStopped
  model.OperateType:
    enum:
    - workload_create_test
    - workload_stop_test
    - workload_create_cluster
    - workload_prepare_data
    - workload_run_traffic
    - workload_scale_cluster
    - workload_config_traffic_connection
    - workload_update_cluster_ru
    - workload_inject_failure
    - workload_rollback_failure
    - workload_execute_sql
    - workload_download_pdf
    - workload_script_proceed
    type: string
    x-enum-varnames:
    - OperateTypeCreateWorkloadTest
    - OperateTypeStopWorkloadTest
    - OperateTypeCreateCluster
    - OperateTypePrepareData
    - OperateTypeRunTraffic
    - OperateTypeScaleCluster
    - OperateTypeConfigTrafficConn
    - OperateTypeUpdateClusterRU
    - OperateTypeInjectFailure
    - OperateTypeRollbackFailure
    - OperateTypeExecuteSQL
    - OperateTypeDownloadWorkloadTestPDF
    - OperateTypeProceed
  model.OperatorMeta:
    properties:
      id:
        type: string
      type:
        $ref: '#/definitions/model.OperatorType'
    type: object
  model.OperatorType:
    enum:
    - service
    - user
    type: string
    x-enum-varnames:
    - OperatorTypeService
    - OperatorTypeUser
  model.SampleDBOptions:
    properties:
      db_limit:
        type: integer
      row_options:
        $ref: '#/definitions/model.SampleDataOptions'
      table_limit:
        type: integer
      with_data:
        type: boolean
    type: object
  model.SampleDataOptions:
    properties:
      cutoff:
        description: |-
          SampleMethod SampleMethod `json:"sample_method,omitempty"` // Not supported now
          Cutoff is the max lenght of the string
        type: integer
      db_name:
        type: string
      limit:
        description: Max rows per table
        type: integer
      table_name:
        type: string
    type: object
  model.ScriptMutation:
    properties:
      direction:
        type: string
      param:
        $ref: '#/definitions/constant.WorkloadParamName'
      toValue:
        type: string
    type: object
  model.ScriptPhaseType:
    enum:
    - proceed
    - mutate
    type: string
    x-enum-varnames:
    - ScriptPhaseTypeProceed
    - ScriptPhaseTypeMutate
  model.ScriptTypeDetail:
    properties:
      detail: {}
      type:
        $ref: '#/definitions/model.ScriptPhaseType'
    type: object
  model.Table:
    properties:
      columns:
        items:
          $ref: '#/definitions/model.Column'
        type: array
      create_statement:
        type: string
      error_message:
        type: string
      name:
        type: string
      rows:
        items:
          items:
            type: string
          type: array
        type: array
      type:
        type: string
    type: object
  model.TiDBCluster:
    properties:
      clusterID:
        type: string
      maxRU:
        type: integer
      minRU:
        type: integer
      orgID:
        type: string
      projectID:
        type: string
      type:
        allOf:
        - $ref: '#/definitions/model.ClusterType'
        description: |-
          TODO: Add the CloudRegion to the TiDBCluster struct
          CloudRegion string `json:"cloudRegion,omitempty" dbstore:"cloudRegion"`
    type: object
  model.WorkloadField:
    properties:
      description:
        type: string
      key:
        type: string
      lowerLimit:
        description: 'INFO: string for now'
      name:
        type: string
      options:
        items: {}
        type: array
      required:
        type: boolean
      type:
        type: string
      upperLimit: {}
      value:
        description: 'INFO: it''s always string now. Maybe optimize to real type later'
    type: object
  model.WorkloadParam:
    properties:
      name:
        type: string
      value:
        type: string
    type: object
  model.WorkloadTaskPhase:
    enum:
    - pending
    - triggering
    - running
    - completed
    - failed
    - stopping
    - stopped
    - updating
    type: string
    x-enum-comments:
      WorkloadTaskPhaseCompleted: Task completed successfully
      WorkloadTaskPhaseFailed: Task failed
      WorkloadTaskPhasePending: Task created but not yet triggered
      WorkloadTaskPhaseRunning: Polling external service for task status
      WorkloadTaskPhaseTriggering: Calling external service to trigger the task
      WorkloadTaskPhaseUpdating: under Updating task configuration, only viable for
        workload task now
    x-enum-descriptions:
    - Task created but not yet triggered
    - Calling external service to trigger the task
    - Polling external service for task status
    - Task completed successfully
    - Task failed
    - under Updating task configuration, only viable for workload task now
    x-enum-varnames:
    - WorkloadTaskPhasePending
    - WorkloadTaskPhaseTriggering
    - WorkloadTaskPhaseRunning
    - WorkloadTaskPhaseCompleted
    - WorkloadTaskPhaseFailed
    - WorkloadTaskPhaseStopping
    - WorkloadTaskPhaseStopped
    - WorkloadTaskPhaseUpdating
  model.WorkloadTaskType:
    enum:
    - create_cluster
    - prepare_data
    - run_traffic
    type: string
    x-enum-varnames:
    - WorkloadTaskTypeCreateCluster
    - WorkloadTaskTypePrepareData
    - WorkloadTaskTypeRunTraffic
  model.WorkloadTestPhase:
    enum:
    - Pending
    - Creating Cluster
    - Preparing Data
    - Running Workload
    - Finished
    - ""
    type: string
    x-enum-varnames:
    - WorkloadTestPhasePending
    - WorkloadTestPhaseCreateCluster
    - WorkloadTestPhasePrepareData
    - WorkloadTestPhaseRunWorkload
    - WorkloadTestPhaseFinished
    - WorkloadTestPhaseDumb
  model.WorkloadType:
    enum:
    - HTAP
    - OLTP
    - OLAP
    type: string
    x-enum-varnames:
    - WorkloadTypeHTAP
    - WorkloadTypeOLTP
    - WorkloadTypeOLAP
info:
  contact: {}
paths:
  /api/v1/workloads:
    get:
      consumes:
      - application/json
      description: Lists all available workload (templates).
      operationId: ListWorkloadTemplates
      parameters:
      - description: Workload type
        enum:
        - HTAP
        - OLTP
        - OLAP
        in: query
        name: type
        type: string
      - description: Keyword to search in workload name or description
        in: query
        name: keyword
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: List of workloads
          schema:
            $ref: '#/definitions/dto.ListWorkloadResp'
        "400":
          description: invalid config
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: List Available Workloads
      tags:
      - workload
  /api/v1/workloads/{id}:
    get:
      consumes:
      - application/json
      description: Retrieves a workload template by the given ID, including usage
        statistics.
      operationId: GetWorkloadTemplate
      parameters:
      - description: Workload ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Workload template retrieved successfully
          schema:
            $ref: '#/definitions/dto.WorkloadResp'
        "400":
          description: Invalid ID parameter
          schema:
            type: object
        "404":
          description: Workload not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Get Workload Template
      tags:
      - workload
  /api/v1/workloads/{id}/sample/data:
    get:
      consumes:
      - application/json
      description: Retrieves the preserved sample data for a workload by workload
        ID.
      operationId: GetPreservedSampleWorkloadData
      parameters:
      - description: Workload ID
        in: path
        name: id
        required: true
        type: string
      - description: Sample data request
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/dto.SampleDataReq'
      produces:
      - application/json
      responses:
        "200":
          description: Data sample result
          schema:
            $ref: '#/definitions/dto.SampleDataResp'
        "400":
          description: Invalid query parameters
          schema:
            type: object
        "404":
          description: Workload not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Get Preserved Sample Data
      tags:
      - workload
  /api/v1/workloads/{id}/sample/db:
    get:
      consumes:
      - application/json
      description: Retrieves the preserved sample databases for a workload by workload
        ID.
      operationId: GetPreservedSampleWorkloadDB
      parameters:
      - description: Workload ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Sample databases retrieved successfully
          schema:
            $ref: '#/definitions/dto.SampleDBResp'
        "400":
          description: Invalid ID parameter
          schema:
            type: object
        "404":
          description: Workload not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Get Preserved Sample Databases
      tags:
      - workload
  /api/v1/workloads/scripts:
    get:
      consumes:
      - application/json
      description: Lists all available workload script with their phases.
      operationId: ListWorkloadScripts
      parameters:
      - description: Sort order for workload tests (e.g., createdAt)
        in: query
        name: sort
        type: string
      - description: Order by direction (asc or desc)
        enum:
        - asc
        - desc
        in: query
        name: orderBy
        type: string
      - description: Filter by workload test ID
        in: query
        name: testID
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: List of scripts
          schema:
            $ref: '#/definitions/dto.ListScriptResp'
        "500":
          description: Internal server error
          schema:
            type: object
      summary: List Workload Script
      tags:
      - workload
  /api/v1/workloads/scripts/templates:
    get:
      consumes:
      - application/json
      description: Lists all available workload script templates with their phases,
        including message, startDuration, and mutation details.
      operationId: ListWorkloadScriptTemplates
      produces:
      - application/json
      responses:
        "200":
          description: List of script templates
          schema:
            $ref: '#/definitions/dto.ListScriptTemplatesResp'
        "500":
          description: Internal server error
          schema:
            type: object
      summary: List Workload Script Templates
      tags:
      - workload
  /api/v1/workloads/tests:
    get:
      consumes:
      - application/json
      description: Lists all workload tests with optional filtering and sorting.
      operationId: ListWorkloadTests
      parameters:
      - description: Sort order for workload tests (e.g., createdAt)
        in: query
        name: sort
        type: string
      - description: Order by direction (asc or desc)
        enum:
        - asc
        - desc
        in: query
        name: orderBy
        type: string
      - description: Filter by workload test status
        enum:
        - Created
        - Running
        - Succeeded
        - Failed
        - Canceled
        in: query
        name: status
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: List of workload tests
          schema:
            $ref: '#/definitions/dto.ListWorkloadTestResp'
        "400":
          description: Invalid query parameters
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: List Workload Tests
      tags:
      - workload
    post:
      consumes:
      - application/json
      description: Runs a workload test with the provided configuration, this test
        will automatically process the cluster
      operationId: RunWorkloadTest
      parameters:
      - description: Bearer JWT token
        in: header
        name: Authorization
        required: true
        type: string
      - description: Workload test configuration
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/dto.RunWorkloadReq'
      produces:
      - application/json
      responses:
        "201":
          description: Workload test executed successfully
          schema:
            $ref: '#/definitions/dto.WorkloadTestResp'
        "400":
          description: invalid config
          schema:
            type: object
        "401":
          description: unauthorized - missing or invalid JWT token
          schema:
            type: object
        "404":
          description: workload not found
          schema:
            type: object
        "500":
          description: internal server error
          schema:
            type: object
      summary: Start Workload Test
      tags:
      - workload
  /api/v1/workloads/tests/{id}:
    get:
      consumes:
      - application/json
      description: Retrieves a workload test result by the ID.
      operationId: GetWorkloadTest
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Workload test result
          schema:
            $ref: '#/definitions/dto.WorkloadTestResp'
        "400":
          description: Invalid ID parameter
          schema:
            type: object
        "404":
          description: Workload test not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Get A Specific Test
      tags:
      - workload
    patch:
      consumes:
      - application/json
      description: Updates the configuration of a workload test by the ID, including
        max connections and RU settings.
      operationId: UpdateWorkloadTest
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      - description: Workload test configuration update request
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/dto.UpdateWorkloadTestReq'
      produces:
      - application/json
      responses:
        "200":
          description: Workload test updated successfully
        "400":
          description: Invalid query parameters
          schema:
            type: object
        "401":
          description: Unauthorized - missing or invalid JWT token
          schema:
            type: object
        "404":
          description: Workload test not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      security:
      - Bearer: []
      summary: Update Workload Test
      tags:
      - workload
  /api/v1/workloads/tests/{id}/audit:
    get:
      consumes:
      - application/json
      description: Lists all audit logs for a workload test by ID.
      operationId: ListAuditLog
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Audit logs retrieved successfully
          schema:
            $ref: '#/definitions/dto.ListAuditLogResp'
        "400":
          description: Invalid ID parameter
          schema:
            type: object
        "404":
          description: Workload test not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: List Audit Logs
      tags:
      - workload
  /api/v1/workloads/tests/{id}/cluster:
    post:
      consumes:
      - application/json
      description: Triggers cluster creation for a workload test by ID.
      operationId: TriggerCreateCluster
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Cluster creation triggered successfully
          schema:
            $ref: '#/definitions/dto.WorkloadTestResp'
        "400":
          description: Invalid ID parameter
          schema:
            type: object
        "401":
          description: unauthorized - missing or invalid JWT token
          schema:
            type: object
        "404":
          description: Workload test not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Trigger Cluster Creation
      tags:
      - workload
  /api/v1/workloads/tests/{id}/cluster/ru:
    patch:
      consumes:
      - application/json
      description: Updates the minimum and maximum RU settings for a cluster by the
        workload test ID.
      operationId: UpdateClusterRU
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      - description: Update cluster RU request
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/dto.UpdateClusterRUReq'
      produces:
      - application/json
      responses:
        "200":
          description: Cluster RU updated successfully
        "400":
          description: Invalid query parameters
          schema:
            type: object
        "401":
          description: Unauthorized
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      security:
      - Bearer: []
      summary: Update Cluster RU
      tags:
      - workload
  /api/v1/workloads/tests/{id}/cluster/scale:
    post:
      consumes:
      - application/json
      description: Scales a cluster by the ID.
      operationId: ScaleCluster
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      - description: Scale cluster request
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/dto.ScaleClusterReq'
      produces:
      - application/json
      responses:
        "200":
          description: Cluster scaled successfully
        "400":
          description: Invalid query parameters
          schema:
            type: object
        "401":
          description: Unauthorized
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      security:
      - Bearer: []
      summary: Scale Cluster
      tags:
      - workload
  /api/v1/workloads/tests/{id}/conn:
    patch:
      consumes:
      - application/json
      description: Updates the maximum connections for a workload test by the ID.
      operationId: UpdateWorkloadTestMaxConn
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      - description: Update max connections request
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/dto.UpdateWorkloadTestMaxConnReq'
      produces:
      - application/json
      responses:
        "200":
          description: Workload test max connections updated successfully
        "400":
          description: Invalid query parameters
          schema:
            type: object
        "401":
          description: Unauthorized
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      security:
      - Bearer: []
      summary: Update Workload Test Max Connections
      tags:
      - workload
  /api/v1/workloads/tests/{id}/failure:
    post:
      consumes:
      - application/json
      description: Injects a failure into a cluster for a workload test by the ID
        with specified duration.
      operationId: InjectFailure
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      - description: Inject failure request
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/dto.InjectFailureReq'
      produces:
      - application/json
      responses:
        "204":
          description: Failure injected successfully
        "400":
          description: Invalid query parameters
          schema:
            type: object
        "401":
          description: Unauthorized
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      security:
      - Bearer: []
      summary: Inject Failure
      tags:
      - workload
  /api/v1/workloads/tests/{id}/prepare:
    post:
      consumes:
      - application/json
      description: Triggers data preparation for a workload test by ID.
      operationId: TriggerPrepareData
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Data preparation triggered successfully
          schema:
            $ref: '#/definitions/dto.WorkloadTestResp'
        "400":
          description: Invalid ID parameter
          schema:
            type: object
        "401":
          description: unauthorized - missing or invalid JWT token
          schema:
            type: object
        "404":
          description: Workload test not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Trigger Data Preparation
      tags:
      - workload
  /api/v1/workloads/tests/{id}/reports/pdf:
    post:
      consumes:
      - application/json
      description: Generates and downloads a PDF report for a workload test by ID.
        The report includes test configuration, performance metrics, and visualizations.
      operationId: DownloadTestReport
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      - description: PDF generation options
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/dto.DownloadTestReportReq'
      produces:
      - application/pdf
      responses:
        "200":
          description: PDF report generated successfully
        "400":
          description: Invalid ID parameter or request body
          schema:
            type: object
        "401":
          description: unauthorized - missing or invalid JWT token
          schema:
            type: object
        "404":
          description: Workload test not found
          schema:
            type: object
        "500":
          description: Internal server error or PDF generation failed
          schema:
            type: object
      summary: Download Test Report
      tags:
      - workload
  /api/v1/workloads/tests/{id}/sample/data:
    get:
      consumes:
      - application/json
      description: Samples the data of a workload test by ID.
      operationId: SampleWorkloadTestData
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      - description: Sample data request
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/dto.SampleDataReq'
      produces:
      - application/json
      responses:
        "200":
          description: Data sample result
          schema:
            $ref: '#/definitions/dto.SampleDataResp'
        "400":
          description: Invalid query parameters
          schema:
            type: object
        "404":
          description: Workload test not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Sample Workload Test Data
      tags:
      - workload
  /api/v1/workloads/tests/{id}/sample/db:
    get:
      consumes:
      - application/json
      description: Samples the database of a workload test by ID.
      operationId: SampleWorkloadTestDB
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      - description: Sample DB request
        in: body
        name: request
        required: true
        schema:
          $ref: '#/definitions/dto.SampleDBReq'
      produces:
      - application/json
      responses:
        "200":
          description: Database sample result
          schema:
            $ref: '#/definitions/dto.SampleDBResp'
        "400":
          description: Invalid query parameters
          schema:
            type: object
        "404":
          description: Workload test not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Sample Workload Test DB
      tags:
      - workload
  /api/v1/workloads/tests/{id}/scripts/{scriptId}:
    post:
      consumes:
      - application/json
      description: Activates a script for a specific workload test.
      operationId: ActivateWorkloadScript
      parameters:
      - description: Test ID
        in: path
        name: id
        required: true
        type: string
      - description: Script ID
        in: path
        name: scriptId
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Script activated successfully
          schema:
            type: object
        "400":
          description: Invalid parameters
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Activate Workload Script
      tags:
      - workload
  /api/v1/workloads/tests/{id}/stop:
    post:
      consumes:
      - application/json
      description: Stops a running workload test by the ID.
      operationId: StopWorkloadTest
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Workload test stopped successfully
          schema:
            $ref: '#/definitions/dto.WorkloadTestResp'
        "400":
          description: Invalid ID parameter
          schema:
            type: object
        "401":
          description: unauthorized - missing or invalid JWT token
          schema:
            type: object
        "404":
          description: Workload test not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Stop Workload Test
      tags:
      - workload
  /api/v1/workloads/tests/{id}/traffic:
    post:
      consumes:
      - application/json
      description: Triggers traffic generation for a workload test by ID.
      operationId: TriggerRunTraffic
      parameters:
      - description: Workload Test ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: Traffic generation triggered successfully
          schema:
            $ref: '#/definitions/dto.WorkloadTestResp'
        "400":
          description: Invalid ID parameter
          schema:
            type: object
        "401":
          description: unauthorized - missing or invalid JWT token
          schema:
            type: object
        "404":
          description: Workload test not found
          schema:
            type: object
        "500":
          description: Internal server error
          schema:
            type: object
      summary: Trigger Traffic Generation
      tags:
      - workload
swagger: "2.0"
