更新时间:2024-11-06 GMT+08:00

初始化数据标准模板

功能介绍

初始化数据标准模板。

调用方法

请参见如何调用API

URI

POST /v2/{project_id}/design/standards/templates/action

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取方法请参见项目ID和账号ID

表2 Query参数

参数

是否必选

参数类型

描述

action-id

String

action-id=init,初始化数据标准模板时固定参数。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

IAM Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)

使用Token认证时必选。

workspace

String

工作空间ID,获取方法请参见实例ID和工作空间ID

X-Project-Id

String

项目ID,获取方法请参见项目ID和账号ID

多project场景采用AK/SK认证的接口请求,则该字段必选。

Content-Type

String

默认值:application/json;charset=UTF-8

可选,有Body体的情况下必选,没有Body体则无需填写和校验。

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

data

data object

data,统一的返回结果的最外层数据结构。

表5 data

参数

参数类型

描述

value

Array of StandElementFieldVO objects

数据标准模板字段详情数组。

表6 StandElementFieldVO

参数

参数类型

描述

fd_name

String

属性名称。

fd_name_en

String

属性英文名称。

description

String

属性描述。

descriptionEn

String

属性英文描述。

label

String

属性标签。

disabled

Boolean

是否禁用。

id

String

数据标准ID,填写String类型替代Long类型。

actived

Boolean

是否显示,系统默认项必然显示不允许修改。true表示使用数据标准时体现(增改查的时候可以操作该属性),false表示使用数据标准时不体现。

required

Boolean

是否必填。true:必填,false:非必填。

searchable

Boolean

是否可搜索。true表示在数据标准列表页面可搜索,false表示在数据标准列表页面不可搜索。

optional_values

String

允许值。

field_type

Integer

字段类型,0表示系统字段, 1表示自定义字段。

displayed_name

String

前端展示名。

displayed_name_en

String

前端展示名英文。

create_time

String

创建时间,只读,格式遵循RFC3339,精确到秒,UTC时区,即yyyy-mm-ddTHH:MM:SSZ,如1970-01-01T00:00:00Z。

update_time

String

更新时间,只读,格式遵循RFC3339,精确到秒,UTC时区,即yyyy-mm-ddTHH:MM:SSZ,如1970-01-01T00:00:00Z。

create_by

String

创建人。

update_by

String

更新人。

状态码: 400

表7 响应Body参数

参数

参数类型

描述

error_code

String

错误码,如DS.6000,请求处理失败。

error_msg

String

错误信息。

data

Object

返回的数据信息。

状态码: 401

表8 响应Body参数

参数

参数类型

描述

error_code

String

错误码,如DS.6000,请求处理失败。

error_msg

String

错误信息。

data

Object

返回的数据信息。

状态码: 403

表9 响应Body参数

参数

参数类型

描述

error_code

String

错误码,如DS.6000,请求处理失败。

error_msg

String

错误信息。

data

Object

返回的数据信息。

状态码: 404

表10 响应Body参数

参数

参数类型

描述

error_code

String

错误码,如DS.6000,请求处理失败。

error_msg

String

错误信息。

data

Object

返回的数据信息。

请求示例

初始化数据标准模板。

POST https://{endpoint}/v2/{project_id}/design/standards/templates/action?action-id=init

