Modifying a Classification
Function
This API is used to modify a classification.
Calling Method
For details, see Calling APIs.
URI
PUT /v1/{project_id}/workspaces/{workspace_id}/soc/mappings/classifiers/{classifier_id}
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition Project ID, which is used to specify the project that a resource belongs to. You can query the resources of a project by project ID. You can obtain the project ID from the API or console. Obtaining the Project ID Constraints N/A Range N/A Default Value N/A |
|
workspace_id |
Yes |
String |
Definition Workspace ID. Range N/A |
|
classifier_id |
Yes |
String |
Categorical mapping ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition User token. You can obtain it by calling the IAM API for obtaining a user token. The user token is the value of X-Subject-Token in the response header. Obtaining a User Token Constraints N/A Range N/A Default Value N/A |
|
Content-Type |
Yes |
String |
Definition Content type. Constraints N/A Range Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
Yes |
String |
Mapping ID. |
|
name |
Yes |
String |
Name. |
|
project_id |
No |
String |
Definition Project ID, which is used to specify the project that a resource belongs to. You can query the resources of a project by project ID. You can obtain the project ID from the API or console. Obtaining the Project ID Constraints N/A Range N/A Default Value N/A |
|
workspace_id |
No |
String |
Definition Workspace ID. Range N/A |
|
dataclass_id |
Yes |
String |
Mapping ID. |
|
data_source |
Yes |
String |
Data source. |
|
description |
Yes |
String |
Description. |
|
classifier |
Yes |
DpeClassifyCreate object |
Classification creation information. |
|
mapper |
No |
CreateDpeMappingRequestBody object |
Request body for creating a categorical mapping. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
Yes |
String |
Mapping ID. |
|
name |
No |
String |
Name. |
|
project_id |
No |
String |
Mapping ID. |
|
workspace_id |
No |
String |
Mapping ID. |
|
dataclass_id |
Yes |
String |
Mapping ID. |
|
data_source |
No |
String |
Data source. |
|
status |
No |
String |
Status: enabled or disabled. |
|
description |
No |
String |
Description. |
|
create_time |
No |
String |
Creation time. |
|
creator_id |
No |
String |
Creator ID. |
|
creator_name |
No |
String |
Creator name. |
|
update_time |
No |
String |
Update time. |
|
modifier_id |
No |
String |
Modifier ID. |
|
modifier_name |
No |
String |
Modifier name. |
|
mapper |
Yes |
DpeMappingDetail object |
Mapping information. |
|
classifier |
No |
DpeClassifyCreate object |
Classification creation information. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Mapping ID. |
|
name |
No |
String |
Name. |
|
project_id |
No |
String |
Mapping ID. |
|
workspace_id |
No |
String |
Mapping ID. |
|
dataclass_id |
No |
String |
Mapping ID. |
|
dataclass_name |
No |
String |
Data class name. |
|
mapper_type_id |
No |
String |
Mapping ID. |
|
mapping_id |
No |
String |
Mapping ID. |
|
mapping_info |
No |
DpeInfo object |
Classification information. |
|
create_time |
No |
String |
Creation time. |
|
creator_id |
No |
String |
Creator ID. |
|
creator_name |
No |
String |
Creator name. |
|
update_time |
No |
String |
Update time. |
|
modifier_id |
No |
String |
Modifier ID. |
|
modifier_name |
No |
String |
Modifier name. |
|
mapper_field_list |
No |
Array of DpeMappingFieldDetail objects |
Mapping set. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Mapping ID. |
|
project_id |
No |
String |
Mapping ID. |
|
workspace_id |
No |
String |
Mapping ID. |
|
dataclass_id |
No |
String |
Mapping ID. |
|
mapping_id |
No |
String |
Mapping ID. |
|
mapper_id |
No |
String |
Mapping ID. |
|
default_value |
No |
String |
Default Value |
|
target_key |
No |
String |
Target field. |
|
expression |
No |
String |
Expression. |
|
create_time |
No |
String |
Creation time. |
|
update_time |
No |
String |
Update time. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Mapping ID. |
|
project_id |
No |
String |
Mapping ID. |
|
workspace_id |
No |
String |
Mapping ID. |
|
dataclass_id |
No |
String |
Mapping ID. |
|
dataclass_name |
No |
String |
Data class name. |
|
mapping_id |
No |
String |
Mapping ID. |
|
direct_classifier |
No |
String |
Direct classification. |
|
direct_classifier_type_id |
No |
String |
Mapping ID. |
|
create_time |
No |
String |
Creation time. |
|
creator_id |
No |
String |
Creator ID. |
|
creator_name |
No |
String |
Creator name. |
|
update_time |
No |
String |
Update time. |
|
modifier_id |
No |
String |
Modifier ID. |
|
modifier_name |
No |
String |
Modifier name. |
|
mapping_info |
No |
DpeInfo object |
Classification information. |
|
classifier_item_list |
No |
Array of DpeClassifyItemDetail objects |
Category set element. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Mapping ID. |
|
name |
No |
String |
Name. |
|
project_id |
No |
String |
Mapping ID. |
|
workspace_id |
No |
String |
Mapping ID. |
|
dataclass_id |
No |
String |
Mapping ID. |
|
dataclass_name |
No |
String |
Data class name. |
|
classifier_id |
No |
String |
Associated classification ID. |
|
status |
No |
String |
Status. |
|
complete_degree |
No |
String |
Progress. |
|
instance_num |
No |
String |
The number of associated instances. |
|
built_in |
No |
String |
Whether the data is built-in. |
|
data_source |
No |
String |
Data source. |
|
description |
No |
String |
Description. |
|
update_time |
No |
String |
Update time. |
|
create_time |
No |
String |
Creation time. |
|
creator_id |
No |
String |
Creator ID. |
|
creator_name |
No |
String |
Creator name. |
|
modifier_id |
No |
String |
Modifier ID. |
|
modifier_name |
No |
String |
Modifier name. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
No |
String |
Mapping ID. |
|
classifier_id |
No |
String |
Mapping ID. |
|
classifier_type_id |
No |
String |
Mapping ID. |
|
mapping_id |
No |
String |
Mapping ID. |
|
classifier_order |
No |
Integer |
Classification priority. |
|
expression |
No |
String |
Expression. |
|
create_time |
No |
String |
Creation time. |
|
update_time |
No |
String |
Update time. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Definition Error code. Range N/A |
|
message |
String |
Definition Error description. Range N/A |
|
data |
CreateDpeClassifyRequestBody object |
Request body for creating a classification mapping. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
name |
String |
Name. |
|
project_id |
String |
Definition Project ID, which is used to specify the project that a resource belongs to. You can query the resources of a project by project ID. You can obtain the project ID from the API or console. Obtaining the Project ID Constraints N/A Range N/A Default Value N/A |
|
workspace_id |
String |
Definition Workspace ID. Range N/A |
|
dataclass_id |
String |
Mapping ID. |
|
data_source |
String |
Data source. |
|
description |
String |
Description. |
|
classifier |
DpeClassifyCreate object |
Classification creation information. |
|
mapper |
CreateDpeMappingRequestBody object |
Request body for creating a categorical mapping. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
name |
String |
Name. |
|
project_id |
String |
Mapping ID. |
|
workspace_id |
String |
Mapping ID. |
|
dataclass_id |
String |
Mapping ID. |
|
data_source |
String |
Data source. |
|
status |
String |
Status: enabled or disabled. |
|
description |
String |
Description. |
|
create_time |
String |
Creation time. |
|
creator_id |
String |
Creator ID. |
|
creator_name |
String |
Creator name. |
|
update_time |
String |
Update time. |
|
modifier_id |
String |
Modifier ID. |
|
modifier_name |
String |
Modifier name. |
|
mapper |
DpeMappingDetail object |
Mapping information. |
|
classifier |
DpeClassifyCreate object |
Classification creation information. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
name |
String |
Name. |
|
project_id |
String |
Mapping ID. |
|
workspace_id |
String |
Mapping ID. |
|
dataclass_id |
String |
Mapping ID. |
|
dataclass_name |
String |
Data class name. |
|
mapper_type_id |
String |
Mapping ID. |
|
mapping_id |
String |
Mapping ID. |
|
mapping_info |
DpeInfo object |
Classification information. |
|
create_time |
String |
Creation time. |
|
creator_id |
String |
Creator ID. |
|
creator_name |
String |
Creator name. |
|
update_time |
String |
Update time. |
|
modifier_id |
String |
Modifier ID. |
|
modifier_name |
String |
Modifier name. |
|
mapper_field_list |
Array of DpeMappingFieldDetail objects |
Mapping set. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
project_id |
String |
Mapping ID. |
|
workspace_id |
String |
Mapping ID. |
|
dataclass_id |
String |
Mapping ID. |
|
mapping_id |
String |
Mapping ID. |
|
mapper_id |
String |
Mapping ID. |
|
default_value |
String |
Default Value |
|
target_key |
String |
Target field. |
|
expression |
String |
Expression. |
|
create_time |
String |
Creation time. |
|
update_time |
String |
Update time. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
project_id |
String |
Mapping ID. |
|
workspace_id |
String |
Mapping ID. |
|
dataclass_id |
String |
Mapping ID. |
|
dataclass_name |
String |
Data class name. |
|
mapping_id |
String |
Mapping ID. |
|
direct_classifier |
String |
Direct classification. |
|
direct_classifier_type_id |
String |
Mapping ID. |
|
create_time |
String |
Creation time. |
|
creator_id |
String |
Creator ID. |
|
creator_name |
String |
Creator name. |
|
update_time |
String |
Update time. |
|
modifier_id |
String |
Modifier ID. |
|
modifier_name |
String |
Modifier name. |
|
mapping_info |
DpeInfo object |
Classification information. |
|
classifier_item_list |
Array of DpeClassifyItemDetail objects |
Category set element. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
name |
String |
Name. |
|
project_id |
String |
Mapping ID. |
|
workspace_id |
String |
Mapping ID. |
|
dataclass_id |
String |
Mapping ID. |
|
dataclass_name |
String |
Data class name. |
|
classifier_id |
String |
Associated classification ID. |
|
status |
String |
Status. |
|
complete_degree |
String |
Progress. |
|
instance_num |
String |
The number of associated instances. |
|
built_in |
String |
Whether the data is built-in. |
|
data_source |
String |
Data source. |
|
description |
String |
Description. |
|
update_time |
String |
Update time. |
|
create_time |
String |
Creation time. |
|
creator_id |
String |
Creator ID. |
|
creator_name |
String |
Creator name. |
|
modifier_id |
String |
Modifier ID. |
|
modifier_name |
String |
Modifier name. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Mapping ID. |
|
classifier_id |
String |
Mapping ID. |
|
classifier_type_id |
String |
Mapping ID. |
|
mapping_id |
String |
Mapping ID. |
|
classifier_order |
Integer |
Classification priority. |
|
expression |
String |
Expression. |
|
create_time |
String |
Creation time. |
|
update_time |
String |
Update time. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Definition Error code. Range N/A |
|
message |
String |
Definition Error description. Range N/A |
Example Requests
Modify a category.
{
"classifier" : {
"direct_classifier" : false,
"classifier_item_list" : [ {
"classifier_type_id" : "23f48a58c5b2fbb037c2162846076cd0",
"classifier_order" : 0,
"expression" : {
"pre_filter" : { },
"transformer" : { },
"filter" : {
"conditions" : [ {
"name" : "general-classify-field-0",
"is_contxt" : true,
"data" : [ "ops.csvc", "Equals", "secmaster" ]
} ],
"logics" : [ "general-classify-field-0" ]
}
}
} ]
},
"name" : "UpdateClassifier",
"data_source" : "CFW",
"dataclass_id" : "a5883c13-39b6-34e4-ae4f-a5256bf7e27d",
"description" : "UpdateClassifier",
"id" : "33dbe0e6-f242-47a6-8ddc-eaea8f405258"
}
Example Responses
Status code: 200
Response to the request for modifying a classification.
{
"code" : "00000000",
"data" : {
"classifier" : {
"classifier_item_list" : [ {
"classifier_order" : "0",
"classifier_type_id" : "23f48a58c5b2fbb037c2162846076cd0",
"expression" : "{\"filter\":{\"logics\":[\"general-classify-field-0\"],\"conditions\":[{\"data\":[\"ops.csvc\",\"Equals\",\"secmaster\"],\"name\":\"general-classify-field-0\",\"is_contxt\":true}]},\"transformer\":{},\"pre_filter\":{}}"
} ],
"dataclass_id" : "",
"direct_classifier" : "false",
"direct_classifier_type_id" : "",
"id" : "4e47a0f5-60c8-4999-afc4-e595bd5de041",
"mapping_id" : "",
"project_id" : "",
"workspace_id" : ""
},
"data_source" : "CFW",
"dataclass_id" : "a5883c13-39b6-34e4-ae4f-a5256bf7e27d",
"description" : "UpdateClassifier",
"id" : "33dbe0e6-f242-47a6-8ddc-eaea8f405258",
"mapper" : null,
"name" : "UpdateClassifier",
"project_id" : "15645222e8744afa985c93dab6341da6",
"workspace_id" : "5e6377d9-548d-43d7-9241-fb63a75a464e"
},
"message" : ""
}
SDK Sample Code
The SDK sample code is as follows.
Modify a category.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.secmaster.v1.region.SecMasterRegion; import com.huaweicloud.sdk.secmaster.v1.*; import com.huaweicloud.sdk.secmaster.v1.model.*; import java.util.List; import java.util.ArrayList; public class UpdateClassifierSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); SecMasterClient client = SecMasterClient.newBuilder() .withCredential(auth) .withRegion(SecMasterRegion.valueOf("<YOUR REGION>")) .build(); UpdateClassifierRequest request = new UpdateClassifierRequest(); request.withWorkspaceId("{workspace_id}"); request.withClassifierId("{classifier_id}"); CreateDpeClassifyRequestBody body = new CreateDpeClassifyRequestBody(); List<DpeClassifyItemDetail> listClassifierClassifierItemList = new ArrayList<>(); listClassifierClassifierItemList.add( new DpeClassifyItemDetail() .withClassifierTypeId("23f48a58c5b2fbb037c2162846076cd0") .withClassifierOrder(0) .withExpression("{pre_filter={}, transformer={}, filter={conditions=[{name=general-classify-field-0, is_contxt=true, data=[ops.csvc, Equals, secmaster]}], logics=[general-classify-field-0]}}") ); DpeClassifyCreate classifierbody = new DpeClassifyCreate(); classifierbody.withDirectClassifier("false") .withClassifierItemList(listClassifierClassifierItemList); body.withClassifier(classifierbody); body.withDescription("UpdateClassifier"); body.withDataSource("undefined"); body.withDataclassId("a5883c13-39b6-34e4-ae4f-a5256bf7e27d"); body.withName("UpdateClassifier"); body.withId("33dbe0e6-f242-47a6-8ddc-eaea8f405258"); request.withBody(body); try { UpdateClassifierResponse response = client.updateClassifier(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Modify a category.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksecmaster.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = SecMasterClient.new_builder() \ .with_credentials(credentials) \ .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdateClassifierRequest() request.workspace_id = "{workspace_id}" request.classifier_id = "{classifier_id}" listClassifierItemListClassifier = [ DpeClassifyItemDetail( classifier_type_id="23f48a58c5b2fbb037c2162846076cd0", classifier_order=0, expression="{pre_filter={}, transformer={}, filter={conditions=[{name=general-classify-field-0, is_contxt=true, data=[ops.csvc, Equals, secmaster]}], logics=[general-classify-field-0]}}" ) ] classifierbody = DpeClassifyCreate( direct_classifier="false", classifier_item_list=listClassifierItemListClassifier ) request.body = CreateDpeClassifyRequestBody( classifier=classifierbody, description="UpdateClassifier", data_source="undefined", dataclass_id="a5883c13-39b6-34e4-ae4f-a5256bf7e27d", name="UpdateClassifier", id="33dbe0e6-f242-47a6-8ddc-eaea8f405258" ) response = client.update_classifier(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Modify a category.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := secmaster.NewSecMasterClient( secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdateClassifierRequest{} request.WorkspaceId = "{workspace_id}" request.ClassifierId = "{classifier_id}" classifierTypeIdClassifierItemList:= "23f48a58c5b2fbb037c2162846076cd0" classifierOrderClassifierItemList:= int32(0) expressionClassifierItemList:= "{pre_filter={}, transformer={}, filter={conditions=[{name=general-classify-field-0, is_contxt=true, data=[ops.csvc, Equals, secmaster]}], logics=[general-classify-field-0]}}" var listClassifierItemListClassifier = []model.DpeClassifyItemDetail{ { ClassifierTypeId: &classifierTypeIdClassifierItemList, ClassifierOrder: &classifierOrderClassifierItemList, Expression: &expressionClassifierItemList, }, } var directClassifierClassifier interface{} = "false" classifierbody := &model.DpeClassifyCreate{ DirectClassifier: &directClassifierClassifier, ClassifierItemList: &listClassifierItemListClassifier, } request.Body = &model.CreateDpeClassifyRequestBody{ Classifier: classifierbody, Description: "UpdateClassifier", DataSource: "undefined", DataclassId: "a5883c13-39b6-34e4-ae4f-a5256bf7e27d", Name: "UpdateClassifier", Id: "33dbe0e6-f242-47a6-8ddc-eaea8f405258", } response, err := client.UpdateClassifier(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Response to the request for modifying a classification. |
|
400 |
Returned packet for abnormal requests. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot