Standard Template for Initializing Data
Function
Initialize the data standard template.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/design/standards/templates/action
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Project ID and Account ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
action-id |
Yes |
String |
If action-id is set to init, this parameter is a fixed parameter for initializing the data standard template. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
IAM token, which is obtained by calling the IAM API for obtaining a user token (value of X-Subject-Token in the response header). This field is mandatory for authentication using tokens. |
workspace |
Yes |
String |
Workspace ID. For details about how to obtain the workspace ID, see Instance ID and Workspace ID. |
X-Project-Id |
No |
String |
Project ID. For details about how to obtain the project ID, see Project ID and Account ID. This parameter is mandatory for API requests that use AK/SK authentication in multi-project scenarios. |
Content-Type |
No |
String |
Default value: application/json;charset=UTF-8 This parameter is optional. If the body is available, this parameter is mandatory. If the body is unavailable, you do not need to set this parameter or verify it. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
data |
data object |
data: unified outermost data structure of the returned result. |
Parameter |
Type |
Description |
---|---|---|
value |
Array of StandElementFieldVO objects |
Array of field details in the data standard template. |
Parameter |
Type |
Description |
---|---|---|
fd_name |
String |
Attribute name. |
fd_name_en |
String |
English name of an attribute. |
description |
String |
Attribute description. |
descriptionEn |
String |
Attribute description in English. |
label |
String |
Attribute tag. |
disabled |
Boolean |
Disable or not. |
id |
String |
Data standard ID, which is a string |
actived |
Boolean |
Indicates whether to display the default item. The default item is displayed and cannot be modified. The value true indicates that the attribute is displayed when the data standard is used (the attribute can be operated during adding, modification, and query). The value false indicates that the attribute is not displayed when the data standard is used. |
required |
Boolean |
Whether the header input parameter is mandatory. true: mandatory; false: optional. |
searchable |
Boolean |
Indicates whether the content can be searched. The value true indicates that the data can be searched on the data standard list page, and the value false indicates that the data cannot be searched on the data standard list page. |
optional_values |
String |
Allowed value. |
field_type |
Integer |
Field type. The value 0 indicates a system field, and the value 1 indicates a customized field. |
displayed_name |
String |
Frontend display name. |
displayed_name_en |
String |
Frontend display name in English. |
create_time |
String |
Creation time, which is read-only. The format complies with RFC3339 and is accurate to seconds. The UTC time zone is yyyy-mm-ddTHH:MM:SSZ, for example, 1970-01-01T00:00:00Z. |
update_time |
String |
Update time, which is read-only. The format complies with RFC3339 and is accurate to seconds. The UTC time zone is yyyy-mm-ddTHH:MM:SSZ, for example, 1970-01-01T00:00:00Z. |
create_by |
String |
Creator. |
update_by |
String |
Person who updates the information. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code, for example, DS.6000, indicating that the request fails to be processed. |
error_msg |
String |
Error message |
data |
Object |
Returned data information. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code, for example, DS.6000, indicating that the request fails to be processed. |
error_msg |
String |
Error message |
data |
Object |
Returned data information. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code, for example, DS.6000, indicating that the request fails to be processed. |
error_msg |
String |
Error message |
data |
Object |
Returned data information. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code, for example, DS.6000, indicating that the request fails to be processed. |
error_msg |
String |
Error message |
data |
Object |
Returned data information. |
Example Requests
Initialize the data standard template.
POST https://{endpoint}/v2/{project_id}/design/standards/templates/action?action-id=init { "fields" : [ { "descriptionEn" : "Standard Name", "fd_name" : "nameCh", "description" : "Standard Name", "required" : true, "searchable" : true, "actived" : true, "label" : "Standard Name", "displayed_name" : "Standard Name", "displayed_name_en" : "Standard name" }, { "descriptionEn" : "Standard Code", "fd_name" : "nameEn", "description" : "Standard Code", "required" : true, "searchable" : true, "actived" : true, "label" : "Standard Code", "displayed_name" : "Standard Code", "displayed_name_en" : "Standard code" }, { "descriptionEn" : "Data Type", "fd_name" : "dataType", "description" : "Data Type", "required" : true, "searchable" : true, "actived" : true, "label" : "Data type", "displayed_name" : "Data Type", "displayed_name_en" : "Data type" }, { "descriptionEn" : "Standard English Name", "fd_name" : "englishName", "description" : "Identifier Name", "required" : false, "searchable" : false, "actived" : false, "label" : "Identifier Name", "disabled" : false, "displayed_name" : "Identifier Name", "displayed_name_en" : "Name (EN)" }, { "descriptionEn" : "Data Length", "fd_name" : "dataLength", "description" : "Max. Data Length", "required" : false, "searchable" : false, "actived" : true, "label" : "Data Length", "disabled" : false, "displayed_name" : "Max. Data Length", "displayed_name_en" : "Data length" }, { "descriptionEn" : "Allowed Value", "fd_name" : "hasAllowValueList", "description" : "Allowed Value Exist", "required" : false, "searchable" : false, "actived" : false, "label" : "Allowed Value Exist", "disabled" : false, "displayed_name" : "Allowed Value Exist", "displayed_name_en" : "Allowed value exist" }, { "descriptionEn" : "Allowed Value List", "fd_name" : "allowList", "description" : "Allowed Value", "required" : false, "searchable" : false, "actived" : false, "label" : "Allowed Value", "disabled" : true, "displayed_name" : "Allowed Value", "displayed_name_en" : "Allowed values" }, { "descriptionEn" : "Referenced Lookup Table", "fd_name" : "referCodeTable", "description" : "Lookup Table", "required" : false, "searchable" : false, "actived" : false, "label" : "Referenced Lookup Table", "disabled" : false, "displayed_name" : "Lookup Table", "displayed_name_en" : "Lookup table" }, { "descriptionEn" : "Lookup Table Field", "fd_name" : "codeStandColumn", "description" : "Lookup Table Field", "required" : false, "searchable" : false, "actived" : false, "label" : "Lookup Table Field", "disabled" : true, "displayed_name" : "Lookup Table Field", "displayed_name_en" : "Lookup table field" }, { "descriptionEn" : "Quality Rule", "fd_name" : "dqcRule", "description" : "Quality rule", "required" : false, "searchable" : false, "actived" : false, "label" : "Quality rule", "disabled" : false, "displayed_name" : "Quality rule", "displayed_name_en" : "Quality rule" }, { "descriptionEn" : "Owner of Business Rules", "fd_name" : "ruleOwner", "description" : "Rule Designer", "required" : false, "searchable" : false, "actived" : false, "label" : "Rule Designer", "disabled" : false, "displayed_name" : "Rule Designer", "displayed_name_en" : "Rule designer" }, { "descriptionEn" : "Owner of Data Monitoring", "fd_name" : "dataMonitorOwner", "description" : "Rule Implementer", "required" : false, "searchable" : false, "actived" : false, "label" : "Rule Implementer", "disabled" : false, "displayed_name" : "Rule Implementer", "displayed_name_en" : "Rule implementer" }, { "descriptionEn" : "Standard Level", "fd_name" : "standardLevel", "description" : "Level", "required" : false, "searchable" : false, "actived" : false, "label" : "Standard Level", "disabled" : false, "displayed_name" : "Standard Level", "displayed_name_en" : "Standard level" }, { "descriptionEn" : "Description", "fd_name" : "description", "description" : "Description", "required" : false, "searchable" : false, "actived" : true, "label" : "Description", "disabled" : false, "displayed_name" : "Description", "displayed_name_en" : "Description" } ] }
Example Responses
Status code: 200
Success
{ "data" : { "value" : [ { "fd_name" : "nameCh", "fd_name_en" : null, "description" : "Standard Name", "id" : "1230921379143135232", "actived" : true, "required" : true, "searchable" : true, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "nameEn", "fd_name_en" : null, "description" : "Standard Code", "id" : "1230921379164106752", "actived" : true, "required" : true, "searchable" : true, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "dataType", "fd_name_en" : null, "description" : "Data Type", "id" : "1230921379180883968", "actived" : true, "required" : true, "searchable" : true, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "englishName", "fd_name_en" : null, "description" : "Identifier Name", "id" : "1230921379201855488", "actived" : false, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "dataLength", "fd_name_en" : null, "description" : "Data Length", "id" : "1230921379222827008", "actived" : true, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "hasAllowValueList", "fd_name_en" : null, "description" : "Allowed Value Exist", "id" : "1230921379239604224", "actived" : false, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "allowList", "fd_name_en" : null, "description" : "Allowed Value", "id" : "1230921379260575744", "actived" : false, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "referCodeTable", "fd_name_en" : null, "description" : "Lookup Table", "id" : "1230921379277352960", "actived" : false, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "codeStandColumn", "fd_name_en" : null, "description" : "Lookup Table Field", "id" : "1230921379298324480", "actived" : false, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "dqcRule", "fd_name_en" : null, "description" : "Quality rule", "id" : "1230921379315101696", "actived" : false, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "ruleOwner", "fd_name_en" : null, "description" : "Rule Designer", "id" : "1230921379340267520", "actived" : false, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "dataMonitorOwner", "fd_name_en" : null, "description" : "Rule Implementer", "id" : "1230921379361239040", "actived" : false, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "standardLevel", "fd_name_en" : null, "description" : "Level", "id" : "1230921379382210560", "actived" : false, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" }, { "fd_name" : "description", "fd_name_en" : null, "description" : "Description", "id" : "1230921379398987776", "actived" : true, "required" : false, "searchable" : false, "optional_values" : null, "field_type" : null, "displayed_name" : null, "displayed_name_en" : null, "create_time" : "2024-04-19T16:42:06+08:00", "update_time" : "2024-04-19T16:42:06+08:00", "create_by" : "test_uesr", "update_by" : "test_uesr" } ] } }
Status code: 400
{ "error_code" : "DS.60xx", "error_msg" : "The user request is illegal." }
Status code: 401
{ "error_code" : "DS.60xx", "error_msg" : "User authentication failed." }
Status code: 403
{ "error_code" : "DS.60xx", "error_msg" : "The user does not have permission to call this API." }
Status code: 404
{ "error_code" : "DS.60xx", "error_msg" : "The User Request API does not exist." }
SDK Sample Code
The SDK sample code is as follows.
Initialize the data standard template.
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
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.dataartsstudio.v1.region.DataArtsStudioRegion; import com.huaweicloud.sdk.dataartsstudio.v1.*; import com.huaweicloud.sdk.dataartsstudio.v1.model.*; import java.util.List; import java.util.ArrayList; public class InitializeStandardTemplateSolution { 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); DataArtsStudioClient client = DataArtsStudioClient.newBuilder() .withCredential(auth) .withRegion(DataArtsStudioRegion.valueOf("<YOUR REGION>")) .build(); InitializeStandardTemplateRequest request = new InitializeStandardTemplateRequest(); StandElementFieldVOList body = new StandElementFieldVOList(); List<StandElementFieldVO> listbodyFields = new ArrayList<>(); listbodyFields.add( new StandElementFieldVO() .withFdName("nameCh") .withDescription("Standard Name") .withDescriptionEn("Standard Name") .withLabel("Standard Name") .withActived(true) .withRequired(true) .withSearchable(true) .withDisplayedName("Standard Name") .withDisplayedNameEn("Standard name") ); listbodyFields.add( new StandElementFieldVO() .withFdName("nameEn") .withDescription("Standard Code") .withDescriptionEn("Standard Code") .withLabel("Standard Code") .withActived(true) .withRequired(true) .withSearchable(true) .withDisplayedName("Standard Code") .withDisplayedNameEn("Standard code") ); listbodyFields.add( new StandElementFieldVO() .withFdName("dataType") .withDescription("Data Type") .withDescriptionEn("Data Type") .withLabel("Data type") .withActived(true) .withRequired(true) .withSearchable(true) .withDisplayedName("Data Type") .withDisplayedNameEn("Data type") ); listbodyFields.add( new StandElementFieldVO() .withFdName("englishName") .withDescription("Identifier Name") .withDescriptionEn("Standard English Name") .withLabel("Identifier Name") .withDisabled(false) .withActived(false) .withRequired(false) .withSearchable(false) .withDisplayedName("Identifier Name") .withDisplayedNameEn("Name (EN)") ); listbodyFields.add( new StandElementFieldVO() .withFdName("dataLength") .withDescription("Max. Data Length") .withDescriptionEn("Data Length") .withLabel("Data Length") .withDisabled(false) .withActived(true) .withRequired(false) .withSearchable(false) .withDisplayedName("Max. Data Length") .withDisplayedNameEn("Data length") ); listbodyFields.add( new StandElementFieldVO() .withFdName("hasAllowValueList") .withDescription("Allowed Value Exist") .withDescriptionEn("Allowed Value") .withLabel("Allowed Value Exist") .withDisabled(false) .withActived(false) .withRequired(false) .withSearchable(false) .withDisplayedName("Allowed Value Exist") .withDisplayedNameEn("Allowed value exist") ); listbodyFields.add( new StandElementFieldVO() .withFdName("allowList") .withDescription("Allowed Value") .withDescriptionEn("Allowed Value List") .withLabel("Allowed Value") .withDisabled(true) .withActived(false) .withRequired(false) .withSearchable(false) .withDisplayedName("Allowed Value") .withDisplayedNameEn("Allowed values") ); listbodyFields.add( new StandElementFieldVO() .withFdName("referCodeTable") .withDescription("Lookup Table") .withDescriptionEn("Referenced Lookup Table") .withLabel("Referenced Lookup Table") .withDisabled(false) .withActived(false) .withRequired(false) .withSearchable(false) .withDisplayedName("Lookup Table") .withDisplayedNameEn("Lookup table") ); listbodyFields.add( new StandElementFieldVO() .withFdName("codeStandColumn") .withDescription("Lookup Table Field") .withDescriptionEn("Lookup Table Field") .withLabel("Lookup Table Field") .withDisabled(true) .withActived(false) .withRequired(false) .withSearchable(false) .withDisplayedName("Lookup Table Field") .withDisplayedNameEn("Lookup table field") ); listbodyFields.add( new StandElementFieldVO() .withFdName("dqcRule") .withDescription("Quality rule") .withDescriptionEn("Quality Rule") .withLabel("Quality rule") .withDisabled(false) .withActived(false) .withRequired(false) .withSearchable(false) .withDisplayedName("Quality rule") .withDisplayedNameEn("Quality rule") ); listbodyFields.add( new StandElementFieldVO() .withFdName("ruleOwner") .withDescription("Rule Designer") .withDescriptionEn("Owner of Business Rules") .withLabel("Rule Designer") .withDisabled(false) .withActived(false) .withRequired(false) .withSearchable(false) .withDisplayedName("Rule Designer") .withDisplayedNameEn("Rule designer") ); listbodyFields.add( new StandElementFieldVO() .withFdName("dataMonitorOwner") .withDescription("Rule Implementer") .withDescriptionEn("Owner of Data Monitoring") .withLabel("Rule Implementer") .withDisabled(false) .withActived(false) .withRequired(false) .withSearchable(false) .withDisplayedName("Rule Implementer") .withDisplayedNameEn("Rule implementer") ); listbodyFields.add( new StandElementFieldVO() .withFdName("standardLevel") .withDescription("Level") .withDescriptionEn("Standard Level") .withLabel("Standard Level") .withDisabled(false) .withActived(false) .withRequired(false) .withSearchable(false) .withDisplayedName("Standard Level") .withDisplayedNameEn("Standard level") ); listbodyFields.add( new StandElementFieldVO() .withFdName("description") .withDescription("Description") .withDescriptionEn("Description") .withLabel("Description") .withDisabled(false) .withActived(true) .withRequired(false) .withSearchable(false) .withDisplayedName("Description") .withDisplayedNameEn("Description") ); body.withFields(listbodyFields); request.withBody(body); try { InitializeStandardTemplateResponse response = client.initializeStandardTemplate(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()); } } } |
Initialize the data standard template.
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdataartsstudio.v1.region.dataartsstudio_region import DataArtsStudioRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdataartsstudio.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 = DataArtsStudioClient.new_builder() \ .with_credentials(credentials) \ .with_region(DataArtsStudioRegion.value_of("<YOUR REGION>")) \ .build() try: request = InitializeStandardTemplateRequest() listFieldsbody = [ StandElementFieldVO( fd_name="nameCh", description="Standard Name", description_en="Standard Name", label="Standard Name", actived=True, required=True, searchable=True, displayed_name="Standard Name", displayed_name_en="Standard name" ), StandElementFieldVO( fd_name="nameEn", description="Standard Code", description_en="Standard Code", label="Standard Code", actived=True, required=True, searchable=True, displayed_name="Standard Code", displayed_name_en="Standard code" ), StandElementFieldVO( fd_name="dataType", description="Data Type", description_en="Data Type", label="Data type", actived=True, required=True, searchable=True, displayed_name="Data Type", displayed_name_en="Data type" ), StandElementFieldVO( fd_name="englishName", description="Identifier Name", description_en="Standard English Name", label="Identifier Name", disabled=False, actived=False, required=False, searchable=False, displayed_name="Identifier Name", displayed_name_en="Name (EN)" ), StandElementFieldVO( fd_name="dataLength", description="Max. Data Length", description_en="Data Length", label="Data Length", disabled=False, actived=True, required=False, searchable=False, displayed_name="Max. Data Length", displayed_name_en="Data length" ), StandElementFieldVO( fd_name="hasAllowValueList", description="Allowed Value Exist", description_en="Allowed Value", label="Allowed Value Exist", disabled=False, actived=False, required=False, searchable=False, displayed_name="Allowed Value Exist", displayed_name_en="Allowed value exist" ), StandElementFieldVO( fd_name="allowList", description="Allowed Value", description_en="Allowed Value List", label="Allowed Value", disabled=True, actived=False, required=False, searchable=False, displayed_name="Allowed Value", displayed_name_en="Allowed values" ), StandElementFieldVO( fd_name="referCodeTable", description="Lookup Table", description_en="Referenced Lookup Table", label="Referenced Lookup Table", disabled=False, actived=False, required=False, searchable=False, displayed_name="Lookup Table", displayed_name_en="Lookup table" ), StandElementFieldVO( fd_name="codeStandColumn", description="Lookup Table Field", description_en="Lookup Table Field", label="Lookup Table Field", disabled=True, actived=False, required=False, searchable=False, displayed_name="Lookup Table Field", displayed_name_en="Lookup table field" ), StandElementFieldVO( fd_name="dqcRule", description="Quality rule", description_en="Quality Rule", label="Quality rule", disabled=False, actived=False, required=False, searchable=False, displayed_name="Quality rule", displayed_name_en="Quality rule" ), StandElementFieldVO( fd_name="ruleOwner", description="Rule Designer", description_en="Owner of Business Rules", label="Rule Designer", disabled=False, actived=False, required=False, searchable=False, displayed_name="Rule Designer", displayed_name_en="Rule designer" ), StandElementFieldVO( fd_name="dataMonitorOwner", description="Rule Implementer", description_en="Owner of Data Monitoring", label="Rule Implementer", disabled=False, actived=False, required=False, searchable=False, displayed_name="Rule Implementer", displayed_name_en="Rule implementer" ), StandElementFieldVO( fd_name="standardLevel", description="Level", description_en="Standard Level", label="Standard Level", disabled=False, actived=False, required=False, searchable=False, displayed_name="Standard Level", displayed_name_en="Standard level" ), StandElementFieldVO( fd_name="description", description="Description", description_en="Description", label="Description", disabled=False, actived=True, required=False, searchable=False, displayed_name="Description", displayed_name_en="Description" ) ] request.body = StandElementFieldVOList( fields=listFieldsbody ) response = client.initialize_standard_template(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Initialize the data standard template.
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dataartsstudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/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 := dataartsstudio.NewDataArtsStudioClient( dataartsstudio.DataArtsStudioClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.InitializeStandardTemplateRequest{} descriptionFields:= "Standard Name" descriptionEnFields:= "Standard Name" labelFields:= "Standard Name" requiredFields:= true searchableFields:= true displayedNameFields:= "Standard Name" displayedNameEnFields:= "Standard name" descriptionFields1:= "Standard Code" descriptionEnFields1:= "Standard Code" labelFields1:= "Standard Code" requiredFields1:= true searchableFields1:= true displayedNameFields1:= "Standard Code" displayedNameEnFields1:= "Standard code" descriptionFields2:= "Data Type" descriptionEnFields2:= "Data Type" labelFields2:= "Data type" requiredFields2:= true searchableFields2:= true displayedNameFields2:= "Data Type" displayedNameEnFields2:= "Data type" descriptionFields3:= "Identifier Name" descriptionEnFields3:= "Standard English Name" labelFields3:= "Identifier Name" disabledFields:= false requiredFields3:= false searchableFields3:= false displayedNameFields3:= "Identifier Name" displayedNameEnFields3:= "Name (EN)" descriptionFields4:= "Max. Data Length" descriptionEnFields4:= "Data Length" labelFields4:= "Data Length" disabledFields1:= false requiredFields4:= false searchableFields4:= false displayedNameFields4:= "Max. Data Length" displayedNameEnFields4:= "Data length" descriptionFields5:= "Allowed Value Exist" descriptionEnFields5:= "Allowed Value" labelFields5:= "Allowed Value Exist" disabledFields2:= false requiredFields5:= false searchableFields5:= false displayedNameFields5:= "Allowed Value Exist" displayedNameEnFields5:= "Allowed value exist" descriptionFields6:= "Allowed Value" descriptionEnFields6:= "Allowed Value List" labelFields6:= "Allowed Value" disabledFields3:= true requiredFields6:= false searchableFields6:= false displayedNameFields6:= "Allowed Value" displayedNameEnFields6:= "Allowed values" descriptionFields7:= "Lookup Table" descriptionEnFields7:= "Referenced Lookup Table" labelFields7:= "Referenced Lookup Table" disabledFields4:= false requiredFields7:= false searchableFields7:= false displayedNameFields7:= "Lookup Table" displayedNameEnFields7:= "Lookup table" descriptionFields8:= "Lookup Table Field" descriptionEnFields8:= "Lookup Table Field" labelFields8:= "Lookup Table Field" disabledFields5:= true requiredFields8:= false searchableFields8:= false displayedNameFields8:= "Lookup Table Field" displayedNameEnFields8:= "Lookup table field" descriptionFields9:= "Quality rule" descriptionEnFields9:= "Quality Rule" labelFields9:= "Quality rule" disabledFields6:= false requiredFields9:= false searchableFields9:= false displayedNameFields9:= "Quality rule" displayedNameEnFields9:= "Quality rule" descriptionFields10:= "Rule Designer" descriptionEnFields10:= "Owner of Business Rules" labelFields10:= "Rule Designer" disabledFields7:= false requiredFields10:= false searchableFields10:= false displayedNameFields10:= "Rule Designer" displayedNameEnFields10:= "Rule designer" descriptionFields11:= "Rule Implementer" descriptionEnFields11:= "Owner of Data Monitoring" labelFields11:= "Rule Implementer" disabledFields8:= false requiredFields11:= false searchableFields11:= false displayedNameFields11:= "Rule Implementer" displayedNameEnFields11:= "Rule implementer" descriptionFields12:= "Level" descriptionEnFields12:= "Standard Level" labelFields12:= "Standard Level" disabledFields9:= false requiredFields12:= false searchableFields12:= false displayedNameFields12:= "Standard Level" displayedNameEnFields12:= "Standard level" descriptionFields13:= "Description" descriptionEnFields13:= "Description" labelFields13:= "Description" disabledFields10:= false requiredFields13:= false searchableFields13:= false displayedNameFields13:= "Description" displayedNameEnFields13:= "Description" var listFieldsbody = []model.StandElementFieldVo{ { FdName: "nameCh", Description: &descriptionFields, DescriptionEn: &descriptionEnFields, Label: &labelFields, Actived: true, Required: &requiredFields, Searchable: &searchableFields, DisplayedName: &displayedNameFields, DisplayedNameEn: &displayedNameEnFields, }, { FdName: "nameEn", Description: &descriptionFields1, DescriptionEn: &descriptionEnFields1, Label: &labelFields1, Actived: true, Required: &requiredFields1, Searchable: &searchableFields1, DisplayedName: &displayedNameFields1, DisplayedNameEn: &displayedNameEnFields1, }, { FdName: "dataType", Description: &descriptionFields2, DescriptionEn: &descriptionEnFields2, Label: &labelFields2, Actived: true, Required: &requiredFields2, Searchable: &searchableFields2, DisplayedName: &displayedNameFields2, DisplayedNameEn: &displayedNameEnFields2, }, { FdName: "englishName", Description: &descriptionFields3, DescriptionEn: &descriptionEnFields3, Label: &labelFields3, Disabled: &disabledFields, Actived: false, Required: &requiredFields3, Searchable: &searchableFields3, DisplayedName: &displayedNameFields3, DisplayedNameEn: &displayedNameEnFields3, }, { FdName: "dataLength", Description: &descriptionFields4, DescriptionEn: &descriptionEnFields4, Label: &labelFields4, Disabled: &disabledFields1, Actived: true, Required: &requiredFields4, Searchable: &searchableFields4, DisplayedName: &displayedNameFields4, DisplayedNameEn: &displayedNameEnFields4, }, { FdName: "hasAllowValueList", Description: &descriptionFields5, DescriptionEn: &descriptionEnFields5, Label: &labelFields5, Disabled: &disabledFields2, Actived: false, Required: &requiredFields5, Searchable: &searchableFields5, DisplayedName: &displayedNameFields5, DisplayedNameEn: &displayedNameEnFields5, }, { FdName: "allowList", Description: &descriptionFields6, DescriptionEn: &descriptionEnFields6, Label: &labelFields6, Disabled: &disabledFields3, Actived: false, Required: &requiredFields6, Searchable: &searchableFields6, DisplayedName: &displayedNameFields6, DisplayedNameEn: &displayedNameEnFields6, }, { FdName: "referCodeTable", Description: &descriptionFields7, DescriptionEn: &descriptionEnFields7, Label: &labelFields7, Disabled: &disabledFields4, Actived: false, Required: &requiredFields7, Searchable: &searchableFields7, DisplayedName: &displayedNameFields7, DisplayedNameEn: &displayedNameEnFields7, }, { FdName: "codeStandColumn", Description: &descriptionFields8, DescriptionEn: &descriptionEnFields8, Label: &labelFields8, Disabled: &disabledFields5, Actived: false, Required: &requiredFields8, Searchable: &searchableFields8, DisplayedName: &displayedNameFields8, DisplayedNameEn: &displayedNameEnFields8, }, { FdName: "dqcRule", Description: &descriptionFields9, DescriptionEn: &descriptionEnFields9, Label: &labelFields9, Disabled: &disabledFields6, Actived: false, Required: &requiredFields9, Searchable: &searchableFields9, DisplayedName: &displayedNameFields9, DisplayedNameEn: &displayedNameEnFields9, }, { FdName: "ruleOwner", Description: &descriptionFields10, DescriptionEn: &descriptionEnFields10, Label: &labelFields10, Disabled: &disabledFields7, Actived: false, Required: &requiredFields10, Searchable: &searchableFields10, DisplayedName: &displayedNameFields10, DisplayedNameEn: &displayedNameEnFields10, }, { FdName: "dataMonitorOwner", Description: &descriptionFields11, DescriptionEn: &descriptionEnFields11, Label: &labelFields11, Disabled: &disabledFields8, Actived: false, Required: &requiredFields11, Searchable: &searchableFields11, DisplayedName: &displayedNameFields11, DisplayedNameEn: &displayedNameEnFields11, }, { FdName: "standardLevel", Description: &descriptionFields12, DescriptionEn: &descriptionEnFields12, Label: &labelFields12, Disabled: &disabledFields9, Actived: false, Required: &requiredFields12, Searchable: &searchableFields12, DisplayedName: &displayedNameFields12, DisplayedNameEn: &displayedNameEnFields12, }, { FdName: "description", Description: &descriptionFields13, DescriptionEn: &descriptionEnFields13, Label: &labelFields13, Disabled: &disabledFields10, Actived: true, Required: &requiredFields13, Searchable: &searchableFields13, DisplayedName: &displayedNameFields13, DisplayedNameEn: &displayedNameEnFields13, }, } request.Body = &model.StandElementFieldVoList{ Fields: &listFieldsbody, } response, err := client.InitializeStandardTemplate(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 |
Success |
400 |
BadRequest |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
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