{
  "fields" : [ {
    "descriptionEn" : "Standard Name",
    "fd_name" : "nameCh",
    "description" : "标准名称",
    "required" : true,
    "searchable" : true,
    "actived" : true,
    "label" : "标准名称",
    "displayed_name" : "标准名称",
    "displayed_name_en" : "Standard name"
  }, {
    "descriptionEn" : "Standard Code",
    "fd_name" : "nameEn",
    "description" : "标准编码",
    "required" : true,
    "searchable" : true,
    "actived" : true,
    "label" : "标准编码",
    "displayed_name" : "标准编码",
    "displayed_name_en" : "Standard code"
  }, {
    "descriptionEn" : "Data Type",
    "fd_name" : "dataType",
    "description" : "数据类型",
    "required" : true,
    "searchable" : true,
    "actived" : true,
    "label" : "数据类型",
    "displayed_name" : "数据类型",
    "displayed_name_en" : "Data type"
  }, {
    "descriptionEn" : "Standard English Name",
    "fd_name" : "englishName",
    "description" : "英文名称",
    "required" : false,
    "searchable" : false,
    "actived" : false,
    "label" : "英文名称",
    "disabled" : false,
    "displayed_name" : "英文名称",
    "displayed_name_en" : "Name (EN)"
  }, {
    "descriptionEn" : "Data Length",
    "fd_name" : "dataLength",
    "description" : "数据长度",
    "required" : false,
    "searchable" : false,
    "actived" : true,
    "label" : "数据长度",
    "disabled" : false,
    "displayed_name" : "数据长度",
    "displayed_name_en" : "Data length"
  }, {
    "descriptionEn" : "Allowed Value",
    "fd_name" : "hasAllowValueList",
    "description" : "是否有允许值",
    "required" : false,
    "searchable" : false,
    "actived" : false,
    "label" : "是否有允许值",
    "disabled" : false,
    "displayed_name" : "是否有允许值",
    "displayed_name_en" : "Allowed value exist"
  }, {
    "descriptionEn" : "Allowed Value List",
    "fd_name" : "allowList",
    "description" : "允许值",
    "required" : false,
    "searchable" : false,
    "actived" : false,
    "label" : "允许值",
    "disabled" : true,
    "displayed_name" : "允许值",
    "displayed_name_en" : "Allowed values"
  }, {
    "descriptionEn" : "Referenced Lookup Table",
    "fd_name" : "referCodeTable",
    "description" : "引用码表",
    "required" : false,
    "searchable" : false,
    "actived" : false,
    "label" : "引用码表",
    "disabled" : false,
    "displayed_name" : "引用码表",
    "displayed_name_en" : "Lookup table"
  }, {
    "descriptionEn" : "Lookup Table Field",
    "fd_name" : "codeStandColumn",
    "description" : "码表字段",
    "required" : false,
    "searchable" : false,
    "actived" : false,
    "label" : "码表字段",
    "disabled" : true,
    "displayed_name" : "码表字段",
    "displayed_name_en" : "Lookup table field"
  }, {
    "descriptionEn" : "Quality Rule",
    "fd_name" : "dqcRule",
    "description" : "质量规则",
    "required" : false,
    "searchable" : false,
    "actived" : false,
    "label" : "质量规则",
    "disabled" : false,
    "displayed_name" : "质量规则",
    "displayed_name_en" : "Quality rule"
  }, {
    "descriptionEn" : "Owner of Business Rules",
    "fd_name" : "ruleOwner",
    "description" : "业务规则责任人",
    "required" : false,
    "searchable" : false,
    "actived" : false,
    "label" : "业务规则责任人",
    "disabled" : false,
    "displayed_name" : "业务规则责任人",
    "displayed_name_en" : "Rule designer"
  }, {
    "descriptionEn" : "Owner of Data Monitoring",
    "fd_name" : "dataMonitorOwner",
    "description" : "数据监控责任人",
    "required" : false,
    "searchable" : false,
    "actived" : false,
    "label" : "数据监控责任人",
    "disabled" : false,
    "displayed_name" : "数据监控责任人",
    "displayed_name_en" : "Rule implementer"
  }, {
    "descriptionEn" : "Standard Level",
    "fd_name" : "standardLevel",
    "description" : "标准层级",
    "required" : false,
    "searchable" : false,
    "actived" : false,
    "label" : "标准层级",
    "disabled" : false,
    "displayed_name" : "标准层级",
    "displayed_name_en" : "Standard level"
  }, {
    "descriptionEn" : "Description",
    "fd_name" : "description",
    "description" : "描述",
    "required" : false,
    "searchable" : false,
    "actived" : true,
    "label" : "描述",
    "disabled" : false,
    "displayed_name" : "描述",
    "displayed_name_en" : "Description"
  } ]
}

响应示例

状态码: 200

Success

{
  "data" : {
    "value" : [ {
      "fd_name" : "nameCh",
      "fd_name_en" : null,
      "description" : "标准名称",
      "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" : "标准编码",
      "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" : "数据类型",
      "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" : "英文名称",
      "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" : "数据长度",
      "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" : "是否有允许值",
      "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" : "允许值",
      "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" : "引用码表",
      "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" : "码表字段",
      "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" : "质量规则",
      "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" : "业务规则责任人",
      "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" : "数据监控责任人",
      "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" : "标准层级",
      "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" : "描述",
      "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"
    } ]
  }
}

