UpdateHostGroup - 更新主机组

更新时间:
复制为 MD 格式

通过 OpenAPI 更新主机组。

适用版本

中心版、Region

服务接入点与授权信息

产品

资源

所需权限

流水线

主机组

读写

请求语法

中心版

PUT https://{domain}/oapi/v1/flow/organizations/{organizationId}/hostGroups

Region

PUT https://{domain}/oapi/v1/flow/hostGroups

请求头

参数

类型

是否必填

描述

示例值

x-yunxiao-token

string

个人访问令牌。

pt-0fh3****0fbG_35af****0484

请求参数

参数

类型

位置

是否必填

描述

示例值

organizationId

string

path

  • 是:中心版

  • 否:Region

企业 Id。

5ebbc0228123212b59xxxxx

id

integer

query

主机组 id。

123

type

string

query

主机组类型,暂只支持 ECS。

ECS

envId

string

query

环境 id。

0

name

string

query

主机组名称。

主机组

serviceConnectionId

integer

query

服务连接 id。

123

tagIds

string

query

标签 id,多个逗号分割。

12,234

ecsType

string

query

ECS 类型,暂支持 ECS_ALIYUN。

ECS_ALIYUN

ecsLabelKey

string

query

ecs 标签 key。

ecs

ecsLabelValue

string

query

ecs 标签 value。

ecs

aliyunRegion

string

query

阿里云 region。

cn-beijing

machineInfos

string

query

aliyunRegionId 机器所在 aliyun region,machineSn 机器的 sn, instanceName,主机名,ip 主机 ip。

[{"aliyunRegionId":"cn-beijing","machineSn":"i-sssssss","instanceName":"ceshi","ip":"120.0.0.0"}]

请求示例

中心版

curl -X 'PUT' \
  'https://{domain}/oapi/v1/flow/organizations/5ebbc0228123212b59xxxxx/hostGroups?id=123&type=ECS&envId=0&name=主机组&serviceConnectionId=123&tagIds=12,234&ecsType=ECS_ALIYUN&ecsLabelKey=ecs&ecsLabelValue=ecs&aliyunRegion=cn-beijing&machineInfos=[{"aliyunRegionId":"cn-beijing","machineSn":"i-sssssss","instanceName":"ceshi","ip":"120.0.0.0"}]' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Region

curl -X 'PUT' \
  'https://{domain}/oapi/v1/flow/hostGroups?id=123&type=ECS&envId=0&name=主机组&serviceConnectionId=123&tagIds=12,234&ecsType=ECS_ALIYUN&ecsLabelKey=ecs&ecsLabelValue=ecs&aliyunRegion=cn-beijing&machineInfos=[{"aliyunRegionId":"cn-beijing","machineSn":"i-sssssss","instanceName":"ceshi","ip":"120.0.0.0"}]' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

返回参数

参数

类型

描述

示例值

-

boolean

是否成功。

true

返回示例

true

错误码

访问错误码中心查看 API 相关错误码。