获取模型树配置信息 - GetModelConfig
功能介绍
获取模型树配置信息
调用方法
请参见如何调用API。
授权信息
账号根用户具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备如下身份策略权限,更多的权限说明请参见权限和授权项。
URI
GET /v1/ipdprojectservice/projects/{project_id}/model-config
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| project_id | 是 | String | 参数解释: 项目32位ID,项目唯一标识。通过查询IPD项目列表获取,响应消息体中的id字段的值就是项目ID。 约束限制: 不涉及。 取值范围: 32个字符,由英文字母和数字组成。 默认取值: 不涉及。 |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| X-Auth-Token | 是 | String | 参数解释: 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 约束限制: 不涉及。 取值范围: 10~32768个字符。 默认取值: 不涉及。 |
响应参数
状态码:200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| status | String | 参数解释: 响应状态。 取值范围: 不涉及。 |
| result | ModelConfigDTO object | 参数解释: 响应状态。 取值范围: 不涉及。 |
| message | String | 参数解释: 响应信息。 取值范围: 不涉及。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| categories | Array of BaseCategory objects | 参数解释: 工作项属性。 取值范围: 不涉及。 |
| category_layer_config | Array of CategoryLayerDTO objects | 参数解释: 工作项层级关系。 取值范围: 不涉及。 |
| feature_page_link_template | String | 参数解释: 工作项功能页面跳转链接模板。 取值范围: 不涉及。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| tenant_id | String | 参数解释: 租户ID。 取值范围: 不涉及。 |
| modified_by | String | 参数解释: 修改人。 取值范围: 不涉及。 |
| modified_date | Long | 参数解释: 修改时间。 取值范围: 不涉及。 |
| created_by | String | 参数解释: 创建人。 取值范围: 不涉及。 |
| created_date | String | 参数解释: 创建时间。 取值范围: 不涉及。 |
| code | String | 参数解释: 对象类型编码。 取值范围: 不涉及。 |
| classification_id | Long | 参数解释: 类型分类ID。 取值范围: 不涉及。 |
| prefix | String | 参数解释: 编号前缀。 取值范围: 不涉及。 |
| domain_id | Long | 参数解释: 租户下项目空间唯一标识ID。 取值范围: 不涉及。 |
| icon | String | 参数解释: 图标。 取值范围: 不涉及。 |
| color | String | 参数解释: 颜色。 取值范围: 不涉及。 |
| description | String | 参数解释: 描述信息。 取值范围: 不涉及。 |
| definition_type | String | 参数解释: 定义类型。 取值范围: |
| type_id | Long | 参数解释: 类别ID。 取值范围: 不涉及。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| category | BaseCategory object | 参数解释: 对象类型信息。 取值范围: 不涉及。 |
| link_parent_field | String | 参数解释: 父类字段。 取值范围: 不涉及。 |
| code | String | 参数解释: 层级对象类型编码。 取值范围: 不涉及。 |
| category_code | String | 参数解释: 对象类型编码。 取值范围: 不涉及。 |
| category_id | Long | 参数解释: 对象类型ID。 取值范围: 不涉及。 |
| layer_type | String | 参数解释: 层级类型。 取值范围: 不涉及。 |
| parent_id | Long | 参数解释: 父ID。 取值范围: 不涉及。 |
| root_id | Long | 参数解释: 根工作项ID。 取值范围: 不涉及。 |
| position_x | Integer | 参数解释: 画布X轴坐标。 取值范围: 不涉及。 |
| position_y | Integer | 参数解释: 画布Y轴坐标。 取值范围: 不涉及。 |
状态码:400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 参数解释: 错误码。 取值范围: 不涉及。 |
| error_msg | String | 参数解释: 错误描述,对error_code的补充解释。 取值范围: 不涉及。 |
请求示例
假设项目ID为26f251d688044d6ca53f7b1b8829d168,查询该项目的模型树配置信息,示例如下:
GET https://{endpoint}/v1/ipdprojectservice/projects/26f251d688044d6ca53f7b1b8829d168/model-config 响应示例
状态码:200
{
"status" : "success",
"result" : {
"categories" : [ {
"id" : "1188444320469135361",
"region" : "xx-xx-xx",
"enabled" : 1,
"tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
"modified_by" : "a360371833bf4c558f796fd707b44daf",
"modified_date" : "1766559565636",
"created_by" : "a360371833bf4c558f796fd707b44daf",
"created_date" : "1761276806227",
"code" : "c7380365137905545216",
"prefix" : "ZR",
"domain_id" : "-1",
"icon" : "ZR",
"color" : "#86CAFF",
"description" : "1",
"display_name" : "ZR",
"definition_type" : 4,
"type_id" : "10026"
}, {
"id" : "1188444430468952065",
"region" : "xx-xx-xx",
"enabled" : 1,
"tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
"modified_by" : "a360371833bf4c558f796fd707b44daf",
"modified_date" : "1761276832453",
"created_by" : "a360371833bf4c558f796fd707b44daf",
"created_date" : "1761276832453",
"code" : "c7380365247985053696",
"prefix" : "CCR",
"domain_id" : "-1",
"icon" : "CCR",
"color" : "#6DDEBB",
"description" : "",
"display_name" : "CCR",
"definition_type" : 4,
"type_id" : "10026"
}, {
"id" : "1188444469958324225",
"region" : "xx-xx-xx",
"enabled" : 1,
"tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
"modified_by" : "a360371833bf4c558f796fd707b44daf",
"modified_date" : "1761276841868",
"created_by" : "a360371833bf4c558f796fd707b44daf",
"created_date" : "1761276841868",
"code" : "c7380365287323430912",
"prefix" : "VVR",
"domain_id" : "-1",
"icon" : "VVR",
"color" : "#A6DD82",
"description" : "",
"display_name" : "VVR",
"definition_type" : 4,
"type_id" : "10026"
}, {
"id" : "1192859851372670977",
"region" : "xx-xx-xx",
"enabled" : 1,
"tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
"modified_by" : "a360371833bf4c558f796fd707b44daf",
"modified_date" : "1762329550831",
"created_by" : "a360371833bf4c558f796fd707b44daf",
"created_date" : "1762329550831",
"code" : "c7384780668794400768",
"prefix" : "QY",
"domain_id" : "-1",
"icon" : "QY",
"color" : "#86CAFF",
"description" : "",
"display_name" : "QY",
"definition_type" : 4,
"type_id" : "10026"
}, {
"id" : "1192859886432858112",
"region" : "xx-xx-xx",
"enabled" : 1,
"tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
"modified_by" : "a360371833bf4c558f796fd707b44daf",
"modified_date" : "1762329559190",
"created_by" : "a360371833bf4c558f796fd707b44daf",
"created_date" : "1762329559190",
"code" : "c7384780703795867648",
"prefix" : "WY",
"domain_id" : "-1",
"icon" : "WY",
"color" : "#6DDEBB",
"description" : "",
"display_name" : "WY",
"definition_type" : 4,
"type_id" : "10026"
}, {
"id" : "1192859911804203008",
"region" : "xx-xx-xx",
"enabled" : 1,
"tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
"modified_by" : "a360371833bf4c558f796fd707b44daf",
"modified_date" : "1762329565239",
"created_by" : "a360371833bf4c558f796fd707b44daf",
"created_date" : "1762329565239",
"code" : "c7384780729121075200",
"prefix" : "EY",
"domain_id" : "-1",
"icon" : "EY",
"color" : "#A6DD82",
"description" : "",
"display_name" : "EY",
"definition_type" : 4,
"type_id" : "10026"
}, {
"id" : "1192859944242950144",
"region" : "xx-xx-xx",
"enabled" : 1,
"tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
"modified_by" : "a360371833bf4c558f796fd707b44daf",
"modified_date" : "1762329572973",
"created_by" : "a360371833bf4c558f796fd707b44daf",
"created_date" : "1762329572973",
"code" : "c7384780761601765376",
"prefix" : "RY",
"domain_id" : "-1",
"icon" : "RY",
"color" : "#FAC20A",
"description" : "",
"display_name" : "RY",
"definition_type" : 4,
"type_id" : "10026"
}, {
"id" : "1196449663501512704",
"region" : "xx-xx-xx",
"enabled" : 1,
"tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
"modified_by" : "a360371833bf4c558f796fd707b44daf",
"modified_date" : "1763185428738",
"created_by" : "a360371833bf4c558f796fd707b44daf",
"created_date" : "1763185428738",
"code" : "c7388370480791121920",
"prefix" : "QU",
"domain_id" : "-1",
"icon" : "QU",
"color" : "#6DDEBB",
"description" : "",
"display_name" : "QU",
"definition_type" : 4,
"type_id" : "10026"
}, {
"id" : "10020",
"region" : "0",
"enabled" : 1,
"tenant_id" : "0",
"modified_by" : "system",
"modified_date" : "1643094460",
"created_by" : "system",
"created_date" : "1643094460",
"code" : "IR",
"prefix" : "IR",
"domain_id" : "0",
"icon" : "IR",
"color" : "#FFE1C7",
"description" : "初始需求(IR)是站在内外部客户/市场角度,以准确的语言(完整的背景、标准的格式)重新描述的需求。",
"display_name" : "初始需求",
"definition_type" : 3,
"type_id" : "10013"
}, {
"id" : "10021",
"region" : "0",
"enabled" : 1,
"tenant_id" : "0",
"modified_by" : "system",
"modified_date" : "1643094460",
"created_by" : "system",
"created_date" : "1643094460",
"code" : "RR",
"prefix" : "RR",
"domain_id" : "0",
"icon" : "RR",
"color" : "#E1E8FD",
"description" : "原始需求(RR)是来自公司内、外部客户的,以客户视角描述的原始问题或者原始诉求。客户需求属于原始需求的一种类别。此类需求需要RMT/RAT分析评审后做出决定。",
"display_name" : "原始需求",
"definition_type" : 3,
"type_id" : "10012"
}, {
"id" : "10022",
"region" : "0",
"enabled" : 1,
"tenant_id" : "0",
"modified_by" : "system",
"modified_date" : "1643094460",
"created_by" : "system",
"created_date" : "1643094460",
"code" : "SR",
"prefix" : "SR",
"domain_id" : "0",
"icon" : "SR",
"color" : "#CFFCEE",
"description" : "系统需求(SR)是站在研发视角,描述系统对外呈现的、可测试的全部功能需求和非功能需求。其中功能需求是对系统提供的功能的场景化的具体要求,非功能需求是对系统的成本、全局质量属性(主要是DFX)、技术限制等非功能性方面的具体要求。",
"display_name" : "系统需求",
"definition_type" : 3,
"type_id" : "10013"
}, {
"id" : "10027",
"region" : "0",
"enabled" : 1,
"tenant_id" : "0",
"modified_by" : "system",
"modified_date" : "1643094460",
"created_by" : "system",
"created_date" : "1643094460",
"code" : "Task",
"prefix" : "TASK",
"domain_id" : "0",
"icon" : "Task",
"color" : "#D8FCC0",
"description" : "任务(Task)是为了完成某个目标而产生的活动,通常为过程性的工作,是研发生产中的最小工作单元。",
"display_name" : "任务",
"definition_type" : 3,
"type_id" : "10014"
}, {
"id" : "10029",
"region" : "0",
"enabled" : 1,
"tenant_id" : "0",
"modified_by" : "system",
"modified_date" : "1643094460",
"created_by" : "system",
"created_date" : "1643094460",
"code" : "AR",
"prefix" : "AR",
"domain_id" : "0",
"icon" : "AR",
"color" : "#D1EBFF",
"description" : "分配需求(AR)是根据基层组织分工不同,以可交付的视角,由SR进一步分解分配到子系统/模块的功能或非功能需求。",
"display_name" : "分配需求",
"definition_type" : 3,
"type_id" : "10013"
}, {
"id" : "10033",
"region" : "0",
"enabled" : 1,
"tenant_id" : "0",
"modified_by" : "system",
"modified_date" : "1643094460",
"created_by" : "system",
"created_date" : "1643094460",
"code" : "Bug",
"prefix" : "BUG",
"domain_id" : "0",
"icon" : "Bug",
"color" : "#FFBCBA",
"description" : "在项目管理(尤其是敏捷开发或软件项目管理)中,缺陷(Bug)是指产品或系统中存在的错误、故障或不符合预期功能的问题,它会导致系统无法正常运行或产生非预期的结果。",
"display_name" : "缺陷",
"definition_type" : 3,
"type_id" : "10015"
}, {
"id" : "10065",
"region" : "0",
"enabled" : 1,
"tenant_id" : "0",
"modified_by" : "system",
"modified_date" : "1643094460",
"created_by" : "system",
"created_date" : "1643094460",
"code" : "SF",
"prefix" : "SF",
"domain_id" : "0",
"icon" : "SF",
"color" : "#E7D9FF",
"description" : "系统特性(SF)是产品主要卖点和销售亮点的描述,会随着产品增长持续迭代优化。",
"display_name" : "系统特性",
"definition_type" : 3,
"type_id" : "10001"
} ],
"category_layer_config" : [ {
"id" : "1196425853033295873",
"path" : "/1196425853033295873",
"enabled" : true,
"children" : [ {
"id" : "1196425853033295875",
"path" : "/1196425853033295873/1196425853033295875",
"enabled" : true,
"children" : [ {
"id" : "1196425853033295878",
"path" : "/1196425853033295873/1196425853033295875/1196425853033295878",
"enabled" : true,
"children" : [ ],
"link_parent_field" : "parent_id",
"code" : "af96edc9b0364841a9cfb51ccb6dd80b",
"category_code" : "AR",
"category_id" : "10029",
"parent_id" : "1196425853033295875",
"root_id" : "1196425853033295873",
"position_x" : -607,
"position_y" : 422
} ],
"link_parent_field" : "parent_id",
"code" : "6cf2ef794d1443f6bb35983fdbeb6feb",
"category_code" : "SR",
"category_id" : "10022",
"parent_id" : "1196425853033295873",
"root_id" : "1196425853033295873",
"position_x" : -607,
"position_y" : 286
} ],
"link_parent_field" : "parent_id",
"code" : "22faeb024989486191cceddf4c731bae",
"category_code" : "IR",
"category_id" : "10020",
"root_id" : "1196425853033295873",
"position_x" : -607,
"position_y" : 150
}, {
"id" : "1196425853033295874",
"path" : "/1196425853033295874",
"enabled" : true,
"children" : [ ],
"link_parent_field" : "parent_id",
"code" : "f0a3bf7b53e04a2288ad41c4d6f9d602",
"category_code" : "RR",
"category_id" : "10021",
"root_id" : "1196425853033295874",
"position_x" : -445,
"position_y" : 150
}, {
"id" : "1196425853033295876",
"path" : "/1196425853033295876",
"enabled" : true,
"children" : [ {
"id" : "1196425853033295877",
"path" : "/1196425853033295876/1196425853033295877",
"enabled" : true,
"children" : [ {
"id" : "1200897868364558337",
"path" : "/1196425853033295876/1196425853033295877/1200897868364558337",
"enabled" : true,
"children" : [ {
"id" : "1200897868364558336",
"path" : "/1196425853033295876/1196425853033295877/1200897868364558337/1200897868364558336",
"enabled" : true,
"children" : [ ],
"link_parent_field" : "parent_id",
"category_code" : "Task",
"category_id" : "10027",
"parent_id" : "1200897868364558337",
"root_id" : "1196425853033295876",
"position_x" : -282,
"position_y" : 558
} ],
"link_parent_field" : "parent_id",
"category_code" : "Task",
"category_id" : "10027",
"parent_id" : "1196425853033295877",
"root_id" : "1196425853033295876",
"position_x" : -282,
"position_y" : 422
} ],
"link_parent_field" : "parent_id",
"code" : "9a851a94d5fe47348c4abcc8f6506d0a",
"category_code" : "Task",
"category_id" : "10027",
"parent_id" : "1196425853033295876",
"root_id" : "1196425853033295876",
"position_x" : -282,
"position_y" : 286
} ],
"link_parent_field" : "parent_id",
"code" : "9a851a94d5fe47348c4abcc8f6506d0a",
"category_code" : "Task",
"category_id" : "10027",
"root_id" : "1196425853033295876",
"position_x" : -282,
"position_y" : 150
}, {
"id" : "1196425853033295879",
"path" : "/1196425853033295879",
"enabled" : true,
"children" : [ ],
"link_parent_field" : "parent_id",
"code" : "2d981e00439c4799bf7088c6e9e87570",
"category_code" : "Bug",
"category_id" : "10033",
"root_id" : "1196425853033295879",
"position_x" : -135,
"position_y" : 150
}, {
"id" : "1196425853033295880",
"path" : "/1196425853033295880",
"enabled" : true,
"children" : [ ],
"link_parent_field" : "parent_id",
"code" : "6fb084e99bb648e786c1d7b59cf4197c",
"category_code" : "SF",
"category_id" : "10065",
"root_id" : "1196425853033295880",
"position_x" : 7,
"position_y" : 150
}, {
"id" : "1196425853033295881",
"path" : "/1196425853033295881",
"enabled" : true,
"children" : [ {
"id" : "1196425853033295882",
"path" : "/1196425853033295881/1196425853033295882",
"enabled" : true,
"children" : [ {
"id" : "1196425853033295883",
"path" : "/1196425853033295881/1196425853033295882/1196425853033295883",
"enabled" : true,
"children" : [ ],
"link_parent_field" : "parent_id",
"category_code" : "c7380365287323430912",
"category_id" : "1188444469958324225",
"parent_id" : "1196425853033295882",
"root_id" : "1196425853033295881",
"position_x" : 90,
"position_y" : 422
} ],
"link_parent_field" : "parent_id",
"category_code" : "c7380365247985053696",
"category_id" : "1188444430468952065",
"parent_id" : "1196425853033295881",
"root_id" : "1196425853033295881",
"position_x" : 88,
"position_y" : 286
}, {
"id" : "1196449973783539712",
"path" : "/1196425853033295881/1196449973783539712",
"enabled" : true,
"children" : [ ],
"link_parent_field" : "parent_id",
"category_code" : "c7388370480791121920",
"category_id" : "1196449663501512704",
"parent_id" : "1196425853033295881",
"root_id" : "1196425853033295881",
"position_x" : 238,
"position_y" : 286
} ],
"link_parent_field" : "parent_id",
"category_code" : "c7380365137905545216",
"category_id" : "1188444320469135361",
"root_id" : "1196425853033295881",
"position_x" : 169,
"position_y" : 150
}, {
"id" : "1196425853033295884",
"path" : "/1196425853033295884",
"enabled" : true,
"children" : [ {
"id" : "1196425853033295885",
"path" : "/1196425853033295884/1196425853033295885",
"enabled" : true,
"children" : [ {
"id" : "1196425853033295887",
"path" : "/1196425853033295884/1196425853033295885/1196425853033295887",
"enabled" : true,
"children" : [ ],
"link_parent_field" : "parent_id",
"category_code" : "c7384780729121075200",
"category_id" : "1192859911804203008",
"parent_id" : "1196425853033295885",
"root_id" : "1196425853033295884",
"position_x" : 376,
"position_y" : 422
} ],
"link_parent_field" : "parent_id",
"category_code" : "c7384780703795867648",
"category_id" : "1192859886432858112",
"parent_id" : "1196425853033295884",
"root_id" : "1196425853033295884",
"position_x" : 372,
"position_y" : 286
} ],
"link_parent_field" : "parent_id",
"category_code" : "c7384780668794400768",
"category_id" : "1192859851372670977",
"root_id" : "1196425853033295884",
"position_x" : 374,
"position_y" : 150
}, {
"id" : "1196425853033295886",
"path" : "/1196425853033295886",
"enabled" : true,
"children" : [ {
"id" : "1196425853033295888",
"path" : "/1196425853033295886/1196425853033295888",
"enabled" : true,
"children" : [ {
"id" : "1196425853033295889",
"path" : "/1196425853033295886/1196425853033295888/1196425853033295889",
"enabled" : true,
"children" : [ ],
"link_parent_field" : "parent_id",
"category_code" : "c7384780761601765376",
"category_id" : "1192859944242950144",
"parent_id" : "1196425853033295888",
"root_id" : "1196425853033295886",
"position_x" : 510,
"position_y" : 422
} ],
"link_parent_field" : "parent_id",
"category_code" : "c7384780729121075200",
"category_id" : "1192859911804203008",
"parent_id" : "1196425853033295886",
"root_id" : "1196425853033295886",
"position_x" : 511,
"position_y" : 286
} ],
"link_parent_field" : "parent_id",
"category_code" : "c7384780703795867648",
"category_id" : "1192859886432858112",
"root_id" : "1196425853033295886",
"position_x" : 507,
"position_y" : 150
} ],
"feature_page_link_template" : "https://{endpoint}/ipdproject/openapi/v1/projects/ea7320ff143048a289add875b56b5f76/redirect-feature-link?issue_id={issue_id}"
}
} 状态码:400
{
"error_code" : "PM.02174103",
"error_msg" : "无操作权限"
} SDK代码示例
SDK代码示例如下。
Java
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 | 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.projectman.v4.region.ProjectManRegion; import com.huaweicloud.sdk.projectman.v4.*; import com.huaweicloud.sdk.projectman.v4.model.*; public class GetModelConfigSolution { 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"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); ProjectManClient client = ProjectManClient.newBuilder() .withCredential(auth) .withRegion(ProjectManRegion.valueOf("<YOUR REGION>")) .build(); GetModelConfigRequest request = new GetModelConfigRequest(); request.withProjectId("{project_id}"); try { GetModelConfigResponse response = client.getModelConfig(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()); } } } |
Python
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 | # coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkprojectman.v4.region.projectman_region import ProjectManRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkprojectman.v4 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"] credentials = BasicCredentials(ak, sk) client = ProjectManClient.new_builder() \ .with_credentials(credentials) \ .with_region(ProjectManRegion.value_of("<YOUR REGION>")) \ .build() try: request = GetModelConfigRequest() request.project_id = "{project_id}" response = client.get_model_config(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
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 | package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" projectman "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/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") auth, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := projectman.ProjectManClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := projectman.NewProjectManClient(hcClient) request := &model.GetModelConfigRequest{} request.ProjectId = "{project_id}" response, err := client.GetModelConfig(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
| 状态码 | 描述 |
|---|---|
| 200 | 获取模型树配置信息成功的响应。 |
| 400 | 请求失败的响应。例如无操作权限、项目不存在。 |
错误码
请参见错误码。