状态码: 400

{
  "error_code" : "DS.60xx",
  "error_msg" : "The user request is illegal."
}

状态码: 401

{
  "error_code" : "DS.60xx",
  "error_msg" : "User authentication failed."
}

状态码: 403

{
  "error_code" : "DS.60xx",
  "error_msg" : "The user does not have permission to call this API."
}

状态码: 404

{
  "error_code" : "DS.60xx",
  "error_msg" : "The User Request API does not exist."
}

SDK代码示例

SDK代码示例如下。

初始化数据标准模板。

  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("标准名称")
                .withDescriptionEn("Standard Name")
                .withLabel("标准名称")
                .withActived(true)
                .withRequired(true)
                .withSearchable(true)
                .withDisplayedName("标准名称")
                .withDisplayedNameEn("Standard name")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("nameEn")
                .withDescription("标准编码")
                .withDescriptionEn("Standard Code")
                .withLabel("标准编码")
                .withActived(true)
                .withRequired(true)
                .withSearchable(true)
                .withDisplayedName("标准编码")
                .withDisplayedNameEn("Standard code")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("dataType")
                .withDescription("数据类型")
                .withDescriptionEn("Data Type")
                .withLabel("数据类型")
                .withActived(true)
                .withRequired(true)
                .withSearchable(true)
                .withDisplayedName("数据类型")
                .withDisplayedNameEn("Data type")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("englishName")
                .withDescription("英文名称")
                .withDescriptionEn("Standard English Name")
                .withLabel("英文名称")
                .withDisabled(false)
                .withActived(false)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("英文名称")
                .withDisplayedNameEn("Name (EN)")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("dataLength")
                .withDescription("数据长度")
                .withDescriptionEn("Data Length")
                .withLabel("数据长度")
                .withDisabled(false)
                .withActived(true)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("数据长度")
                .withDisplayedNameEn("Data length")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("hasAllowValueList")
                .withDescription("是否有允许值")
                .withDescriptionEn("Allowed Value")
                .withLabel("是否有允许值")
                .withDisabled(false)
                .withActived(false)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("是否有允许值")
                .withDisplayedNameEn("Allowed value exist")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("allowList")
                .withDescription("允许值")
                .withDescriptionEn("Allowed Value List")
                .withLabel("允许值")
                .withDisabled(true)
                .withActived(false)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("允许值")
                .withDisplayedNameEn("Allowed values")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("referCodeTable")
                .withDescription("引用码表")
                .withDescriptionEn("Referenced Lookup Table")
                .withLabel("引用码表")
                .withDisabled(false)
                .withActived(false)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("引用码表")
                .withDisplayedNameEn("Lookup table")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("codeStandColumn")
                .withDescription("码表字段")
                .withDescriptionEn("Lookup Table Field")
                .withLabel("码表字段")
                .withDisabled(true)
                .withActived(false)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("码表字段")
                .withDisplayedNameEn("Lookup table field")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("dqcRule")
                .withDescription("质量规则")
                .withDescriptionEn("Quality Rule")
                .withLabel("质量规则")
                .withDisabled(false)
                .withActived(false)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("质量规则")
                .withDisplayedNameEn("Quality rule")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("ruleOwner")
                .withDescription("业务规则责任人")
                .withDescriptionEn("Owner of Business Rules")
                .withLabel("业务规则责任人")
                .withDisabled(false)
                .withActived(false)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("业务规则责任人")
                .withDisplayedNameEn("Rule designer")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("dataMonitorOwner")
                .withDescription("数据监控责任人")
                .withDescriptionEn("Owner of Data Monitoring")
                .withLabel("数据监控责任人")
                .withDisabled(false)
                .withActived(false)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("数据监控责任人")
                .withDisplayedNameEn("Rule implementer")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("standardLevel")
                .withDescription("标准层级")
                .withDescriptionEn("Standard Level")
                .withLabel("标准层级")
                .withDisabled(false)
                .withActived(false)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("标准层级")
                .withDisplayedNameEn("Standard level")
        );
        listbodyFields.add(
            new StandElementFieldVO()
                .withFdName("description")
                .withDescription("描述")
                .withDescriptionEn("Description")
                .withLabel("描述")
                .withDisabled(false)
                .withActived(true)
                .withRequired(false)
                .withSearchable(false)
                .withDisplayedName("描述")
                .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());
        }
    }
}

