华为云用户手册

  • onRemoteShareStatusChangeNotify void onRemoteShareStatusChangeNotify(const char* userId, bool isRecving) 【功能说明】 上报下行辅流状态变化通知,接收端探测网络变化,分配给下行辅流,如果有辅流因为带宽不足被停掉或者带宽恢复而恢复,则上报给产品。 【回调参数】 userId:下行辅流对应的用户ID。 isRecving:是否接受。
  • onDownStreamStatusChangeNotify void onDownStreamStatusChangeNotify(const HRTCDownStreamStatusChangeNotify* downStreamInfos, unsigned int count) 【功能说明】 全量上报下行主流状态变化通知,接收端探测网络变化,分配给每路下行流,如果有下行流因为带宽不足被停掉或者带宽恢复而恢复,则上报给产品。 【回调参数】 downStreamInfos:下行流信息,具体请参见HRTCDownStreamStatusChangeNotify。 count:下行流数量。
  • onRemoteShareStatusChangeNotify -(void)onRemoteShareStatusChangeNotify:(NSString * _Nonnull)userId isRecving:(BOOL)isRecving; 【功能说明】 上报下行辅流状态变化通知,接收端探测网络变化,分配给下行辅流,如果有辅流因为带宽不足被停掉或者带宽恢复而恢复,则上报给产品。 【回调参数】 userId:下行辅流对应的用户ID。 isRecving:是否接受。
  • onMultiRoomMediaRelayStateChanged - (void)onMultiRoomMediaRelayStateChangedWithRoomId:(NSString *)roomId state:(HWRtcMultiRoomMediaRelayState)state code:(HWRtcMultiRoomMediaRelayStateCode)code 【功能说明】 跨房状态回调。 【回调参数】 roomId:跨房房间号。 state:状态类型,具体请参见HRTCMultiRoomMediaRelayState。 code:状态的具体原因,具体请参见HRTCMultiRoomMediaRelayStateCode。
  • HRTCAuxiliarCaptureMode 表109 辅流采集模式模式 属性 描述 HRTC_AUXILIAR_CAPTURE_MODE_AUTO 自适应采集模式 HRTC_AUXILIAR_CAPTURE_MODE_MAGNIFIER 放大镜采集模式 HRTC_AUXILIAR_CAPTURE_MODE_GDI GDI采集模式 HRTC_AUXILIAR_CAPTURE_MODE_D3D D3D采集模式
  • 响应消息 响应参数 参数 参数类型 描述 status String 共享状态 created_at String 共享时间,格式为UTC时间 updated_at String 更新时间,格式为UTC时间 image_id String 镜像ID member_id String 成员ID schema String 共享视图 响应样例 STATUS CODE 200 1 2 3 4 5 6 7 8 { "status": "accepted", "created_at": "2016-09-01T02:05:14Z", "updated_at": "2016-09-01T02:37:11Z", "image_id": "d164b5df-1bc3-4c3f-893e-3e471fd16e64", "member_id": "edc89b490d7d4392898e19b2deb34797", "schema": "/v2/schemas/member" }
  • 响应消息 响应参数 参数 参数类型 描述 quotas Object 查询的配额信息。 详情请参见表1。 表1 quotas参数说明 参数 参数类型 描述 resources Array of objects 查询的配额信息。 详情请参见表2。 表2 quotas.resources参数说明 参数 参数类型 描述 type String 查询的资源类型。 used Integer 已使用的资源配额。 quota Integer 查询出的资源的总配额。 min Integer 资源的最小配额。 max Integer 资源的最大配额。 响应样例 STATUS CODE 200 1 2 3 4 5 6 7 8 9 10 11 12 13 { "quotas": { "resources": [ { "type": "image", "used": 0, "quota": 20, "min": 1, "max": 1000 } ] } }
  • 响应消息 响应参数 参数 参数类型 描述 name String 视图名称。 properties Object 镜像属性说明,主要是对基础属性的说明,包含每个属性的取值类型,用途。 具体参数说明可参考镜像属性。 响应样例 STATUS CODE 200 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 { "name": "member", "properties": { "status": { "enum": [ "pending", "accepted", "rejected" ], "type": "string", "description": "The status of this image member" }, "created_at": { "type": "string", "description": "Date and time of image member creation" }, "updated_at": { "type": "string", "description": "Date and time of last modification of image member" }, "image_id": { "pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", "type": "string", "description": "An identifier for the image" }, "member_id": { "type": "string", "description": "An identifier for the image member (tenantId)" }, "schema": { "readOnly": true, "type": "string" } } }
  • Token认证 Token的有效期为24小时,需要使用一个Token鉴权时,可以先缓存起来,避免频繁调用。 Token在计算机系统中代表令牌(临时)的意思,拥有Token就代表拥有某种权限。Token认证就是在调用API的时候将Token加到请求消息头中,从而通过身份认证,获得操作API的权限。Token可通过调用获取用户Token接口获取。 调用本服务API需要项目级别的Token,即调用获取用户Token接口时,请求body中auth.scope的取值需要选择project,如下所示。 { "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "username", //IAM用户名 "password": "********", //IAM用户密码 "domain": { "name": "domainname" //IAM用户所属账号名 } } } }, "scope": { "project": { "name": "xxxxxxxx" //项目名称 } } } } 获取Token后,再调用其他接口时,您需要在请求消息头中添加“X-Auth-Token”,其值即为Token。例如Token值为“ABCDEFJ....”,则调用接口时将“X-Auth-Token: ABCDEFJ....”加到请求消息头即可,如下所示。 1 2 3 POST https://iam.cn-north-1.myhuaweicloud.com/v3/auth/projects Content-Type: application/json X-Auth-Token: ABCDEFJ.... 您还可以通过这个视频教程了解如何使用Token认证:https://bbs.huaweicloud.com/videos/101333。
  • AK/SK认证 AK/SK签名认证方式仅支持消息体大小在12MB以内,12MB以上的请求请使用Token认证。 AK/SK认证就是使用AK/SK对请求进行签名,在请求时将签名信息添加到消息头,从而通过身份认证。 AK(Access Key ID):访问密钥ID。与私有访问密钥关联的唯一标识符;访问密钥ID和私有访问密钥一起使用,对请求进行加密签名。 SK(Secret Access Key):私有访问密钥。与访问密钥ID结合使用,对请求进行加密签名,可标识发送方,并防止请求被修改。 使用AK/SK认证时,您可以基于签名算法使用AK/SK对请求进行签名,也可以使用专门的签名SDK对请求进行签名。详细的签名方法和SDK使用方法请参见API签名指南。 签名SDK只提供签名功能,与服务提供的SDK不同,使用时请注意。
  • 响应消息 响应参数 参数 参数类型 描述 name String 视图名称。 links Array of objects 视图链接。 详情请参见表1。 properties Object 镜像属性说明,主要是对基础属性的说明,包含每个属性的取值类型,用途。 具体参数说明可参考镜像属性。 表1 links字段说明 参数 参数类型 描述 href String 域名。 rel String 域名描述。 响应样例 STATUS CODE 200 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 49 50 51 52 { "name": "members", "links": [ { "href": "{schema}", "rel": "describedby" } ], "properties": { "members": { "items": { "name": "member", "properties": { "status": { "enum": [ "pending", "accepted", "rejected" ], "type": "string", "description": "The status of this image member" }, "created_at": { "type": "string", "description": "Date and time of image member creation" }, "updated_at": { "type": "string", "description": "Date and time of last modification of image member" }, "image_id": { "pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", "type": "string", "description": "An identifier for the image" }, "member_id": { "type": "string", "description": "An identifier for the image member (tenantId)" }, "schema": { "readOnly": true, "type": "string" } } }, "type": "array" }, "schema": { "type": "string" } } }
  • 响应消息 响应参数 参数 参数类型 描述 images Array of objects 镜像详情。 具体请参见表2。 表2 images字段说明 参数 参数类型 描述 file String 镜像文件下载和上传链接。 owner String 镜像属于哪个租户。 id String 镜像ID。 size Long 目前暂时不使用。 self String 镜像链接信息。 schema String 镜像视图。 status String 镜像状态。取值如下: queued:表示镜像元数据已经创建成功,等待上传镜像文件。 saving:表示镜像正在上传文件到后端存储。 deleted:表示镜像已经删除。 killed:表示镜像上传错误。 active:表示镜像可以正常使用。 tags Array of strings 镜像标签列表,提供用户可以自定义管理私有镜像的能力。用户可以通过镜像标签接口为每个镜像增加不同的标签,在查询接口中可以根据标签进行过滤。 visibility String 是否被其他租户可见,取值如下: private:表示私有镜像。 public:表示公共镜像。 shared:表示共享镜像。 name String 镜像名称。name参数说明请参考镜像属性。 checksum String 目前暂时不使用。 protected Boolean 是否是受保护的,受保护的镜像不允许删除。取值为true或false。 container_format String 容器类型。 min_ram Integer 镜像运行最小内存,单位为MB。取值参考云服务器规格限制,一般设置为0。 云服务器的规格限制,请参见规格清单。 max_ram String 镜像支持的最大内存,单位为MB。取值可以参考云服务器规格限制,一般不设置。 云服务器的规格限制,请参见规格清单。 updated_at String 更新时间。格式为UTC时间。 __os_bit String 操作系统位数,一般取值为“32”或者“64”。 __os_version String 操作系统具体版本。 __description String 镜像描述信息。_description参数说明请参考镜像属性。 disk_format String 镜像格式,目前支持zvhd2、vhd、zvhd、raw、qcow2、iso。非iso格式时默认值是zvhd2。 __isregistered String 是否是注册过的镜像,取值为“true”或者“false”。 __platform String 镜像平台分类,取值为Windows、Ubuntu、Red Hat、SUSE、CentOS、Debian、OpenSUSE、Oracle Linux、Fedora、Other、CoreOS和EulerOS。 __os_type String 操作系统类型,目前取值Linux、Windows、Other。 min_disk Integer 镜像运行需要的最小磁盘,单位为GB 。取值为40~1024GB。 virtual_env_type String 镜像使用环境类型:FusionCompute、Ironic、DataImage、IsoImage。 如果是云服务器镜像,则取值为FusionCompute。 如果是数据盘镜像,则取值是DataImage。 如果是裸金属服务器镜像,则取值是Ironic。 如果是ISO镜像,则取值是IsoImage。 __image_source_type String 镜像后端存储类型,目前支持uds。 __imagetype String 镜像类型,目前支持以下类型: 公共镜像:gold 私有镜像:private 共享镜像:shared 市场镜像:market created_at String 创建时间。格式为UTC时间。 virtual_size Integer 目前暂时不使用。 __originalimagename String 父镜像ID。 公共镜像或通过文件创建的私有镜像,取值为空。 __backup_id String 备份ID。如果是备份创建的镜像,则填写为备份的ID,否则为空。 __productcode String 市场镜像的产品ID。 __image_size String 镜像文件的大小,单位为字节。 __data_origin String 镜像来源。 公共镜像为空。 __lazyloading String 镜像是否支持延迟加载。取值为true、false、True或False。 active_at String 镜像状态变为正常的时间。 __os_feature_list String 镜像附加属性。该属性采用JSON格式来标识镜像支持的高级特性清单。 __support_kvm String 如果镜像支持KVM,取值为true,否则无需增加该属性。 __support_xen String 如果镜像支持XEN,取值为true,否则无需增加该属性。 __support_largememory String 表示该镜像支持超大内存。如果镜像支持超大内存,取值为true,否则无需增加该属性。 __support_diskintensive String 表示该镜像支持密集存储。如果镜像支持密集存储性能,则值为true,否则无需增加该属性。 __support_highperformance String 表示该镜像支持高计算性能。如果镜像支持高计算性能,则值为true,否则无需增加该属性。 __support_xen_gpu_type String 表示该镜像是支持XEN虚拟化平台下的GPU优化类型,取值参考表2。如果不支持XEN虚拟化下GPU类型,无需添加该属性。该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_kvm_gpu_type String 表示该镜像是支持KVM虚拟化平台下的GPU类型,取值参考表3。 如果不支持KVM虚拟化下GPU类型,无需添加该属性。该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_xen_hana String 如果镜像支持XEN虚拟化下HANA类型,取值为true。否则,无需添加该属性。 该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_kvm_infiniband String 如果镜像支持KVM虚拟化下Infiniband网卡类型,取值为true。否则,无需添加该属性。 该属性与“__support_xen”属性不共存。 __system_support_market Boolean 表示当前镜像是否支持发布为市场镜像。 true:支持 false:不支持 __is_offshelved String 表示当前市场镜像是否下架。 true:已下架 false:未下架 enterprise_project_id String 表示当前镜像所属的企业项目。 取值为0或无该值,表示属于default企业项目。 取值为UUID,表示属于该UUID对应的企业项目。 关于企业项目特性的详细信息,请参考“企业中心总览”。 __root_origin String 表示当前镜像来源是从外部导入。取值:file。 __sequence_num String 表示当前镜像对应云服务器的系统盘插槽位置。 取值样例:0。 __support_fc_inject String 表示当前镜像支持Cloud-Init密码/密钥注入方式。 如果取值为“true”,表示该镜像不支持Cloud-Init注入密码/密钥,其他取值时表示支持Cloud-Init注入密钥/密码。 说明: 该特性参数只对ECS系统盘镜像生效,其他类型镜像不生效。 hw_firmware_type String 云服务器的启动方式。目前支持: bios:表示bios引导启动。 uefi:表示uefi引导启动。 hw_vif_multiqueue_enabled String 镜像是否支持网卡多队列。取值为“true”或者“false”。 __support_arm String 是否是ARM架构类型的镜像。取值为“true”或者“false”。 __support_agent_list String 镜像是否支持企业主机安全或主机监控。 hss:企业主机安全 ces:主机监控 取值样例: "__support_agent_list": "hss,ces" 说明: 如果查询结果无此字段,表示镜像不支持企业主机安全或主机监控。 __system__cmkid String 加密镜像所使用的密钥ID。 __account_code String 收费镜像标识。 __support_amd String 是否是AMD架构类型的镜像。取值为“true”或者“false”。 响应样例 STATUS CODE 200 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 { "images": [ { "schema": "/v2/schemas/image", "min_disk": 100, "created_at": "2018-09-06T14:03:27Z", "__image_source_type": "uds", "container_format": "bare", "file": "/v2/images/bc6bed6e-ba3a-4447-afcc-449174a3eb52/file", "updated_at": "2018-09-06T15:17:33Z", "protected": true, "checksum": "d41d8cd98f00b204e9800998ecf8427e", "id": "bc6bed6e-ba3a-4447-afcc-449174a3eb52", "__isregistered": "true", "min_ram": 2048, "__lazyloading": "true", "owner": "1bed856811654c1cb661a6ca845ebc77", "__os_type": "Linux", "__imagetype": "gold", "visibility": "public", "virtual_env_type": "FusionCompute", "tags": [], "__platform": "CentOS", "size": 0, "__os_bit": "64", "__os_version": "CentOS 7.3 64bit", "name": "CentOS 7.3 64bit vivado", "self": "/v2/images/bc6bed6e-ba3a-4447-afcc-449174a3eb52", "disk_format": "zvhd2", "virtual_size": null, "hw_firmware_type": "bios", "status": "active", "__support_fc_inject":"true" }, { "schema": "/v2/schemas/image", "min_disk": 100, "created_at": "2018-09-06T14:03:05Z", "__image_source_type": "uds", "container_format": "bare", "file": "/v2/images/0328c25e-c840-4496-81ac-c4e01b214b1f/file", "updated_at": "2018-09-25T14:27:40Z", "protected": true, "checksum": "d41d8cd98f00b204e9800998ecf8427e", "id": "0328c25e-c840-4496-81ac-c4e01b214b1f", "__isregistered": "true", "min_ram": 2048, "__lazyloading": "true", "owner": "1bed856811654c1cb661a6ca845ebc77", "__os_type": "Linux", "__imagetype": "gold", "visibility": "public", "virtual_env_type": "FusionCompute", "tags": [], "__platform": "CentOS", "size": 0, "__os_bit": "64", "__os_version": "CentOS 7.3 64bit", "name": "CentOS 7.3 64bit with sdx", "self": "/v2/images/0328c25e-c840-4496-81ac-c4e01b214b1f", "disk_format": "zvhd2", "virtual_size": null, "hw_firmware_type": "bios", "status": "active", "__support_fc_inject":"true" } ] }
  • 常用列表查询方法 公共镜像列表查询 GET /v2/cloudimages?__imagetype=gold&visibility=public&protected=true 私有镜像列表查询 GET /v2/cloudimages?owner={project_id} 可以使用的共享镜像列表 GET /v2/cloudimages?member_status=accepted&visibility=shared&__imagetype=shared 被拒绝的共享镜像列表 GET /v2/cloudimages?member_status=rejected&visibility=shared&__imagetype=shared 未接受的共享镜像列表 GET /v2/cloudimages?member_status=pending&visibility=shared&__imagetype=shared 裸金属服务器某规格支持的公共镜像列表 GET /v2/cloudimages?__imagetype=gold&__support_xxx=true&virtual_env_type=Ironic
  • URI GET /v2/cloudimages{?__isregistered,__imagetype,__whole_image,__system__cmkid,protected,visibility,owner,id,status,name,flavor_id,container_format,disk_format,min_ram,min_disk,__os_bit,__platform,marker,limit,sort_key,sort_dir,__os_type,tag,member_status,__support_kvm,__support_xen,__support_largememory,__support_diskintensive,__support_highperformance,__support_xen_gpu_type,__support_kvm_gpu_type,__support_xen_hana,__support_kvm_infiniband,virtual_env_type,enterprise_project_id,created_at,updated_at,architecture} 可以在URI后面用‘?’和‘&’添加不同的查询条件组合,请参考请求样例。 表1 查询参数 参数 是否必选 参数类型 描述 __isregistered 否 String 镜像是否可用,取值为true,扩展接口会默认为true,普通用户只能查询取值为true的镜像。 __imagetype 否 String 镜像类型,目前支持以下类型: 公共镜像:gold 私有镜像:private 共享镜像:shared 市场镜像:market 说明: 当前租户共享给其他租户的私有镜像或当前租户接受的共享镜像中,__imagetype均为shared,可用owner字段进行区分。当前租户接受的共享镜像可用member_status进行过滤查询。 __whole_image 否 Boolean 是否为整机镜像,取值为true/false。 __system__cmkid 否 String 加密镜像所使用的密钥ID。可以从镜像服务控制台获取,或者调用查询镜像详情(OpenStack原生)API查询。 protected 否 Boolean 镜像是否是受保护,取值为true/false,一般查询公共镜像时候取值为true,查询私有镜像可以不指定。 visibility 否 String 是否被其他租户可见,取值如下: public:公共镜像 private:私有镜像 shared:共享镜像 owner 否 String 镜像属于哪个租户。 id 否 String 镜像ID。 status 否 String 镜像状态。取值如下: queued:表示镜像元数据已经创建成功,等待上传镜像文件。 saving:表示镜像正在上传文件到后端存储。 deleted:表示镜像已经删除。 killed:表示镜像上传错误。 active:表示镜像可以正常使用。 name 否 String 镜像名称,匹配规则为精确匹配。name参数说明请参考镜像属性。 flavor_id 否 String 用于通过云服务器规格过滤出可用公共镜像,取值为规格ID。 约束: 仅支持通过单个规格进行过滤。 仅支持按照云服务器规格进行过滤,裸金属服务器暂不支持。 如果需要查看某裸金属服务器规格支持的公共镜像,可以使用“__support_s4l=true”标签。其中,s4l为裸金属服务器规格的board_type,若规格为“physical.s4.large”,则填入“s4l”。详细说明请参见“怎么确定裸金属服务器规格的board_type?”。调用示例请参考常用列表查询方法。 container_format 否 String 容器类型,取值为bare。 disk_format 否 String 镜像格式,目前支持zvhd2、vhd、zvhd、raw、qcow2、iso。非iso格式时默认值是zvhd2。 min_ram 否 Integer 镜像运行需要的最小内存,单位为MB。参数取值依据云服务器的规格限制,一般设置为0。 云服务器的规格限制,请参见规格清单。 min_disk 否 Integer 镜像运行需要的最小磁盘,单位为GB 。取值为40~1024GB。 __os_bit 否 String 操作系统位数,一般取值为32或者64。 __platform 否 String 镜像平台分类,取值为Windows、Ubuntu、Red Hat、SUSE、CentOS、Debian、OpenSUSE、Oracle Linux、Fedora、Other、CoreOS、EulerOS和Huawei Cloud EulerOS等。 marker 否 String 用于分页,表示从哪个镜像开始查询,取值为镜像ID。 limit 否 Integer 用于分页,表示查询几条镜像记录,取值为整数,默认取值为500。 sort_key 否 String 用于排序,表示按照哪个字段排序。取值为镜像属性name、container_format、disk_format、status、id、size、created_at字段,默认为创建时间。 sort_dir 否 String 用于排序,表示升序还是降序,取值为asc和desc。与sort_key一起组合使用,默认为降序desc。 __os_type 否 String 镜像系统类型,取值如下: Linux Windows Other tag 否 String 标签,用户为镜像增加自定义标签后可以通过该参数过滤查询。 说明: 系统近期对标签功能进行了升级。如果之前添加的Tag为“Key.Value”的形式,则查询的时候需要使用“Key=Value”的格式来查询。例如:之前添加的tag为“a.b”,则升级后,查询时需使用“tag=a=b”。 member_status 否 String 成员状态。目前取值有accepted、rejected、pending。accepted表示已经接受共享的镜像,rejected表示已经拒绝了其他用户共享的镜像,pending表示需要确认的其他用户的共享镜像。需要在查询时,设置“visibility”参数为“shared”。 __support_kvm 否 String 如果镜像支持KVM,取值为true,否则无需增加该属性。 __support_xen 否 String 如果镜像支持XEN,取值为true,否则无需增加该属性。 __support_largememory 否 String 表示该镜像支持超大内存。如果镜像支持超大内存,取值为true,否则无需增加该属性。 镜像操作系统类型请参考“弹性云服务器类型与支持的操作系统版本”。 __support_diskintensive 否 String 表示该镜像支持密集存储。如果镜像支持密集存储性能,则值为true,否则无需增加该属性。 __support_highperformance 否 String 表示该镜像支持高计算性能。如果镜像支持高计算性能,则值为true,否则无需增加该属性。 __support_xen_gpu_type 否 String 表示该镜像是支持XEN虚拟化平台下的GPU优化类型,取值参考表2。如果不支持XEN虚拟化下GPU类型,无需添加该属性。该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_kvm_gpu_type 否 String 表示该镜像是支持KVM虚拟化平台下的GPU类型,取值参考表3。如果不支持KVM虚拟化下GPU类型,无需添加该属性。该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_xen_hana 否 String 如果镜像支持XEN虚拟化下HANA类型,取值为true。否则,无需添加该属性。 该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_kvm_infiniband 否 String 如果镜像支持KVM虚拟化下Infiniband网卡类型,取值为true。否则,无需添加该属性。 该属性与“__support_xen”属性不共存。 virtual_env_type 否 String 镜像使用环境类型:FusionCompute、Ironic、DataImage、IsoImage。 如果是云服务器镜像(即系统盘镜像),则取值为FusionCompute。 如果是数据盘镜像,则取值是DataImage。 如果是裸金属服务器镜像,则取值是Ironic。 如果是ISO镜像,则取值是IsoImage。 enterprise_project_id 否 String 表示查询某个企业项目下的镜像。 取值为0,表示查询属于default企业项目下的镜像。 取值为UUID,表示查询属于该UUID对应的企业项目下的镜像。 取值为all_granted_eps,表示查询当前用户所有企业项目下的镜像。 关于企业项目ID的获取及企业项目特性的详细信息,请参考“企业中心总览”。 created_at 否 String 镜像创建时间。支持按照时间点过滤查询,取值格式为“操作符:UTC时间”。 其中操作符支持如下几种: gt:大于 gte:大于等于 lt:小于 lte:小于等于 eq:等于 neq:不等于 时间格式支持:yyyy-MM-ddThh:mm:ssZ或者yyyy-MM-dd hh:mm:ss 例如,查询创建时间在2018-10-28 10:00:00之前的镜像,可以通过如下条件过滤: created_at=lt:2018-10-28T10:00:00Z updated_at 否 String 镜像修改时间。支持按照时间点过滤查询,取值格式为“操作符:UTC时间”。 其中操作符支持如下几种: gt:大于 gte:大于等于 lt:小于 lte:小于等于 eq:等于 neq:不等于 时间格式支持:yyyy-MM-ddThh:mm:ssZ或者yyyy-MM-dd hh:mm:ss 例如,查询修改时间在2018-10-28 10:00:00之前的镜像,可以通过如下条件过滤: updated_at=lt:2018-10-28T10:00:00Z architecture 否 String 镜像架构类型。取值包括: x86 arm
  • 响应消息 响应参数 参数 参数类型 描述 status String 镜像状态 virtual_size Integer 镜像虚拟大小 name String 镜像名称。name参数说明请参考镜像属性。 deleted Boolean 镜像是否已删除 container_format String 镜像容器类型 created_at String 镜像创建时间 disk_format String 镜像文件类型 updated_at String 镜像更新时间 properties Object 镜像属性 owner String 镜像所属租户 protected Boolean 镜像是否受保护 min_ram Integer 运行镜像所需最小内存,单位MB checksum String 镜像校验和,上传镜像文件后存在 min_disk Integer 运行镜像所需最小磁盘,单位GB is_public Boolean 是否为公共镜像 deleted_at String 镜像删除时间 id String 镜像UUID size Integer 镜像大小,上传镜像文件后存在 响应样例 HTTP/1.1 200 OK 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 Content-Type: application/json; charset=UTF-8 Content-Length: 495 X-Openstack-Request-Id: req-68327dda-8078-41fe-b091-01a09ec073da Date: Mon, 23 May 2016 02:32:28 GMT { "images": [ { "status": "active", "deleted_at": null, "name": "cirros", "deleted": false, "container_format": "bare", "created_at": "2016-05-22T06:04:20.425843", "disk_format": "qcow2", "updated_at": "2016-05-22T06:04:22.719791", "min_disk": 0, "protected": false, "id": "3c3d1d01-b48a-4639-8a88-08be3b9b5d78", "min_ram": 0, "checksum": "64d7c1cd2b6f60c92c14662941cb7913", "owner": "23f4cb75768d4febb39542ef6fe169f3", "is_public": true, "virtual_size": null, "properties": { }, "size": 13167616 } ] }
  • 请求消息 请求参数 可以把name、container_format、disk_format、status、size_min、size_max、changes-since作为uri参数,过滤查询结果。 参数 是否必选 参数类型 描述 name 否 String 镜像名称。name参数说明请参考镜像属性。 container_format 否 String 镜像容器类型 disk_format 否 String 镜像文件格式 status 否 String 镜像状态 size_min 否 String 镜像不小于 size_max 否 String 镜像不大于 changes-since 否 String 镜像最后更新时间
  • 响应消息 响应参数 参数 参数类型 描述 tags Array of objects 标签列表。详情请参见表2。 表2 tags数据结构说明 参数 参数类型 描述 key String 标签的键。 values Array of strings 标签的值列表。如果标签只有key,则在值列表中以空白字符串""的形式出现。 响应样例 STATUS CODE 200 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 { "tags": [{ "values": ["value9"], "key": "key9" }, { "values": [""], "key": "key8" }, { "values": ["valueXX", "value3"], "key": "key3" }] }
  • 响应消息 响应参数 参数 参数类型 描述 first String 查询首页的URL。 next String 查询下一页的URL。当查询镜像列表最后一页时,不存在next。 schema String 描述镜像列表模式的URL。 images Array of objects 资源类型。 具体请参见表2。 表2 images字段说明 参数 参数类型 描述 __backup_id String 备份ID。如果是备份创建的镜像,则填写为备份的ID,否则无此参数。 __data_origin String 镜像来源。公共镜像为空。 __description String 镜像描述信息。 __image_location String 镜像的存储位置。 __image_size String 镜像文件的大小,单位为字节。目前取值为大于0的字符串。 __image_source_type String 镜像后端存储类型,目前只支持uds。 __is_config_init String 是否完成了初始化配置。取值为“true”或“false”。 __isregistered String 镜像是否可用,取值为true,扩展接口会默认为true,普通用户只能查询取值为true的镜像。 __lazyloading String 镜像是否支持延迟加载。取值为true、false、True或False。 __originalimagename String 父镜像ID。公共镜像或通过文件创建的私有镜像,取值为空。 __imagetype String 镜像类型,目前支持以下类型: 公共镜像:gold 私有镜像:private 共享镜像:shared 市场镜像:market protected Boolean 镜像是否是受保护,查询公共镜像时候取值为true,查询私有镜像可以不指定。 virtual_env_type String 镜像使用的环境类型:FusionCompute、Ironic、DataImage、IsoImage。 如果是云服务器镜像(即系统盘镜像),则取值为FusionCompute。 如果是数据盘镜像,则取值是DataImage。 如果是裸金属服务器镜像,则取值是Ironic。 如果是ISO镜像,则取值是IsoImage。 virtual_size Integer 目前暂时不使用。 visibility String 是否被其他租户可见。取值如下: public:表示公共镜像。 private:表示私有镜像。 shared:表示共享镜像。 owner String 镜像属于哪个租户。 id String 镜像ID。 status String 镜像状态。取值如下: queued:表示镜像元数据已经创建成功,等待上传镜像文件。 saving:表示镜像正在上传文件到后端存储。 deleted:表示镜像已经删除。 killed:表示镜像上传错误。 active:表示镜像可以正常使用。 name String 镜像名称。name参数说明请参考镜像属性。 container_format String 容器类型。 disk_format String 镜像格式,目前支持zvhd2、vhd、zvhd、raw、qcow2、iso。非iso格式时默认值是zvhd2。 min_ram Integer 镜像运行需要的最小内存,单位为MB。参数取值依据云服务器的规格限制,一般为0。 云服务器的规格限制,请参见规格清单。 max_ram String 镜像支持的最大内存,单位为MB。 min_disk Integer 镜像运行需要的最小磁盘容量,单位为GB 。取值为40~1024GB。 __os_bit String 操作系统位数,一般取值为32或者64。 __os_feature_list String 镜像附加属性。该属性采用JSON格式来标识镜像支持的高级特性清单。 __platform String 镜像平台分类,取值为Windows、Ubuntu、Red Hat、SUSE、CentOS、Debian、OpenSUSE、Oracle Linux、Fedora、Other、CoreOS和EulerOS。 schema String 镜像视图。 self String 镜像链接信息。 size Integer 目前暂时不使用。 __os_type String 镜像系统类型,取值为Linux、Windows、Other。 __os_version String 操作系统具体版本。 tags Array of strings 镜像标签列表,提供用户可以自定义管理私有镜像的能力。 __support_kvm String 如果镜像支持KVM,取值为true,否则无此属性。 __support_xen String 如果镜像支持XEN,取值为true,否则无此属性。 __support_largememory String 表示该镜像支持超大内存。如果镜像支持超大内存,取值为true,否则无此属性。 __support_diskintensive String 表示该镜像支持密集存储。如果镜像支持密集存储性能,则值为true,否则无此属性。 __support_highperformance String 表示该镜像支持高计算性能。如果镜像支持高计算性能,则值为true,否则无此属性。 __support_xen_gpu_type String 表示该镜像是支持XEN虚拟化平台下的GPU类型。支持GPU加速型实例的镜像操作系统类型请参考表2。如果不支持XEN虚拟化下GPU类型,无此属性。该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_kvm_gpu_type String 表示该镜像是支持KVM虚拟化平台下的GPU类型,取值参考表3。如果不支持KVM虚拟化下GPU类型,无此属性。该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_xen_hana String 如果镜像支持XEN虚拟化下HANA类型,取值为true。否则,无此属性。 该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_kvm_infiniband String 如果镜像支持KVM虚拟化下Infiniband网卡类型,取值为true。否则,无此属性。 该属性与“__support_xen”属性不共存。 __productcode String 市场镜像的产品ID。 __root_origin String 表示当前镜像来源是从外部导入。取值样例:file。 __sequence_num String 表示当前镜像对应云服务器的系统盘插槽位置。 取值样例:0。 __support_fc_inject String 表示当前镜像支持Cloud-Init密码/密钥注入方式。 如果取值为“true”,表示该镜像不支持Cloud-Init注入密码/密钥,其他取值时表示支持Cloud-Init注入密钥/密码。 说明: 该特性参数只对ECS系统盘镜像生效,其他类型镜像不生效。 __is_offshelved String 表示当前市场镜像是否下架。 true:已下架 false:未下架 created_at String 创建时间。格式为UTC时间。 updated_at String 更新时间。格式为UTC时间。 active_at String 镜像状态变为正常的时间。 checksum String 目前暂时不使用。 hw_firmware_type String 云服务器的启动方式。目前支持: bios:表示bios引导启动。 uefi:表示uefi引导启动。 file String 镜像文件下载和上传链接。 enterprise_project_id String 表示当前镜像所属的企业项目。 取值为0或无该值,表示属于default企业项目。 取值为UUID,表示属于该UUID对应的企业项目。 _sys_enterprise_project_id String 表示当前镜像所属的企业项目。 取值为0或无该值,表示属于default企业项目。 取值为UUID,表示属于该UUID对应的企业项目。 __support_arm String 是否是ARM架构类型的镜像。取值为“true”或者“false”。 __support_agent_list String 镜像是否支持企业主机安全或主机监控。 hss:企业主机安全 ces:主机监控 取值样例: "__support_agent_list": "hss,ces" 说明: 如果查询结果无此字段,表示镜像不支持企业主机安全或主机监控。 __account_code string 收费镜像标识。 __support_amd String 是否是AMD架构类型的镜像。取值为“true”或者“false”。 __system__cmkid String 加密镜像所使用的密钥ID。 hw_vif_multiqueue_enabled String 镜像是否支持网卡多队列。取值为“true”或者“false”。 响应样例 STATUS CODE 200 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 { "schema": "/v2/schemas/images", "next": "/v2/images?__isregistered=true&marker=0328c25e-c840-4496-81ac-c4e01b214b1f&__imagetype=gold&limit=2", "images": [ { "schema": "/v2/schemas/image", "min_disk": 100, "created_at": "2018-09-06T14:03:27Z", "__image_source_type": "uds", "container_format": "bare", "file": "/v2/images/bc6bed6e-ba3a-4447-afcc-449174a3eb52/file", "updated_at": "2018-09-06T15:17:33Z", "protected": true, "checksum": "d41d8cd98f00b204e9800998ecf8427e", "id": "bc6bed6e-ba3a-4447-afcc-449174a3eb52", "__isregistered": "true", "min_ram": 2048, "__lazyloading": "true", "owner": "1bed856811654c1cb661a6ca845ebc77", "__os_type": "Linux", "__imagetype": "gold", "visibility": "public", "virtual_env_type": "FusionCompute", "tags": [], "__platform": "CentOS", "size": 0, "__os_bit": "64", "__os_version": "CentOS 7.3 64bit", "name": "CentOS 7.3 64bit vivado", "self": "/v2/images/bc6bed6e-ba3a-4447-afcc-449174a3eb52", "disk_format": "zvhd2", "virtual_size": null, "hw_firmware_type": "bios", "status": "active" }, { "schema": "/v2/schemas/image", "min_disk": 100, "created_at": "2018-09-06T14:03:05Z", "__image_source_type": "uds", "container_format": "bare", "file": "/v2/images/0328c25e-c840-4496-81ac-c4e01b214b1f/file", "updated_at": "2018-09-25T14:27:40Z", "protected": true, "checksum": "d41d8cd98f00b204e9800998ecf8427e", "id": "0328c25e-c840-4496-81ac-c4e01b214b1f", "__isregistered": "true", "min_ram": 2048, "__lazyloading": "true", "owner": "1bed856811654c1cb661a6ca845ebc77", "__os_type": "Linux", "__imagetype": "gold", "visibility": "public", "virtual_env_type": "FusionCompute", "tags": [], "__platform": "CentOS", "size": 0, "__os_bit": "64", "__os_version": "CentOS 7.3 64bit", "name": "CentOS 7.3 64bit with sdx", "self": "/v2/images/0328c25e-c840-4496-81ac-c4e01b214b1f", "disk_format": "zvhd2", "virtual_size": null, "hw_firmware_type": "bios", "status": "active" } ], "first": "/v2/images?__isregistered=true&__imagetype=gold&limit=2" }
  • 常用列表查询方法 公共镜像列表查询 GET /v2/images?__imagetype=gold&visibility=public&protected=true 私有镜像列表查询 GET /v2/images?owner={project_id} 可以使用的共享镜像列表 GET /v2/images?member_status=accepted&visibility=shared&__imagetype=shared 被拒绝的共享镜像列表 GET /v2/images?member_status=rejected&visibility=shared&__imagetype=shared 未接受的共享镜像列表 GET /v2/images?member_status=pending&visibility=shared&__imagetype=shared
  • URI GET /v2/images 可以在URI后面用‘?’和‘&’添加不同的查询条件组合,请参考请求样例。 如需使用OpenStack Queens版本API,请在请求消息头中包含X-Api-Version。当X-Api-Version取值大于M则返回Queens版本的结果,小于等于M,返回Mitaka版本结果 。 参数说明请参见表1。 表1 参数说明 参数 是否必选 参数类型 描述 __isregistered 否 String 镜像是否可用,取值为true,扩展接口会默认为true,普通用户只能查询取值为true的镜像。 __imagetype 否 String 镜像类型,目前支持以下类型: 公共镜像:gold 私有镜像:private 共享镜像:shared 市场镜像:market protected 否 Boolean 镜像是否是受保护,取值为true/false。一般查询公共镜像时候取值为true,查询私有镜像可以不指定。 visibility 否 String 是否被其他租户可见,取值如下: public:公共镜像 private:私有镜像 shared:共享镜像 owner 否 String 镜像属于哪个租户。 id 否 String 镜像ID。 status 否 String 镜像状态。取值如下: queued:表示镜像元数据已经创建成功,等待上传镜像文件。 saving:表示镜像正在上传文件到后端存储。 deleted:表示镜像已经删除。 killed:表示镜像上传错误。 active:表示镜像可以正常使用。 name 否 String 镜像名称,匹配规则为精确匹配。name参数说明请参考镜像属性。 container_format 否 String 容器类型。默认值是bare。 disk_format 否 String 镜像格式,目前支持zvhd2、vhd、zvhd、raw、qcow2、iso。非iso格式时默认值是zvhd2。 min_ram 否 Integer 镜像运行需要的最小内存,单位为MB。参数取值依据云服务器的规格限制,一般设置为0。 云服务器的规格限制,请参见规格清单。 min_disk 否 Integer 镜像运行需要的最小磁盘,单位为GB 。取值为40~1024GB。 __os_bit 否 String 操作系统位数,一般取值为32或者64。 __platform 否 String 镜像平台分类,取值为Windows、Ubuntu、Red Hat、SUSE、CentOS、Debian、OpenSUSE、Oracle Linux、Fedora、Other、CoreOS和EulerOS。 marker 否 String 用于分页,表示从哪个镜像开始查询,取值为镜像ID。 limit 否 Integer 用于分页,表示查询几条镜像记录,取值为整数,默认返回25条镜像记录。 sort_key 否 String 用于排序,表示按照哪个字段排序。取值为镜像属性name、container_format、disk_format、status、id、size、created_at字段,默认为创建时间。 sort_dir 否 String 用于排序,表示升序还是降序,取值为asc和desc。与sort_key一起组合使用,默认为降序desc。 __os_type 否 String 镜像系统类型,取值为Linux、Windows、Other。 tag 否 String 标签,用户为镜像增加自定义标签后可以通过该参数过滤查询。 说明: 系统近期对标签功能进行了升级。如果之前添加的Tag为“Key.Value”的形式,则查询的时候需要使用“Key=Value”的格式来查询。例如:之前添加的tag为“a.b”,则升级后,查询时需使用“tag=a=b”。 member_status 否 String 成员状态。目前取值有accepted、rejected、pending。accepted表示已经接受共享的镜像,rejected表示已经拒绝了其他用户共享的镜像,pending表示需要确认的其他用户的共享镜像。需要在查询时,设置“visibility”参数为“shared”。 __support_kvm 否 String 如果镜像支持KVM,取值为true,否则无需增加该属性。 __support_xen 否 String 如果镜像支持XEN,取值为true,否则无需增加该属性。 __support_largememory 否 String 表示该镜像支持超大内存。如果镜像支持超大内存,取值为true,否则无需增加该属性。 __support_diskintensive 否 String 表示该镜像支持密集存储。如果镜像支持密集存储性能,则值为true,否则无需增加该属性。 __support_highperformance 否 String 表示该镜像支持高计算性能。如果镜像支持高计算性能,则值为true,否则无需增加该属性。 __support_xen_gpu_type 否 String 表示该镜像是支持XEN虚拟化平台下的GPU类型。支持GPU加速型实例的镜像操作系统类型请参考表2。如果不支持XEN虚拟化下GPU类型,无需添加该属性。该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_kvm_gpu_type 否 String 表示该镜像是支持KVM虚拟化平台下的GPU类型,取值参考表3。如果不支持KVM虚拟化下GPU类型,无需添加该属性。该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_xen_hana 否 String 如果镜像支持XEN虚拟化下HANA类型,取值为true。否则,无需添加该属性。 该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_kvm_infiniband 否 String 如果镜像支持KVM虚拟化下Infiniband网卡类型,取值为true。否则,无需添加该属性。 该属性与“__support_xen”属性不共存。 created_at 否 String 镜像创建时间。支持按照时间点过滤查询,取值格式为“ 操作符:UTC时间”。 其中操作符支持如下几种: gt:大于 gte:大于等于 lt:小于 lte:小于等于 eq:等于 neq:不等于 时间格式支持:yyyy-MM-ddThh:mm:ssZ或者yyyy-MM-dd hh:mm:ss 例如,查询创建时间在2018-10-28 10:00:00之前的镜像,可以通过如下条件过滤: created_at=lt:2018-10-28T10:00:00Z updated_at 否 String 镜像修改时间。支持按照时间点过滤查询,取值格式为 “ 操作符:UTC时间”。 其中操作符支持如下几种: gt:大于 gte:大于等于 lt:小于 lte:小于等于 eq:等于 neq:不等于 时间格式支持:yyyy-MM-ddThh:mm:ssZ或者yyyy-MM-dd hh:mm:ss 例如,查询修改时间在2018-10-28 10:00:00之前的镜像,可以通过如下条件过滤: updated_at=lt:2018-10-28T10:00:00Z
  • 响应消息 响应参数 参数 参数类型 描述 name String 视图名称。 links Array of objects 视图链接。 详情请参见表1。 properties Object 镜像属性说明,主要是对基础属性的说明,包含每个属性的取值类型,用途。 具体参数说明可参考镜像属性。 表1 links字段说明 参数 参数类型 描述 href String 域名。 rel String 域名描述。 响应样例 STATUS CODE 200 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 { "name": "images", "links": [ { "href": "{first}", "rel": "first" }, { "href": "{next}", "rel": "next" }, { "href": "{schema}", "rel": "describedby" } ], "properties": { "images": { "items": { "additionalProperties": { "type": "String" }, "name": "image", "links": [ { "href": "{self}", "rel": "self" }, { "href": "{file}", "rel": "enclosure" }, { "href": "{schema}", "rel": "describedby" } ], "properties": { "status": { "enum": [ "queued", "saving", "active", "killed", "deleted", "pending_delete" ], "type": "string", "description": "Status of the image (READ-ONLY)" }, "tags": { "items": { "type": "string", "maxLength": 255 }, "type": "array", "description": "List of strings related to the image" }, "kernel_id": { "pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", "type": "string", "description": "ID of image stored in Glance that should be used as the kernel when booting an AMI-style image.", "is_base": false }, "container_format": { "enum": [ "ami", "ari", "aki", "bare", "ovf", "ova" ], "type": "string", "description": "Format of the container" }, "min_ram": { "type": "integer", "description": "Amount of ram (in MB) required to boot image." }, "ramdisk_id": { "pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", "type": "string", "description": "ID of image stored in Glance that should be used as the ramdisk when booting an AMI-style image.", "is_base": false }, "locations": { "items": { "required": [ "url", "metadata" ], "type": "object", "properties": { "url": { "type": "string", "maxLength": 255 }, "metadata": { "type": "object" } } }, "type": "array", "description": "A set of URLs to access the image file kept in external store" }, "visibility": { "enum": [ "public", "private" ], "type": "string", "description": "Scope of image accessibility" }, "updated_at": { "type": "string", "description": "Date and time of the last image modification (READ-ONLY)" }, "owner": { "type": "string", "description": "Owner of the image", "maxLength": 255 }, "file": { "type": "string", "description": "(READ-ONLY)" }, "min_disk": { "type": "integer", "description": "Amount of disk space (in GB) required to boot image." }, "virtual_size": { "type": "integer", "description": "Virtual size of image in bytes (READ-ONLY)" }, "id": { "pattern": "^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", "type": "string", "description": "An identifier for the image" }, "size": { "type": "integer", "description": "Size of image file in bytes (READ-ONLY)" }, "instance_uuid": { "type": "string", "description": "ID of instance used to create this image.", "is_base": false }, "os_distro": { "type": "string", "description": "Common name of operating system distribution as specified in http://docs.openstack.org/trunk/openstack-compute/admin/content/adding-images.html", "is_base": false }, "name": { "type": "string", "description": "Descriptive name for the image", "maxLength": 255 }, "checksum": { "type": "string", "description": "md5 hash of image contents. (READ-ONLY)", "maxLength": 32 }, "created_at": { "type": "string", "description": "Date and time of image registration (READ-ONLY)" }, "disk_format": { "enum": [ "ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vdi", "iso" ], "type": "string", "description": "Format of the disk" }, "os_version": { "type": "string", "description": "Operating system version as specified by the distributor", "is_base": false }, "protected": { "type": "boolean", "description": "If true, image will not be deletable." }, "architecture": { "type": "string", "description": "Operating system architecture as specified in http://docs.openstack.org/trunk/openstack-compute/admin/content/adding-images.html", "is_base": false }, "direct_url": { "type": "string", "description": "URL to access the image file kept in external store (READ-ONLY)" }, "self": { "type": "string", "description": "(READ-ONLY)" }, "schema": { "type": "string", "description": "(READ-ONLY)" } } }, "type": "array" }, "schema": { "type": "string" }, "next": { "type": "string" }, "first": { "type": "string" } } }
  • 响应消息 响应参数 参数 参数类型 描述 tags Array of strings 标签列表 响应样例 STATUS CODE 200 1 2 3 4 5 6 7 8 9 { "tags": [ "jjjj.11111", "uuuu.22222", "234.4", "test", "image" ] } 新规范中使用“=”作为分隔符。
  • URI GET /v1/cloudimages/tags{?__isregistered,__imagetype,__whole_image,__system__cmkid,protected,visibility,owner,id,status,name,flavor_id,container_format,disk_format,min_ram,min_disk,__os_bit,__platform,marker,limit,sort_key,sort_dir,__os_type,tag,member_status,__support_kvm,__support_xen,__support_largememory,__support_diskintensive,__support_highperformance,__support_xen_gpu_type,__support_kvm_gpu_type,__support_xen_hana,__support_kvm_infiniband,virtual_env_type,enterprise_project_id,created_at,updated_at,architecture} 可以在URI后面用‘?’和‘&’添加不同的查询条件组合,请参考请求样例。 表1 查询参数 参数 是否必选 参数类型 描述 __isregistered 否 String 镜像是否可用,取值为true,扩展接口会默认为true,普通用户只能查询取值为true的镜像。 __imagetype 否 String 镜像类型,目前支持以下类型: 公共镜像:gold 私有镜像:private 共享镜像:shared 市场镜像:market 说明: 当前租户共享给其他租户的私有镜像或当前租户接受的共享镜像中,__imagetype均为shared,可用owner字段进行区分。当前租户接受的共享镜像可用member_status进行过滤查询。 __whole_image 否 Boolean 是否为整机镜像,取值为true/false。 __system__cmkid 否 String 加密镜像所使用的密钥ID。可以从镜像服务控制台获取,或者调用查询镜像详情(OpenStack原生)API查询。 protected 否 Boolean 镜像是否是受保护,取值为true/false,一般查询公共镜像时候取值为true,查询私有镜像可以不指定。 visibility 否 String 是否被其他租户可见,取值如下: public:公共镜像 private:私有镜像 shared:共享镜像 owner 否 String 镜像属于哪个租户。 id 否 String 镜像ID。 status 否 String 镜像状态。取值如下: queued:表示镜像元数据已经创建成功,等待上传镜像文件。 saving:表示镜像正在上传文件到后端存储。 deleted:表示镜像已经删除。 killed:表示镜像上传错误。 active:表示镜像可以正常使用。 name 否 String 镜像名称,匹配规则为精确匹配。name参数说明请参考镜像属性。 flavor_id 否 String 用于通过云服务器规格过滤出可用公共镜像,取值为规格ID。 约束: 仅支持通过单个规格进行过滤。 仅支持按照云服务器规格进行过滤,裸金属服务器暂不支持。 如果需要查看某裸金属服务器规格支持的公共镜像,可以使用“__support_s4l=true”标签。其中,s4l为裸金属服务器规格的board_type,若规格为“physical.s4.large”,则填入“s4l”。详细说明请参见“怎么确定裸金属服务器规格的board_type?”。调用示例请参考常用列表查询方法。 container_format 否 String 容器类型,取值为bare。 disk_format 否 String 镜像格式,目前支持zvhd2、vhd、zvhd、raw、qcow2、iso。非iso格式时默认值是zvhd2。 min_ram 否 Integer 镜像运行需要的最小内存,单位为MB。参数取值依据云服务器的规格限制,一般设置为0。 云服务器的规格限制,请参见规格清单。 min_disk 否 Integer 镜像运行需要的最小磁盘,单位为GB 。取值为40~1024GB。 __os_bit 否 String 操作系统位数,一般取值为32或者64。 __platform 否 String 镜像平台分类,取值为Windows、Ubuntu、Red Hat、SUSE、CentOS、Debian、OpenSUSE、Oracle Linux、Fedora、Other、CoreOS和EulerOS。 marker 否 String 用于分页,表示从哪个镜像开始查询,取值为镜像ID。 limit 否 Integer 用于分页,表示查询几条镜像记录,取值为整数,默认取值为500。 sort_key 否 String 用于排序,表示按照哪个字段排序。取值为镜像属性name、container_format、disk_format、status、id、size、created_at字段,默认为创建时间。 sort_dir 否 String 用于排序,表示升序还是降序,取值为asc和desc。与sort_key一起组合使用,默认为降序desc。 __os_type 否 String 镜像系统类型,取值如下: Linux Windows Other tag 否 String 标签,用户为镜像增加自定义标签后可以通过该参数过滤查询。 说明: 系统近期对标签功能进行了升级。如果之前添加的Tag为“Key.Value”的形式,则查询的时候需要使用“Key=Value”的格式来查询。例如:之前添加的tag为“a.b”,则升级后,查询时需使用“tag=a=b”。 member_status 否 String 成员状态。目前取值有accepted、rejected、pending。accepted表示已经接受共享的镜像,rejected表示已经拒绝了其他用户共享的镜像,pending表示需要确认的其他用户的共享镜像。需要在查询时,设置“visibility”参数为“shared”。 __support_kvm 否 String 如果镜像支持KVM,取值为true,否则无需增加该属性。 __support_xen 否 String 如果镜像支持XEN,取值为true,否则无需增加该属性。 __support_largememory 否 String 表示该镜像支持超大内存。如果镜像支持超大内存,取值为true,否则无需增加该属性。 镜像操作系统类型请参考“弹性云服务器类型与支持的操作系统版本”。 __support_diskintensive 否 String 表示该镜像支持密集存储。如果镜像支持密集存储性能,则值为true,否则无需增加该属性。 __support_highperformance 否 String 表示该镜像支持高计算性能。如果镜像支持高计算性能,则值为true,否则无需增加该属性。 __support_xen_gpu_type 否 String 表示该镜像是支持XEN虚拟化平台下的GPU优化类型,取值参考表2。如果不支持XEN虚拟化下GPU类型,无需添加该属性。该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_kvm_gpu_type 否 String 表示该镜像是支持KVM虚拟化平台下的GPU类型,取值参考表3。如果不支持KVM虚拟化下GPU类型,无需添加该属性。该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_xen_hana 否 String 如果镜像支持XEN虚拟化下HANA类型,取值为true。否则,无需添加该属性。 该属性与“__support_xen”和“__support_kvm”属性不共存。 __support_kvm_infiniband 否 String 如果镜像支持KVM虚拟化下Infiniband网卡类型,取值为true。否则,无需添加该属性。 该属性与“__support_xen”属性不共存。 virtual_env_type 否 String 镜像使用环境类型:FusionCompute、Ironic、DataImage、IsoImage。 如果是云服务器镜像(即系统盘镜像),则取值为FusionCompute。 如果是数据盘镜像,则取值是DataImage。 如果是裸金属服务器镜像,则取值是Ironic。 如果是ISO镜像,则取值是IsoImage。 enterprise_project_id 否 String 表示查询某个企业项目下的镜像。 取值为0,表示查询属于default企业项目下的镜像。 取值为UUID,表示查询属于该UUID对应的企业项目下的镜像。 关于企业项目ID的获取及企业项目特性的详细信息,请参考“企业中心总览”。 created_at 否 String 镜像创建时间。支持按照时间点过滤查询,取值格式为“操作符:UTC时间”。 其中操作符支持如下几种: gt:大于 gte:大于等于 lt:小于 lte:小于等于 eq:等于 neq:不等于 时间格式支持:yyyy-MM-ddThh:mm:ssZ或者yyyy-MM-dd hh:mm:ss 例如,查询创建时间在2018-10-28 10:00:00之前的镜像,可以通过如下条件过滤: created_at=lt:2018-10-28T10:00:00Z updated_at 否 String 镜像修改时间。支持按照时间点过滤查询,取值格式为“操作符:UTC时间”。 其中操作符支持如下几种: gt:大于 gte:大于等于 lt:小于 lte:小于等于 eq:等于 neq:不等于 时间格式支持:yyyy-MM-ddThh:mm:ssZ或者yyyy-MM-dd hh:mm:ss 例如,查询修改时间在2018-10-28 10:00:00之前的镜像,可以通过如下条件过滤: updated_at=lt:2018-10-28T10:00:00Z architecture 否 String 镜像架构类型。取值包括: x86 arm
  • URI GET /v1/cloudimages/os_version 表1 查询参数 参数 是否必选 参数类型 描述 tag 否 String OS的标签。 根据标签值可以过滤查询指定特性的OS信息。取值范围: bms:表示该镜像支持BMS的os_version列表。 uefi:支持UEFI启动方式的os_version列表。 arm:显示基于arm架构的os_version列表。 x86:显示基于x86架构的os_version列表。 不带tag查询条件则默认查询当前region支持的所有的OS列表。
  • 响应消息 响应参数 参数 参数类型 描述 [数组] Array of objects 详情请参见表2。 表2 [数组]字段说明 参数 参数类型 描述 platform String 操作系统平台。 version_list Array of objects 返回的操作系统详情。 具体请参见表3。 表3 [数组].version_list字段数据结构说明 参数 参数类型 描述 platform String 操作系统平台。 os_version_key String 操作系统key值。 默认取os_version的值为key值。 os_version String 操作系统完整信息。 os_bit Integer 操作系统的位数。 os_type String 操作系统的类型。 响应样例 STATUS CODE 200 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 [ { "platform": "SUSE", "version_list": [ { "platform": "SUSE", "os_version_key": "SUSE Linux Enterprise Server 15 64bit", "os_version": "SUSE Linux Enterprise Server 15 64bit", "os_bit": 64, "os_type": "Linux" }, { "platform": "SUSE", "os_version_key": "SUSE Linux Enterprise Server 12 SP3 64bit", "os_version": "SUSE Linux Enterprise Server 12 SP3 64bit", "os_bit": 64, "os_type": "Linux" } ] }, { "platform": "Other", "version_list": [ { "platform": "Other", "os_version_key": "Other(32 bit)", "os_version": "Other(32 bit)", "os_bit": 32, "os_type": "Linux" } ] } ]
  • 响应消息 响应参数 参数 参数类型 描述 versions Array of objects 版本信息。 详情请参见表2。 表2 versions字段说明 参数 参数类型 描述 status String 接口状态。 id String 接口ID。 links Array of objects 自描述信息。 详情请参见表3。 表3 versions.links字段说明 参数 参数类型 描述 href String 域名。 rel String 域名描述。 响应样例 STATUS CODE 300 1 2 3 4 5 6 7 8 9 10 11 12 13 14 { "versions": [ { "status": "SUPPORTED", "id": "v2.0", "links": [ { "href": "https://image.az1.dc1.domainname.com/v2/", "rel": "self" } ] } ] }
  • 请求消息体(可选) 该部分可选。请求消息体通常以结构化格式(如JSON或XML)发出,与请求消息头中Content-Type对应,传递除请求消息头之外的内容。若请求消息体中的参数支持中文,则中文字符必须为UTF-8编码。 每个接口的请求消息体内容不同,也并不是每个接口都需要有请求消息体(或者说消息体为空),GET、DELETE操作类型的接口就不需要消息体,消息体具体内容需要根据具体接口而定。 对于获取用户Token接口,您可以从接口的请求部分看到所需的请求参数及参数说明。将消息体加入后的请求如下所示,加粗的斜体字段需要根据实际值填写,其中username为用户名,domainname为用户所属的账号名称,********为用户登录密码,xxxxxxxxxxxxxxxxxx为project的名称,如“cn-north-1”,您可以从地区和终端节点获取。 scope参数定义了Token的作用域,下面示例中获取的Token仅能访问project下的资源。您还可以设置Token的作用域为某个账号下所有资源或账号的某个project下的资源,详细定义请参见获取用户Token。 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 POST https://iam.cn-north-1.myhuaweicloud.com/v3/auth/tokens Content-Type: application/json { "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "username", "password": "********", "domain": { "name": "domainname" } } } }, "scope": { "project": { "name": "xxxxxxxxxxxxxxxxxx" } } } } 到这里为止这个请求需要的内容就具备齐全了,您可以使用curl、Postman或直接编写代码等方式发送请求调用API。对于获取用户Token接口,返回的响应消息头中的“x-subject-token”就是需要获取的用户Token。有了Token之后,您就可以使用Token认证调用其他API。
  • 请求URI 请求URI由如下部分组成: {URI-scheme}://{Endpoint}/{resource-path}?{query-string} 尽管请求URI包含在请求消息头中,但大多数语言或框架都要求您从请求消息中单独传递它,所以在此单独强调。 表1 URI中的参数说明 参数 描述 URI-scheme 表示用于传输请求的协议,当前所有API均采用HTTPS协议。 Endpoint 指定承载REST服务端点的服务器域名或IP,不同服务不同区域的Endpoint不同,您可以从地区和终端节点获取。 例如IAM服务在“华北-北京四”区域的Endpoint为“iam.cn-north-4.myhuaweicloud.com”。 resource-path 资源路径,即API访问路径。从具体API的URI模块获取,例如“获取用户Token”API的resource-path为“/v3/auth/tokens”。 query-string 查询参数,是可选部分,并不是每个API都有查询参数。查询参数前面需要带一个“?”,形式为“参数名=参数取值”,例如“?limit=10”,表示查询不超过10条数据。 例如您需要获取IAM在“华北-北京四”区域的Token,则需使用“华北-北京四”区域的Endpoint(iam.cn-north-4.myhuaweicloud.com),并在获取用户Token的URI部分找到resource-path(/v3/auth/tokens),拼接起来如下所示。 1 https://iam.cn-north-4.myhuaweicloud.com/v3/auth/tokens 图1 URI示意图 为方便查看,在每个具体API的URI部分,只给出resource-path部分,并将请求方法写在一起。这是因为URI-scheme都是HTTPS,而Endpoint在同一个区域也相同,所以简洁起见将这两部分省略。
  • 请求方法 HTTP请求方法(也称为操作或动词),它告诉服务您正在请求什么类型的操作。 表2 HTTP方法 方法 说明 GET 请求服务器返回指定资源。 PUT 请求服务器更新指定资源。 POST 请求服务器新增资源或执行特殊操作。 DELETE 请求服务器删除指定资源,如删除对象等。 HEAD 请求服务器资源头部。 PATCH 请求服务器更新资源的部分内容。 当资源不存在的时候,PATCH可能会去创建一个新的资源。 在获取用户Token的URI部分,您可以看到其请求方法为“POST”,则其请求为: 1 POST https://iam.cn-north-1.myhuaweicloud.com/v3/auth/tokens
  • 请求消息头 附加请求头字段,如指定的URI和HTTP方法所要求的字段。例如定义消息体类型的请求头“Content-Type”,请求鉴权信息等。 详细的公共请求消息头字段请参见表3。 表3 公共请求消息头 名称 描述 是否必选 示例 Host 请求的服务器信息,从服务API的URL中获取。值为hostname[:port]。端口缺省时使用默认的端口,https的默认端口为443。 否 使用AK/SK认证时该字段必选。 code.test.com or code.test.com:443 Content-Type 消息体的类型(格式)。推荐用户使用默认值application/json,有其他取值时会在具体接口中专门说明。 是 application/json Content-Length 请求body长度,单位为Byte。 否 3495 X-Project-Id project id,项目编号。请参考获取项目ID章节获取项目编号。 否 如果是专属云场景采用AK/SK认证方式的接口请求,或者多project场景采用AK/SK认证的接口请求,则该字段必选。 e9993fc787d94b6c886cbaa340f9c0f4 X-Auth-Token 用户Token。 用户Token也就是调用获取用户Token接口的响应值,该接口是唯一不需要认证的接口。 请求响应成功后在响应消息头(Headers)中包含的“X-Subject-Token”的值即为Token值。 否 使用Token认证时该字段必选。 注:以下仅为Token示例片段。 MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ API同时支持使用AK/SK认证,AK/SK认证使用SDK对请求进行签名,签名过程会自动往请求中添加Authorization(签名认证信息)和X-Sdk-Date(请求发送的时间)请求头。 AK/SK认证的详细说明请参见认证鉴权的“AK/SK认证”。 对于获取用户Token接口,由于不需要认证,所以只添加“Content-Type”即可,添加消息头后的请求如下所示。 1 2 POST https://iam.cn-north-1.myhuaweicloud.com/v3/auth/tokens Content-Type: application/json
共100000条