Skip to content

Modify Object Classification Configuration



POST /api/v1/objc_cfg/{objc_name}/modify

Overview

Modify the object classification configuration.

Route Parameters

Parameter Name Type Required Description
objc_name string Y Object classification configuration name

Body Request Parameters

Parameter Name Type Required Description
sourceType string Y Source type, default value is custom_object
Allow null: False
Options: ['object', 'custom_object']
objcGroupUUID string Business group UUID
Allow null: False
Example: Haha
Allow empty string: True
Maximum length: 64
fields array Custom attribute fields (the reported data must contain these fields; otherwise, the reported data will be discarded)
Allow null: False
Example: [{'name': 'ak', 'alias': 'machine gun'}]
templateInfo json Template configuration details
Allow null: False
Example: {}

Additional Parameter Descriptions


Description of fields parameter This parameter stores bound field information in list form. The list member parameters are as follows:

Parameter Name Type Description
name string Field name
alias string Field alias

Description of templateInfo parameter

For detailed structure description, please refer to [Create Resource Explorer - JSON Configuration - Template Configuration Description]

1. source parameter description Defines the resource category and the text content that needs to be displayed on the UI page. List member parameters are as follows:

Parameter Name Type Description
key string Resource class
name string Resource class alias

2. filters parameter description Defines the default display fields for quick filtering in the resource explorer. Format is as follows:

"filters":[
  {
    "key":"field name"
  },
  {
    "key":"field name"
  }
]

3. columns parameter description Defines the default display fields in the resource explorer's list. Format is as follows:

"columns":[
  {
    "key":"field name",
  },
  {
    "key":"field name",
  }
]

4. views parameter description

Parameter Required Description Example Syntax
title / Tab display title "text"
required false Whether the tab page is hidden, fixed values: true, false.
  • true: Hidden by default, linked with keys configuration to determine if data matches; if it does, it shows
  • false: Shown by default
"false"
keys / Linked with the required parameter, configure key fields and matching logic for field values, show if matched. Note: In this case, the value of the required parameter must be true
  • {"key":"*"} : Data satisfies the key field
  • {"key":"value"} : Data contains the key field and its value must be value
  • {"key1":"value1","key2":"value2"} : Data contains key1 with value1 and key2 with value2 combination
timerange default Definition of the time range for querying interface data. Basic format:
  • default: Follows the platform's default time widget settings, usually 15m (i.e., query data from the last 15 minutes)
  • Relative time: Custom relative time range, units include m(minutes), h(hours), d(days)
  • Data linkage with time field configuration ["offset before", "offset after"]
  • "default" : Last 15 minutes
  • "15m" : Last 15 minutes
  • "1h" : Last 1 hour
  • "1d" : Last 1 day
  • ["15m","15m"] : Offset 15 minutes before and after the current data time
  • ["5m","30m"] : Offset 5 minutes before and 30 minutes after the current data time
viewType / Page type. Currently supports two types: "built-in page" and "built-in view", corresponding to "component" and "dashboard". /
viewName / Page name. If the page type is a built-in page, fill in the relative path address of the page; if the page type is a built-in view, fill in the view name only. Refer to the following [Link Built-in Pages][Link Built-in Views] descriptions /

5. templateInfo parameter example

{
  "main": [
    {
      "class":"custom_object",
      "source": {
        "key":"resource classification",
        "name":"resource classification alias"
      },
      "filters":[
        {
          "key":"field name"
        },
        {
          "key":"field name"
        }
      ],
      "table":{
        "columns":[
          {
            "key":"field name",
          },
          {
            "key":"field name",
          }
        ],
      },
      "detail":{
        "views":[
          {
            "title":"Tab title",
            "required":"false",
            "keys":{},
            "view_type": "component",
            "viewName":"built-in page"
          },
          {
            "title":"Tab title",
            "required":"false",
            "keys":{},
            "timerange":"default",
            "view_type": "dashboard",
            "viewName":"built-in view"
          }
        ]
      }
    }
  ],
  "title": "Resource classification or alias"
}

Request Example

curl 'https://openapi.guance.com/api/v1/objc_cfg/test/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"sourceType":"custom_object","objcGroupUUID":"objcg_xxxx","fields":[{"name":"name"}],"templateInfo":{"iconSet":{},"main":[{"class":"custom_object","source":{"key":"test","name":""},"filters":[],"fills":[],"groups":[],"table":{"columns":[],"detail":{"views":[{"keys":{},"viewType":"dashboard","viewName":"NtpQ Monitoring View","title":"viewer","required":true,"timerange":"default"}]}}}],"title":"test"}}' \
--compressed

Response

{
    "code": 200,
    "content": {
        "conditions": "{ source =  'kodo-log'  and ( hostname in [ '127.0.0.1' ] )}",
        "createAt": 1677653414,
        "creator": "acnt_xxxx32",
        "deleteAt": -1,
        "desc": "",
        "filters": [
            {
                "condition": "and",
                "name": "hostname",
                "operation": "in",
                "value": [
                    "127.0.0.1"
                ]
            }
        ],
        "id": 24,
        "name": "Rule 1",
        "source": "kodo-log",
        "status": 0,
        "type": "logging",
        "updateAt": 1678029845.282458,
        "updator": "xxxx",
        "uuid": "blist_xxxx32",
        "workspaceUUID": "wksp_xxxx32"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-BC365EB4-B4BA-4194-B0BB-B1AC8FA29804"
} 

Feedback

Is this page helpful? ×