初始化数据标准模板。

  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="标准名称",
                description_en="Standard Name",
                label="标准名称",
                actived=True,
                required=True,
                searchable=True,
                displayed_name="标准名称",
                displayed_name_en="Standard name"
            ),
            StandElementFieldVO(
                fd_name="nameEn",
                description="标准编码",
                description_en="Standard Code",
                label="标准编码",
                actived=True,
                required=True,
                searchable=True,
                displayed_name="标准编码",
                displayed_name_en="Standard code"
            ),
            StandElementFieldVO(
                fd_name="dataType",
                description="数据类型",
                description_en="Data Type",
                label="数据类型",
                actived=True,
                required=True,
                searchable=True,
                displayed_name="数据类型",
                displayed_name_en="Data type"
            ),
            StandElementFieldVO(
                fd_name="englishName",
                description="英文名称",
                description_en="Standard English Name",
                label="英文名称",
                disabled=False,
                actived=False,
                required=False,
                searchable=False,
                displayed_name="英文名称",
                displayed_name_en="Name (EN)"
            ),
            StandElementFieldVO(
                fd_name="dataLength",
                description="数据长度",
                description_en="Data Length",
                label="数据长度",
                disabled=False,
                actived=True,
                required=False,
                searchable=False,
                displayed_name="数据长度",
                displayed_name_en="Data length"
            ),
            StandElementFieldVO(
                fd_name="hasAllowValueList",
                description="是否有允许值",
                description_en="Allowed Value",
                label="是否有允许值",
                disabled=False,
                actived=False,
                required=False,
                searchable=False,
                displayed_name="是否有允许值",
                displayed_name_en="Allowed value exist"
            ),
            StandElementFieldVO(
                fd_name="allowList",
                description="允许值",
                description_en="Allowed Value List",
                label="允许值",
                disabled=True,
                actived=False,
                required=False,
                searchable=False,
                displayed_name="允许值",
                displayed_name_en="Allowed values"
            ),
            StandElementFieldVO(
                fd_name="referCodeTable",
                description="引用码表",
                description_en="Referenced Lookup Table",
                label="引用码表",
                disabled=False,
                actived=False,
                required=False,
                searchable=False,
                displayed_name="引用码表",
                displayed_name_en="Lookup table"
            ),
            StandElementFieldVO(
                fd_name="codeStandColumn",
                description="码表字段",
                description_en="Lookup Table Field",
                label="码表字段",
                disabled=True,
                actived=False,
                required=False,
                searchable=False,
                displayed_name="码表字段",
                displayed_name_en="Lookup table field"
            ),
            StandElementFieldVO(
                fd_name="dqcRule",
                description="质量规则",
                description_en="Quality Rule",
                label="质量规则",
                disabled=False,
                actived=False,
                required=False,
                searchable=False,
                displayed_name="质量规则",
                displayed_name_en="Quality rule"
            ),
            StandElementFieldVO(
                fd_name="ruleOwner",
                description="业务规则责任人",
                description_en="Owner of Business Rules",
                label="业务规则责任人",
                disabled=False,
                actived=False,
                required=False,
                searchable=False,
                displayed_name="业务规则责任人",
                displayed_name_en="Rule designer"
            ),
            StandElementFieldVO(
                fd_name="dataMonitorOwner",
                description="数据监控责任人",
                description_en="Owner of Data Monitoring",
                label="数据监控责任人",
                disabled=False,
                actived=False,
                required=False,
                searchable=False,
                displayed_name="数据监控责任人",
                displayed_name_en="Rule implementer"
            ),
            StandElementFieldVO(
                fd_name="standardLevel",
                description="标准层级",
                description_en="Standard Level",
                label="标准层级",
                disabled=False,
                actived=False,
                required=False,
                searchable=False,
                displayed_name="标准层级",
                displayed_name_en="Standard level"
            ),
            StandElementFieldVO(
                fd_name="description",
                description="描述",
                description_en="Description",
                label="描述",
                disabled=False,
                actived=True,
                required=False,
                searchable=False,
                displayed_name="描述",
                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)

