华为云用户手册

  • 响应参数 状态码: 200 表6 响应Body参数 参数 参数类型 描述 status Boolean 创建状态 rule_id String 规则ID 状态码: 400 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 401 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 403 表9 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 404 表10 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述
  • 请求示例 PUT https://{endpoint}/v2/ce8df55870164338a72d7e828a966a2a/rules/425eba0deaf04596a74cf7967d7fc04d/update { "name" : "新建规则-20230919104204", "type" : "Test", "plugin_id" : "official_devcloud_apiTest", "plugin_name" : "official_devcloud_apiTest", "plugin_version" : "0.0.12", "layout_content" : "layout_content", "content" : [ { "group_name" : "API测试通过率门禁", "properties" : [ { "key" : "pass_ratio", "name" : "api测试通过率", "type" : "judge", "operator" : "=", "value_type" : "float", "value" : "0.5" } ] } ] }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 type 是 String 规则类型 name 是 String 规则名称 layout_content 是 String 布局内容 plugin_id 否 String 插件ID plugin_name 否 String 插件名称 plugin_version 否 String 插件版本号 content 是 Array of RuleContent objects 规则属性集 表4 RuleContent 参数 是否必选 参数类型 描述 group_name 是 String 分组名称 can_modify_when_inherit 否 Boolean 继承后的子策略是否可以修改阈值 properties 是 Array of RuleProperty objects 规则属性列表 表5 RuleProperty 参数 是否必选 参数类型 描述 key 是 String 属性键 type 是 String 类型 name 是 String 展示名称 operator 否 String 比较运算符 value 是 String 属性值 value_type 是 String 数据类型
  • 响应参数 状态码: 200 表2 响应Body参数 参数 参数类型 描述 id String 模板ID name String 模板名称 icon String 模板图标 manifest_version String 版本 language String 模板语言 description String 模板描述 is_system Boolean 是否系统模板 region String 所属局点 domain_id String 所属租户ID variables Array of CustomVariable objects 自定义参数 creator_id String 创建人ID updater_id String 编辑人ID create_time Integer 创建日期 update_time Integer 更新日期 is_collect String 是否收藏 is_show_source Boolean 是否显示流水线源 definition String 模板编排json,包含stages 表3 CustomVariable 参数 参数类型 描述 pipeline_id String 流水线ID name String 自定义参数名称 sequence Integer 自定义参数顺序 type String 自定义参数类型 value String 自定义参数默认值 is_secret Boolean 是否私密参数 description String 自定义参数描述 is_runtime Boolean 是否运行时设置 limits Array of objects 限制 is_reset Boolean 是否重置 latest_value String 最近一次参数值 runtime_value String 运行时传入值 状态码: 400 表4 响应Body参数 参数 参数类型 描述 error_msg String 错误信息 error_code String 错误码
  • 响应示例 状态码: 200 OK { "id" : "deb18013bb6c4659b160b15fd7468644", "name" : "新建流水线模板-20230112115711", "icon" : null, "manifest_version" : "3.0", "language" : "none", "description" : "", "is_system" : false, "region" : "region01", "domain_id" : "70ffec613024477bbaf266128bd9778d", "variables" : [ ], "creator_id" : "5ffd41c9df9d4506862ce27e209bb106", "updater_id" : "5ffd41c9df9d4506862ce27e209bb106", "create_time" : 1673495851000, "update_time" : 1673495851000, "is_collect" : null, "is_show_source" : true, "definition" : "{\"stages\":[{\"name\":\"阶段_1\",\"sequence\":\"0\",\"jobs\":[{\"stage_id\":1673495831907,\"identifier\":\"16734958501367554c26c-561b-4831-a906-e88316c8e674\",\"name\":\"新建任务\",\"depends_on\":[],\"timeout\":\"\",\"timeout_unit\":\"\",\"steps\":[],\"exec_type\":\"AGENTLESS_JOB\",\"sequence\":0}],\"identifier\":\"0\",\"pre\":[{\"task\":\"official_devcloud_autoTrigger\",\"sequence\":0}],\"post\":null,\"depends_on\":[],\"run_always\":false}]}" }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 name 是 String 开源治理策略名称 parent_id 否 String 开源治理策略父策略ID content 是 OpenSourceRuleContent object 开源治理策略规则详情 表4 OpenSourceRuleContent 参数 是否必选 参数类型 描述 version_set 否 VersionSetProperty object 开源依赖 security 否 SecurityProperty object 漏洞 license 否 LicenseProperty object 许可证 表5 VersionSetProperty 参数 是否必选 参数类型 描述 enable 否 Boolean 是否启用 rules 否 Array of VersionSetRule objects 规则列表 表6 VersionSetRule 参数 是否必选 参数类型 描述 enable 否 Boolean 是否开启 ecosystem 否 String 依赖类型 package_name 否 String 包名称 package_version 否 String 包版本 description 否 String 规则说明 predicate 否 String 比较规则 表7 SecurityProperty 参数 是否必选 参数类型 描述 enable 否 Boolean 是否启用 rules 否 SecurityRule object 规则详情 表8 SecurityRule 参数 是否必选 参数类型 描述 severity 否 severity object 漏洞级别 cve 否 cve object 漏洞编号 表9 severity 参数 是否必选 参数类型 描述 enable 否 Boolean 是否启用 values 否 Array of strings 漏洞等级 表10 cve 参数 是否必选 参数类型 描述 enable 否 Boolean 是否启用 values 否 Array of strings 漏洞编号 表11 LicenseProperty 参数 是否必选 参数类型 描述 enable 否 Boolean 是否开启 rules 否 Array of rules objects 规则列表 表12 rules 参数 是否必选 参数类型 描述 values 否 Array of strings license详情 predicate 否 String 比较规则
  • 请求示例 PUT https://{endpoint}/v2/ce8df55870164338a72d7e828a966a2a/tenant/open-source/rule-sets/5bd5bee0865242fcaa545371c2081a65/update { "name" : "创建开源治理策略CC22", "content" : { "version_set" : { "enable" : true, "rules" : [ { "ecosystem" : "Maven", "package_name" : "sboot", "predicate" : "eq", "package_version" : "1.1", "description" : "", "enable" : true } ] }, "security" : { "enable" : true, "rules" : { "severity" : { "enable" : false, "values" : [ ] }, "cve" : { "enable" : false, "values" : [ "" ] } } }, "license" : { "enable" : true, "rules" : [ { "predicate" : "contain", "values" : [ ] } ] } } }
  • 响应参数 状态码: 200 表2 响应Body参数 参数 参数类型 描述 id String 规则模版实例ID name String 规则模版实例名称 type String 类型 version String 版本 creator String 创建人 create_time String 创建时间 updater String 最近更新人 update_time String 最近更新时间 is_valid Boolean 是否生效 rule_instances Array of RuleInstance objects 规则实例集合 表3 RuleInstance 参数 参数类型 描述 id String 规则实例ID type String 规则类型ID name String 规则名称 version String 规则版本 plugin_id String 插件ID plugin_name String 插件名称 plugin_version String 插件版本号 is_valid Boolean 是否生效 editable Boolean 是否可编辑 content Array of RuleInstanceContent objects 规则属性列表 parent RuleSet object 父级规则实例模板简要信息 表4 RuleInstanceContent 参数 参数类型 描述 group_name String 分组名称 type String 分组类型 can_modify_when_inherit Boolean 继承后的子策略是否可以修改阈值 properties Array of RuleInstanceProperty objects 规则属性列表 表5 RuleInstanceProperty 参数 参数类型 描述 key String 属性键 type String 类型 name String 展示名称 operator String 比较运算符 value String 属性值 value_type String 数据类型 表6 RuleSet 参数 参数类型 描述 id String 规则模版实例ID name String 规则模版实例名称 type String 类型 version String 版本 operator String 最近操作人 operate_time Long 最近操作时间 is_valid Boolean 是否生效 level String 租户级、项目级 is_public Boolean 是否系统级 状态码: 400 表7 响应Body参数 参数 参数类型 描述 error_msg String 错误信息 error_code String 错误码 状态码: 401 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 403 表9 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 404 表10 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述
  • 响应示例 状态码: 200 OK { "id" : "58d55f8a646443a984e7399632b3963e", "domain_id" : "ce8df55870164338a72d7e828a966a2a", "project_id" : "d80a8a6530324b7bac972cbb8a9f28ec", "name" : "G1", "parent_id" : "", "path_id" : "58d55f8a646443a984e7399632b3963e", "ordinal" : 0, "creator" : "847a5317086c41798469d0868535943a", "updater" : null, "create_time" : null, "update_time" : null, "children" : null }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 id String 分组ID domain_id String 租户ID project_id String 项目ID name String 分组名 parent_id String 父分组ID path_id String 分组路径ID ordinal Integer 序号 creator String 创建用户ID updater String 更新用户ID create_time Long 创建时间 update_time Long 更新时间 children Array of PipelineGroupVo objects 子分组列表 状态码: 400 表5 响应Body参数 参数 参数类型 描述 error_msg String 错误信息 error_code String 错误码
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 name 是 String 流水线分组名 project_id 是 String 项目名 parent_id 否 String 父分组ID
  • 响应示例 状态码: 200 图标路径 /api/v1/ce8df55870164338a72d7e828a966a2a/common/get-plugin-icon?object_key=apie_test-3 a9aa612ab8747898c8b2832561d6751-2023-08-03141751.png-ce8df55870164338a72d7e828a966a2a&icon_type=plugin
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 [数组元素] 否 Array of PluginPartQueryDTO objects 查询请求体 表4 PluginPartQueryDTO 参数 是否必选 参数类型 描述 plugin_name 否 String 插件名 display_name 否 String 展示名 version 否 String 版本号 plugin_attribution 否 String 插件属性 version_attribution 否 String 版本属性
  • 响应参数 状态码: 200 表5 响应Body参数 参数 参数类型 描述 [数组元素] Array of PluginPartQueryVOListAgentPluginInputVO objects OK 表6 PluginPartQueryVOListAgentPluginInputVO 参数 参数类型 描述 plugin_name String 插件名 display_name String 展示名 data Array of data objects 结果集 表7 data 参数 参数类型 描述 unique_id String 唯一ID name String 名称 default_value String 默认值 plugin_name String 插件名 version String 版本 type String 类型 workspace_id String 租户ID validation ExtensionValidation object 验证 layout_content String 样式信息 表8 ExtensionValidation 参数 参数类型 描述 required_message String 消息 regex String 正则 regex_message String 正则消息 max_length Integer 最大长度 min_length Integer 最小长度 状态码: 400 表9 响应Body参数 参数 参数类型 描述 error_msg String 错误信息 error_code String 错误码
  • 请求示例 POST https://{endpoint}/v1/ce8df55870164338a72d7e828a966a2a/agent-plugin/plugin-input [ { "plugin_name" : "official_shell_plugin", "display_name" : "执行Shell", "version" : "0.0.2", "plugin_attribution" : "official", "version_attribution" : "formal" } ]
  • 响应示例 状态码: 200 OK [ { "plugin_name" : "official_shell_plugin", "display_name" : "执行Shell", "data" : [ { "unique_id" : "aac7e571b0d4462ba7962ce1735c4ec3", "name" : "OFFICIAL_SHELL_SCRIPT_INPUT", "default_value" : "", "plugin_name" : "official_shell_plugin", "version" : "0.0.2", "type" : "shell", "workspace_id" : "*", "layout_content" : null, "front_data_prop" : null, "label" : "Shell命令", "description" : "用户在此处输入Shell命令", "required" : "true", "extend_prop" : { "api_options" : null, "api_type" : null, "options" : null, "disabled_conditions" : null, "visible_conditions" : null }, "validation" : { "required_message" : null, "regex" : null, "regex_message" : null, "max_length" : null, "min_length" : null } } ] } ]
  • 请求示例 POST https://{endpoint}/v5/d80a8a6530324b7bac972cbb8a9f28ec/api/pipelines/8bfbd69eac154a0da341705a36294aca/pipeline-runs/94511c7207474053ab5f6e2dd5624cd5/jobs/d2ce3825a5e147dd98793ef6e76d038e/steps/f2f0441226444c1199ca0cce8d24074f/pass
  • URI POST /v5/{project_id}/api/pipelines/{pipeline_id}/pipeline-runs/{pipeline_run_id}/jobs/{job_run_id}/steps/{step_run_id}/pass 表1 路径参数 参数 是否必选 参数类型 描述 job_run_id 是 String 流水线任务ID project_id 是 String 项目ID pipeline_id 是 String 流水线ID pipeline_run_id 是 String 流水线运行实例ID step_run_id 是 String 流水线步骤ID
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 type String 类型 name String 名称 friendly_name String 展示名 category String 业务类型 description String 描述 version String 版本 version_description String 版本说明 inputs Array of inputs objects 输入信息 outputs Array of outputs objects 输出信息 execution execution object 执行信息 表5 inputs 参数 参数类型 描述 name String 名称 type String 类型 label String 标签 description String 说明 default_value String 默认值 required Boolean 必填 extend_prop ExtensionExtendProp object 扩展属性 validation ExtensionValidation object 验证 表6 ExtensionExtendProp 参数 参数类型 描述 api_options String API 选项 api_type String API 类型 options String 选项 disabled_conditions String 禁用条件 visible_conditions String 可见条件 表7 ExtensionValidation 参数 参数类型 描述 required_message String 消息 regex String 正则 regex_message String 正则消息 max_length Integer 最大长度 min_length Integer 最小长度 表8 outputs 参数 参数类型 描述 name String 名称 type String 类型 description String 描述 表9 execution 参数 参数类型 描述 target String 入口 type String 类型 sha256 String sha256 状态码: 400 表10 响应Body参数 参数 参数类型 描述 error_msg String 错误信息 error_code String 错误码
  • 响应示例 状态码: 200 OK { "type" : "Task", "name" : "basic-CTS", "category" : "Test", "description" : "", "version" : "2.3.5", "inputs" : [ { "name" : "SHELL_PLUGIN", "type" : "input", "label" : "单行输入框", "description" : "Sample String", "required" : true, "validation" : { "required_message" : null, "regex" : null, "regex_message" : null, "max_length" : null, "min_length" : null }, "default_value" : "", "extend_prop" : { "api_options" : null, "api_type" : null, "options" : null, "disabled_conditions" : null, "visible_conditions" : null } } ], "outputs" : [ { "name" : "problem", "type" : "output", "description" : "记录问题个数" } ], "execution" : { "type" : "scripts/test.sh", "target" : "Shell", "sha256" : "4fa52dab3fb72847e4da5f00295a96fce8892f301d384efe9b776aa1731ba8f0" }, "friendly_name" : "基础插件-CTS2", "version_description" : "执行Shell命令" }
  • 请求示例 PUT https://{endpoint}/v5/ce8df55870164338a72d7e828a966a2a/api/pipeline-templates/ad8a26f8b19a4b83a8d92eb733b65476 { "name" : "新建流水线模板-20231023212159", "language" : "none", "description" : "", "is_system" : false, "domain_id" : "ce8df55870164338a72d7e828a966a2a", "variables" : [ ], "is_show_source" : true, "definition" : "{\"stages\":[{\"name\":\"阶段_1\",\"sequence\":\"0\",\"jobs\":[{\"stage_id\":1698067319814,\"identifier\":\"16980673371452673e2a4-b3e1-4389-a145-fc57a4473137\",\"name\":\"CloudBuild模板\",\"depends_on\":[],\"timeout\":\"\",\"timeout_unit\":\"\",\"steps\":[{\"name\":\"CloudBuild模板\",\"task\":\"official_devcloud_cloudBuild_template\",\"sequence\":0,\"inputs\":[{\"key\":\"pipelineNumber\",\"value\":\"v1.0.0\"},{\"key\":\"artifactName\",\"value\":\"name\"},{\"key\":\"is_build_in\",\"value\":\"system\"},{\"key\":\"module_or_template_id\",\"value\":\"00057\"}],\"business_type\":\"Build\",\"runtime_attribution\":\"agent\",\"identifier\":\"1698067328741629de896-a67b-4c2a-be40-7f6531af2f19\",\"multi_step_editable\":0,\"official_task_version\":\"0.0.1\"}],\"resource\":\"{\\\"type\\\":\\\"system\\\",\\\"arch\\\":\\\"x86\\\"}\",\"condition\":\"completed()\",\"exec_type\":\"OCTOPUS_JOB\",\"sequence\":0},{\"identifier\":\"1698067635354dba15971-5277-48fe-a219-8cd578aa8773\",\"name\":\"CodeCheck中文名称\",\"depends_on\":[],\"timeout\":\"\",\"timeout_unit\":\"\",\"steps\":[{\"name\":\"CodeCheck中文名称\",\"task\":\"official_devcloud_codeCheck_template\",\"sequence\":0,\"inputs\":[{\"key\":\"language\",\"value\":\"C/C++\"},{\"key\":\"module_or_template_id\",\"value\":\"d7dffaefb6d94c63a09cf141668356c7\"}],\"business_type\":\"Gate\",\"runtime_attribution\":\"agent\",\"identifier\":\"1698067631617e1847e52-06ff-429e-9bfa-492ae877f192\",\"multi_step_editable\":0,\"official_task_version\":\"0.0.1\"}],\"resource\":\"{\\\"type\\\":\\\"system\\\",\\\"arch\\\":\\\"x86\\\"}\",\"condition\":\"completed()\",\"exec_type\":\"OCTOPUS_JOB\",\"sequence\":1}],\"identifier\":\"1698067319814bd28be5a-eb0c-4bdf-9ac5-4b441ef46ef9\",\"pre\":[{\"task\":\"official_devcloud_autoTrigger\",\"sequence\":0}],\"post\":null,\"depends_on\":[],\"run_always\":false}]}" }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 name 是 String 模板名称 description 否 String 模板描述 language 是 String 模板语言 variables 否 CustomVariable object 自定义参数 definition 是 String 模板编排json,包含stages is_system 是 Boolean 是否系统模板 domain_id 是 String 所属租户ID is_show_source 是 Boolean 是否显示流水线源 表4 CustomVariable 参数 是否必选 参数类型 描述 pipeline_id 否 String 流水线ID name 否 String 自定义参数名称 sequence 否 Integer 自定义参数顺序 type 否 String 自定义参数类型 value 否 String 自定义参数默认值 is_secret 否 Boolean 是否私密参数 description 否 String 自定义参数描述 is_runtime 否 Boolean 是否运行时设置 limits 否 Array of objects 限制 is_reset 否 Boolean 是否重置 latest_value 否 String 最近一次参数值 runtime_value 否 String 运行时传入值
  • 响应参数 状态码: 200 表5 响应Body参数 参数 参数类型 描述 [数组元素] Array of PluginPartQueryVOListAgentPluginOutputVO objects OK 表6 PluginPartQueryVOListAgentPluginOutputVO 参数 参数类型 描述 plugin_name String 插件名 display_name String 展示名 data Array of data objects 结果集 表7 data 参数 参数类型 描述 unique_id String 唯一ID plugin_name String 插件名 version String 版本 workspace_id String 租户ID output_key String 名称 output_value String 值 状态码: 400 表8 响应Body参数 参数 参数类型 描述 error_msg String 错误信息 error_code String 错误码
  • 响应示例 状态码: 200 OK [ { "plugin_name" : "test_multi_language", "display_name" : "", "data" : [ { "unique_id" : "2df0e830196247f8a10cd598b045fa8a", "plugin_name" : "test_multi_language", "version" : "0.0.11", "workspace_id" : "*", "output_key" : "SYSTEM_METRICS_UNIQUE_KEY", "output_value" : "[{\"group_name\":\"中文\",\"properties\":[{\"key\":\"test\",\"value\":\"111\",\"desc\":\"中文\"}]}]" } ] } ]
  • 请求示例 POST https://{endpoint}/v1/ce8df55870164338a72d7e828a966a2a/agent-plugin/plugin-metrics [ { "plugin_name" : "test_multi_language", "version" : "0.0.11", "plugin_attribution" : "official" } ]
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 [数组元素] 否 Array of PluginPartQueryDTO objects 查询请求体 表4 PluginPartQueryDTO 参数 是否必选 参数类型 描述 plugin_name 否 String 插件名 display_name 否 String 展示名 version 否 String 版本号 plugin_attribution 否 String 插件属性 version_attribution 否 String 版本属性
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 plugin_name 否 String 插件名 version 否 String 版本 publisher_unique_id 否 String 发布商ID
  • 请求示例 POST https://{endpoint}/v1/ce8df55870164338a72d7e828a966a2a/agent-plugin/publish-plugin { "plugin_name" : "basic_plugin", "version" : "", "publisher_unique_id" : "b9fc8fb6d9194536ac66dd74c2212126" }
  • 响应示例 状态码: 200 图标访问路径 /api/v1/ce8df55870164338a72d7e828a966a2a/common/get-plugin-icon?object_key=default-82960e8 ecd194e07bcb5e4e660b7439f-2023-08-03141751.png-ce8df55870164338a72d7e828a966a2a&icon_type=publish
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 offset Integer 偏移 limit Integer 大小 total Integer 总数 data Array of data objects 结果集 表5 data 参数 参数类型 描述 name String 名称 display_name String 展示名 plugin_attribution String 属性 icon_url String 图标URL description String 描述 publisher_id String 发布商ID manifest_version String 版本 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error_msg String 错误信息 error_code String 错误码
共100000条