github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/openapi/spec/dm.yaml (about)

     1  openapi: "3.0.0"
     2  info:
     3    title: DM OpenAPI DOC
     4    version: "6.0.0"
     5  externalDocs:
     6    description: "DM OpenAPI DOC"
     7    url: "https://docs.pingcap.com/zh/tidb-data-migration/stable"
     8  servers:
     9    - url: "https://you.domain.com/"
    10  tags:
    11    - name: source
    12      description: source
    13      externalDocs:
    14        description: doc
    15        url: "https://docs.pingcap.com/zh/tidb/stable/quick-start-create-source"
    16    - name: task
    17      description: task
    18      externalDocs:
    19        description: doc
    20        url: "https://docs.pingcap.com/zh/tidb/stable/quick-start-with-dm"
    21    - name: cluster
    22      description: cluster
    23  
    24  paths:
    25    /api/v1/docs:
    26      get:
    27        tags:
    28          - doc
    29        summary: "get doc html"
    30        operationId: "GetDocHTML"
    31        responses:
    32          "200":
    33            description: HTML content
    34    /api/v1/dm.json:
    35      get:
    36        tags:
    37          - doc
    38        summary: "get doc json"
    39        operationId: "GetDocJSON"
    40        responses:
    41          "200":
    42            description: json content
    43  
    44    /api/v1/sources:
    45      post:
    46        tags:
    47          - source
    48        summary: "create and enable a new data source"
    49        operationId: "DMAPICreateSource"
    50        requestBody:
    51          description: "request body"
    52          content:
    53            "application/json":
    54              schema:
    55                $ref: "#/components/schemas/CreateSourceRequest"
    56        responses:
    57          "201":
    58            description: "success"
    59            content:
    60              "application/json":
    61                schema:
    62                  $ref: "#/components/schemas/Source"
    63          "400":
    64            description: "failed"
    65            content:
    66              "application/json":
    67                schema:
    68                  $ref: "#/components/schemas/ErrorWithMessage"
    69      get:
    70        tags:
    71          - source
    72        summary: "get data source list"
    73        operationId: "DMAPIGetSourceList"
    74        parameters:
    75          - name: "with_status"
    76            in: query
    77            required: false
    78            description: "list source with status"
    79            schema:
    80              type: boolean
    81              example: true
    82          - name: "enable_relay"
    83            in: query
    84            required: false
    85            description: "only return the enable-relay source"
    86            schema:
    87              type: boolean
    88              example: true
    89        responses:
    90          "200":
    91            description: "data source list"
    92            content:
    93              "application/json":
    94                schema:
    95                  $ref: "#/components/schemas/GetSourceListResponse"
    96    /api/v1/sources/{source-name}:
    97      get:
    98        tags:
    99          - source
   100        summary: "get source"
   101        operationId: "DMAPIGetSource"
   102        parameters:
   103          - name: "source-name"
   104            in: path
   105            description: "globally unique data source name"
   106            required: true
   107            schema:
   108              type: string
   109              example: "mysql-01"
   110          - name: "with_status"
   111            in: query
   112            required: false
   113            description: "list source with status"
   114            schema:
   115              type: boolean
   116              example: true
   117        responses:
   118          "200":
   119            description: "source"
   120            content:
   121              "application/json":
   122                schema:
   123                  $ref: "#/components/schemas/Source"
   124          "404":
   125            description: "source not found"
   126      delete:
   127        tags:
   128          - source
   129        summary: "delete a data source"
   130        operationId: "DMAPIDeleteSource"
   131        parameters:
   132          - name: "source-name"
   133            in: path
   134            description: "globally unique data source name"
   135            required: true
   136            schema:
   137              type: string
   138              example: "mysql-01"
   139          - name: "force"
   140            in: query
   141            required: false
   142            description: "force stop source also stop the related tasks"
   143            schema:
   144              type: boolean
   145              example: true
   146        responses:
   147          "204":
   148            description: "success"
   149          "400":
   150            description: "failed"
   151            content:
   152              "application/json":
   153                schema:
   154                  $ref: "#/components/schemas/ErrorWithMessage"
   155      put:
   156        tags:
   157          - source
   158        summary: "update a data source"
   159        operationId: "DMAPIUpdateSource"
   160        parameters:
   161          - name: "source-name"
   162            in: path
   163            description: "globally unique data source name"
   164            required: true
   165            schema:
   166              type: string
   167              example: "mysql-01"
   168        requestBody:
   169          required: true
   170          content:
   171            "application/json":
   172              schema:
   173                $ref: "#/components/schemas/UpdateSourceRequest"
   174        responses:
   175          "200":
   176            description: "success"
   177            content:
   178              "application/json":
   179                schema:
   180                  $ref: "#/components/schemas/Source"
   181          "400":
   182            description: "failed"
   183            content:
   184              "application/json":
   185                schema:
   186                  $ref: "#/components/schemas/ErrorWithMessage"
   187    /api/v1/sources/{source-name}/status:
   188      get:
   189        tags:
   190          - source
   191        summary: "get the current status of the data source"
   192        operationId: "DMAPIGetSourceStatus"
   193        parameters:
   194          - name: source-name
   195            in: path
   196            description: "globally unique data source name"
   197            required: true
   198            schema:
   199              type: string
   200              example: "mysql-replica-01"
   201        responses:
   202          "200":
   203            description: "success"
   204            content:
   205              "application/json":
   206                schema:
   207                  $ref: "#/components/schemas/GetSourceStatusResponse"
   208          "400":
   209            description: "failed"
   210            content:
   211              "application/json":
   212                schema:
   213                  $ref: "#/components/schemas/ErrorWithMessage"
   214    /api/v1/sources/{source-name}/enable:
   215      post:
   216        tags:
   217          - source
   218        summary: "enable a data source"
   219        operationId: "DMAPIEnableSource"
   220        parameters:
   221          - name: "source-name"
   222            in: path
   223            description: "globally unique data source name"
   224            required: true
   225            schema:
   226              type: string
   227              example: "mysql-01"
   228        responses:
   229          "200":
   230            description: "success"
   231          "400":
   232            description: "failed"
   233            content:
   234              "application/json":
   235                schema:
   236                  $ref: "#/components/schemas/ErrorWithMessage"
   237    /api/v1/sources/{source-name}/disable:
   238      post:
   239        tags:
   240          - source
   241        summary: "disable a data source"
   242        operationId: "DMAPIDisableSource"
   243        parameters:
   244          - name: "source-name"
   245            in: path
   246            description: "globally unique data source name"
   247            required: true
   248            schema:
   249              type: string
   250              example: "mysql-01"
   251        responses:
   252          "200":
   253            description: "success"
   254          "400":
   255            description: "failed"
   256            content:
   257              "application/json":
   258                schema:
   259                  $ref: "#/components/schemas/ErrorWithMessage"
   260    /api/v1/sources/{source-name}/transfer:
   261      post:
   262        tags:
   263          - source
   264        summary: "transfer source to a free worker"
   265        operationId: "DMAPITransferSource"
   266        parameters:
   267          - name: "source-name"
   268            in: path
   269            description: "globally unique data source name"
   270            required: true
   271            schema:
   272              type: string
   273              example: "mysql-01"
   274        requestBody:
   275          required: true
   276          content:
   277            "application/json":
   278              schema:
   279                $ref: "#/components/schemas/WorkerNameRequest"
   280        responses:
   281          "200":
   282            description: "success"
   283          "400":
   284            description: "failed"
   285            content:
   286              "application/json":
   287                schema:
   288                  $ref: "#/components/schemas/ErrorWithMessage"
   289    /api/v1/sources/{source-name}/relay/enable:
   290      post:
   291        tags:
   292          - source
   293        summary: "enable relay log function for the data source"
   294        parameters:
   295          - name: "source-name"
   296            in: path
   297            description: "globally unique data source name"
   298            required: true
   299            schema:
   300              type: string
   301              example: "mysql-01"
   302        operationId: "DMAPIEnableRelay"
   303        requestBody:
   304          required: false
   305          content:
   306            "application/json":
   307              schema:
   308                $ref: "#/components/schemas/EnableRelayRequest"
   309        responses:
   310          "200":
   311            description: "success"
   312          "400":
   313            description: "failed"
   314            content:
   315              "application/json":
   316                schema:
   317                  $ref: "#/components/schemas/ErrorWithMessage"
   318    /api/v1/sources/{source-name}/relay/disable:
   319      post:
   320        tags:
   321          - source
   322        summary: "disable relay log function for the data source"
   323        operationId: "DMAPIDisableRelay"
   324        parameters:
   325          - name: "source-name"
   326            in: path
   327            description: "globally unique data source name"
   328            required: true
   329            schema:
   330              type: string
   331              example: "mysql-01"
   332        requestBody:
   333          required: false
   334          content:
   335            "application/json":
   336              schema:
   337                $ref: "#/components/schemas/DisableRelayRequest"
   338        responses:
   339          "200":
   340            description: "success"
   341          "400":
   342            description: "failed"
   343            content:
   344              "application/json":
   345                schema:
   346                  $ref: "#/components/schemas/ErrorWithMessage"
   347    /api/v1/sources/{source-name}/relay/purge:
   348      post:
   349        tags:
   350          - source
   351        summary: "purge relay log"
   352        operationId: "DMAPIPurgeRelay"
   353        parameters:
   354          - name: "source-name"
   355            in: path
   356            description: "globally unique data source name"
   357            required: true
   358            schema:
   359              type: string
   360              example: "mysql-01"
   361        requestBody:
   362          required: true
   363          content:
   364            "application/json":
   365              schema:
   366                $ref: "#/components/schemas/PurgeRelayRequest"
   367        responses:
   368          "200":
   369            description: "success"
   370          "400":
   371            description: "failed"
   372            content:
   373              "application/json":
   374                schema:
   375                  $ref: "#/components/schemas/ErrorWithMessage"
   376  
   377    /api/v1/sources/{source-name}/schemas:
   378      get:
   379        tags:
   380          - source
   381        summary: "get source schema list"
   382        operationId: "DMAPIGetSourceSchemaList"
   383        parameters:
   384          - name: source-name
   385            in: path
   386            description: "source name"
   387            required: true
   388            schema:
   389              type: string
   390              example: "source-1"
   391        responses:
   392          "200":
   393            description: "success"
   394            content:
   395              "application/json":
   396                schema:
   397                  $ref: "#/components/schemas/SchemaNameList"
   398          "400":
   399            description: "failed"
   400            content:
   401              "application/json":
   402                schema:
   403                  $ref: "#/components/schemas/ErrorWithMessage"
   404    /api/v1/sources/{source-name}/schemas/{schema-name}:
   405      get:
   406        tags:
   407          - source
   408        summary: "get source table list"
   409        operationId: "DMAPIGetSourceTableList"
   410        parameters:
   411          - name: source-name
   412            in: path
   413            description: "source name"
   414            required: true
   415            schema:
   416              type: string
   417              example: "source-1"
   418          - name: schema-name
   419            in: path
   420            description: "schema name"
   421            required: true
   422            schema:
   423              type: string
   424              example: "db1"
   425        responses:
   426          "200":
   427            description: "success"
   428            content:
   429              application/json:
   430                schema:
   431                  $ref: "#/components/schemas/TableNameList"
   432          "400":
   433            description: "failed"
   434            content:
   435              "application/json":
   436                schema:
   437                  $ref: "#/components/schemas/ErrorWithMessage"
   438  
   439    /api/v1/tasks:
   440      post:
   441        tags:
   442          - task
   443        summary: "create a task"
   444        operationId: "DMAPICreateTask"
   445        requestBody:
   446          description: "request body"
   447          content:
   448            "application/json":
   449              schema:
   450                $ref: "#/components/schemas/CreateTaskRequest"
   451        responses:
   452          "201":
   453            description: "success"
   454            content:
   455              "application/json":
   456                schema:
   457                  $ref: "#/components/schemas/OperateTaskResponse"
   458          "400":
   459            description: "failed"
   460            content:
   461              "application/json":
   462                schema:
   463                  $ref: "#/components/schemas/ErrorWithMessage"
   464      get:
   465        tags:
   466          - task
   467        summary: "get task list"
   468        parameters:
   469          - name: "with_status"
   470            in: query
   471            required: false
   472            description: "get task with status"
   473            schema:
   474              type: boolean
   475              example: true
   476          - name: "stage"
   477            in: query
   478            required: false
   479            description: "filter by task stage"
   480            schema:
   481              $ref: "#/components/schemas/TaskStage"
   482          - name: source_name_list
   483            in: query
   484            required: false
   485            description: "filter by source name"
   486            schema:
   487              $ref: "#/components/schemas/SourceNameList"
   488        operationId: "DMAPIGetTaskList"
   489        responses:
   490          "200":
   491            description: "task list"
   492            content:
   493              "application/json":
   494                schema:
   495                  $ref: "#/components/schemas/GetTaskListResponse"
   496          "400":
   497            description: "failed"
   498            content:
   499              "application/json":
   500                schema:
   501                  $ref: "#/components/schemas/ErrorWithMessage"
   502    /api/v1/tasks/{task-name}:
   503      get:
   504        tags:
   505          - task
   506        summary: "get a task"
   507        parameters:
   508          - name: task-name
   509            in: path
   510            description: "globally unique task name"
   511            required: true
   512            schema:
   513              type: string
   514              example: "task-1"
   515          - name: "with_status"
   516            in: query
   517            required: false
   518            description: "get task with status"
   519            schema:
   520              type: boolean
   521              example: true
   522        operationId: "DMAPIGetTask"
   523        responses:
   524          "200":
   525            description: "task list"
   526            content:
   527              "application/json":
   528                schema:
   529                  $ref: "#/components/schemas/Task"
   530          "404":
   531            description: "task not found"
   532      delete:
   533        tags:
   534          - task
   535        summary: "delete a task"
   536        operationId: "DMAPIDeleteTask"
   537        parameters:
   538          - name: task-name
   539            in: path
   540            description: "globally unique task name"
   541            required: true
   542            schema:
   543              type: string
   544              example: "task-1"
   545          - name: "force"
   546            in: query
   547            required: false
   548            description: "force stop task even if some subtask is running"
   549            schema:
   550              type: boolean
   551              example: true
   552        responses:
   553          "204":
   554            description: "success"
   555          "400":
   556            description: "failed"
   557            content:
   558              "application/json":
   559                schema:
   560                  $ref: "#/components/schemas/ErrorWithMessage"
   561      put:
   562        tags:
   563          - task
   564        summary: "update a task"
   565        operationId: "DMAPIUpdateTask"
   566        requestBody:
   567          description: "request body"
   568          content:
   569            "application/json":
   570              schema:
   571                $ref: "#/components/schemas/UpdateTaskRequest"
   572        parameters:
   573          - name: task-name
   574            in: path
   575            description: "globally unique task name"
   576            required: true
   577            schema:
   578              type: string
   579              example: "task-1"
   580        responses:
   581          "200":
   582            description: "success"
   583            content:
   584              "application/json":
   585                schema:
   586                  $ref: "#/components/schemas/OperateTaskResponse"
   587          "400":
   588            description: "failed"
   589            content:
   590              "application/json":
   591                schema:
   592                  $ref: "#/components/schemas/ErrorWithMessage"
   593    /api/v1/tasks/{task-name}/status:
   594      get:
   595        tags:
   596          - task
   597        summary: "get task status"
   598        operationId: "DMAPIGetTaskStatus"
   599        parameters:
   600          - name: task-name
   601            in: path
   602            description: "globally unique task name"
   603            required: true
   604            schema:
   605              type: string
   606              example: "task-1"
   607          - name: source_name_list
   608            in: query
   609            description: "source name list"
   610            required: false
   611            schema:
   612              $ref: "#/components/schemas/SourceNameList"
   613        responses:
   614          "200":
   615            description: "success"
   616            content:
   617              "application/json":
   618                schema:
   619                  $ref: "#/components/schemas/GetTaskStatusResponse"
   620          "400":
   621            description: "failed"
   622            content:
   623              "application/json":
   624                schema:
   625                  $ref: "#/components/schemas/ErrorWithMessage"
   626    /api/v1/tasks/{task-name}/start:
   627      post:
   628        tags:
   629          - task
   630        summary: "start a task"
   631        operationId: "DMAPIStartTask"
   632        parameters:
   633          - name: task-name
   634            in: path
   635            description: "globally unique task name"
   636            required: true
   637            schema:
   638              type: string
   639              example: "task-1"
   640        requestBody:
   641          required: false
   642          content:
   643            "application/json":
   644              schema:
   645                $ref: "#/components/schemas/StartTaskRequest"
   646        responses:
   647          "200":
   648            description: "success"
   649          "400":
   650            description: "failed"
   651            content:
   652              "application/json":
   653                schema:
   654                  $ref: "#/components/schemas/ErrorWithMessage"
   655    /api/v1/tasks/{task-name}/stop:
   656      post:
   657        tags:
   658          - task
   659        summary: "stop a task"
   660        operationId: "DMAPIStopTask"
   661        parameters:
   662          - name: task-name
   663            in: path
   664            description: "globally unique task name"
   665            required: true
   666            schema:
   667              type: string
   668              example: "task-1"
   669        requestBody:
   670          required: false
   671          content:
   672            "application/json":
   673              schema:
   674                $ref: "#/components/schemas/StopTaskRequest"
   675        responses:
   676          "200":
   677            description: "success"
   678          "400":
   679            description: "failed"
   680            content:
   681              "application/json":
   682                schema:
   683                  $ref: "#/components/schemas/ErrorWithMessage"
   684  
   685    /api/v1/tasks/{task-name}/sources/{source-name}/migrate_targets:
   686      get:
   687        tags:
   688          - task
   689        summary: "get task source table and target table route relation"
   690        operationId: "DMAPIGetTaskMigrateTargets"
   691        parameters:
   692          - name: task-name
   693            in: path
   694            description: "globally unique task name"
   695            required: true
   696            schema:
   697              type: string
   698              example: "task-1"
   699          - name: source-name
   700            in: path
   701            description: "source name"
   702            required: true
   703            schema:
   704              type: string
   705              example: "source-1"
   706          - name: "schema_pattern"
   707            in: query
   708            required: false
   709            schema:
   710              type: string
   711              example: "db*"
   712          - name: "table_pattern"
   713            in: query
   714            required: false
   715            schema:
   716              type: string
   717              example: "table*"
   718        responses:
   719          "200":
   720            description: "success"
   721            content:
   722              "application/json":
   723                schema:
   724                  $ref: "#/components/schemas/GetTaskMigrateTargetsResponse"
   725          "400":
   726            description: "failed"
   727            content:
   728              "application/json":
   729                schema:
   730                  $ref: "#/components/schemas/ErrorWithMessage"
   731    /api/v1/tasks/{task-name}/sources/{source-name}/schemas:
   732      get:
   733        tags:
   734          - task
   735        summary: "get task source schema list"
   736        operationId: "DMAPIGetSchemaListByTaskAndSource"
   737        parameters:
   738          - name: task-name
   739            in: path
   740            description: "globally unique task name"
   741            required: true
   742            schema:
   743              type: string
   744              example: "task-1"
   745          - name: source-name
   746            in: path
   747            description: "source name"
   748            required: true
   749            schema:
   750              type: string
   751              example: "source-1"
   752        responses:
   753          "200":
   754            description: "success"
   755            content:
   756              "application/json":
   757                schema:
   758                  $ref: "#/components/schemas/SchemaNameList"
   759          "400":
   760            description: "failed"
   761            content:
   762              "application/json":
   763                schema:
   764                  $ref: "#/components/schemas/ErrorWithMessage"
   765    /api/v1/tasks/{task-name}/sources/{source-name}/schemas/{schema-name}:
   766      get:
   767        tags:
   768          - task
   769        summary: "get task source table list"
   770        operationId: "DMAPIGetTableListByTaskAndSource"
   771        parameters:
   772          - name: task-name
   773            in: path
   774            description: "globally unique task name"
   775            required: true
   776            schema:
   777              type: string
   778              example: "task-1"
   779          - name: source-name
   780            in: path
   781            description: "source name"
   782            required: true
   783            schema:
   784              type: string
   785              example: "source-1"
   786          - name: schema-name
   787            in: path
   788            description: "schema name"
   789            required: true
   790            schema:
   791              type: string
   792              example: "db1"
   793        responses:
   794          "200":
   795            description: "success"
   796            content:
   797              application/json:
   798                schema:
   799                  $ref: "#/components/schemas/TableNameList"
   800          "400":
   801            description: "failed"
   802            content:
   803              "application/json":
   804                schema:
   805                  $ref: "#/components/schemas/ErrorWithMessage"
   806    /api/v1/tasks/{task-name}/sources/{source-name}/schemas/{schema-name}/{table-name}:
   807      get:
   808        tags:
   809          - task
   810        summary: "get task source table structure"
   811        operationId: "DMAPIGetTableStructure"
   812        parameters:
   813          - name: task-name
   814            in: path
   815            description: "globally unique task name"
   816            required: true
   817            schema:
   818              type: string
   819              example: "task-1"
   820          - name: source-name
   821            in: path
   822            description: "source name"
   823            required: true
   824            schema:
   825              type: string
   826              example: "source-1"
   827          - name: schema-name
   828            in: path
   829            description: "schema name"
   830            required: true
   831            schema:
   832              type: string
   833              example: "db1"
   834          - name: table-name
   835            in: path
   836            description: "table name"
   837            required: true
   838            schema:
   839              type: string
   840              example: "table1"
   841        responses:
   842          "200":
   843            description: "success"
   844            content:
   845              application/json:
   846                schema:
   847                  $ref: "#/components/schemas/GetTaskTableStructureResponse"
   848          "400":
   849            description: "failed"
   850            content:
   851              "application/json":
   852                schema:
   853                  $ref: "#/components/schemas/ErrorWithMessage"
   854      put:
   855        tags:
   856          - task
   857        summary: "operate task source table structure"
   858        operationId: "DMAPIOperateTableStructure"
   859        parameters:
   860          - name: task-name
   861            in: path
   862            description: "globally unique task name"
   863            required: true
   864            schema:
   865              type: string
   866              example: "task-1"
   867          - name: source-name
   868            in: path
   869            description: "source name"
   870            required: true
   871            schema:
   872              type: string
   873              example: "task-1"
   874          - name: schema-name
   875            in: path
   876            description: "schema name"
   877            required: true
   878            schema:
   879              type: string
   880              example: "db1"
   881          - name: table-name
   882            in: path
   883            description: "table name"
   884            required: true
   885            schema:
   886              type: string
   887              example: "table1"
   888        requestBody:
   889          required: true
   890          content:
   891            "application/json":
   892              schema:
   893                $ref: "#/components/schemas/OperateTaskTableStructureRequest"
   894        responses:
   895          "200":
   896            description: "success"
   897          "400":
   898            description: "failed"
   899            content:
   900              "application/json":
   901                schema:
   902                  $ref: "#/components/schemas/ErrorWithMessage"
   903      delete:
   904        tags:
   905          - task
   906        summary: "delete task source table structure"
   907        operationId: "DMAPIDeleteTableStructure"
   908        parameters:
   909          - name: task-name
   910            in: path
   911            description: "globally unique task name"
   912            required: true
   913            schema:
   914              type: string
   915              example: "task-1"
   916          - name: source-name
   917            in: path
   918            description: "source name"
   919            required: true
   920            schema:
   921              type: string
   922              example: "source-1"
   923          - name: schema-name
   924            in: path
   925            description: "schema name"
   926            required: true
   927            schema:
   928              type: string
   929              example: "db1"
   930          - name: table-name
   931            in: path
   932            description: "table name"
   933            required: true
   934            schema:
   935              type: string
   936              example: "table1"
   937        responses:
   938          "204":
   939            description: "success"
   940          "400":
   941            description: "failed"
   942            content:
   943              "application/json":
   944                schema:
   945                  $ref: "#/components/schemas/ErrorWithMessage"
   946  
   947    /api/v1/tasks/converters:
   948      post:
   949        tags:
   950          - task
   951        summary: "Turn task into the format of a configuration file or vice versa."
   952        operationId: "DMAPIConvertTask"
   953        requestBody:
   954          description: "if task is input this task will be converted to task_config file or vice versa"
   955          content:
   956            "application/json":
   957              schema:
   958                $ref: "#/components/schemas/ConverterTaskRequest"
   959        responses:
   960          "201":
   961            description: "success"
   962            content:
   963              "application/json":
   964                schema:
   965                  $ref: "#/components/schemas/ConverterTaskResponse"
   966          "400":
   967            description: "failed"
   968            content:
   969              "application/json":
   970                schema:
   971                  $ref: "#/components/schemas/ErrorWithMessage"
   972  
   973    /api/v1/tasks/templates:
   974      post:
   975        tags:
   976          - task
   977        summary: "create task template"
   978        operationId: "DMAPICreateTaskTemplate"
   979        requestBody:
   980          description: "request body"
   981          content:
   982            "application/json":
   983              schema:
   984                $ref: "#/components/schemas/Task"
   985        responses:
   986          "201":
   987            description: "success"
   988            content:
   989              "application/json":
   990                schema:
   991                  $ref: "#/components/schemas/Task"
   992          "400":
   993            description: "failed"
   994            content:
   995              "application/json":
   996                schema:
   997                  $ref: "#/components/schemas/ErrorWithMessage"
   998      get:
   999        tags:
  1000          - task
  1001        summary: "get task template list"
  1002        operationId: "DMAPIGetTaskTemplateList"
  1003        responses:
  1004          "200":
  1005            description: "task list"
  1006            content:
  1007              "application/json":
  1008                schema:
  1009                  $ref: "#/components/schemas/GetTaskListResponse"
  1010          "400":
  1011            description: "failed"
  1012            content:
  1013              "application/json":
  1014                schema:
  1015                  $ref: "#/components/schemas/ErrorWithMessage"
  1016    /api/v1/tasks/templates/import:
  1017      post:
  1018        tags:
  1019          - task
  1020        summary: "import task template"
  1021        operationId: "DMAPIImportTaskTemplate"
  1022        requestBody:
  1023          description: "request body"
  1024          content:
  1025            "application/json":
  1026              schema:
  1027                $ref: "#/components/schemas/TaskTemplateRequest"
  1028        responses:
  1029          "202":
  1030            description: "success"
  1031            content:
  1032              "application/json":
  1033                schema:
  1034                  $ref: "#/components/schemas/TaskTemplateResponse"
  1035          "400":
  1036            description: "failed"
  1037            content:
  1038              "application/json":
  1039                schema:
  1040                  $ref: "#/components/schemas/ErrorWithMessage"
  1041    /api/v1/tasks/templates/{task-name}:
  1042      get:
  1043        tags:
  1044          - task
  1045        summary: "get task template template"
  1046        operationId: "DMAPIGetTaskTemplate"
  1047        parameters:
  1048          - name: task-name
  1049            in: path
  1050            description: "globally unique task name"
  1051            required: true
  1052            schema:
  1053              type: string
  1054              example: "task-1"
  1055        responses:
  1056          "200":
  1057            description: "success"
  1058            content:
  1059              "application/json":
  1060                schema:
  1061                  $ref: "#/components/schemas/Task"
  1062          "400":
  1063            description: "failed"
  1064            content:
  1065              "application/json":
  1066                schema:
  1067                  $ref: "#/components/schemas/ErrorWithMessage"
  1068      put:
  1069        tags:
  1070          - task
  1071        summary: "update task template template"
  1072        operationId: "DMAPUpdateTaskTemplate"
  1073        parameters:
  1074          - name: task-name
  1075            in: path
  1076            description: "globally unique task name"
  1077            required: true
  1078            schema:
  1079              type: string
  1080              example: "task-1"
  1081        responses:
  1082          "200":
  1083            description: "success"
  1084            content:
  1085              "application/json":
  1086                schema:
  1087                  $ref: "#/components/schemas/Task"
  1088          "400":
  1089            description: "failed"
  1090            content:
  1091              "application/json":
  1092                schema:
  1093                  $ref: "#/components/schemas/ErrorWithMessage"
  1094      delete:
  1095        tags:
  1096          - task
  1097        summary: "delete task template template"
  1098        operationId: "DMAPIDeleteTaskTemplate"
  1099        parameters:
  1100          - name: task-name
  1101            in: path
  1102            description: "globally unique task name"
  1103            required: true
  1104            schema:
  1105              type: string
  1106              example: "task-1"
  1107        responses:
  1108          "204":
  1109            description: "success"
  1110          "400":
  1111            description: "failed"
  1112            content:
  1113              "application/json":
  1114                schema:
  1115                  $ref: "#/components/schemas/ErrorWithMessage"
  1116  
  1117    /api/v1/cluster/info:
  1118      get:
  1119        tags:
  1120          - cluster
  1121        summary: "get cluster info such as cluster id"
  1122        operationId: "DMAPIGetClusterInfo"
  1123        responses:
  1124          "200":
  1125            description: "success"
  1126            content:
  1127              "application/json":
  1128                schema:
  1129                  $ref: "#/components/schemas/GetClusterInfoResponse"
  1130      put:
  1131        tags:
  1132          - cluster
  1133        summary: "update cluster info."
  1134        operationId: "DMAPIUpdateClusterInfo"
  1135        requestBody:
  1136          description: "request body"
  1137          content:
  1138            "application/json":
  1139              schema:
  1140                $ref: "#/components/schemas/ClusterTopology"
  1141        responses:
  1142          "200":
  1143            description: "success"
  1144            content:
  1145              "application/json":
  1146                schema:
  1147                  $ref: "#/components/schemas/GetClusterInfoResponse"
  1148    /api/v1/cluster/masters:
  1149      get:
  1150        tags:
  1151          - cluster
  1152        summary: "get cluster master node list"
  1153        operationId: "DMAPIGetClusterMasterList"
  1154        responses:
  1155          "200":
  1156            description: "success"
  1157            content:
  1158              "application/json":
  1159                schema:
  1160                  $ref: "#/components/schemas/GetClusterMasterListResponse"
  1161          "400":
  1162            description: "failed"
  1163            content:
  1164              "application/json":
  1165                schema:
  1166                  $ref: "#/components/schemas/ErrorWithMessage"
  1167    /api/v1/cluster/masters/{master-name}:
  1168      delete:
  1169        tags:
  1170          - cluster
  1171        summary: "offline master node"
  1172        operationId: "DMAPIOfflineMasterNode"
  1173        parameters:
  1174          - name: "master-name"
  1175            in: path
  1176            description: "master node name"
  1177            required: true
  1178            schema:
  1179              type: string
  1180              example: "master1"
  1181        responses:
  1182          "204":
  1183            description: "success"
  1184          "400":
  1185            description: "failed"
  1186            content:
  1187              "application/json":
  1188                schema:
  1189                  $ref: "#/components/schemas/ErrorWithMessage"
  1190    /api/v1/cluster/workers:
  1191      get:
  1192        tags:
  1193          - cluster
  1194        summary: "get cluster worker node list"
  1195        operationId: "DMAPIGetClusterWorkerList"
  1196        responses:
  1197          "200":
  1198            description: "success"
  1199            content:
  1200              "application/json":
  1201                schema:
  1202                  $ref: "#/components/schemas/GetClusterWorkerListResponse"
  1203          "400":
  1204            description: "failed"
  1205            content:
  1206              "application/json":
  1207                schema:
  1208                  $ref: "#/components/schemas/ErrorWithMessage"
  1209    /api/v1/cluster/workers/{worker-name}:
  1210      delete:
  1211        tags:
  1212          - cluster
  1213        summary: "offline worker node"
  1214        operationId: "DMAPIOfflineWorkerNode"
  1215        parameters:
  1216          - name: "worker-name"
  1217            in: path
  1218            description: "worker node name"
  1219            required: true
  1220            schema:
  1221              type: string
  1222              example: "master1"
  1223        responses:
  1224          "204":
  1225            description: "success"
  1226          "400":
  1227            description: "failed"
  1228            content:
  1229              "application/json":
  1230                schema:
  1231                  $ref: "#/components/schemas/ErrorWithMessage"
  1232  
  1233  components:
  1234    schemas:
  1235      ErrorWithMessage:
  1236        description: "operation error"
  1237        type: object
  1238        properties:
  1239          error_msg:
  1240            type: string
  1241            description: "error message"
  1242          error_code:
  1243            type: integer
  1244            description: "error code"
  1245        required:
  1246          - "error_msg"
  1247          - "error_code"
  1248  
  1249      Security:
  1250        type: object
  1251        description: "data source ssl configuration, the field will be hidden when getting the data source configuration from the interface"
  1252        nullable: true
  1253        properties:
  1254          ssl_ca_content:
  1255            type: string
  1256            example: ""
  1257            description: "certificate file content"
  1258          ssl_cert_content:
  1259            type: string
  1260            example: ""
  1261            description: "File content of PEM format/X509 format certificates"
  1262          ssl_key_content:
  1263            type: string
  1264            example: ""
  1265            description: "Content of the private key file in X509 format"
  1266          cert_allowed_cn:
  1267            type: array
  1268            description: "Common Name of SSL certificates"
  1269            items:
  1270              type: string
  1271        required:
  1272          - "ssl_ca_content"
  1273          - "ssl_cert_content"
  1274          - "ssl_key_content"
  1275      Purge:
  1276        description: "relay log cleanup policy configuration"
  1277        type: object
  1278        properties:
  1279          interval:
  1280            type: integer
  1281            default: 3600
  1282            description: "The interval to periodically check if the relay log is expired, default value: 3600, in seconds"
  1283            format: int64
  1284            nullable: true
  1285          expires:
  1286            type: integer
  1287            default: 0
  1288            description: "expiration time of relay log"
  1289            format: int64
  1290            nullable: true
  1291          remain_space:
  1292            type: integer
  1293            default: 15
  1294            description: "Minimum free disk space, in GB"
  1295            format: int64
  1296            nullable: true
  1297      RelayStatus:
  1298        description: "status of relay log"
  1299        type: object
  1300        properties:
  1301          master_binlog:
  1302            type: string
  1303            example: "(mysql-bin.000001, 1979)"
  1304            description: "upstream binlog file information"
  1305          master_binlog_gtid:
  1306            type: string
  1307            example: "e9a1fc22-ec08-11e9-b2ac-0242ac110003:1-7849"
  1308            description: "GTID of the upstream"
  1309          relay_dir:
  1310            type: string
  1311            description: "the directory where the relay log is stored"
  1312            example: "./sub_dir"
  1313          relay_binlog_gtid:
  1314            type: string
  1315            example: "e9a1fc22-ec08-11e9-b2ac-0242ac110003:1-7849"
  1316            description: "relay current GTID"
  1317          relay_catch_up_master:
  1318            type: boolean
  1319            description: "whether to catch up with upstream progress"
  1320          stage:
  1321            type: string
  1322            description: "current status"
  1323            example: "Running"
  1324        required:
  1325          - "master_binlog"
  1326          - "master_binlog_gtid"
  1327          - "relay_dir"
  1328          - "relay_binlog_gtid"
  1329          - "relay_catch_up_master"
  1330          - "stage"
  1331      SourceStatus:
  1332        description: "source status"
  1333        type: object
  1334        properties:
  1335          source_name:
  1336            type: string
  1337            example: "mysql-replica-01"
  1338            description: "source name"
  1339          worker_name:
  1340            type: string
  1341            example: "worker-1"
  1342            description: "The worker currently bound to the source"
  1343          relay_status:
  1344            $ref: "#/components/schemas/RelayStatus"
  1345          error_msg:
  1346            type: string
  1347            description: "error message when something wrong"
  1348        required:
  1349          - "source_name"
  1350          - "worker_name"
  1351      Source:
  1352        type: object
  1353        description: "source"
  1354        properties:
  1355          source_name:
  1356            type: string
  1357            example: "mysql-01"
  1358            description: "source name"
  1359            nullable: false
  1360          host:
  1361            type: string
  1362            example: "127.0.0.1"
  1363            description: "source address"
  1364            nullable: false
  1365          port:
  1366            type: integer
  1367            example: 3306
  1368            description: "source port"
  1369            nullable: false
  1370          user:
  1371            type: string
  1372            example: "root"
  1373            description: "source username"
  1374            nullable: false
  1375          password:
  1376            type: string
  1377            example: "123456"
  1378            description: "source password"
  1379            nullable: true
  1380          enable_gtid:
  1381            type: boolean
  1382            example: false
  1383            default: false
  1384            description: "whether to use GTID to pull binlogs from upstream"
  1385            nullable: false
  1386          enable:
  1387            type: boolean
  1388            example: false
  1389            default: false
  1390            description: "whether this source is enabled"
  1391            nullable: false
  1392          flavor:
  1393            type: string
  1394            example: mysql
  1395            description: "flavor of this source"
  1396          task_name_list:
  1397            $ref: "#/components/schemas/TaskNameList"
  1398          security:
  1399            $ref: "#/components/schemas/Security"
  1400          purge:
  1401            $ref: "#/components/schemas/Purge"
  1402          status_list:
  1403            type: array
  1404            items:
  1405              $ref: "#/components/schemas/SourceStatus"
  1406          relay_config:
  1407            $ref: "#/components/schemas/RelayConfig"
  1408        required:
  1409          - "source_name"
  1410          - "host"
  1411          - "port"
  1412          - "user"
  1413          - "enable_gtid"
  1414          - "enable"
  1415      ShardingGroup:
  1416        type: object
  1417        properties:
  1418          target:
  1419            type: string
  1420          ddl_list:
  1421            type: array
  1422            items:
  1423              type: string
  1424            description: ""
  1425          first_location:
  1426            type: string
  1427          synced:
  1428            type: array
  1429            items:
  1430              type: string
  1431            description: ""
  1432          unsynced:
  1433            type: array
  1434            items:
  1435              type: string
  1436            description: ""
  1437        required:
  1438          - "target"
  1439          - "ddl_list"
  1440          - "first_location"
  1441          - "synced"
  1442          - "unsynced"
  1443      LoadStatus:
  1444        type: object
  1445        description: "status of load unit"
  1446        properties:
  1447          finished_bytes:
  1448            type: integer
  1449            format: int64
  1450          total_bytes:
  1451            type: integer
  1452            format: int64
  1453          progress:
  1454            type: string
  1455          meta_binlog:
  1456            type: string
  1457          meta_binlog_gtid:
  1458            type: string
  1459        required:
  1460          - "finished_bytes"
  1461          - "total_bytes"
  1462          - "progress"
  1463          - "meta_binlog"
  1464          - "meta_binlog_gtid"
  1465      SyncStatus:
  1466        type: object
  1467        description: "status of sync unit"
  1468        properties:
  1469          total_events:
  1470            type: integer
  1471            format: int64
  1472          total_tps:
  1473            type: integer
  1474            format: int64
  1475          recent_tps:
  1476            type: integer
  1477            format: int64
  1478          master_binlog:
  1479            type: string
  1480          master_binlog_gtid:
  1481            type: string
  1482          syncer_binlog:
  1483            type: string
  1484          syncer_binlog_gtid:
  1485            type: string
  1486          blocking_ddls:
  1487            type: array
  1488            items:
  1489              type: string
  1490            description: sharding DDL which current is blocking
  1491          unresolved_groups:
  1492            type: array
  1493            items:
  1494              $ref: "#/components/schemas/ShardingGroup"
  1495            description: sharding groups which current are un-resolved
  1496          synced:
  1497            type: boolean
  1498          binlog_type:
  1499            type: string
  1500          seconds_behind_master:
  1501            type: integer
  1502            format: int64
  1503        required:
  1504          - "total_events"
  1505          - "total_tps"
  1506          - "recent_tps"
  1507          - "master_binlog"
  1508          - "master_binlog_gtid"
  1509          - "syncer_binlog"
  1510          - "syncer_binlog_gtid"
  1511          - "blocking_ddls"
  1512          - "unresolved_groups"
  1513          - "synced"
  1514          - "binlog_type"
  1515          - "seconds_behind_master"
  1516      DumpStatus:
  1517        type: object
  1518        description: "status of dump unit"
  1519        properties:
  1520          total_tables:
  1521            type: integer
  1522            format: int64
  1523          completed_tables:
  1524            type: number
  1525            format: double
  1526          finished_bytes:
  1527            type: number
  1528            format: double
  1529          finished_rows:
  1530            type: number
  1531            format: double
  1532          estimate_total_rows:
  1533            type: number
  1534            format: double
  1535        required:
  1536          - "total_tables"
  1537          - "completed_tables"
  1538          - "finished_bytes"
  1539          - "finished_rows"
  1540          - "estimate_total_rows"
  1541      SubTaskStatus:
  1542        type: object
  1543        properties:
  1544          name:
  1545            type: string
  1546            description: task name
  1547          source_name:
  1548            type: string
  1549            description: source name
  1550          worker_name:
  1551            type: string
  1552            description: worker name
  1553          stage:
  1554            $ref: "#/components/schemas/TaskStage"
  1555          unit:
  1556            type: string
  1557            example: "sync"
  1558            description: "task unit type"
  1559          unresolved_ddl_lock_id:
  1560            type: string
  1561          load_status:
  1562            nullable: true
  1563            $ref: "#/components/schemas/LoadStatus"
  1564          sync_status:
  1565            nullable: true
  1566            $ref: "#/components/schemas/SyncStatus"
  1567          dump_status:
  1568            nullable: true
  1569            $ref: "#/components/schemas/DumpStatus"
  1570          error_msg:
  1571            type: string
  1572            description: "error message when something wrong"
  1573        required:
  1574          - "name"
  1575          - "source_name"
  1576          - "worker_name"
  1577          - "stage"
  1578          - "unit"
  1579      TaskTargetDataBase:
  1580        type: object
  1581        description: "downstream database configuration"
  1582        properties:
  1583          host:
  1584            type: string
  1585            example: "127.0.0.1"
  1586            description: "source address"
  1587          port:
  1588            type: integer
  1589            example: 3306
  1590            description: "source port"
  1591          user:
  1592            type: string
  1593            example: "root"
  1594            description: "source username"
  1595          password:
  1596            type: string
  1597            example: "123456"
  1598            description: "source password"
  1599          security:
  1600            $ref: "#/components/schemas/Security"
  1601        required:
  1602          - "host"
  1603          - "port"
  1604          - "user"
  1605          - "password"
  1606      TaskBinLogFilterRule:
  1607        description: "Filtering rules at binlog level"
  1608        type: object
  1609        properties:
  1610          ignore_event:
  1611            description: "event type"
  1612            type: array
  1613            items:
  1614              type: string
  1615              description: "event type"
  1616              example: "all dml"
  1617          ignore_sql:
  1618            description: "sql pattern to filter"
  1619            type: array
  1620            items:
  1621              type: string
  1622              description: "sql pattern to filter"
  1623              example: "^Drop"
  1624      TaskTableMigrateRule:
  1625        type: object
  1626        description: "upstream table to downstream migrate rules"
  1627        properties:
  1628          source:
  1629            type: object
  1630            description: source-related configuration
  1631            properties:
  1632              source_name:
  1633                type: string
  1634                description: source name
  1635                example: "source-name"
  1636              schema:
  1637                type: string
  1638                description: schema name, wildcard support
  1639                example: "db-*"
  1640              table:
  1641                type: string
  1642                description: table name, wildcard support
  1643                example: "tb-*"
  1644            required:
  1645              - "source_name"
  1646              - "schema"
  1647              - "table"
  1648          target:
  1649            type: object
  1650            description: downstream-related configuration
  1651            properties:
  1652              schema:
  1653                type: string
  1654                description: schema name, does not support wildcards
  1655                example: "db1"
  1656              table:
  1657                type: string
  1658                description: table name, does not support wildcards
  1659                example: "tb1"
  1660          binlog_filter_rule:
  1661            type: array
  1662            description: "filter rule name"
  1663            items:
  1664              type: string
  1665              example: rule-1
  1666        required:
  1667          - "source"
  1668      TaskFullMigrateConf:
  1669        description: configuration of full migrate tasks
  1670        type: object
  1671        properties:
  1672          export_threads:
  1673            type: integer
  1674            description: full export of concurrent
  1675            default: 4
  1676          import_threads:
  1677            type: integer
  1678            description: full import of concurrent
  1679            default: 16
  1680          data_dir:
  1681            type: string
  1682            example: "./exported_data"
  1683            description: "storage dir name"
  1684          consistency:
  1685            type: string
  1686            example: "auto"
  1687            description: "to control the way in which data is exported for consistency assurance"
  1688          import_mode:
  1689            type: string
  1690            example: "logical"
  1691            description: "to control import mode of full import"
  1692            enum:
  1693              - "logical"
  1694              - "physical"
  1695          sorting_dir:
  1696            type: string
  1697            example: "./sort_dir"
  1698            description: "sorting dir name for physical import"
  1699          disk_quota:
  1700            type: string
  1701            example: "80G"
  1702            description: "disk quota for physical import"
  1703          checksum:
  1704            type: string
  1705            example: "optional"
  1706            description: "to control checksum of physical import"
  1707            enum:
  1708              - "required"
  1709              - "optional"
  1710              - "off"
  1711          analyze:
  1712            type: string
  1713            example: "optional"
  1714            description: "to control checksum of physical import"
  1715            enum:
  1716              - "required"
  1717              - "optional"
  1718              - "off"
  1719          range_concurrency:
  1720            type: integer
  1721            description: "to control range concurrency of physical import"
  1722            default: 0
  1723          compress-kv-pairs:
  1724            type: string
  1725            description: "to control compress kv pairs of physical import"
  1726          pd_addr:
  1727            type: string
  1728            description: "address of pd"
  1729          on_duplicate_logical:
  1730            type: string
  1731            example: "replace"
  1732            description: "to control the duplication resolution when meet duplicate rows for logical import"
  1733            enum:
  1734              - "replace"
  1735              - "error"
  1736              - "ignore"
  1737          on_duplicate_physical:
  1738            type: string
  1739            example: "none"
  1740            description: "to control the duplication resolution when meet duplicate rows for physical import"
  1741            enum:
  1742              - "none"
  1743              - "manual"
  1744      TaskIncrMigrateConf:
  1745        description: configuration of incremental tasks
  1746        type: object
  1747        properties:
  1748          repl_threads:
  1749            type: integer
  1750            description: incremental task of concurrent
  1751            default: 16
  1752          repl_batch:
  1753            type: integer
  1754            description: incremental synchronization of batch execution sql quantities
  1755            default: 100
  1756      TaskSourceConf:
  1757        type: object
  1758        properties:
  1759          source_name:
  1760            type: string
  1761            example: "mysql-replica-01"
  1762            description: "source name"
  1763          binlog_name:
  1764            type: string
  1765            example: "binlog.000001"
  1766          binlog_pos:
  1767            type: integer
  1768            example: 4
  1769          binlog_gtid:
  1770            type: string
  1771            example: "03fc0263-28c7-11e7-a653-6c0b84d59f30:1-7041423,05474d3c-28c7-11e7-8352-203db246dd3d:1-170"
  1772        required:
  1773          - "source_name"
  1774      TaskSourceConfig:
  1775        type: object
  1776        description: "source-related configuration"
  1777        properties:
  1778          full_migrate_conf:
  1779            $ref: "#/components/schemas/TaskFullMigrateConf"
  1780          incr_migrate_conf:
  1781            $ref: "#/components/schemas/TaskIncrMigrateConf"
  1782          source_conf:
  1783            type: array
  1784            description: "source configuration"
  1785            items:
  1786              $ref: "#/components/schemas/TaskSourceConf"
  1787        required:
  1788          - "source_conf"
  1789      TaskCheckerConfig:
  1790        type: object
  1791        description: "task status checker configuration"
  1792        properties:
  1793          enable:
  1794            type: boolean
  1795            example: false
  1796            default: true
  1797            description: "determines whether to enable task status checker"
  1798          backoff_max:
  1799            type: string
  1800            example: "5m0s"
  1801            description: "sets the longest time interval for the automatic recovery after errors are detected."
  1802          backoff_rollback:
  1803            type: string
  1804            example: "5m0s"
  1805            description: "sets the time interval for adjusting the waiting time of the automatic recovery."
  1806      TaskStage:
  1807        type: string
  1808        enum:
  1809          - Stopped
  1810          - Running
  1811          - Finished
  1812      Task:
  1813        description: "task"
  1814        type: object
  1815        properties:
  1816          name:
  1817            type: string
  1818            example: "task-1"
  1819            description: "task name"
  1820          task_mode:
  1821            type: string
  1822            example: "all"
  1823            description: "migrate mode"
  1824            enum:
  1825              - "full"
  1826              - "incremental"
  1827              - "all"
  1828          shard_mode:
  1829            type: string
  1830            description: the way to coordinate DDL
  1831            enum:
  1832              - "pessimistic"
  1833              - "optimistic"
  1834          strict_optimistic_shard_mode:
  1835            type: boolean
  1836            example: true
  1837            description: "whether to enable strict optimistic shard mode"
  1838            default: false
  1839          meta_schema:
  1840            type: string
  1841            example: "dm-meta"
  1842            description: "downstream database for storing meta information"
  1843            default: "dm-meta"
  1844          enhance_online_schema_change:
  1845            type: boolean
  1846            example: true
  1847            description: whether to enable support for the online ddl plugin
  1848            default: true
  1849          on_duplicate:
  1850            type: string
  1851            description: "how to handle conflicted data"
  1852            enum:
  1853              - "replace"
  1854              - "error"
  1855              - "ignore"
  1856          target_config:
  1857            $ref: "#/components/schemas/TaskTargetDataBase"
  1858          binlog_filter_rule:
  1859            type: object
  1860            additionalProperties:
  1861              $ref: "#/components/schemas/TaskBinLogFilterRule"
  1862          table_migrate_rule:
  1863            type: array
  1864            description: "table migrate rule"
  1865            items:
  1866              $ref: "#/components/schemas/TaskTableMigrateRule"
  1867          source_config:
  1868            $ref: "#/components/schemas/TaskSourceConfig"
  1869          status_list:
  1870            type: array
  1871            items:
  1872              $ref: "#/components/schemas/SubTaskStatus"
  1873          ignore_checking_items:
  1874            type: array
  1875            description: "ignore precheck items"
  1876            items:
  1877              type: string
  1878              example: "version"
  1879        required:
  1880          - "name"
  1881          - "task_mode"
  1882          - "enhance_online_schema_change"
  1883          - "on_duplicate"
  1884          - "target_config"
  1885          - "table_migrate_rule"
  1886          - "source_config"
  1887  
  1888      ClusterMaster:
  1889        type: object
  1890        properties:
  1891          name:
  1892            type: string
  1893            example: master1
  1894          alive:
  1895            type: boolean
  1896            example: true
  1897            description: "online status of this master"
  1898          leader:
  1899            type: boolean
  1900            example: true
  1901            description: "is this master the leader"
  1902          addr:
  1903            type: string
  1904            example: "127.0.0.1:8261"
  1905            description: "address of the current master node"
  1906        required:
  1907          - "name"
  1908          - "alive"
  1909          - "leader"
  1910          - "addr"
  1911      ClusterWorker:
  1912        type: object
  1913        properties:
  1914          name:
  1915            type: string
  1916            example: worker1
  1917          addr:
  1918            type: string
  1919            example: "127.0.0.1:8261"
  1920            description: "address of the current master node"
  1921          bound_stage:
  1922            type: string
  1923            example: "bound"
  1924            description: "bound stage of this worker node"
  1925          bound_source_name:
  1926            type: string
  1927            example: "mysql-01"
  1928            description: "source name bound to this worker node"
  1929        required:
  1930          - "name"
  1931          - "addr"
  1932          - "bound_stage"
  1933          - "bound_source_name"
  1934  
  1935      MasterTopology:
  1936        type: object
  1937        properties:
  1938          name:
  1939            type: string
  1940            example: master
  1941          host:
  1942            type: string
  1943            example: "127.0.0.1"
  1944          port:
  1945            type: integer
  1946            example: 8261
  1947        required:
  1948          - "name"
  1949          - "host"
  1950          - "port"
  1951      WorkerTopology:
  1952        type: object
  1953        properties:
  1954          name:
  1955            type: string
  1956            example: worker1
  1957          host:
  1958            type: string
  1959            example: "127.0.0.1"
  1960          port:
  1961            type: integer
  1962            example: 8261
  1963        required:
  1964          - "name"
  1965          - "host"
  1966          - "port"
  1967      GrafanaTopology:
  1968        type: object
  1969        properties:
  1970          host:
  1971            type: string
  1972            example: "127.0.0.1"
  1973          port:
  1974            type: integer
  1975            example: 3000
  1976        required:
  1977          - "host"
  1978          - "port"
  1979      PrometheusTopology:
  1980        type: object
  1981        properties:
  1982          host:
  1983            type: string
  1984            example: "127.0.0.1"
  1985          port:
  1986            type: integer
  1987            example: 9090
  1988        required:
  1989          - "host"
  1990          - "port"
  1991      AlertManagerTopology:
  1992        type: object
  1993        properties:
  1994          host:
  1995            type: string
  1996            example: "127.0.0.1"
  1997          port:
  1998            type: integer
  1999            example: 9093
  2000        required:
  2001          - "host"
  2002          - "port"
  2003      ClusterTopology:
  2004        type: object
  2005        properties:
  2006          master_topology_list:
  2007            type: array
  2008            items:
  2009              $ref: "#/components/schemas/MasterTopology"
  2010          worker_topology_list:
  2011            type: array
  2012            items:
  2013              $ref: "#/components/schemas/WorkerTopology"
  2014          grafana_topology:
  2015            $ref: "#/components/schemas/GrafanaTopology"
  2016          prometheus_topology:
  2017            $ref: "#/components/schemas/PrometheusTopology"
  2018          alert_manager_topology:
  2019            $ref: "#/components/schemas/AlertManagerTopology"
  2020      WorkerNameList:
  2021        description: worker name list
  2022        type: array
  2023        items:
  2024          type: string
  2025          example: "worker-1"
  2026      SourceNameList:
  2027        description: source name list
  2028        type: array
  2029        items:
  2030          type: string
  2031          example: "source-1"
  2032      SchemaNameList:
  2033        description: schema name list
  2034        type: array
  2035        items:
  2036          type: string
  2037          example: "db1"
  2038      TableNameList:
  2039        description: schema name list
  2040        type: array
  2041        items:
  2042          type: string
  2043          example: "table1"
  2044      TaskNameList:
  2045        description: task name list
  2046        type: array
  2047        items:
  2048          type: string
  2049          example: "task1"
  2050  
  2051      RelayConfig:
  2052        description: the config of relay
  2053        type: object
  2054        properties:
  2055          enable_relay:
  2056            type: boolean
  2057          relay_binlog_name:
  2058            type: string
  2059            example: "mysql-bin.000002"
  2060            description: "starting filename of the upstream binlog"
  2061            nullable: true
  2062          relay_binlog_gtid:
  2063            type: string
  2064            example: "e9a1fc22-ec08-11e9-b2ac-0242ac110003:1-7849"
  2065            description: "starting GTID of the upstream binlog"
  2066            nullable: true
  2067          relay_dir:
  2068            type: string
  2069            default: "./relay_log"
  2070            description: "the directory where the relay log is stored"
  2071            nullable: true
  2072  
  2073      WorkerNameRequest:
  2074        description: requests related to workers
  2075        type: object
  2076        properties:
  2077          worker_name:
  2078            type: string
  2079            example: "worker-1"
  2080            description: "worker name"
  2081        required:
  2082          - "worker_name"
  2083      EnableRelayRequest:
  2084        description: action to start a relay request
  2085        type: object
  2086        properties:
  2087          worker_name_list:
  2088            $ref: "#/components/schemas/WorkerNameList"
  2089          relay_binlog_name:
  2090            type: string
  2091            example: "mysql-bin.000002"
  2092            description: "starting filename of the upstream binlog"
  2093            nullable: true
  2094          relay_binlog_gtid:
  2095            type: string
  2096            example: "e9a1fc22-ec08-11e9-b2ac-0242ac110003:1-7849"
  2097            description: "starting GTID of the upstream binlog"
  2098            nullable: true
  2099          relay_dir:
  2100            type: string
  2101            default: "./relay_log"
  2102            description: "the directory where the relay log is stored"
  2103            nullable: true
  2104      DisableRelayRequest:
  2105        description: action to stop a relay request
  2106        type: object
  2107        properties:
  2108          worker_name_list:
  2109            $ref: "#/components/schemas/WorkerNameList"
  2110      PurgeRelayRequest:
  2111        description: action to stop a relay request
  2112        type: object
  2113        properties:
  2114          relay_binlog_name:
  2115            type: string
  2116            example: "mysql-bin.000002"
  2117            description: "starting filename of the upstream binlog"
  2118          relay_dir:
  2119            type: string
  2120            description: "specify relay sub directory for relay_binlog_name. If not specified, the latest one will be used. Sample format: 2ae76434-f79f-11e8-bde2-0242ac130008.000001"
  2121            nullable: true
  2122        required:
  2123          - "relay_binlog_name"
  2124  
  2125      CreateSourceRequest:
  2126        type: object
  2127        properties:
  2128          source:
  2129            $ref: "#/components/schemas/Source"
  2130          worker_name:
  2131            type: string
  2132            example: worker-1
  2133        required:
  2134          - "source"
  2135      UpdateSourceRequest:
  2136        type: object
  2137        properties:
  2138          source:
  2139            $ref: "#/components/schemas/Source"
  2140        required:
  2141          - "source"
  2142      GetSourceListResponse:
  2143        type: object
  2144        properties:
  2145          total:
  2146            type: integer
  2147          data:
  2148            type: array
  2149            items:
  2150              $ref: "#/components/schemas/Source"
  2151        required:
  2152          - "total"
  2153          - "data"
  2154      GetSourceStatusResponse:
  2155        type: object
  2156        properties:
  2157          total:
  2158            type: integer
  2159          data:
  2160            type: array
  2161            items:
  2162              $ref: "#/components/schemas/SourceStatus"
  2163        required:
  2164          - "total"
  2165          - "data"
  2166  
  2167      ConverterTaskRequest:
  2168        type: object
  2169        properties:
  2170          task:
  2171            $ref: "#/components/schemas/Task"
  2172          task_config_file:
  2173            type: string
  2174            description: config file in yaml format https://docs.pingcap.com/zh/tidb/stable/task-configuration-file-full.
  2175      ConverterTaskResponse:
  2176        type: object
  2177        properties:
  2178          task:
  2179            $ref: "#/components/schemas/Task"
  2180          task_config_file:
  2181            type: string
  2182            description: config file in yaml format https://docs.pingcap.com/zh/tidb/stable/task-configuration-file-full.
  2183        required:
  2184          - "task"
  2185          - "task_config_file"
  2186  
  2187      TaskMigrateTarget:
  2188        type: object
  2189        description: "task migrate targets"
  2190        properties:
  2191          source_schema:
  2192            type: string
  2193            example: "db1"
  2194          source_table:
  2195            type: string
  2196            example: "tb1"
  2197          target_schema:
  2198            type: string
  2199            example: "db1"
  2200          target_table:
  2201            type: string
  2202            example: "tb1"
  2203        required:
  2204          - "source_schema"
  2205          - "source_table"
  2206          - "target_schema"
  2207          - "target_table"
  2208      GetTaskMigrateTargetsResponse:
  2209        type: object
  2210        properties:
  2211          total:
  2212            type: integer
  2213          data:
  2214            type: array
  2215            items:
  2216              $ref: "#/components/schemas/TaskMigrateTarget"
  2217        required:
  2218          - "total"
  2219          - "data"
  2220  
  2221      CreateTaskRequest:
  2222        type: object
  2223        properties:
  2224          task:
  2225            $ref: "#/components/schemas/Task"
  2226        required:
  2227          - "task"
  2228      StartTaskRequest:
  2229        type: object
  2230        properties:
  2231          remove_meta:
  2232            type: boolean
  2233            default: false
  2234            description: whether to remove meta database in downstream database
  2235          source_name_list:
  2236            $ref: "#/components/schemas/SourceNameList"
  2237          start_time:
  2238            type: string
  2239            example: "2006-01-02 15:04:05"
  2240            description: task start time
  2241          safe_mode_time_duration:
  2242            type: string
  2243            example: "10s"
  2244            description: time duration of safe mode
  2245      StopTaskRequest:
  2246        type: object
  2247        properties:
  2248          timeout_duration:
  2249            type: string
  2250            example: "15s"
  2251            description: time duration waiting task stop
  2252          source_name_list:
  2253            $ref: "#/components/schemas/SourceNameList"
  2254      UpdateTaskRequest:
  2255        type: object
  2256        properties:
  2257          task:
  2258            $ref: "#/components/schemas/Task"
  2259        required:
  2260          - "task"
  2261      OperateTaskTableStructureRequest:
  2262        description: action to operate table request
  2263        type: object
  2264        properties:
  2265          sql_content:
  2266            type: string
  2267            example: "CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL, `c3` int(11) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;"
  2268            description: "sql you want to operate"
  2269          flush:
  2270            type: boolean
  2271            default: true
  2272            description: "Writes the schema to the checkpoint so that DM can load it after restarting the task"
  2273          sync:
  2274            type: boolean
  2275            description: "Updates the optimistic sharding metadata with this schema only used when an error occurs in the optimistic sharding DDL mode"
  2276        required:
  2277          - "sql_content"
  2278      OperateTaskResponse:
  2279        type: object
  2280        properties: 
  2281          task:
  2282            $ref: "#/components/schemas/Task"
  2283          check_result:
  2284            type: string
  2285            description: "pre-check result"
  2286            example: "pre-check is passed. "
  2287        required:
  2288          - "task"
  2289          - "check_result"
  2290      GetTaskListResponse:
  2291        type: object
  2292        properties:
  2293          total:
  2294            type: integer
  2295          data:
  2296            type: array
  2297            items:
  2298              $ref: "#/components/schemas/Task"
  2299        required:
  2300          - "total"
  2301          - "data"
  2302      GetTaskStatusResponse:
  2303        type: object
  2304        properties:
  2305          total:
  2306            type: integer
  2307          data:
  2308            type: array
  2309            items:
  2310              $ref: "#/components/schemas/SubTaskStatus"
  2311        required:
  2312          - "total"
  2313          - "data"
  2314      GetTaskTableStructureResponse:
  2315        type: object
  2316        properties:
  2317          schema_name:
  2318            type: string
  2319            example: "db1"
  2320          table_name:
  2321            type: string
  2322            example: "table1"
  2323          schema_create_sql:
  2324            type: string
  2325            example: "CREATE TABLE `t1` (`id` int(11) NOT NULL AUTO_INCREMENT,PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"
  2326        required:
  2327          - "table_name"
  2328          - "table_create_sql"
  2329  
  2330      GetClusterWorkerListResponse:
  2331        type: object
  2332        properties:
  2333          total:
  2334            type: integer
  2335          data:
  2336            type: array
  2337            items:
  2338              $ref: "#/components/schemas/ClusterWorker"
  2339        required:
  2340          - "total"
  2341          - "data"
  2342      GetClusterMasterListResponse:
  2343        type: object
  2344        properties:
  2345          total:
  2346            type: integer
  2347          data:
  2348            type: array
  2349            items:
  2350              $ref: "#/components/schemas/ClusterMaster"
  2351        required:
  2352          - "total"
  2353          - "data"
  2354  
  2355      TaskTemplateRequest:
  2356        type: object
  2357        properties:
  2358          overwrite:
  2359            type: boolean
  2360            default: false
  2361            description: whether to overwrite task template template
  2362        required:
  2363          - "overwrite"
  2364      TaskTemplateResponse:
  2365        type: object
  2366        properties:
  2367          success_task_list:
  2368            type: array
  2369            items:
  2370              type: string
  2371          failed_task_list:
  2372            type: array
  2373            items:
  2374              type: object
  2375              properties:
  2376                task_name:
  2377                  type: string
  2378                error_msg:
  2379                  type: string
  2380              required:
  2381                - "task_name"
  2382                - "error_msg"
  2383        required:
  2384          - "success_task_list"
  2385          - "failed_task_list"
  2386      GetClusterInfoResponse:
  2387        type: object
  2388        properties:
  2389          cluster_id:
  2390            type: integer
  2391            format: uint64
  2392            description: "cluster id"
  2393          topology:
  2394            $ref: "#/components/schemas/ClusterTopology"
  2395        required:
  2396          - "cluster_id"