Updated on 2025-03-25 GMT+08:00

Querying the Details of a Policy

Function

This API is used to query the details of a policy.

Calling Method

For details, see Calling APIs.

URI

GET /v2/{cloudProjectId}/rule-sets/{ruleSetId}/detail

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

cloudProjectId

Yes

String

Project ID.

ruleSetId

Yes

String

Policy ID.

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

data

Array of SimpleRuleSetVO objects

Data.

total

Long

Total number.

Table 3 SimpleRuleSetVO

Parameter

Type

Description

id

String

Policy ID.

name

String

Policy name.

level

String

Scope identifier: tenant – tenant, other – non-tenant.

is_valid

Boolean

Whether it is valid, true: valid; false: not valid.

version

String

Rule template version.

operator

String

Last operator.

is_public

Boolean

Whether the policy is a system policy.

is_legacy

Boolean

Whether the data is 1.0 data.

operate_time

Integer

Last operation time.

Example Requests

GET https://{endpoint}/v2/2d09f712e9504b61b034cc8f40e475a8/rule-sets/842cacd3424a470eb410300b537fa756/detail

Example Responses

Status code: 200

Response body for querying the details of a policy.

{
  "id" : "842cacd3424a470eb410300b537fa756",
  "name" : "New policy-20240625194201",
  "level" : "project",
  "version" : "efaddbfff5c742f781802004b888eccb",
  "is_valid" : true,
  "is_public" : false,
  "creator" : "05d8ca972f114765a8984795a8aa4d41",
  "create_time" : "2024-06-25 19:42:07",
  "updater" : "05d8ca972f114765a8984795a8aa4d41",
  "update_time" : "2024-06-25 19:42:07",
  "rule_instances" : [ {
    "id" : "46db451f3a204a9cafdebf820968041f",
    "type" : "Gate",
    "name" : "Code check - passed",
    "is_valid" : true,
    "version" : "3f13237656524cc48dd4e8f2e489b060",
    "plugin_id" : "official_devcloud_codeCheck",
    "plugin_name" : "official_devcloud_codeCheck",
    "plugin_version" : "0.0.4",
    "content" : [ {
      "group_name" : "Defects statistics",
      "can_modify_when_inherit" : true,
      "editable" : true,
      "properties" : [ {
        "key" : "codecheck.deadly",
        "type" : "judge",
        "name" : "Critical",
        "value_type" : "float",
        "value" : "0",
        "operator" : ">=",
        "is_valid" : true
      }, {
        "key" : "codecheck.important",
        "type" : "judge",
        "name" : "Major",
        "value_type" : "float",
        "value" : "0",
        "operator" : ">=",
        "is_valid" : true
      }, {
        "key" : "codecheck.common",
        "type" : "judge",
        "name" : "Minor",
        "value_type" : "float",
        "value" : "0",
        "operator" : ">=",
        "is_valid" : true
      }, {
        "key" : "codecheck.prompt",
        "type" : "judge",
        "name" : "Suggestion",
        "value_type" : "float",
        "value" : "0",
        "operator" : ">=",
        "is_valid" : true
      }, {
        "key" : "new_issue_count",
        "type" : "judge",
        "name" : "Total defects",
        "value_type" : "float",
        "value" : "0",
        "operator" : ">=",
        "is_valid" : true
      } ]
    } ],
    "creator" : "05d8ca972f114765a8984795a8aa4d41",
    "create_time" : "2024-05-27 10:57:12",
    "updater" : "05d8ca972f114765a8984795a8aa4d41",
    "update_time" : "2024-05-27 10:57:12"
  }, {
    "id" : "df6f4de49cf14d738ce34ec63e5039ff",
    "type" : "Test",
    "name" : "Test - passed",
    "is_valid" : true,
    "version" : "17258d9993b44a7db86d36e51b2e3b1c",
    "plugin_id" : "official_devcloud_apiTest",
    "plugin_name" : "official_devcloud_apiTest",
    "plugin_version" : "0.0.1",
    "content" : [ {
      "group_name" : "Threshold of the API test pass rate",
      "can_modify_when_inherit" : true,
      "editable" : true,
      "properties" : [ {
        "key" : "pass_ratio",
        "type" : "judge",
        "name" : "API test pass rate",
        "value_type" : "float",
        "value" : "0",
        "operator" : ">=",
        "is_valid" : true
      } ]
    } ],
    "creator" : "05d8ca972f114765a8984795a8aa4d41",
    "create_time" : "2024-05-27 11:01:39",
    "updater" : "05d8ca972f114765a8984795a8aa4d41",
    "update_time" : "2024-05-27 11:01:39"
  } ]
}

Status Codes

Status Code

Description

200

Response body for querying the details of a policy.

Error Codes

See Error Codes.