Skip to content

Latest commit

 

History

History
526 lines (443 loc) · 14.9 KB

remote-replication.md

File metadata and controls

526 lines (443 loc) · 14.9 KB

分发接口

[toc]

创建远端集群分发配置

  • API: POST /replication/api/remote/distribution/create/{projectId}/{repoName}

  • API 名称: remote_distribution_create

  • 功能说明:

    • 中文:创建远端集群分发配置
    • English:remote distribution create
  • 请求体:

    新建异构分发任务
    {
      "configs":[
      {
      "name": "mirrors",
      "registry":"{registry-host}/{repository}",
      "username":"***",
      "password":"****",
      "packageConstraints": [],
      "pathConstraints": [],
      "replicaType": "REAL_TIME",
      "setting": {
        "rateLimit": 0,
        "includeMetadata": true,
        "conflictStrategy": "SKIP",
        "errorStrategy": "CONTINUE",
        "executionStrategy": "IMMEDIATELY",
        "executionPlan": {
          "executeImmediately": true
        }
      },
      "enable": true,
      "description": "test replica task"
     }
    ]
    }
    已有同构分发集群
    {
      "configs":[
      {
      "name": "mirrors",
      "clusterId":"xxxx",
      "remoteProjectId":"xxxx",
      "remoteRepoName":"xxxx",
      "packageConstraints": [],
      "pathConstraints": [],
      "replicaType": "REAL_TIME",
      "setting": {
        "rateLimit": 0,
        "includeMetadata": true,
        "conflictStrategy": "SKIP",
        "errorStrategy": "CONTINUE",
        "executionStrategy": "IMMEDIATELY",
        "executionPlan": {
          "executeImmediately": true
        }
      },
      "enable": true,
      "description": "test replica task"
     }
    ]
    }
  • 请求字段说明

    字段 类型 是否必须 默认值 说明 Description
    projectId string 项目id the project Id
    repoName string 仓库名称 the repoName
    name string 远端源名称 name
    clusterId string 集群id,与registry互斥,必须存在一个 clusterId
    registry string 远端源地址,与clusterId互斥,必须存在一个 registry
    username string 用户名, 当registry不为空时配置,可为空 username
    password string 密码,当registry不为空时配置,可为空 password
    certificate string 证书,当registry不为空时配置,可为空 certificate
    remoteProjectId string 远端项目id,当clusterId不为空时必填 remote ProjectId
    remoteRepoName string 远端仓库id,当clusterId不为空时必填 remote RepoName
    packageConstraints list 包限制 package constraints
    pathConstraints list 路径限制 path constraints
    replicaType enum REAL_TIME [SCHEDULED,REAL_TIME] replication type
    setting object 计划相关设置 task setting
    enable bool true 计划是否启动 do task enable
    description sting 描述 description
  • setting对象说明

    字段 类型 是否必须 默认值 说明 Description
    rateLimit long 0 分发限速 rate limit
    includeMetadata bool true 是否同步元数据 do include metadata
    conflictStrategy enum SKIP [SKIP,OVERWRITE,FAST_FAIL] conflict strategy
    errorStrategy enum CONTINUE [CONTINUE,FAST_FAIL] error strategy
    executionStrategy enum IMMEDIATELY [IMMEDIATELY,SPECIFIED_TIME,CRON_EXPRESSION] execution strategy
    executionPlan object 调度策略 execution plan
  • executionPlan对象说明

    字段 类型 是否必须 默认值 说明 Description
    executeImmediately bool true 立即执行 execute immediately
    executeTime time 执行时间执行 execute time
    cronExpression string cron表达式执行 cron expression
  • 响应体

    {
      "code": 0,
      "message": null,
      "data": null,
      "traceId": ""
    }

