云服务器内容精选

  • 请求示例 PUT https://{endpoint}/v1/{project_id}/v2x-edge-apps/{edge_app_id}/versions/{version} Content-Type:application/json X-Auth-Token:******** Instance-Id:******** { "description" : "this is a test app version", "container_settings" : { "configs" : { "privileged" : false, "host_network" : true, "restart_policy" : "Never" }, "image_url" : "xxx.com/huawei/edge:1.0.0", "volumes" : [ { "name" : "newconfig", "destination" : "newDestination", "source" : "/user" } ] } }
  • 响应参数 状态码: 200 表11 响应Body参数 参数 参数类型 描述 edge_app_id String 参数说明:用户自定义应用唯一ID。 取值范围:只允许字母、数字、下划线(_)、连接符(-)、美元符号($)的组合。 最小长度:0 最大长度:32 version String 参数说明:应用版本。 最小长度:0 最大长度:32 description String 参数说明:应用描述。 取值范围:只允许中文、字母、数字、下划线(_)、中文分号(;)、中文冒号(:)、中文问号(?)、中文感叹号(!)中文逗号(,)、中文句号(。)、英文引号(;)、英文冒号(:)、英文逗号(,)、英文句号(.)、英文问号(?)、英文感叹号(!)、顿号(、)、连接符(-)的组合。 最小长度:0 最大长度:255 created_time String 参数说明:创建时间。 最小长度:0 最大长度:255 last_modified_time String 参数说明:最后一次修改时间。 最小长度:0 最大长度:255 state String 参数说明:应用版本状态。 取值范围: DRAFT:草稿 PUBLISHED:发布 OFF_SHELF:下线 command Array of strings 参数说明:启动命令。 数组长度:1 - 1000000 args Array of strings 参数说明:启动参数。 数组长度:1 - 1000000 container_settings ContainerSettingsDTO object 参数说明:容器配置。 publish_time String 参数说明:发布时间。 最小长度:0 最大长度:255 off_shelf_time String 参数说明:下线时间。 最小长度:0 最大长度:255 表12 ContainerSettingsDTO 参数 参数类型 描述 configs ContainerConfigsDTO object 参数说明:容器特殊参数。 image_url String 参数说明:镜像存储地址。 envs Object 参数说明:环境变量。 volumes Array of VolumeDTO objects 参数说明:卷配置。 数组长度:0 - 100 resources ResourceDTO object 参数说明:资源配额。 ext_devices Array of ExtDevice objects 参数说明:外挂设备配置。 数组长度:0 - 100 表13 ContainerConfigsDTO 参数 参数类型 描述 privileged Boolean 参数说明:开启容器特权模式。 缺省值:false host_network Boolean 参数说明:是否使用主机网络模式。 缺省值:true restart_policy String 参数说明:重启策略,容器执行健康检查后失败后的策略。 最小长度:1 最大长度:255 container_port_list Array of ContainerPortDTO objects 参数说明:容器端口映射值。 数组长度:0 - 1000000 表14 ContainerPortDTO 参数 参数类型 描述 container_port Integer 参数说明:构成一堆映射的容器端口。 最小值:1 最大值:65535 host_port Integer 参数说明:构成一对映射的物理机对应网卡端口。 最小值:1 最大值:65535 host_ip String 参数说明:对应网卡地址。 表15 VolumeDTO 参数 参数类型 描述 name String 参数说明:卷名称。 最小长度:1 最大长度:63 type String 参数说明:挂载类型。 source String 参数说明:源路径。 最小长度:1 最大长度:255 destination String 参数说明:卷挂载路径。 最小长度:1 最大长度:255 read_only Boolean 参数说明:只读,默认只读。 表16 ResourceDTO 参数 参数类型 描述 limits ResourceConfigDTO object 参数说明:允许容器使用的最大资源。 requests ResourceConfigDTO object 参数说明:容器需要使用的最小资源。 表17 ResourceConfigDTO 参数 参数类型 描述 cpu Float 参数说明:cpu个数。 最小值:0.01 最大值:1000 memory Float 参数说明:内存大小。 最小值:0.01 最大值:1024000 gpu Float 参数说明:gpu个数。 最小值:0.01 最大值:1024000 npu Float 参数说明:npu个数。 最小值:0.01 最大值:1000 表18 ExtDevice 参数 参数类型 描述 source String 参数说明:源路径。 最小长度:1 最大长度:255 destination String 参数说明:卷挂载路径。 最小长度:1 最大长度:255 cgroup_permissions String 参数说明:只读,默认MRW。
  • 响应示例 状态码: 200 OK { "edge_app_id" : "12617852507412065303014562034843", "version" : "1.0.2", "description" : "hello", "created_time" : "2020-05-28T11:31:29.740Z", "last_modified_time" : "2020-05-28T11:31:29.740Z", "state" : "DRAFT", "command" : null, "args" : null, "container_settings" : null, "publish_time" : null, "off_shelf_time" : "2020-05-28T11:31:29.740Z" }
  • 请求示例 POST https://{endpoint}/v2/{project_id}/edge-apps/{edge_app_id}/versions { "version" : "1.0.0", "description" : "string", "sdk_version" : "string", "deploy_type" : "docker", "deploy_multi_instance" : false, "container_settings" : { "configs" : { "privileged" : false, "host_network" : true, "restart_policy" : "string", "container_port_list" : [ { "container_port" : 65535, "host_port" : 65535, "host_ip" : "string" } ] }, "image_url" : "string", "envs" : { }, "volumes" : [ { "name" : "string", "type" : "string", "source" : "string", "destination" : "string", "read_only" : true } ], "npu_type" : "D310", "resources" : { "limits" : { "cpu" : 1000, "memory" : 1024000, "gpu" : 1024000, "npu" : 1000 }, "requests" : { "cpu" : 1000, "memory" : 1024000, "gpu" : 1024000, "npu" : 1000 } }, "ext_devices" : [ { "source" : "string", "destination" : "string", "cgroup_permissions" : "string" } ] }, "liveness_probe" : { "exec_command" : "string", "tcp_socket" : { "port" : 65535 }, "http_get" : { "path" : "string", "port" : 65535, "host" : "string", "scheme" : "HTTP" }, "initial_delay_seconds" : 3600, "timeout_seconds" : 3600, "period_seconds" : 30, "failure_threshold" : 3 }, "readiness_probe" : { "exec_command" : "string", "tcp_socket" : { "port" : 65535 }, "http_get" : { "path" : "string", "port" : 65535, "host" : "string", "scheme" : "HTTP" }, "initial_delay_seconds" : 3600, "timeout_seconds" : 3600, "period_seconds" : 30, "failure_threshold" : 3 }, "arch" : { }, "command" : { }, "args" : { }, "outputs" : { }, "inputs" : { }, "services" : { }, "supplier" : "华为", "tpl_id" : "sys_general_opcua" }
  • 响应参数 状态码: 201 表14 响应Body参数 参数 参数类型 描述 edge_app_id String 应用ID 最小长度:0 最大长度:32 name String 应用名称 最小长度:0 最大长度:64 deploy_type String 部署类型docker|process 最小长度:0 最大长度:64 deploy_multi_instance Boolean 是否允许部署多实例 缺省值:false version String 应用版本 最小长度:0 最大长度:32 sdk_version String 应用集成的边缘SDK版本 最小长度:1 最大长度:32 description String 应用描述 最小长度:0 最大长度:256 create_time String 创建时间 最小长度:0 最大长度:256 update_time String 最后一次修改时间 最小长度:0 最大长度:256 state String 应用版本状态 最小长度:0 最大长度:64 枚举值: DRAFT PUBLISHED OFF_SHELF liveness_probe ProbeDTO object 工作负载存活探针 readiness_probe ProbeDTO object 工作负载业务探针 arch Array of strings 架构 数组长度:1 - 1000000 command Array of strings 启动命令 数组长度:1 - 1000000 args Array of strings 启动参数 数组长度:1 - 1000000 container_settings ContainerSettingsDTO object 容器相关配置 outputs Array of strings 应用输出路由端点 数组长度:1 - 1000000 inputs Array of strings 应用输入路由 数组长度:1 - 1000000 services Array of strings 应用实现的服务列表 数组长度:1 - 1000 publish_time String 发布时间 最小长度:0 最大长度:256 off_shelf_time String 下线时间 最小长度:0 最大长度:256 supplier String 驱动厂商 最小长度:1 最大长度:128 tpl_id String 模板id 最小长度:1 最大长度:64 表15 ProbeDTO 参数 参数类型 描述 exec_command String 执行探测的命令行命令 最小长度:0 最大长度:256 tcp_socket TcpSocketDTO object 执行tcp探测 http_get HttpGetDTO object 执行http探测 initial_delay_seconds Integer 表示从工作负载启动后从多久开始探测 最小值:0 最大值:3600 timeout_seconds Integer 表示探测超时时间 最小值:1 最大值:3600 period_seconds Integer 检查周期 最小值:5 最大值:3600 缺省值:30 failure_threshold Integer 失败多少次算不健康 最小值:1 最大值:3600 缺省值:3 表16 TcpSocketDTO 参数 参数类型 描述 port Integer 端口 最小值:1 最大值:65535 表17 HttpGetDTO 参数 参数类型 描述 path String 请求路径 最小长度:2 最大长度:64 port Integer 端口 最小值:1 最大值:65535 host String 主机地址 最小长度:0 最大长度:64 scheme String 协议类型 最小长度:1 最大长度:64 枚举值: HTTP HTTPS 表18 ContainerSettingsDTO 参数 参数类型 描述 configs ContainerConfigsDTO object 容器特殊参数 image_url String 镜像存储地址 最小长度:1 最大长度:1000000 envs Object 环境变量 volumes Array of VolumeDTO objects 卷配置 数组长度:0 - 1000000 npu_type String NPU类型 最小长度:0 最大长度:16 枚举值: D310 D910 D310P vnpu_template String NPU算力切分模板,可在对应芯片的机器上通过npu-smi info -t template-info命令查询其详细信息 最小长度:0 最大长度:32 枚举值: vir01 vir02 vir04 vir08 vir02_1c vir04_3c vir04_3c_ndvpp vir04_4c_dvpp resources ResourceDTO object 资源配额 ext_devices Array of ExtDevice objects 外挂设备配置 数组长度:0 - 1000000 表19 ContainerConfigsDTO 参数 参数类型 描述 privileged Boolean 开启容器特权模式 缺省值:false host_network Boolean 是否使用主机网络模式 缺省值:true restart_policy String 重启策略,容器执行健康检查后失败后的策略 最小长度:1 最大长度:256 container_port_list Array of ContainerPortDTO objects 容器端口映射值 数组长度:0 - 1000000 表20 ContainerPortDTO 参数 参数类型 描述 container_port Integer 构成一堆映射的容器端口 最小值:1 最大值:65535 host_port Integer 构成一对映射的物理机对应网卡端口 最小值:1 最大值:65535 host_ip String 对应网卡地址 最小长度:0 最大长度:64 表21 VolumeDTO 参数 参数类型 描述 name String 卷名称 最小长度:1 最大长度:63 type String 挂载类型 source String 源路径 destination String 卷挂载路径 read_only Boolean 只读,默认只读 表22 ResourceDTO 参数 参数类型 描述 limits ResourceConfigDTO object 允许容器使用的最大资源 requests ResourceConfigDTO object 容器需要使用的最小资源 表23 ResourceConfigDTO 参数 参数类型 描述 cpu Float cpu个数 最小值:0.01 最大值:1000 memory Float 内存大小 最小值:0.01 最大值:1024000 gpu Float gpu内存大小,单位为M 最小值:0.01 最大值:1024000 npu Float 使用npu加速卡个数 最小值:0.01 最大值:1000 表24 ExtDevice 参数 参数类型 描述 source String 源路径 destination String 卷挂载路径 cgroup_permissions String 只读,默认MRW
  • 响应示例 状态码: 201 Created { "edge_app_id" : "string", "name" : "string", "deploy_type" : "string", "deploy_multi_instance" : false, "version" : "string", "sdk_version" : "string", "description" : "string", "create_time" : "string", "update_time" : "string", "state" : "DRAFT", "liveness_probe" : { "exec_command" : "string", "tcp_socket" : { "port" : 65535 }, "http_get" : { "path" : "string", "port" : 65535, "host" : "string", "scheme" : "HTTP" }, "initial_delay_seconds" : 3600, "timeout_seconds" : 3600, "period_seconds" : 30, "failure_threshold" : 3 }, "readiness_probe" : { "exec_command" : "string", "tcp_socket" : { "port" : 65535 }, "http_get" : { "path" : "string", "port" : 65535, "host" : "string", "scheme" : "HTTP" }, "initial_delay_seconds" : 3600, "timeout_seconds" : 3600, "period_seconds" : 30, "failure_threshold" : 3 }, "arch" : "string", "command" : "string", "args" : "string", "container_settings" : { "configs" : { "privileged" : false, "host_network" : true, "restart_policy" : "string", "container_port_list" : { "container_port" : 65535, "host_port" : 65535, "host_ip" : "string" } }, "image_url" : "string", "envs" : { }, "volumes" : { "name" : "string", "type" : "string", "source" : "string", "destination" : "string", "read_only" : true }, "resources" : { "limits" : { "cpu" : 1000, "memory" : 1024000, "gpu" : 1024000, "npu" : 1000 }, "requests" : { "cpu" : 1000, "memory" : 1024000, "gpu" : 1024000, "npu" : 1000 } }, "ext_devices" : { "source" : "string", "destination" : "string", "cgroup_permissions" : "string" } }, "outputs" : "string", "inputs" : "string", "services" : "string", "publish_time" : { }, "off_shelf_time" : { }, "supplier" : "华为", "tpl_id" : "sys_general_opcua" }
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。通过调用IAM服务 获取IAM用户Token接口获取,接口返回的响应消息头中“X-Subject-Token”就是需要获取的用户Token。简要的获取方法样例请参见 Token认证。 最小长度:0 最大长度:20000 表3 请求Body参数 参数 是否必选 参数类型 描述 version 是 String 应用版本 最小长度:1 最大长度:32 description 否 String 应用描述 最小长度:0 最大长度:255 sdk_version 否 String 应用集成的边缘SDK版本 最小长度:1 最大长度:32 deploy_type 否 String 应用部署类型,分为docker容器部署类型和process进程部署类型,兼容之前数据,此字段可以为空,为空情况为docker类型 最小长度:0 最大长度:64 枚举值: docker process deploy_multi_instance 否 Boolean 是否允许部署多实例 缺省值:false container_settings 是 ContainerSettingsDTO object 容器相关配置 liveness_probe 否 ProbeDTO object 工作负载存活探针 readiness_probe 否 ProbeDTO object 工作负载业务探针 arch 是 Object 架构 command 否 Object 启动命令 args 否 Object 启动参数 outputs 否 Object 应用输出路由端点 inputs 否 Object 应用输入路由 services 否 Object 应用实现的服务列表 supplier 否 String 驱动厂商 最小长度:1 最大长度:128 tpl_id 否 String 模板id 最小长度:1 最大长度:64 表4 ContainerSettingsDTO 参数 是否必选 参数类型 描述 configs 否 ContainerConfigsDTO object 容器特殊参数 image_url 是 String 镜像存储地址 最小长度:1 最大长度:1000000 envs 否 Object 环境变量 volumes 否 Array of VolumeDTO objects 卷配置 数组长度:0 - 1000000 npu_type 否 String NPU类型 最小长度:0 最大长度:16 枚举值: D310 D910 D310P vnpu_template 否 String NPU算力切分模板,可在对应芯片的机器上通过npu-smi info -t template-info命令查询其详细信息 最小长度:0 最大长度:32 枚举值: vir01 vir02 vir04 vir08 vir02_1c vir04_3c vir04_3c_ndvpp vir04_4c_dvpp resources 否 ResourceDTO object 资源配额 ext_devices 否 Array of ExtDevice objects 外挂设备配置 数组长度:0 - 1000000 表5 ContainerConfigsDTO 参数 是否必选 参数类型 描述 privileged 否 Boolean 开启容器特权模式 缺省值:false host_network 否 Boolean 是否使用主机网络模式 缺省值:true restart_policy 是 String 重启策略,容器执行健康检查后失败后的策略 最小长度:1 最大长度:256 container_port_list 否 Array of ContainerPortDTO objects 容器端口映射值 数组长度:0 - 1000000 表6 ContainerPortDTO 参数 是否必选 参数类型 描述 container_port 否 Integer 构成一堆映射的容器端口 最小值:1 最大值:65535 host_port 否 Integer 构成一对映射的物理机对应网卡端口 最小值:1 最大值:65535 host_ip 否 String 对应网卡地址 最小长度:0 最大长度:64 表7 VolumeDTO 参数 是否必选 参数类型 描述 name 是 String 卷名称 最小长度:1 最大长度:63 type 否 String 挂载类型 source 是 String 源路径 destination 是 String 卷挂载路径 read_only 否 Boolean 只读,默认只读 表8 ResourceDTO 参数 是否必选 参数类型 描述 limits 否 ResourceConfigDTO object 允许容器使用的最大资源 requests 否 ResourceConfigDTO object 容器需要使用的最小资源 表9 ResourceConfigDTO 参数 是否必选 参数类型 描述 cpu 否 Float cpu个数 最小值:0.01 最大值:1000 memory 否 Float 内存大小 最小值:0.01 最大值:1024000 gpu 否 Float gpu内存大小,单位为M 最小值:0.01 最大值:1024000 npu 否 Float 使用npu加速卡个数 最小值:0.01 最大值:1000 表10 ExtDevice 参数 是否必选 参数类型 描述 source 是 String 源路径 destination 是 String 卷挂载路径 cgroup_permissions 否 String 只读,默认MRW 表11 ProbeDTO 参数 是否必选 参数类型 描述 exec_command 否 String 执行探测的命令行命令 最小长度:0 最大长度:256 tcp_socket 否 TcpSocketDTO object 执行tcp探测 http_get 否 HttpGetDTO object 执行http探测 initial_delay_seconds 是 Integer 表示从工作负载启动后从多久开始探测 最小值:0 最大值:3600 timeout_seconds 是 Integer 表示探测超时时间 最小值:1 最大值:3600 period_seconds 否 Integer 检查周期 最小值:5 最大值:3600 缺省值:30 failure_threshold 否 Integer 失败多少次算不健康 最小值:1 最大值:3600 缺省值:3 表12 TcpSocketDTO 参数 是否必选 参数类型 描述 port 是 Integer 端口 最小值:1 最大值:65535 表13 HttpGetDTO 参数 是否必选 参数类型 描述 path 是 String 请求路径 最小长度:2 最大长度:64 port 是 Integer 端口 最小值:1 最大值:65535 host 否 String 主机地址 最小长度:0 最大长度:64 scheme 是 String 协议类型 最小长度:1 最大长度:64 枚举值: HTTP HTTPS
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 edge_app_id String 参数说明:用户自定义应用唯一ID。 最小长度:0 最大长度:32 version String 参数说明:应用版本。 最小长度:0 最大长度:32 description String 参数说明:应用描述。 取值范围:只允许中文、字母、数字、下划线(_)、中文分号(;)、中文冒号(:)、中文问号(?)、中文感叹号(!)中文逗号(,)、中文句号(。)、英文引号(;)、英文冒号(:)、英文逗号(,)、英文句号(.)、英文问号(?)、英文感叹号(!)、顿号(、)、连接符(-)的组合。 最小长度:0 最大长度:255 created_time String 参数说明:创建时间。 最小长度:0 最大长度:255 last_modified_time String 参数说明:最后一次修改时间。 最小长度:0 最大长度:255 state String 参数说明:应用版本状态。 取值范围: DRAFT:草稿 PUBLISHED:发布 OFF_SHELF:下线 publish_time String 参数说明:发布时间。 最小长度:0 最大长度:255 off_shelf_time String 参数说明:下线时间。 最小长度:0 最大长度:255
  • 响应示例 状态码: 200 OK { "edge_app_id" : "16993214329224629859639932733105", "version" : "1.0.0", "description" : "hello", "created_time" : null, "last_modified_time" : null, "state" : "OFF_SHELF", "publish_time" : null, "off_shelf_time" : null}