Updated on 2024-04-11 GMT+08:00

Enabling or Disabling an Agent

Function

This API is used to enable or disable the agent. An enabled agent collects user access information.

URI

POST /v1/{project_id}/{instance_id}/audit/agent/switch

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

instance_id

Yes

String

Instance ID

project_id

Yes

String

Project ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-type

Yes

String

The fixed value of this parameter is application/json;charset=UTF-8, which cannot be changed.

X-Auth-Token

Yes

String

User token.The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

agent_id

Yes

String

Audit agent ID

status

Yes

Integer

Agent status. 1:enabled; 0:disabled

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

result

String

Response status.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 6 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

error

Object

Error message.

Table 8 ErrorDetail

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error information.

Example Requests

/v1/{project_id}/{instance_id}/audit/agent/switch

{
  "agent_id" : "ASWDSDSDSWEWDSDSD",
  "status" : 1
}

Example Responses

Status code: 200

Request succeeded.

{
  "result" : "SUCCESS"
}

Status code: 400

Invalid request parameter.

{
  "error" : {
    "error_code" : "DBSS.XXX",
    "error_msg" : "XXX"
  }
}

Status code: 403

Authentication failed.

{
  "error" : {
    "error_code" : "DBSS.XXX",
    "error_msg" : "XXX"
  }
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Invalid request parameter.

403

Authentication failed.

Error Codes

See Error Codes.