华为云用户手册

  • 请求示例 修改规则名称为xxxx的自建规则,逻辑运算符是OR,其中最小匹配值为1、风险等级为1、规则内容为xxxx、规则描述为xxxx、规则类型为xxxx。 PUT /v1/{project_id}/sdg/server/scan/rules { "category" : "BUILT_SELF", "id" : "xxxxxxxxxxxxxxxxxxx", "logic_operator" : "OR", "min_match" : 1, "risk_level" : 1, "rule_content" : "xxxx", "rule_desc" : "xxxx", "rule_name" : "xxxx", "rule_type" : "xxxx" }
  • 响应示例 状态码: 200 请求成功 { "orderInfos" : [ { "tenantId" : "xxxxxxxxxxxx", "periodType" : 2, "periodNum" : 1, "resourceId" : "xxxxxxxxxxxx", "productInfo" : { "cloudServiceType" : "hws.service.type.sdg", "productId" : "xxxxxxxxxxxx", "resourceSize" : 30, "resourceSizeMeasureId" : 30, "resourceSpecCode" : "base_professional", "resourceType" : "hws.resource.type.dsc.base" } } ] } 状态码: 400 无效请求 { "error_code" : "dsc.40000011", "error_msg" : "Invalid parameter" }
  • 响应参数 状态码: 200 表2 响应Body参数 参数 参数类型 描述 orderInfos Array of ProductOrderInfo objects 订单列表 表3 ProductOrderInfo 参数 参数类型 描述 tenantId String 租户ID periodType String 订购周期类型 periodNum Integer 订购周期数量 resourceId String 资源ID productInfo ProductInfo object 产品信息 表4 ProductInfo 参数 参数类型 描述 allResourceNames Array of strings 资源名称列表 cloudServiceType String 云服务类型 displayId String 展示ID productId String 产品ID productSpecDesc String 产品规格描述 resourceName String 资源名称 resourceSize Integer 产品支持的数据库数量,或者支持obs的扫描量 resourceSizeMeasureId Integer 资源容量度量标识,枚举值举例如下:15:mbps(购买带宽时使用),17:gb(购买云硬盘时使用),14:个/次 resourceSpecCode String 产品编码 resourceType String 资源类型 usageFactor String 已使用系数 usageMeasureId Integer 已使用容量度量标识 usageValue Double 已使用值 状态码: 400 表5 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 调用API获取项目ID 项目ID可以通过调用查询指定条件下的项目信息API获取。 获取项目ID的接口为“GET https://{Endpoint}/v3/projects”,其中{Endpoint}为 IAM 的终端节点,可以从地区和终端节点获取。接口的认证鉴权请参见认证鉴权。 响应示例如下,其中projects下的“id”即为项目ID。 { "projects": [ { "domain_id": "65382450e8f64ac0870cd180d14e684b", "is_domain": false, "parent_id": "65382450e8f64ac0870cd180d14e684b", "name": "xxxxxxxx", "description": "", "links": { "next": null, "previous": null, "self": "https://www.example.com/v3/projects/a4a5d4098fb4474fa22cd05f897d6b99" }, "id": "a4a5d4098fb4474fa22cd05f897d6b99", "enabled": true } ], "links": { "next": null, "previous": null, "self": "https://www.example.com/v3/projects" } }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。通过调用IAM服务“获取用户Token接口”获取(响应消息头中X-Subject-Token的值) 表3 FormData参数 参数 是否必选 参数类型 描述 file 是 File 待提取暗水印的图片文件。 mark_len 否 String 指定待提取水印的长度,mark_len长度大于0,小于32。设置后可以提升水印提取性能
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 asset_ids 否 Array of strings 资产ID列表 cycle 否 String 扫描周期,日(DAY),周(WEEK),月(MONTH),单次扫描(ONCE) 枚举值: ONCE DAY WEEK MONTH name 否 String 扫描任务名 open 否 Boolean 是否开启任务 rule_group_ids 否 Array of strings 规则组ID列表 start_time 否 Long 扫描任务开始时间 time_zone 否 String 时区 topic_urn 否 String 主题的唯一资源标识符 use_nlp 否 Boolean 是否用nlp
  • 请求示例 创建任务名为xxxx的扫描任务,选择xxxxxxxxxxxx规则组,单次扫描,立即执行。 POST /v1/{project_id}/sdg/scan/job { "asset_ids" : [ "xxxx", "xxxx" ], "cycle" : "ONCE", "name" : "xxxx", "open" : true, "rule_group_ids" : [ "xxxx", "xxxx" ], "start_time" : 0, "time_zone" : 8, "topic_urn" : "xxxxxxxxxxxx", "use_nlp" : false }
  • 响应示例 状态码: 200 OK { "total" : 1, "tasks" : [ { "id" : "xxxxxxx", "name" : "ScanDemo", "cycle" : "ONCE", "status" : "FINISHED", "open" : true, "rule_groups" : [ "PCI" ], "last_run_time" : 1634612489173, "create_time" : 1630982438506, "last_scan_risk" : "HIGH", "use_nlp" : false, "topic_urn" : "", "start_time" : 1630983532673 } ] } 状态码: 400 无效请求 { "error_code" : "dsc.40000011", "error_msg" : "Invalid parameter" }
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 tasks Array of ScanJob objects 本次返回的扫描任务列表 total Long 任务总数 表4 ScanJob 参数 参数类型 描述 id String 任务ID name String 任务名称 rule_groups Array of strings 任务使用的规则组 cycle String 任务执行方式 枚举值: ONCE DAY WEEK MONTH status String 任务当前状态 枚举值: INIT WAITING RUNNING FAILED STOPPED FINISHED TERMINATED last_run_time Long 任务上一次执行时间 create_time Long 任务创建时间 last_scan_risk String 任务上一次扫描风险等级结果 use_nlp Boolean 是否使用了NLP进行扫描 open Boolean 任务开启状态 topic_urn String SMN 服务通知主题 start_time Long 任务启动时间 状态码: 400 表5 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 buckets Array of Bucket objects OBS桶列表 total Integer OBS桶总数 表4 Bucket 参数 参数类型 描述 asset_name String 资产名称 bucket_location String 桶位置 bucket_name String 桶名称 bucket_policy String 桶策略 create_time Long 创建时间 deleted Boolean 是否被删除 id String 桶ID is_deleted Boolean 是否被删除 状态码: 400 表5 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 响应示例 状态码: 200 请求成功 { "buckets" : [ { "bucket_name" : "xxxx", "bucket_location" : "xxxx", "create_time" : 1667379757698, "is_deleted" : false } ], "total" : 1 } 状态码: 400 无效请求 { "error_code" : "dsc.40000011", "error_msg" : "Invalid parameter" }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。通过调用IAM服务“获取用户Token接口”获取(响应消息头中X-Subject-Token的值) 表3 FormData参数 参数 是否必选 参数类型 描述 doc_type 是 String 待提取水印的文档类型 枚举值: WORD EXCEL PDF PPT file_password 否 String 解密文件的密码, 最大支持长度256。如果Office文档有读密码或域控的权限密码,请输入读密码,或者有读权限的域控密码。 file 是 File 上传要提取水印的文档
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 region_id String 当前项目所在region的id,如:xx-xx-1。 watermarked_file String 添加水印后的OBS图片地址,当前只支持OBS文件,格式为 obs://bucket/object ,其中bucket为和当前项目处于同一区域的OBS桶名称,object为对象全路径名。例如:obs://hwbucket/hwinfo/hw.png,其中obs://表示OBS存储,hwbucket为桶名,hwinfo/hw.png为对象全路径名。 状态码: 400 表5 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。通过调用IAM服务“获取用户Token接口”获取(响应消息头中X-Subject-Token的值) 表3 请求Body参数 参数 是否必选 参数类型 描述 region_id 是 String 当前项目所在region的id,如:xx-xx-1。 src_file 是 String 待加暗水印的图片地址,当前只支持OBS文件,格式为 obs://bucket/object ,其中bucket为和当前项目处于同一区域的OBS桶名称,object为对象全路径名。例如:obs://hwbucket/hwinfo/hw.png,其中obs://表示OBS存储,hwbucket为桶名,hwinfo/hw.png为对象全路径名。 blind_watermark 否 String 待嵌入的文字暗水印内容,长度不超过32个字符。当前仅支持数字及英文大小写。与图片暗水印image_watermark二选一。 image_watermark 否 String 待嵌入的图片暗水印地址,格式要求同src_file字段,与文字暗水印 blind_watermark 二选一,都填写时,生效image_watermark。 dst_file 否 String 添加水印后的图片存放的地址,格式要求同src_file字段,不设置时,默认取src_file的值,即添加水印后覆盖原文件。
  • 请求示例 在xx-xx-1区域,给obs://hwbucket/test.png路径下的图片嵌入testWaterMark的暗水印。 POST /v1/{project_id}/image-address/watermark/embed HTTP/1.1 { "region_id" : "xx-xx-1", "src_file" : "obs://hwbucket/test.png", "blind_watermark" : "testWaterMark" }
  • 响应示例 状态码: 200 OK { "tasks" : [ { "db_type" : "MySQL", "end_time" : 1658717568622, "execute_line" : 100000, "id" : "xxxxxxxxxxxx", "progress" : 100, "run_status" : "FINISHED", "start_time" : 1658717544469, "task_template_id" : "xxxxxxxxxxxx", "type" : "MANUAL" } ], "total" : 1 } 状态码: 400 无效请求 { "error_code" : "dsc.40000011", "error_msg" : "Invalid parameter" }
  • URI GET /v1/{project_id}/sdg/server/mask/dbs/templates/{template_id}/tasks 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID template_id 是 String 模板ID 表2 Query参数 参数 是否必选 参数类型 描述 workspace_id 否 String 工作区ID offset 否 Integer 页码 limit 否 Integer 分页大小
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 tasks Array of DBMaskTaskInfo objects 脱敏任务列表 total Integer 脱敏任务总数 表4 DBMaskTaskInfo 参数 参数类型 描述 db_type String DB类型 end_time Long 任务结束时间 execute_line Integer 执行行数 id String 任务ID progress Integer 执行进度 run_status String 任务运行状态 start_time Long 任务开始时间 task_template_id String 任务模板ID type String 任务类型 状态码: 400 表5 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 category 否 String 规则类别,内置规则(BUILT_IN)或自建规则(BUILT_SELF) 枚举值: BUILT_IN BUILT_SELF default_status 否 Boolean 是否默认规则组 group_desc 否 String 规则组描述 group_name 否 String 规则组名称 id 否 String 规则组ID rule_ids 否 Array of strings 包含的规则ID列表
  • 请求示例 创建规则组名称为xxxx的自建扫描规则组。 POST /v1/{project_id}/sdg/server/scan/groups { "category" : "BUILT_SELF", "group_desc" : "xxxx", "group_name" : "xxxx", "rule_ids" : [ "xxxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxx" ] }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。通过调用IAM服务“获取用户Token接口”获取(响应消息头中X-Subject-Token的值) 表3 FormData参数 参数 是否必选 参数类型 描述 file 是 File 要添加水印的图片文件,添加的图片短边尺寸需要超过512像素。 blind_watermark 否 String 待嵌入的文字暗水印内容,长度不超过32个字符。当前仅支持数字及英文大小写。与图片暗水印image_watermark二选一填充。 image_watermark 否 File 待嵌入的图片暗水印文件,与文字暗水印 blind_watermark 二选一填充。
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 total Integer 调用API总次数 succeed Integer 调用API成功次数 failed Integer 调用API失败次数 openapi_called_records Array of OpenApiCalledRecord objects API调用记录列表 next_marker String 获取下一页所需的标识符。 表4 OpenApiCalledRecord 参数 参数类型 描述 user_name String 调用API的user_name user_id String 调用API的user_id domain_name String 调用API的domain_name domain_id String 调用API的domain_id request_url String 调用API的URL request_method String http请求方法 response_code String http状态码 fail_reason String 调用API失败原因 timestamp Long 调用API的时间(Unix timestamp),单位:毫秒 状态码: 400 表5 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 响应示例 状态码: 200 OK { "total" : 11, "succeed" : 11, "failed" : 0, "openapi_called_records" : [ { "user_name" : "xxxxxxxxxxxxx", "user_id" : "xxxxxxxxxxxxxxxxx", "domain_name" : "xxxxxxxxxxxxxxxxx", "domain_id" : "xxxxxxxxxxxxxxxxxxx", "request_url" : "/v1/xxxxxxxxxxxxxxxxxxxxxxxxxxx/sdg/doc/watermark/embed", "request_method" : "POST", "response_code" : "200", "fail_reason" : "", "timestamp" : 1638427576524 } ], "next_marker" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } 状态码: 400 无效请求 { "error_code" : "dsc.40000011", "error_msg" : "Invalid parameter" }
  • URI GET /v1/{project_id}/openapi/called-records 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID。 表2 Query参数 参数 是否必选 参数类型 描述 limit 否 Integer 分页大小,默认1000,最大2000。 called_url 否 String 需要查询调用记录的URL,例如:/v1/{project_id}/sdg/database/watermark/embed start_time 否 Long 开始时间(Unix timestamp),单位:毫秒,例如:0 end_time 否 Long 结束时间(Unix timestamp),单位:毫秒,例如:1638515803572 marker 否 String 指定一个标识符。获取第一页时不用赋值,获取下一页时取上页查询结果的返回值。
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 rules Array of ResponseRule objects 规则列表 total Integer 规则总数 表4 ResponseRule 参数 参数类型 描述 category String 规则类别,内置规则(BUILT_IN)或自建规则(BUILT_SELF) 枚举值: BUILT_IN BUILT_SELF delete_allowed Boolean 是否允许删除 group_names String 相关的规则组 id String 规则ID logic_operator String 逻辑运算符,"AND","OR","REGEX" min_match Integer 最小匹配次数 risk_level Integer 风险等级 rule_content String 规则内容 rule_desc String 规则描述 rule_name String 规则名称 rule_type String 规则类型,关键字(KEYWORD)、正则表达式(REGEX)或自然语言(NLP) 枚举值: KEYWORD REGEX NLP selected Boolean 是否可选 状态码: 400 表5 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误信息
  • 响应示例 状态码: 200 请求成功 { "total" : 1, "rules" : [ { "category" : "BUILT_SELF", "delete_allowed" : true, "group_names" : "xxxx", "id" : "xxxxxxxxxxxx", "logic_operator" : "AND", "min_match" : 1, "risk_level" : 1, "rule_content" : "xxxx", "rule_desc" : "xxxx", "rule_name" : "xxxx", "rule_type" : "KEYWORD", "selected" : true } ] } 状态码: 400 无效请求 { "error_code" : "dsc.40000011", "error_msg" : "Invalid parameter" }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。通过调用IAM服务“获取用户Token接口”获取(响应消息头中X-Subject-Token的值) 表3 请求Body参数 参数 是否必选 参数类型 描述 region_id 是 String 项目所在region的id,如:xx-xx-1。 doc_type 是 String 待提取水印的文档类型 枚举值: WORD EXCEL PDF PPT src_file 是 String 待提取文字暗水印的文档的地址,当前只支持OBS对象,格式为 obs://bucket/object ,其中bucket为和当前项目处于同一区域的OBS桶名称,object为对象全路径名。例如:obs://hwbucket/hwinfo/hw.doc,其中obs://表示OBS存储,hwbucket为桶名,hwinfo/hw.doc为对象全路径名。 file_password 否 String 解密文件的密码, 最大支持长度256。如果Office文档有读密码或域控的权限密码,请输入读密码,或者有读权限的域控密码。
  • 请求示例 提取obs://hwbucket/hwinfo/hw.docx路径下的WORD文档中的暗水印。 POST /v1/{project_id}/doc-address/watermark/extract { "region_id" : "xx-xx-1", "src_file" : "obs://hwbucket/hwinfo/hw.docx", "doc_type" : "WORD" }
  • 请求参数 表3 请求Body参数 参数 是否必选 参数类型 描述 buckets 否 Array of BucketBean objects OBS桶列表 表4 BucketBean 参数 是否必选 参数类型 描述 asset_name 否 String 资产名称 location 否 String 桶位置 bucket_name 否 String 桶名称 bucket_policy 否 String 桶策略
  • 请求示例 添加桶名称为xxxx的数据资产扫描授权。 POST /v1/{project_id}/sdg/asset/obs/buckets { "buckets" : [ { "asset_name" : "xxxx", "location" : "xxxx", "bucket_name" : "xxxx", "bucket_policy" : "private" } ] }
共100000条