华为云用户手册

  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 Content-Type 是 String 消息体的类型(格式),默认取值为“application/json” X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 ief-instance-id 否 String 铂金版实例ID,专业版实例为空值
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 tags Array of Tag objects 标签列表 count Integer 标签数量 表4 Tag 参数 参数类型 描述 key String 标签key值,长度取值范围为1~36, 仅允许大小写英文字母、数字、下划线、中划线 values Array of strings 标签value值,长度取值范围为0~43, 仅允许大小写英文字母、数字、下划线、中划线
  • URI GET /v2/{project_id}/{resource_type}/{resource_id}/tags 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID resource_id 是 String 资源ID resource_type 是 String 资源类型 ief-edge_node ief-deployment ief-application ief-device
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 Content-Type 是 String 消息体的类型(格式),默认取值为“application/json” X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 ief-instance-id 否 String 铂金版实例ID,专业版实例为空值
  • 响应示例 状态码: 200 ok { "count" : 1, "deployments" : [ { "id" : "3e64d98a-37c5-43a6-9bfe-052b9083e362", "name" : "app-test", "replicas" : 1, "ready_replicas" : 1, "description" : "this is a test app", "group_id" : "", "node_ids" : [ "29d20c18-c20c-4a45-a087-42c766fc5d97" ], "tags" : [ { "key" : "app", "value" : "test" } ], "api_version" : "v3", "source" : "userdefine", "project_id" : "bcd83056c918480f8f190844bd425b23", "created_at" : "2019-10-10T02:20:40.630Z", "updated_at" : "2019-10-10T02:20:40.630Z", "template" : { "configs" : { "host_network" : true, "host_pid" : true, "migration" : true, "restart_policy" : "Always", "toleration_seconds" : 300 }, "init_containers" : [ ], "containers" : [ { "name" : "container-0", "image_url" : "swr.cn-north-1.myhuaweicloud.com/ief-test/nginx:0705", "args" : [ "-c", "sleep 1000" ], "command" : [ "/bin/bash" ], "resources" : { "limits" : { "cpu" : "0.25", "memory" : "500", "gpu" : "500" }, "requests" : { "cpu" : "0.25", "memory" : "500", "gpu" : "500" } }, "envs" : [ { "name" : "CERT_PATH", "value" : "/opt/cert" } ], "ports" : [ { "container_port" : 80, "host_port" : 80 } ], "privileged" : true, "readiness_probe" : { "http_get" : { "path" : "/", "port" : 80, "scheme" : "http" }, "initial_delay_seconds" : 10, "timeout_seconds" : 10 }, "liveness_probe" : { "http_get" : { "path" : "/", "port" : 80, "scheme" : "http" }, "initial_delay_seconds" : 10, "timeout_seconds" : 10 }, "version" : "1.0", "npu_type" : "", "volumes" : [ { "name" : "log-volume", "type" : "hostPath", "read_only" : false, "source" : "/var/IEF", "destination" : "/var/IEF" } ] } ] } } ]} 状态码: 400 error { "error_code" : "IEF.100001", "error_msg" : "PROJECT_ID not found"} 状态码: 500 error { "error_code" : "IEF.100158", "error_msg" : "Fail to extract gpu infomation"}
  • URI GET /v3/{project_id}/edgemgr/deployments 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID 表2 Query参数 参数 是否必选 参数类型 描述 limit 否 Long 每页显示的条目数量,最大100,默认值10 offset 否 Long 查询的起始位置,默认值0 sort 否 String 查询结果排序,如按照创建时间降序排序为created_at:desc,升序排序为created_at:asc name 否 String deployment名称(支持模糊匹配) node_id 否 String 节点ID,查询部署在该节点下的应用列表,和group_id不可同时请求 group_id 否 String 节点组ID,查询部署在该节点组的应用列表,和node_id不可同时请求
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 Content-Type 是 String 消息体的类型(格式),默认取值为“application/json” X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 ief-instance-id 否 String 铂金版实例ID,专业版实例为空值
  • URI DELETE /v2/{project_id}/{resource_type}/{resource_id}/tags/{key} 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID resource_type 是 String 资源类型 ief-edge_node ief-deployment ief-application ief-device resource_id 是 String 资源id key 是 String 标签key
  • URI POST /v2/{project_id}/{resource_type}/{resource_id}/tags 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID resource_id 是 String 资源ID resource_type 是 String 资源类型 ief-edge_node ief-deployment ief-application ief-device
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 Content-Type 是 String 消息体的类型(格式),默认取值为“application/json” X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 ief-instance-id 否 String 铂金版实例ID,专业版实例为空值 表3 请求Body参数 参数 是否必选 参数类型 描述 tag 是 ResourceTag object 标签属性 表4 ResourceTag 参数 是否必选 参数类型 描述 key 否 String 键。最大长度36个unicode字符。 不能为空,只能包含大小写字母,数字,中划线“-”,下划线“_”。 value 否 String 值。每个值最大长度43个unicode字符,删除时如果value有值按照key/value删除,如果value没值,则按照key删除。 不能为空,只能包含大小写字母,数字,中划线“-”,下划线“_”。
  • 响应示例 状态码: 200 ok { "total_count" : 2, "resources" : [ { "tags" : [ { "value" : "", "key" : "testtest" }, { "value" : "value2", "key" : "test" } ], "resource_name" : "node_test_0108_1", "resource_id" : "e25307d4-bd25-4c29-ba7f-176376ed2f99" }, { "tags" : [ { "value" : "value1", "key" : "key1" }, { "value" : "", "key" : "test" } ], "resource_name" : "node_test-0109_1", "resource_id" : "fc3aeee8-24e1-4912-bf7a-54854251d0e5" } ]}
  • 响应参数 状态码: 200 表7 响应Body参数 参数 参数类型 描述 resources Array of Resource objects 资源实例 total_count Integer 总记录数 表8 Resource 参数 参数类型 描述 resource_id String 资源ID tags Array of ResourceTag objects 标签列表,没有标签默认为空数组 resource_name String 资源名称,资源没有名称时默认为空字符串。 表9 ResourceTag 参数 参数类型 描述 key String 键。最大长度36个unicode字符。 不能为空,只能包含大小写字母,数字,中划线“-”,下划线“_”。 value String 值。每个值最大长度43个unicode字符,删除时如果value有值按照key/value删除,如果value没值,则按照key删除。 不能为空,只能包含大小写字母,数字,中划线“-”,下划线“_”。
  • 请求示例 查询资源实例,按照过滤条件查询,搜索字段为“resource_name”,标签键值为“test”,值为“value1,value2”。 { "action" : "filter", "limit" : "10", "offset" : "0", "matches" : [ { "key" : "resource_name", "value" : "q" } ], "tags" : [ { "key" : "test", "values" : [ "value1", "value2" ] } ]}
  • URI POST /v2/{project_id}/{resource_type}/resource_instances/action 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID resource_type 是 String 资源类型 ief-edge_node ief-deployment ief-application ief-device
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 Content-Type 是 String 消息体的类型(格式),默认取值为“application/json” X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 ief-instance-id 否 String 铂金版实例ID,专业版实例为空值 表3 请求Body参数 参数 是否必选 参数类型 描述 tags 否 Array of Tag objects 包含标签,最多包含20个key,每个key下面的value最多10个,每个key对应的value可以为空数组但结构体不能缺失。Key不能重复,同一个key中values不能重复。结果返回包含所有标签的资源列表,key之间是与的关系,key-value结构中value是或的关系。如tags_any和tags字段同时存在,则去重后返回两者并集。无tag过滤条件时返回全量数据。 tags_any 否 Array of Tag objects 包含任意标签,最多包含20个key,每个key下面的value最多10个。Key不能重复,同一个key中values不能重复。结果返回包含标签的资源列表,key之间是或的关系,key-value结构中value是或的关系。如tags_any和tags字段同时存在,则去重后返回两者并集。无过滤条件时返回全量数据。 not_tags 否 Array of Tag objects 不包含标签,最多包含20个key,每个key下面的value最多10个。Key不能重复,同一个key中values不能重复。结果返回不包含标签的资源列表,key之间是与的关系,key-value结构中value是或的关系。无过滤条件时返回全量数据。 not_tags_any 否 Array of Tag objects 不包含任意标签,最多包含20个key,每个key下面的value最多10个。Key不能重复,同一个key中values不能重复。结果返回不包含标签的资源列表,key之间是或的关系,key-value结构中value是或的关系。无过滤条件时返回全量数据。 limit 否 String 查询记录数(action为count时无此参数)如果action为filter默认为1000,limit最多为1000,不能为负数,最小值为1 offset 否 String 索引位置,偏移量(action为count时无此参数)从第一条数据偏移offset条数据后开始查询,如果action为filter默认为0(偏移0条数据,表示从第一条数据开始查询),必须为数字,不能为负数 action 是 String 操作标识(仅限于filter,count):filter(过滤),count(查询总条数) 如果是filter就按照过滤条件查询,如果是count,只需要返回总条数,禁止返回其他字段。 matches 否 Array of Matches objects 搜索字段,key为要匹配的字段,如resource_name等。value为匹配的值。key为固定字典值,不能包含重复的key或不支持的key。根据key的值确认是否需要模糊匹配,如resource_name默认为模糊搜索(不区分大小写,不支持*,支持字符串匹配),如果value为空字符串则返回空列表(IEF服务不存在资源名称为空的情况,因此这类情况返回空列表)。 console 否 Boolean 确认是否请求源是否为console,通过该字段来判断是否返回resource_detail内容,如果为true则返回,如果为false或者不带该参数则返回空列表。 sorted 否 Sorted object 按标签过滤资源后返回结果的排序方式 表4 Tag 参数 是否必选 参数类型 描述 key 是 String 标签key值,长度取值范围为1~36, 仅允许大小写英文字母、数字、下划线、中划线 values 否 Array of strings 标签value值,长度取值范围为0~43, 仅允许大小写英文字母、数字、下划线、中划线 表5 Matches 参数 是否必选 参数类型 描述 key 是 String 键。限定为resource_name,后续扩展。 value 否 String 值。每个值最大长度64个unicode字符。不校验字符集范围。 表6 Sorted 参数 是否必选 参数类型 描述 key 否 String 按key值对请求内容进行排序 reverse 否 Boolean 是否采用倒序
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 Content-Type 是 String 消息体的类型(格式),默认取值为“application/json” X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 ief-instance-id 否 String 铂金版实例ID,专业版实例为空值 表3 请求Body参数 参数 是否必选 参数类型 描述 tags 否 Array of ResourceTag objects 标签列表 action 是 String 操作标识:仅限于create(创建)、delete(删除) 表4 ResourceTag 参数 是否必选 参数类型 描述 key 否 String 键。最大长度36个unicode字符。 不能为空,只能包含大小写字母,数字,中划线“-”,下划线“_”。 value 否 String 值。每个值最大长度43个unicode字符,删除时如果value有值按照key/value删除,如果value没值,则按照key删除。 不能为空,只能包含大小写字母,数字,中划线“-”,下划线“_”。
  • URI POST /v2/{project_id}/{resource_type}/{resource_id}/tags/action 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID resource_type 是 String 资源类型 ief-edge_node ief-deployment ief-application ief-device resource_id 是 String 资源ID
  • URI GET /v2/{project_id}/edgemgr/configmaps 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID 表2 Query参数 参数 是否必选 参数类型 描述 name 否 String 配置项名称,模糊匹配 limit 否 String 每页显示的条目数量,取值范围1~1000,默认为1000 offset 否 String 查询的起始位置,取值范围为非负整数,默认为0
  • 响应示例 状态码: 200 ok { "count" : 1, "configmaps" : [ { "id" : "12ns9eb6cc0d49a0941df2f31283mds8 ", "name" : "test-cm", "description" : "this is a test cm2", "configs" : { "key1" : "val1", "key3" : "val3" }, "project_id" : "d16e6eb6cc0d49a0941df2f31285757a", "created_at" : "2018-07-16T13:41:25.347335", "updated_at" : "2018-07-19T13:41:25.347335" } ]}
  • 请求参数 表3 请求Header参数 参数 是否必选 参数类型 描述 Content-Type 是 String 消息体的类型(格式),默认取值为“application/json” X-Auth-Token 是 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 ief-instance-id 否 String 铂金版实例ID,专业版实例为空值
  • 响应示例 状态码: 201 ok { "configmap" : { "id" : "12ns9eb6cc0d49a0941df2f31283mds8 ", "name" : "test-cm", "description" : "this is a test cm", "configs" : { "key1" : "val-1", "key2" : "val-2" }, "project_id" : "d16e6eb6cc0d49a0941df2f31285757a", "created_at" : "2018-07-16T13:41:25.347335", "updated_at" : "2018-07-18T13:41:25.347335" }}
  • 响应示例 状态码: 200 ok { "configmap" : { "id" : "12ns9eb6cc0d49a0941df2f31283mds8 ", "name" : "test-cm", "description" : "this is a test cm2", "configs" : { "key1" : "val1", "key3" : "val3" }, "project_id" : "d16e6eb6cc0d49a0941df2f31285757a", "created_at" : "2018-07-16T13:41:25.347335", "updated_at" : "2018-07-19T13:41:25.347335" }}
  • URI DELETE /v2/{project_id}/edgemgr/deployments/{deployment_id} 表1 Path参数 名称 是否必选 说明 project_id 是 项目ID,获取方法请参见获取项目ID。 deployment_id 是 应用部署ID force_delete 否 如果force_delete=true,将强制删除应用部署,主要应对实例无法正常删除的场景
  • 请求示例 更新应用部署,应用部署副本数为1,应用实例启用主机网络,重启策略为“always”。 { "deployment" : { "replicas" : 1, "template" : { "configs" : { "host_network" : true, "host_pid" : true, "migration" : true, "restart_policy" : "Always", "toleration_seconds" : 300 }, "containers" : [ { "name" : "container-0", "image_url" : "swr.cn-north-1.myhuaweicloud.com/ief-test/nginx:0705", "args" : [ "-c", "sleep 1000" ], "command" : [ "/bin/bash" ], "resources" : { "limits" : { "cpu" : "0.25", "memory" : "500", "gpu" : "500" }, "requests" : { "cpu" : "0.25", "memory" : "500", "gpu" : "500" } }, "envs" : [ { "name" : "CERT_PATH", "value" : "/opt/cert" } ], "ports" : [ { "container_port" : 80, "host_port" : 80 } ], "privileged" : true, "readiness_probe" : { "http_get" : { "path" : "/", "port" : 80, "scheme" : "HTTP" }, "initial_delay_seconds" : 10, "timeout_seconds" : 10 }, "liveness_probe" : { "http_get" : { "path" : "/", "port" : 80, "scheme" : "HTTP" }, "initial_delay_seconds" : 10, "timeout_seconds" : 10 }, "version" : "1.0" } ] } }, "description" : "this is a test app"}
  • 响应示例 状态码: 200 ok { "id" : "3e64d98a-37c5-43a6-9bfe-052b9083e362", "name" : "app-test", "replicas" : 1, "ready_replicas" : 1, "description" : "this is a test app", "group_id" : "", "node_ids" : [ "29d20c18-c20c-4a45-a087-42c766fc5d97" ], "tags" : [ { "key" : "app", "value" : "test" } ], "api_version" : "v3", "source" : "userdefine", "project_id" : "bcd83056c918480f8f190844bd425b23", "created_at" : "2019-10-10T02:21:38.489Z", "updated_at" : "2019-10-10T02:21:38.489Z", "template" : { "configs" : { "host_network" : true, "host_pid" : true, "migration" : true, "restart_policy" : "Always", "toleration_seconds" : 300 }, "init_containers" : [ ], "containers" : [ { "name" : "container-0", "image_url" : "swr.cn-north-1.myhuaweicloud.com/ief-test/nginx:0705", "npu_type" : "", "args" : [ "-c", "sleep 1000" ], "command" : [ "/bin/bash" ], "resources" : { "limits" : { "cpu" : "0.25", "memory" : "500", "gpu" : "500" }, "requests" : { "cpu" : "0.25", "memory" : "500", "gpu" : "500" } }, "envs" : [ { "name" : "CERT_PATH", "value" : "/opt/cert" } ], "ports" : [ { "container_port" : 80, "host_port" : 80 } ], "privileged" : true, "readiness_probe" : { "http_get" : { "path" : "/", "port" : 80, "scheme" : "HTTP" }, "initial_delay_seconds" : 10, "timeout_seconds" : 10 }, "liveness_probe" : { "http_get" : { "path" : "/", "port" : 80, "scheme" : "HTTP" }, "initial_delay_seconds" : 10, "timeout_seconds" : 10 }, "version" : "1.0" } ] }} 状态码: 400 error { "error_code" : "IEF.100001", "error_msg" : "PROJECT_ID not found"} 状态码: 500 error { "error_code" : "IEF.100158", "error_msg" : "Fail to extract gpu infomation"}
  • URI GET /v2/{project_id}/edgemgr/deployments?{name=xxx,limit=xxx,offset=xxx} 表1 Path参数 名称 是否必选 说明 project_id 是 项目ID,获取方法请参见获取项目ID。 表2 查询参数 名称 是否必选 参数类型 说明 limit 否 String 每页显示的条目数量 offset 否 String 查询的起始位置 name 否 String deployment的名称 node_id 否 String 节点ID tags 否 String 标签的key和value通过点连接,多个标签通过逗号连接,如:tags=key1.value1,key2.value2 如果不携带任何检索参数,将返回该租户的所有实例信息。 tags可以和多个其他检索参数同时生效。
  • 响应消息 响应参数 表5 响应Body参数 名称 参数类型 说明 deployment 表18 object 部署详细信息 响应示例 { "deployment": { "description": "This is a test deployment", "created_at": "2019-07-10T07:12:44.020393", "updated_at": null, "visibility": null, "instances": [ { "restarts": 0, "name": "test-hw", "envs": [], "liveness_probe": { "timeout_seconds": 10, "exec_command": "/bin/bash", "initial_delay_seconds": 10 }, "state": "PENDING_CREATE", "group_name": null, "configs": { "host_network": false, "restart_policy": "Always", "privileged": false, "ports": [ { "host_port": 88, "container_port": 8888 } ] }, "reason": null, "version": "1.0.0", "image_url": "100.95.181.176:5300/op_svc_ief_container1/sample:latest", "resources": { "requests": { "cpu": 0.25, "memory": 512.0 }, "limits": { "cpu": 1.0, "memory": 512.0 } }, "volumes": [], "is_ready": null, "readiness_probe": null, "message": null, "group_id": null, "id": "f4f87339-fe33-483a-a838-6d5250a96fc5", "node_id": "09dafd3e-63df-47a8-b7c6-119563fefa85" } ], "project_id": "9ff38382ccc546ac9635800c3315a5e2", "id": "8170e363-0232-44eb-b89c-dab6b6e915ff", "name": "deployment-test" }}
  • 响应消息 响应参数 表3 响应Body参数 名称 参数类型 说明 deployment 表18 object 部署详细信息 响应示例 { "deployment": { "description": "a@aaa", "created_at": "2018-07-20T15:18:42", "updated_at": null, "instances": [ { "name": "test17", "envs": [], "state": "PENDING_CREATE", "version": "", "image_url": "camerachecker:1.5.31", "resources": { "requests": { "gpu": 2, "cpu": 3, "memory": 2 }, "limits": { "gpu": 2, "cpu": 3, "memory": 2 } }, "volumes": [ { "read_only": true, "source": "/tmp", "destination": "/tmp0", "type": "hostPath", "name": "test" }, { "read_only": true, "source": "/tmp", "destination": "/tmp2", "type": "hostPath", "name": "test1" } ], "reason": "CrashLoopBackOff ", "message": null, "configs": { "host_network": true, "restart_policy": "Always", "privileged": false }, "is_ready": "NORMAL", "restarts": 0, "node_id": "2fac08a3-f1b0-4326-a1e9-77f0f4f6df43", "liveness_probe": { "http_get": { "path": "/v1", "port": 8080, "host": "", "scheme": "HTTP" }, "initial_delay_seconds": 5, "timeout_seconds": 5 }, "readiness_probe": { "http_get": { "path": "/v1", "port": 9090, "host": "", "scheme": "HTTP" }, "initial_delay_seconds": 5, "timeout_seconds": 5 } } ], "project_id": "d16e6eb6cc0d49a0941df2f31285757a", "id": "12529bc1-7146-43cc-a24f-9199743d7dc6", "name": "test6" }}
  • 响应示例 状态码: 201 ok { "created_at" : "2020-09-23 02:38:17.894471458 +0000 UTC", "replicas" : 1, "ready_replicas" : 0, "description" : "this is a test app", "group_id" : "", "node_ids" : [ "9ebd8efb-9fdd-44a1-abda-9cdbc287a867" ], "id" : "66a7fe7e-699a-41b2-9119-f9468a5ed78e", "name" : "app", "source" : "", "template" : { "configs" : { "host_network" : true, "host_pid" : true, "restart_policy" : "Always", "migration" : false, "toleration_seconds" : 300 }, "init_containers" : [ ], "containers" : [ { "name" : "container-0", "image_url" : "nginx:alpine", "npu_type" : "", "resources" : { "limits" : { "cpu" : "0.25", "memory" : "500" }, "requests" : { "cpu" : "0.25", "memory" : "500" } }, "privileged" : false, "version" : "" } ] }, "state" : "", "project_id" : "05e1aef9040010e22fccc009adecb056", "updated_at" : "2020-09-23 02:38:17.894471458 +0000 UTC", "api_version" : "v3", "source_id" : ""} 状态码: 400 error { "error_code" : "IEF.100001", "error_msg" : "PROJECT_ID not found"} 状态码: 500 error { "error_code" : "IEF.100158", "error_msg" : "Fail to extract gpu infomation"}
  • 请求示例 创建部署,应用部署到指定节点,容器网络为主机网络。 { "name" : "app", "description" : "this is a test app", "node_ids" : [ "9ebd8efb-9fdd-44a1-abda-9cdbc287a867" ], "tags" : [ { "key" : "app", "value" : "test" } ], "deployment" : { "replicas" : 1, "template" : { "configs" : { "host_network" : true, "host_pid" : true, "restart_policy" : "Always", "toleration_seconds" : 300 }, "containers" : [ { "name" : "container-0", "image_url" : "nginx:alpine", "resources" : { "limits" : { "cpu" : "0.25", "memory" : "500" }, "requests" : { "cpu" : "0.25", "memory" : "500" } } } ] } }}
共100000条