初始化数据标准模板。

  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:= "标准名称"
	descriptionEnFields:= "Standard Name"
	labelFields:= "标准名称"
	requiredFields:= true
	searchableFields:= true
	displayedNameFields:= "标准名称"
	displayedNameEnFields:= "Standard name"
	descriptionFields1:= "标准编码"
	descriptionEnFields1:= "Standard Code"
	labelFields1:= "标准编码"
	requiredFields1:= true
	searchableFields1:= true
	displayedNameFields1:= "标准编码"
	displayedNameEnFields1:= "Standard code"
	descriptionFields2:= "数据类型"
	descriptionEnFields2:= "Data Type"
	labelFields2:= "数据类型"
	requiredFields2:= true
	searchableFields2:= true
	displayedNameFields2:= "数据类型"
	displayedNameEnFields2:= "Data type"
	descriptionFields3:= "英文名称"
	descriptionEnFields3:= "Standard English Name"
	labelFields3:= "英文名称"
	disabledFields:= false
	requiredFields3:= false
	searchableFields3:= false
	displayedNameFields3:= "英文名称"
	displayedNameEnFields3:= "Name (EN)"
	descriptionFields4:= "数据长度"
	descriptionEnFields4:= "Data Length"
	labelFields4:= "数据长度"
	disabledFields1:= false
	requiredFields4:= false
	searchableFields4:= false
	displayedNameFields4:= "数据长度"
	displayedNameEnFields4:= "Data length"
	descriptionFields5:= "是否有允许值"
	descriptionEnFields5:= "Allowed Value"
	labelFields5:= "是否有允许值"
	disabledFields2:= false
	requiredFields5:= false
	searchableFields5:= false
	displayedNameFields5:= "是否有允许值"
	displayedNameEnFields5:= "Allowed value exist"
	descriptionFields6:= "允许值"
	descriptionEnFields6:= "Allowed Value List"
	labelFields6:= "允许值"
	disabledFields3:= true
	requiredFields6:= false
	searchableFields6:= false
	displayedNameFields6:= "允许值"
	displayedNameEnFields6:= "Allowed values"
	descriptionFields7:= "引用码表"
	descriptionEnFields7:= "Referenced Lookup Table"
	labelFields7:= "引用码表"
	disabledFields4:= false
	requiredFields7:= false
	searchableFields7:= false
	displayedNameFields7:= "引用码表"
	displayedNameEnFields7:= "Lookup table"
	descriptionFields8:= "码表字段"
	descriptionEnFields8:= "Lookup Table Field"
	labelFields8:= "码表字段"
	disabledFields5:= true
	requiredFields8:= false
	searchableFields8:= false
	displayedNameFields8:= "码表字段"
	displayedNameEnFields8:= "Lookup table field"
	descriptionFields9:= "质量规则"
	descriptionEnFields9:= "Quality Rule"
	labelFields9:= "质量规则"
	disabledFields6:= false
	requiredFields9:= false
	searchableFields9:= false
	displayedNameFields9:= "质量规则"
	displayedNameEnFields9:= "Quality rule"
	descriptionFields10:= "业务规则责任人"
	descriptionEnFields10:= "Owner of Business Rules"
	labelFields10:= "业务规则责任人"
	disabledFields7:= false
	requiredFields10:= false
	searchableFields10:= false
	displayedNameFields10:= "业务规则责任人"
	displayedNameEnFields10:= "Rule designer"
	descriptionFields11:= "数据监控责任人"
	descriptionEnFields11:= "Owner of Data Monitoring"
	labelFields11:= "数据监控责任人"
	disabledFields8:= false
	requiredFields11:= false
	searchableFields11:= false
	displayedNameFields11:= "数据监控责任人"
	displayedNameEnFields11:= "Rule implementer"
	descriptionFields12:= "标准层级"
	descriptionEnFields12:= "Standard Level"
	labelFields12:= "标准层级"
	disabledFields9:= false
	requiredFields12:= false
	searchableFields12:= false
	displayedNameFields12:= "标准层级"
	displayedNameEnFields12:= "Standard level"
	descriptionFields13:= "描述"
	descriptionEnFields13:= "Description"
	labelFields13:= "描述"
	disabledFields10:= false
	requiredFields13:= false
	searchableFields13:= false
	displayedNameFields13:= "描述"
	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)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

Success

400

BadRequest

401

Unauthorized

403

Forbidden

404

Not Found