更新远端集群分发配置

  • API: POST /replication/api/remote/distribution/update/{projectId}/{repoName}/{name}

  • API 名称: remote_distribution_update

  • 功能说明:

    • 中文:更新远端集群分发配置
    • English:remote distribution update
  • 请求体:

    更新异构分发集群
      {
      "registry":"{registry-host}/{repository}",
      "username":"***",
      "password":"****",
      "packageConstraints": [],
      "pathConstraints": [],
      "replicaType": "REAL_TIME",
      "setting": {
        "rateLimit": 0,
        "includeMetadata": true,
        "conflictStrategy": "SKIP",
        "errorStrategy": "CONTINUE",
        "executionStrategy": "IMMEDIATELY",
        "executionPlan": {
          "executeImmediately": true
        }
      },
      "enable": true,
      "description": "test replica task"
     }
    更新同构分发集群
     {
     "clusterId":"xxxx",
     "remoteProjectId":"xxxx",
     "remoteRepoName":"xxxx",
     "packageConstraints": [],
     "pathConstraints": [],
     "replicaType": "REAL_TIME",
     "setting": {
       "rateLimit": 0,
       "includeMetadata": true,
       "conflictStrategy": "SKIP",
       "errorStrategy": "CONTINUE",
       "executionStrategy": "IMMEDIATELY",
       "executionPlan": {
         "executeImmediately": true
       }
     },
     "enable": true,
     "description": "test replica task"
    }
  • 请求字段说明

    字段 类型 是否必须 默认值 说明 Description
    projectId string 项目id the project Id
    repoName string 仓库名称 the repoName
    name string 远端源名称 name
    clusterId string 集群id,与registry互斥,必须存在一个 clusterId
    registry string 远端源地址,与clusterId互斥,必须存在一个 registry
    username string 用户名, 当registry不为空时配置,可为空 username
    password string 密码,当registry不为空时配置,可为空 password
    certificate string 证书,当registry不为空时配置,可为空 certificate
    remoteProjectId string 远端项目id,当clusterId不为空时必填 remote ProjectId
    remoteRepoName string 远端仓库id,当clusterId不为空时必填 remote RepoName
    packageConstraints list 包限制 package constraints
    pathConstraints list 路径限制 path constraints
    replicaType enum REAL_TIME [SCHEDULED,REAL_TIME] replication type
    setting object 计划相关设置 task setting
    enable bool true 计划是否启动 do task enable
    description sting 描述 description
  • setting对象说明

    字段 类型 是否必须 默认值 说明 Description
    rateLimit long 0 分发限速 rate limit
    includeMetadata bool true 是否同步元数据 do include metadata
    conflictStrategy enum SKIP [SKIP,OVERWRITE,FAST_FAIL] conflict strategy
    errorStrategy enum CONTINUE [CONTINUE,FAST_FAIL] error strategy
    executionStrategy enum IMMEDIATELY [IMMEDIATELY,SPECIFIED_TIME,CRON_EXPRESSION] execution strategy
    executionPlan object 调度策略 execution plan
  • executionPlan对象说明

    字段 类型 是否必须 默认值 说明 Description
    executeImmediately bool true 立即执行 execute immediately
    executeTime time 执行时间执行 execute time
    cronExpression string cron表达式执行 cron expression
  • 响应体

    {
      "code": 0,
      "message": null,
      "data": null,
      "traceId": ""
    }

查询远端集群分发配置

  • API: GET /replication/api/remote/distribution/info/{projectId}/{repoName}/{name} /replication/api/remote/distribution/info/{projectId}/{repoName}

  • API 名称: remote_distribution_search

  • 功能说明:

    • 中文:查询远端集群分发配置
    • English:remote distribution search
  • 请求体:

  • 请求字段说明

    字段 类型 是否必须 默认值 说明 Description
    projectId string 项目id the project Id
    repoName string 仓库名称 the repoName
    name string 远端源名称 name
  • 响应体

    {
      "code": 0,
      "message": null,
      "data": [
          {
              "projectId": "{projectId}",
              "repoName": "{repoName}",
              "name": "mirrors",
              "registry":"{registry-host}/{repository}",
              "certificate": null,
              "username": null,
              "password": null,
              "packageConstraints": null,
              "pathConstraints": null,
              "replicaType": "REAL_TIME",
              "setting": {
                  "rateLimit": 0,
                  "includeMetadata": true,
                  "conflictStrategy": "SKIP",
                  "errorStrategy": "FAST_FAIL",
                  "executionStrategy": "IMMEDIATELY",
                  "executionPlan": {
                      "executeImmediately": true,
                      "executeTime": null,
                      "cronExpression": null
                  }
              },
              "description": null,
              "enable": true
          }
      ],
      "traceId": ""
    }

删除远端集群分发配置

  • API: DELETE /replication/api/remote/distribution/delete/{projectId}/{repoName}/{name}

  • API 名称: remote_distribution_delete

  • 功能说明:

    • 中文:删除远端集群分发配置
    • English:remote distribution delete
  • 请求体:

  • 请求字段说明

    字段 类型 是否必须 默认值 说明 Description
    projectId string 项目id the project Id
    repoName string 仓库名称 the repoName
    name string 远端源名称 name
  • 响应体

{
    "code": 0,
    "message": null,
    "data": null,
    "traceId": ""
}

禁用/启用远端集群分发配置

  • API: POST /replication/api/remote/distribution/toggle/status/{projectId}/{repoName}/{name}

  • API 名称:toggle_remote_distribution_status

  • 功能说明:

    • 中文:禁用/启用远端集群分发配置
    • English:toggle remote distribution status
  • 请求体:

  • 请求字段说明

    字段 类型 是否必须 默认值 说明 Description
    projectId string 项目id the project Id
    repoName string 仓库名称 the repoName
    name string 远端源名称 name
  • 响应体

