UpdateHostGroup - Update a host group

Updated at:

Updates a host group.

Applicable editions

Central edition, Region edition

Endpoint and authorization information

  • Obtain the endpoint: Replace {domain} in the API request syntax.
  • Obtain a personal access token.
  • Obtain the organizationId: Required for Central edition only. Go to the Basic Information page in the Organization Management console to retrieve your organization ID.

Product

Resource

Required permission

Pipeline

Host group

Read and write

Request syntax

Central edition

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

Region edition

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

Request headers

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

Personal access token.

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

Request parameters

Parameter

Type

Location

Required

Description

Example value

organizationId

string

path

  • Yes: Central edition

  • No: Region edition

Organization ID.

5ebbc0228123212b59xxxxx

id

integer

query

Yes

Host group ID.

123

type

string

query

Yes

Host group type. Only ECS is supported.

ECS

envId

string

query

No

Environment ID.

0

name

string

query

Yes

Host group name.

Host group

serviceConnectionId

integer

query

Yes

Service connection ID.

123

tagIds

string

query

No

Tag IDs. Separate multiple IDs with commas.

12,234

ecsType

string

query

No

ECS type. Only ECS_ALIYUN is supported.

ECS_ALIYUN

ecsLabelKey

string

query

No

ECS label key.

ecs

ecsLabelValue

string

query

No

ECS label value.

ecs

aliyunRegion

string

query

No

Alibaba Cloud region.

cn-beijing

machineInfos

string

query

No

aliyunRegionId: Alibaba Cloud region where the machine resides. machineSn: Machine serial number. instanceName: Hostname. ip: Host IP address.

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

Request examples

Central edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/flow/organizations/5ebbc0228123212b59xxxxx/hostGroups?id=123&type=ECS&envId=0&name=Host%20group&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 edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/flow/hostGroups?id=123&type=ECS&envId=0&name=Host%20group&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'

Response parameters

Parameter

Type

Description

Example value

-

boolean

Whether the operation succeeded.

true

Response example

true

Error codes

See Error Code Center for API error codes.