文档首页> 云硬盘 EVS> API参考 (巴黎区域)> API> 云硬盘标签管理> 通过标签查询云硬盘资源(废弃)
更新时间:2024-03-25 GMT+08:00

通过标签查询云硬盘资源(废弃)

功能介绍

通过标签查询云硬盘资源。

该接口已废弃,请使用性能更佳的接口,具体请参见通过标签查询云硬盘资源实例详情

接口约束

URI

  • URI格式

    GET /v2/{project_id}/os-vendor-tags/{resource_type}/resource_instances

    使用样例:

    • https://{{evs_url}}/v2/{{project_id}}/os-vendor-tags/volumes/resource_instances?tags={'test':['test']}
    • https://{{evs_url}}/v2/{{project_id}}/os-vendor-tags/volumes/resource_instances
  • 参数说明

    参数

    是否必选

    描述

    project_id

    项目ID。

    获取方法请参见获取项目ID

    resource_type

    资源类型可以是[volumes, snapshots, backups]中的某一种。

  • Request filter参数说明

    参数

    参数类型

    是否必选

    描述

    tags

    String

    获取拥有该标签的云硬盘。

    例如,如果过滤标签是tags={'a':['b', 'c'], 'd':['e']},将会查询到所有拥有标签key是a,value是b或者c和拥有标签key是d,value是e的云硬盘资源。

    tags_any

    String

    获取拥有该过滤条件中任一个标签的云硬盘。

    例如,如果过滤标签是tags_any={'a':['b', 'c'], 'd':['e']},将会查询到所有拥有标签key是a,value是b或者c或者拥有标签key是d,value是e的云硬盘资源。

    not_tags

    String

    获取没有该过滤条件中包含的标签的云硬盘。

    例如,如果过滤标签是not_tags={'a':['b', 'c'], 'd':['e']},将会查询到所有没有标签key是a,value是b或者c和没有标签key是d,value是e的云硬盘资源。

    not_tags_any

    String

    获取没有该过滤条件中包含的任意一个标签的云硬盘。

    例如,如果过滤标签是not_tags={'a':['b', 'c'], 'd':['e']},将会查询到所有没有标签key是a,value是b或者c或没有标签key是d,value是e的云硬盘资源。

请求消息

响应消息

  • 响应参数

    参数

    参数类型

    描述

    total_count

    Integer

    云硬盘资源个数

    resources

    list

    云硬盘资源列表

  • 响应样例
    {
        "total_count": 2, 
        "resources": [
            {
                "resource_name": null, 
                "resource_detail": {
                    "status": "available", 
                    "description": null, 
                    "availability_zone": "az-dc-1", 
                    "updated_at": "2017-07-26T08:14:07.857625", 
                    "source_volid": null, 
                    "snapshot_id": null, 
                    "id": "47cc4949-447a-43dc-b482-a1d7917fef69", 
                    "size": 45, 
                    "name": null, 
                    "bootable": "true", 
                    "created_at": "2017-07-26T08:09:39.787432", 
                    "multiattach": false
                }, 
                "tags": {
                    "a": "c", 
                    "d": "e"
                }, 
                "resource_id": "47cc4949-447a-43dc-b482-a1d7917fef69"
            }, 
            {
                "resource_name": null, 
                "resource_detail": {
                    "status": "available", 
                    "description": null, 
                    "availability_zone": "az-dc-1", 
                    "updated_at": "2017-07-26T08:02:11.250455", 
                    "source_volid": null, 
                    "snapshot_id": null, 
                    "id": "588e94ef-eb2d-4895-a692-18163a7eeddc", 
                    "size": 100, 
                    "name": null, 
                    "bootable": "false", 
                    "created_at": "2017-07-26T08:00:51.563309", 
                    "multiattach": false
                }, 
                "tags": {
                    "a": "c", 
                    "d": "e"
                }, 
                "resource_id": "588e94ef-eb2d-4895-a692-18163a7eeddc"
            }
        ]
    }

    {
        "error": {
            "message": "XXXX", 
            "code": "XXX"
        }
    }

    其中error是泛指的错误,有badRequest、itemNotFound等,如报错:

    {
        "computeFault": {
            "message": "The server has either erred or is incapable of performing the requested operation.", 
            "code": 500
        }
    }

状态码

  • 正常

    200

错误码

请参考错误码