{
    "code": 0,
    "message": null,
    "data": null,
    "traceId": ""
}

创建一次性分发任务

  • API: POST /replication/api/remote/distribution/create/runOnceTask/{projectId}/{repoName}

  • API 名称: runonce_remote_distribution_create

  • 功能说明:

    • 中文:创建一次性分发配置
    • English:create runonce remote distribution
  • 请求体:

    新建异构分发集群
    {
      "name": "xxxx",
      "registry":"{registry-host}/{repository}",
      "username":"***",
      "password":"****",
      "packageName":"nginx",
      "versions": ["1.1"],
      "targetVersions":["1.2","1.3"],
      "description":"xxxx"
    }
    已有同构分发集群,同步package
    {
      "name": "xxxx",
      "clusterId":"xxxx",
      "remoteProjectId":"xxxx",
      "remoteRepoName":"xxxx",
      "packageName":"nginx",
      "versions": ["1.1"],
      "description":"xxxx"
    }
    已有同构分发集群,同步path
    {
      "name": "xxxx",
      "clusterId":"xxxx",
      "remoteProjectId":"xxxx",
      "remoteRepoName":"xxxx",
      "pathConstraints":["/a.txt"],
      "description":"xxxx"
    }
  • 请求字段说明

    字段 类型 是否必须 默认值 说明 Description
    projectId string 项目id the project Id
    repoName string 仓库名称 the repoName
    name string 远端源名称 name
    clusterId string 集群id,与registry互斥,必须存在一个 clusterId
    registry string 远端源地址,与clusterId互斥,必须存在一个 registry
    username string 用户名, 当registry不为空时配置,可为空 username
    password string 密码,当registry不为空时配置,可为空 password
    certificate string 证书,当registry不为空时配置,可为空 certificate
    remoteProjectId string 远端项目id,当clusterId不为空时必填 remote ProjectId
    remoteRepoName string 远端仓库id,当clusterId不为空时必填 remote RepoName
    packageName string 包名,必须与versions一起使用 package name
    versions list 包对应版本列表,必须与packageName一起使用 package versions
    targetVersions list 推送目标版本,只有当versions数量为1时才可以设置,仅针对镜像类型 target versions
    pathConstraints list 路径限制 path constraints
    description sting 描述,在此填请求来源 description
  • 响应体

    {
      "code": 0,
      "message": null,
      "data": null,
      "traceId": ""
    }

执行一次性任务

  • API: POST /replication/api/remote/distribution/execute/runOnceTask/{projectId}/{repoName}?name={name}

  • API 名称:execute_runonce_task

  • 功能说明:

    • 中文:执行一次性任务
    • English:execute task
  • 请求体:

  • 请求字段说明

    字段 类型 是否必须 默认值 说明 Description
    name string 任务名 name
  • 响应体

{
    "code": 0,
    "message": null,
    "data": null,
    "traceId": ""
}

查询一次性任务的执行结果

  • API: GET /replication/api/remote/distribution/get/runOnceTaskStatus/{projectId}/{repoName}?name={name}

  • API 名称:get_runonce_task_status

  • 功能说明:

    • 中文:获取一次性任务执行结果
    • English:get task status
  • 请求体:

  • 请求字段说明

    字段 类型 是否必须 默认值 说明 Description
    name string 任务名 name
  • 响应体

{
    "code": 0,
    "message": null,
    "data": {
        "id": "63043f3ff0cad86bddf5e215",
        "taskKey": "a39012fb57564d13b5c5c237d67f01dc",
        "status": "SUCCESS",
        "startTime": "2022-08-23T10:45:19.79",
        "endTime": "2022-10-20T17:14:37.229",
        "errorReason": null
    },
    "traceId": "8c9e8b15bd87b8fae86b72c4bf97c96a"
}
  • 返回字段说明

    字段 类型 是否必须 默认值 说明 Description
    taskKey string 任务key task key
    status string 执行状态 [SUCCESS,RUNNING,FAILED] status
    startTime string 任务开始执行时间 startTime
    endTime string 任务结束执行时间 endTime
    errorReason string 错误原因 errorReason

删除已经执行完成的一次性任务

  • API: DELETE /replication/api/remote/distribution/delete/runOnceTask/{projectId}/{repoName}?name={name}

  • API 名称:delete_runonce_task

  • 功能说明:

    • 中文:删除已经执行完成的一次性任务
    • English:delete runonce task
  • 请求体:

  • 请求字段说明

    字段 类型 是否必须 默认值 说明 Description
    name string 任务名 name
  • 响应体

{
    "code": 0,
    "message": null,
    "data": null,
    "traceId": null
}