更新时间:2024-09-30 GMT+08:00
分享

根据泳道ID关联组件

功能介绍

此API用于根据泳道ID为泳道关联组件。

调试

您可以在API Explorer中调试该接口。

URI

PUT /v3/{project_id}/cas/swimlane-group/{lane_group_id}/swimlane/{lane_id}/instances

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

租户项目ID。获取方法,请参考获取项目ID

lane_group_id

String

泳道组ID。获取方法,请参考6.4.2-获取所有泳道组

lane_id

String

泳道ID。获取方法,请参考6.5.2-获取泳道组下所有泳道

请求消息

表2 请求Header参数

参数

是否必选

参数类型

描述

Content-Type

String

消息体的类型(格式),默认取值为“application/json”。

X-Auth-Token

String

调用接口的认证方式分为Token和AK/SK两种,如果您使用的Token方式,此参数为必填,请填写Token的值。Token获取方式,请参考获取用户Token

表3 请求Body参数

参数

是否必选

参数类型

描述

action

String

为泳道关联移除组件操作。

  • ADD:关联组件。
  • REMOVE:移除组件。

instance_ids

Array of String

组件实例列表。

响应消息

表4 响应参数

参数

参数类型

描述

id

String

泳道ID。

name

String

泳道名称。

swimlane_group_id

String

所属的泳道组ID。

type

String

泳道类型。

  • BASE:基线泳道。
  • GRAY:灰度泳道。

tag

String

泳道标签,根据标签来控制流量的走向。

route_status

String

泳道路由状态。

  • ENABLE:开启路由。
  • DISABLED:关闭路由。

rule_match_mode

String

路由规则匹配模式。

当泳道组灰度类型为基于内容,即gray_release_type为CONTENT时生效。

  • ALL:匹配所有的规则。
  • ANY:匹配任一规则。

rules

Array of objects

路由规则。当泳道组灰度类型为基于内容,即gray_release_type为CONTENT时生效。请参考表5

weight

Integer

泳道流量权重,范围在0-100之间。当泳道组灰度类型为基于流量,即gray_release_type为WEIGHT时生效。

instances

Array of objects

泳道中纳管的组件列表,请参考表6

instance_count

Integer

泳道中纳管的组件个数。

latest_opt

String

泳道上一步的操作。

  • CLONE:克隆。
  • UPGRADE:升级。
  • ROLLBACK:回滚。
  • CREATE:创建。

release_plan_id

String

泳道上一步操作关联的发布单ID。

project_id

String

项目ID。

create_time

Integer

创建时间。

update_time

Integer

更新时间。

creator

String

创建人。

表5 rules

参数

参数类型

描述

type

String

灰度匹配规则类型。当前只支持HEADER,即基于Header头进行匹配。

key

String

键。

value

String

值。

condition

String

匹配条件。

  • EXACT:精确匹配。
  • PREFIX:前缀匹配。
  • REGEX:正则匹配。
表6 instances

参数

参数类型

描述

id

String

应用组件实例ID。

name

String

应用组件实例名称。

version

String

应用组件版本号。

application_id

String

应用ID。

component_id

String

组件ID。

application_name

String

应用名称。

replica

Integer

实例副本数。

请求示例

为id为8f8a5b33-ee1f-4a70-b3a9-c1b179a69fd2的泳道关联id为887f99d7-4ce5-431d-924f-6a328cb05572的组件实例。

{
    "instance_ids": [
        "887f99d7-4ce5-431d-924f-6a328cb05572"
    ],
    "action": "ADD"
}

响应示例

{
    "id": "8f8a5b33-ee1f-4a70-b3a9-c1b179a69fd2",
    "name": "base",
    "swimlane_group_id": "5447f910-ab74-4d15-b2ab-dd0945900ce9",
    "type": "BASE",
    "tag": "base",
    "route_status": "ENABLE",
    "rule_match_mode": null,
    "project_id": "86a1f7b663b349e89071a3090d9d81f3",
    "rules": null,
    "creator": "test_user",
    "create_time": 1722848532908,
    "update_time": 1722848532908,
    "instances": [
        {
            "componentId": "0b582884-1ad0-4183-8d6d-16998f54818f",
            "id": "887f99d7-4ce5-431d-924f-6a328cb05572",
            "name": "comp-uh59l7s2",
            "version": "1.0.0",
            "application_id": "70502782-4f93-4eda-af19-415bac2d12ae",
            "application_name": "app-apitest-1o6l",
            "replica": 0
        }
    ],
    "instance_count": 1,
    "weight": 100,
    "batch_status": null,
    "latest_opt": null,
    "release_plan_id": null
}

相关文档