Metadata Definitions Service API v2 (CURRENT)

Metadefs

通用信息

元数据定义服务(简称“metadefs”)提供了一个通用的 API,供厂商、运营商、管理员、服务和用户有意义地定义可用于不同类型云资源(例如,镜像、制品、卷、风味、聚合和其他资源)的可用键值对。

为了帮助您入门,Glance 包含一个默认的 metadefs 目录,可以在您的站点上安装;有关详细信息,请参阅代码仓库中的 README

一旦创建了通用的元数据定义目录,就可以通过 API 查询该目录。请注意,此服务仅存储目录,因为 metadefs 是元元数据。Metadefs 提供关于资源元数据的信息,但本身不作为实际的元数据。

实际的键值对存储在应用它们的资源上,使用适当 API 提供的元数据设施。(例如,Images API 将用于将特定的键值对放在虚拟机镜像上。)

一个 metadefs 定义包括属性的键、描述、约束以及可以关联的资源类型。有关更多信息,请参阅 Glance 开发者文档中的 元数据定义概念

注意

默认情况下,只有管理员可以操作此 API 暴露的数据,但所有用户都可以列出和显示公共资源。这与 Wallaby 版本中的默认“对所有人开放”有所不同。

元数据定义命名空间

创建、列出、显示详细信息、更新和删除元数据定义命名空间。定义可以包含属性定义、对象定义和资源类型关联的命名空间。

自 API v2.2 起

POST
/v2/metadefs/namespaces

创建命名空间

创建一个命名空间。

命名空间在所有用户中必须是唯一的。尝试创建一个已经存在的命名空间将导致 409(冲突)响应。

响应头中的 Location 包含新创建的命名空间的 URI。

正常响应代码:201

错误响应代码:400、401、403、409

请求

名称

入参

类型

描述

namespace

body

字符串

命名空间的标识符(名称)。该值在所有用户中必须是唯一的。

display_name(可选)

body

字符串

在 UI 中用于显示命名空间名称的用户友好名称。

description (可选)

body

字符串

命名空间的描述。

visibility (可选)

body

enum

命名空间的可见性。有效值为 publicprivate。默认值为 private

protected (可选)

body

布尔值

命名空间删除保护。有效值为 truefalse。默认值为 false

请求体也可以包含属性、对象和资源类型关联,或者这些可以在以后通过 更新命名空间 调用添加。

请求示例

{
    "namespace": "FredCo::SomeCategory::Example",
    "display_name": "An Example Namespace",
    "description": "A metadata definitions namespace for example use.",
    "visibility": "public",
    "protected": true
}

响应参数

名称

入参

类型

描述

位置

标头

字符串

新创建的命名空间的 URI。

created_at

body

字符串

创建资源的时间和日期。

日期和时间戳格式为 ISO 8601

description (可选)

body

字符串

命名空间的描述。

display_name(可选)

body

字符串

在 UI 中用于显示命名空间名称的用户友好名称。

namespace

body

字符串

命名空间的标识符(名称)。该值在所有用户中必须是唯一的。

owner

body

字符串

此资源的拥有者的标识符,通常是租户 ID。

protected

body

布尔值

命名空间删除保护,为 truefalse

schema

body

字符串

描述一个命名空间的 JSON 模式的 URI。

self

body

字符串

此资源的 URI。

updated_at

body

字符串

资源上次更新的日期和时间。

日期和时间戳格式为 ISO 8601

visibility

body

enum

命名空间的可见性,为 publicprivate

如果请求体包含属性、对象或资源类型关联,这些将在响应中包含。

响应示例

HTTP/1.1 201 Created
Content-Length: 427
Content-Type: application/json; charset=UTF-8
Location: http://glance.openstack.example.org/v2/metadefs/namespaces/FredCo::SomeCategory::Example
X-Openstack-Request-Id: req-6d4a8ad2-c018-4bfc-8fe5-1a36c23c43eb
Date: Thu, 19 May 2016 16:05:48 GMT
{
    "created_at": "2016-05-19T16:05:48Z",
    "description": "A metadata definitions namespace for example use.",
    "display_name": "An Example Namespace",
    "namespace": "FredCo::SomeCategory::Example",
    "owner": "c60b1d57c5034e0d86902aedf8c49be0",
    "protected": true,
    "schema": "/v2/schemas/metadefs/namespace",
    "self": "/v2/metadefs/namespaces/FredCo::SomeCategory::Example",
    "updated_at": "2016-05-19T16:05:48Z",
    "visibility": "public"
}
GET
/v2/metadefs/namespaces

列出命名空间

列出可用的命名空间。

返回一个可以访问的命名空间列表。如果列表太大而无法放入单个响应中,因为操作员配置或您在请求中包含了一个 limit 查询参数来限制响应大小,则响应将包含一个链接,您可以使用该链接获取下一页的命名空间。检查是否存在 next 链接,并将其用作后续 HTTP GET 请求中的 URI。重复此模式,直到不再提供 next 链接。

next 链接保留了您在初始请求中发送的任何查询参数。您可以使用 first 链接返回到集合的第一页。如果您希望手动分页浏览命名空间,请使用 limitmarker 参数。

列表操作接受 resource_typesvisibility 查询参数,您可以使用它们来过滤响应。

要对此操作的结果进行排序,请使用 sort_keysort_dir 参数。API 使用您作为 sort_key 参数提供的命名空间属性中的自然排序顺序。

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

limit (可选)

查询

整数

请求项目页面大小。返回最多限制值数量的项目。使用 limit 参数进行初始限制请求,并在后续限制请求中使用响应中最后一个已查看项目的 ID 作为 marker 参数值。

marker (可选)

查询

字符串

允许指定命名空间标识符。如果存在,将仅列出该命名空间之后的命名空间,即具有 sort_dir 方向的该标记的 sort_key 之后的命名空间。

visibility (可选)

查询

字符串

按命名空间可见性值过滤响应。有效值为 publicprivate。如果您省略此参数,则响应将显示 publicprivate 命名空间。

resource_types (可选)

查询

整数

将响应过滤为仅包含将指定的资源类型作为资源类型关联的命名空间。使用逗号 ( ,) 字符分隔多个值。例如,OS::Glance::Image,OS::Nova::Flavor 仅显示与这些资源类型关联的命名空间。

sort_key (可选)

查询

字符串

按属性排序响应。接受的值为 namespacecreated_atupdated_at。默认值为 created_at

sort_dir (可选)

查询

字符串

对响应进行排序。使用 asc 表示升序或 desc 表示降序。默认值为 desc

响应参数

名称

入参

类型

描述

first

body

字符串

响应第一页的 URI。

namespaces

body

数组

一个 namespace 对象的列表。

下一个

body

字符串

响应下一页的 URI。不会出现在响应的最后一页上。

schema

body

字符串

描述一个namespaces 实体的 JSON 模式的 URI,即由简短的命名空间对象组成的实体。

响应示例

{
    "first": "/v2/metadefs/namespaces?sort_key=created_at&sort_dir=asc",
    "namespaces": [
        {
            "created_at": "2014-08-28T17:13:06Z",
            "description": "The libvirt compute driver options. These are properties specific to compute drivers.  For a list of all hypervisors, see here: https://docs.openstack.org/nova/2025.2/user/support-matrix.html",
            "display_name": "libvirt Driver Options",
            "namespace": "OS::Compute::Libvirt",
            "owner": "admin",
            "protected": true,
            "resource_type_associations": [
                {
                    "created_at": "2014-08-28T17:13:06Z",
                    "name": "OS::Glance::Image",
                    "updated_at": "2014-08-28T17:13:06Z"
                }
            ],
            "schema": "/v2/schemas/metadefs/namespace",
            "self": "/v2/metadefs/namespaces/OS::Compute::Libvirt",
            "updated_at": "2014-08-28T17:13:06Z",
            "visibility": "public"
        },
        {
            "created_at": "2014-08-28T17:13:06Z",
            "description": "Compute drivers may enable quotas on CPUs available to a VM, disk tuning, bandwidth I/O, and instance VIF traffic control.  See: https://docs.openstack.org/admin-guide-cloud/compute-flavors.html",
            "display_name": "Flavor Quota",
            "namespace": "OS::Compute::Quota",
            "owner": "admin",
            "protected": true,
            "resource_type_associations": [
                {
                    "created_at": "2014-08-28T17:13:06Z",
                    "name": "OS::Nova::Flavor",
                    "updated_at": "2014-08-28T17:13:06Z"
                }
            ],
            "schema": "/v2/schemas/metadefs/namespace",
            "self": "/v2/metadefs/namespaces/OS::Compute::Quota",
            "updated_at": "2014-08-28T17:13:06Z",
            "visibility": "public"
        },
        {
            "created_at": "2014-08-28T17:13:06Z",
            "description": "This provides the preferred socket/core/thread counts for the virtual CPU instance exposed to guests. This enables the ability to avoid hitting limitations on vCPU topologies that OS vendors place on their products. See also: https://opendev.org/openstack/nova-specs/src/branch/2025.2/specs/2025.2/implemented/virt-driver-vcpu-topology.rst",
            "display_name": "Virtual CPU Topology",
            "namespace": "OS::Compute::VirtCPUTopology",
            "owner": "admin",
            "protected": true,
            "resource_type_associations": [
                {
                    "created_at": "2014-08-28T17:13:06Z",
                    "name": "OS::Glance::Image",
                    "prefix": "hw_",
                    "updated_at": "2014-08-28T17:13:06Z"
                },
                {
                    "created_at": "2014-08-28T17:13:06Z",
                    "name": "OS::Cinder::Volume",
                    "prefix": "hw_",
                    "properties_target": "image",
                    "updated_at": "2014-08-28T17:13:06Z"
                },
                {
                    "created_at": "2014-08-28T17:13:06Z",
                    "name": "OS::Nova::Flavor",
                    "prefix": "hw:",
                    "updated_at": "2014-08-28T17:13:06Z"
                }
            ],
            "schema": "/v2/schemas/metadefs/namespace",
            "self": "/v2/metadefs/namespaces/OS::Compute::VirtCPUTopology",
            "updated_at": "2014-08-28T17:13:06Z",
            "visibility": "public"
        }
    ],
    "schema": "/v2/schemas/metadefs/namespaces"
}
GET
/v2/metadefs/namespaces/{namespace_name}

获取命名空间详细信息

获取命名空间的详细信息。

响应体显示一个包含所有详细信息的单个命名空间实体,包括属性、对象和资源类型关联。

如果命名空间包含指定了前缀的资源类型关联,您可以选择将资源类型的名称作为查询参数包含在内。在这种情况下,前缀将应用于响应中的所有属性名称。(有关示例,请参见下文。)

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

resource_type (可选)

查询

字符串

将指定资源类型的前缀应用于响应中列出的属性的名称。如果指定的资源类型没有与此命名空间关联,或者资源类型已关联但未在此命名空间中定义前缀,则将忽略此参数。

请求不带主体。

响应参数

名称

入参

类型

描述

created_at

body

字符串

创建资源的时间和日期。

日期和时间戳格式为 ISO 8601

description (可选)

body

字符串

命名空间的描述。

display_name(可选)

body

字符串

在 UI 中用于显示命名空间名称的用户友好名称。

namespace

body

字符串

命名空间的标识符(名称)。该值在所有用户中必须是唯一的。

objects

body

字符串

命名空间的多个对象定义。

owner

body

字符串

此资源的拥有者的标识符,通常是租户 ID。

properties

body

对象

一个键值对字典,其中每个值都是由 Metadefs 属性模式 定义的属性 对象。

protected

body

布尔值

命名空间删除保护,为 truefalse

resource_type_associations

body

数组

一个列表,其中每个元素由 Metadefs 资源类型关联模式 描述。

schema

body

字符串

描述一个命名空间的 JSON 模式的 URI。

self

body

字符串

此资源的 URI。

visibility

body

enum

命名空间的可见性,为 publicprivate

响应示例

{
    "created_at": "2016-06-28T14:57:10Z",
    "description": "The libvirt compute driver options.",
    "display_name": "libvirt Driver Options",
    "namespace": "OS::Compute::Libvirt",
    "owner": "admin",
    "properties": {
        "boot_menu": {
            "description": "If true, enables the BIOS bootmenu.",
            "enum": [
                "true",
                "false"
            ],
            "title": "Boot Menu",
            "type": "string"
        },
        "serial_port_count": {
            "description": "Specifies the count of serial ports.",
            "minimum": 0,
            "title": "Serial Port Count",
            "type": "integer"
        }
    },
    "protected": true,
    "resource_type_associations": [
        {
            "created_at": "2016-06-28T14:57:10Z",
            "name": "OS::Glance::Image",
            "prefix": "hw_"
        },
        {
            "created_at": "2016-06-28T14:57:10Z",
            "name": "OS::Nova::Flavor",
            "prefix": "hw:"
        }
    ],
    "schema": "/v2/schemas/metadefs/namespace",
    "self": "/v2/metadefs/namespaces/OS::Compute::Libvirt",
    "visibility": "public"
}

响应示例(带有 resource_type 查询参数)

这是以下请求的结果

GET /v2/metadefs/namespaces/OS::Compute::Libvirt?resource_type=OS::Glance::Image

请注意,每个属性的名称都应用了适当的前缀。

{
    "created_at": "2016-06-28T14:57:10Z",
    "description": "The libvirt compute driver options.",
    "display_name": "libvirt Driver Options",
    "namespace": "OS::Compute::Libvirt",
    "owner": "admin",
    "properties": {
        "hw_boot_menu": {
            "description": "If true, enables the BIOS bootmenu.",
            "enum": [
                "true",
                "false"
            ],
            "title": "Boot Menu",
            "type": "string"
        },
        "hw_serial_port_count": {
            "description": "Specifies the count of serial ports.",
            "minimum": 0,
            "title": "Serial Port Count",
            "type": "integer"
        }
    },
    "protected": true,
    "resource_type_associations": [
        {
            "created_at": "2016-06-28T14:57:10Z",
            "name": "OS::Glance::Image",
            "prefix": "hw_"
        },
        {
            "created_at": "2016-06-28T14:57:10Z",
            "name": "OS::Nova::Flavor",
            "prefix": "hw:"
        }
    ],
    "schema": "/v2/schemas/metadefs/namespace",
    "self": "/v2/metadefs/namespaces/OS::Compute::Libvirt",
    "visibility": "public"
}
PUT
/v2/metadefs/namespaces/{namespace_name}

更新命名空间

更新一个命名空间。

注意

小心使用此调用,尤其是在您只想更改 protected 值以便可以删除命名空间中的一些对象、属性或资源类型关联时。

虽然请求体中只需要 namespace,但如果仅使用 namespace 在请求体中进行此调用,则其他下面列出的属性将被设置为其默认值——在 descriptiondisplay_name 的情况下,为 null。

因此,如果您只想使用此调用更改 protected 值,请确保在请求体中包含以下参数的当前值

  • description

  • display_name

  • namespace

  • visibility

命名空间中的对象、属性和资源类型关联不受此调用的影响。

正常响应代码:200

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

description (可选)

body

字符串

命名空间的描述。

display_name(可选)

body

字符串

在 UI 中用于显示命名空间名称的用户友好名称。

namespace

body

字符串

命名空间的标识符(名称)。该值在所有用户中必须是唯一的。

protected (可选)

body

布尔值

命名空间删除保护。有效值为 truefalse。默认值为 false

visibility (可选)

body

enum

命名空间的可见性。有效值为 publicprivate。默认值为 private

请求示例

{
    "description": "Choose capabilities that should be provided by the Compute Host. This provides the ability to fine tune the hardware specification required when a new vm is requested.",
    "display_name": "Hypervisor Selection",
    "namespace": "OS::Compute::Hypervisor",
    "protected": false,
    "visibility": "public"
}

响应参数

名称

入参

类型

描述

created_at

body

字符串

创建资源的时间和日期。

日期和时间戳格式为 ISO 8601

description (可选)

body

字符串

命名空间的描述。

display_name(可选)

body

字符串

在 UI 中用于显示命名空间名称的用户友好名称。

namespace

body

字符串

命名空间的标识符(名称)。该值在所有用户中必须是唯一的。

owner

body

字符串

此资源的拥有者的标识符,通常是租户 ID。

protected

body

布尔值

命名空间删除保护,为 truefalse

schema

body

字符串

描述一个命名空间的 JSON 模式的 URI。

self

body

字符串

此资源的 URI。

updated_at

body

字符串

资源上次更新的日期和时间。

日期和时间戳格式为 ISO 8601

visibility

body

enum

命名空间的可见性,为 publicprivate

响应示例

{
    "created_at": "2014-09-19T13:31:37Z",
    "description": "Choose capabilities that should be provided by the Compute Host. This provides the ability to fine tune the hardware specification required when a new vm is requested.",
    "display_name": "Hypervisor Selection",
    "namespace": "OS::Compute::Hypervisor",
    "owner": "7ec22942411e427692e8a3436be1031a",
    "protected": false,
    "schema": "/v2/schemas/metadefs/namespace",
    "self": "/v2/metadefs/namespaces/OS::Compute::Hypervisor",
    "updated_at": "2014-09-19T13:31:37Z",
    "visibility": "public"
}
DELETE
/v2/metadefs/namespaces/{namespace_name}

删除命名空间

删除一个命名空间及其属性、对象和任何资源类型关联。

注意

如果命名空间受到保护,也就是说,如果命名空间的 protected 属性为 true,则必须首先将命名空间的 protected 属性设置为 false,然后才能删除它。

  • 如果您尝试删除受保护的命名空间,则调用将返回 403 响应代码。

  • 要更改命名空间的 protected 属性,请使用 更新命名空间 调用。

成功的操作将返回 HTTP 204(无内容)响应代码。

正常响应代码:204

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

请求不带主体。

请求不返回主体。

元数据定义资源类型

列出资源类型。此外,创建、列出和删除命名空间中的资源类型关联。

自 API v2.2 起

GET
/v2/metadefs/resource_types

列出资源类型

列出所有可用的资源类型。

使用本节中的其他 API 调用,您可以在元数据定义命名空间与通过此调用返回的资源类型之间创建和维护资源类型关联

正常响应代码:200

错误响应代码:400、401、404

请求

没有请求参数。

响应参数

名称

入参

类型

描述

resource_types

body

数组

一个简短的资源类型 JSON 对象的列表,每个对象包含资源类型的 name 及其 created_atupdated_at 时间戳,格式为 ISO 8601 格式

响应示例

{
    "resource_types": [
        {
            "created_at": "2014-08-28T18:13:04Z",
            "name": "OS::Glance::Image",
            "updated_at": "2014-08-28T18:13:04Z"
        },
        {
            "created_at": "2014-08-28T18:13:04Z",
            "name": "OS::Cinder::Volume",
            "updated_at": "2014-08-28T18:13:04Z"
        },
        {
            "created_at": "2014-08-28T18:13:04Z",
            "name": "OS::Nova::Flavor",
            "updated_at": "2014-08-28T18:13:04Z"
        },
        {
            "created_at": "2014-08-28T18:13:04Z",
            "name": "OS::Nova::Aggregate",
            "updated_at": "2014-08-28T18:13:04Z"
        },
        {
            "created_at": "2014-08-28T18:13:04Z",
            "name": "OS::Nova::Instance",
            "updated_at": "2014-08-28T18:13:04Z"
        }
    ]
}
POST
/v2/metadefs/namespaces/{namespace_name}/resource_types

创建资源类型关联

在命名空间和请求体中指定的资源类型之间创建一个资源类型关联。

注意

如果指定的资源类型名称没有命名现有的资源类型,则作为此操作的副作用,将创建一个新的资源类型。

正常响应代码:201

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

name

路径

字符串

资源类型的名称。名称的长度限制为 80 个字符。

prefix (可选)

body

字符串

您想要应用于资源类型的命名空间中任何属性的前缀。如果您指定了前缀,则必须附加一个前缀分隔符,例如冒号 ( :) 字符。

properties_target (可选)

body

字符串

某些资源类型允许每个实例使用多个键值对。例如,Image 服务允许卷上的用户和镜像元数据。 properties_target 参数启用命名空间目标以消除歧义。

请求示例

{
    "name": "OS::Cinder::Volume",
    "prefix": "hw_",
    "properties_target": "image"
}

响应参数

名称

入参

类型

描述

created_at

body

字符串

创建资源的时间和日期。

日期和时间戳格式为 ISO 8601

prefix (可选)

body

字符串

您想要应用于资源类型的命名空间中任何属性的前缀。如果您指定了前缀,则必须附加一个前缀分隔符,例如冒号 ( :) 字符。

properties_target (可选)

body

字符串

某些资源类型允许每个实例使用多个键值对。例如,Image 服务允许卷上的用户和镜像元数据。 properties_target 参数启用命名空间目标以消除歧义。

name

路径

字符串

资源类型的名称。名称的长度限制为 80 个字符。

updated_at

body

字符串

资源上次更新的日期和时间。

日期和时间戳格式为 ISO 8601

GET
/v2/metadefs/namespaces/{namespace_name}/resource_types

列出资源类型关联

列出命名空间中的资源类型关联。

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

没有请求体。

响应参数

名称

入参

类型

描述

resource_type_associations

body

数组

一个列表,其中每个元素由 Metadefs 资源类型关联模式 描述。

响应示例

{
    "resource_type_associations": [
        {
            "created_at": "2018-03-05T18:20:44Z",
            "name": "OS::Nova::Flavor",
            "prefix": "hw:"
        },
        {
            "created_at": "2018-03-05T18:20:44Z",
            "name": "OS::Glance::Image",
            "prefix": "hw_"
        }
    ]
}
DELETE
/v2/metadefs/namespaces/{namespace_name}/resource_types/{name}

删除资源类型关联

删除命名空间中的资源类型关联。

注意

如果包含关联的命名空间受到保护,也就是说,如果命名空间的 protected 属性为 true,则必须首先将命名空间的 protected 属性设置为 false,然后才能删除资源类型关联。

  • 如果您尝试从受保护的命名空间删除资源类型关联,则调用将返回 403 响应代码。

  • 要更改命名空间的 protected 属性,请使用 更新命名空间 调用。

当您成功删除命名空间中的资源类型关联时,响应为空,响应代码为 204

正常响应代码:204

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

name

路径

字符串

资源类型的名称。

元数据定义对象

创建、列出、显示详细信息、更新和删除元数据定义对象。

自 API v2.2 起

POST
/v2/metadefs/namespaces/{namespace_name}/objects

创建对象

在命名空间中创建一个对象定义。

正常响应代码:201

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

name

body

字符串

对象的名称,适合用作标识符。名称的长度限制为 80 个字符。

description (可选)

body

字符串

对象的详细描述。

properties (可选)

body

对象

一组键值对,每个值都是一个属性实体。

required (可选)

body

数组

此对象上必需的属性名称列表。

请求示例

{
    "description": "You can configure the CPU limits with control parameters.",
    "name": "CPU Limits",
    "properties": {
        "quota:cpu_period": {
            "description": "Specifies the enforcement interval (unit: microseconds) for QEMU and LXC hypervisors. Within a period, each VCPU of the domain is not allowed to consume more than the quota worth of runtime. The value should be in range [1000, 1000000]. A period with value 0 means no value.",
            "maximum": 1000000,
            "minimum": 1000,
            "title": "Quota: CPU Period",
            "type": "integer"
        },
        "quota:cpu_quota": {
            "description": "Specifies the maximum allowed bandwidth (unit: microseconds). A domain with a negative-value quota indicates that the domain has infinite bandwidth, which means that it is not bandwidth controlled. The value should be in range [1000, 18446744073709551] or less than 0. A quota with value 0 means no value. You can use this feature to ensure that all vCPUs run at the same speed.",
            "title": "Quota: CPU Quota",
            "type": "integer"
        },
        "quota:cpu_shares": {
            "description": "Specifies the proportional weighted share for the domain. If this element is omitted, the service defaults to the OS provided defaults. There is no unit for the value; it is a relative measure based on the setting of other VMs. For example, a VM configured with value 2048 gets twice as much CPU time as a VM configured with value 1024.",
            "title": "Quota: CPU Shares",
            "type": "integer"
        }
    },
    "required": []
}

响应参数

名称

入参

类型

描述

created_at

body

字符串

创建资源的时间和日期。

日期和时间戳格式为 ISO 8601

description

body

字符串

对象的详细描述。

name

body

字符串

对象的名称,适合用作标识符。名称的长度限制为 80 个字符。

properties

body

对象

一组键值对,每个值都是一个属性实体。

必需

body

数组

此对象上必需的属性名称列表。

schema

body

字符串

描述对象的 JSON 模式的 URI。

self

body

字符串

此资源的 URI。

updated_at

body

字符串

资源上次更新的日期和时间。

日期和时间戳格式为 ISO 8601

响应示例

{
    "created_at": "2014-09-19T18:20:56Z",
    "description": "You can configure the CPU limits with control parameters.",
    "name": "CPU Limits",
    "properties": {
        "quota:cpu_period": {
            "description": "Specifies the enforcement interval (unit: microseconds) for QEMU and LXC hypervisors. Within a period, each VCPU of the domain is not allowed to consume more than the quota worth of runtime. The value should be in range [1000, 1000000]. A period with value 0 means no value.",
            "maximum": 1000000,
            "minimum": 1000,
            "title": "Quota: CPU Period",
            "type": "integer"
        },
        "quota:cpu_quota": {
            "description": "Specifies the maximum allowed bandwidth (unit: microseconds). A domain with a negative-value quota indicates that the domain has infinite bandwidth, which means that it is not bandwidth controlled. The value should be in range [1000, 18446744073709551] or less than 0. A quota with value 0 means no value. You can use this feature to ensure that all vCPUs run at the same speed.",
            "title": "Quota: CPU Quota",
            "type": "integer"
        },
        "quota:cpu_shares": {
            "description": "Specifies the proportional weighted share for the domain. If this element is omitted, the service defaults to the OS provided defaults. There is no unit for the value; it is a relative measure based on the setting of other VMs. For example, a VM configured with value 2048 gets twice as much CPU time as a VM configured with value 1024.",
            "title": "Quota: CPU Shares",
            "type": "integer"
        }
    },
    "required": [],
    "schema": "/v2/schemas/metadefs/object",
    "self": "/v2/metadefs/namespaces/OS::Compute::Quota/objects/CPU Limits",
    "updated_at": "2014-09-19T18:20:56Z"
}
GET
/v2/metadefs/namespaces/{namespace_name}/objects

列出对象

列出命名空间中的对象定义。

返回更大的命名空间集合的子集,以及可用于获取下一组命名空间的链接。您应始终检查是否存在 next 链接,并将其用作后续 HTTP GET 请求中的 URI。您应遵循此模式,直到不再提供 next 链接。next 链接会保留您在初始请求中发送的任何查询参数。您可以使用 first 链接返回到集合的第一页。如果您希望手动分页浏览命名空间,请使用 limitmarker 参数。

使用 resource_typesvisibility 查询参数来过滤响应。

例如,将 resource_types 查询参数设置为 OS::Glance::Image,OS::Nova::Flavor,以过滤响应,仅包含与给定资源类型关联的命名空间。

您可以使用 sort_keysort_dir 参数对此操作的结果进行排序。API 使用提供的 sort_key 属性的自然排序。

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

visibility (可选)

查询

字符串

按命名空间可见性值过滤响应。有效值为 publicprivate。如果您省略此参数,则响应将显示 publicprivate 命名空间。

resource_types (可选)

查询

整数

将响应过滤为仅包含将指定的资源类型作为资源类型关联的命名空间。使用逗号 ( ,) 字符分隔多个值。例如,OS::Glance::Image,OS::Nova::Flavor 仅显示与这些资源类型关联的命名空间。

sort_key (可选)

查询

字符串

按属性排序响应。接受的值为 namespacecreated_atupdated_at。默认值为 created_at

sort_dir (可选)

查询

字符串

对响应进行排序。使用 asc 表示升序或 desc 表示降序。默认值为 desc

响应参数

名称

入参

类型

描述

display_name(可选)

body

字符串

在 UI 中用于显示命名空间名称的用户友好名称。

description (可选)

body

字符串

命名空间的描述。

namespace

body

字符串

命名空间的标识符(名称)。该值在所有用户中必须是唯一的。

visibility

body

enum

命名空间的可见性,为 publicprivate

protected

body

布尔值

命名空间删除保护,为 truefalse

namespaces

body

数组

一个 namespace 对象的列表。

resource_type_associations

body

数组

一个列表,其中每个元素由 Metadefs 资源类型关联模式 描述。

响应示例

{
    "objects": [
        {
            "created_at": "2014-09-18T18:16:35Z",
            "description": "You can configure the CPU limits with control parameters.",
            "name": "CPU Limits",
            "properties": {
                "quota:cpu_period": {
                    "description": "Specifies the enforcement interval (unit: microseconds) for QEMU and LXC hypervisors. Within a period, each VCPU of the domain is not allowed to consume more than the quota worth of runtime. The value should be in range [1000, 1000000]. A period with value 0 means no value.",
                    "maximum": 1000000,
                    "minimum": 1000,
                    "title": "Quota: CPU Period",
                    "type": "integer"
                },
                "quota:cpu_quota": {
                    "description": "Specifies the maximum allowed bandwidth (unit: microseconds). A domain with a negative-value quota indicates that the domain has infinite bandwidth, which means that it is not bandwidth controlled. The value should be in range [1000, 18446744073709551] or less than 0. A quota with value 0 means no value. You can use this feature to ensure that all vCPUs run at the same speed.",
                    "title": "Quota: CPU Quota",
                    "type": "integer"
                },
                "quota:cpu_shares": {
                    "description": "Specifies the proportional weighted share for the domain. If this element is omitted, the service defaults to the OS provided defaults. There is no unit for the value; it is a relative measure based on the setting of other VMs. For example, a VM configured with value 2048 gets twice as much CPU time as a VM configured with value 1024.",
                    "title": "Quota: CPU Shares",
                    "type": "integer"
                }
            },
            "required": [],
            "schema": "/v2/schemas/metadefs/object",
            "self": "/v2/metadefs/namespaces/OS::Compute::Quota/objects/CPU Limits"
        },
        {
            "created_at": "2014-09-18T18:16:35Z",
            "description": "Using disk I/O quotas, you can set maximum disk write to 10 MB per second for a VM user.",
            "name": "Disk QoS",
            "properties": {
                "quota:disk_read_bytes_sec": {
                    "description": "Sets disk I/O quota for disk read bytes / sec.",
                    "title": "Quota: Disk read bytes / sec",
                    "type": "integer"
                },
                "quota:disk_read_iops_sec": {
                    "description": "Sets disk I/O quota for disk read IOPS / sec.",
                    "title": "Quota: Disk read IOPS / sec",
                    "type": "integer"
                },
                "quota:disk_total_bytes_sec": {
                    "description": "Sets disk I/O quota for total disk bytes / sec.",
                    "title": "Quota: Disk Total Bytes / sec",
                    "type": "integer"
                },
                "quota:disk_total_iops_sec": {
                    "description": "Sets disk I/O quota for disk total IOPS / sec.",
                    "title": "Quota: Disk Total IOPS / sec",
                    "type": "integer"
                },
                "quota:disk_write_bytes_sec": {
                    "description": "Sets disk I/O quota for disk write bytes / sec.",
                    "title": "Quota: Disk Write Bytes / sec",
                    "type": "integer"
                },
                "quota:disk_write_iops_sec": {
                    "description": "Sets disk I/O quota for disk write IOPS / sec.",
                    "title": "Quota: Disk Write IOPS / sec",
                    "type": "integer"
                }
            },
            "required": [],
            "schema": "/v2/schemas/metadefs/object",
            "self": "/v2/metadefs/namespaces/OS::Compute::Quota/objects/Disk QoS"
        },
        {
            "created_at": "2014-09-18T18:16:35Z",
            "description": "Bandwidth QoS tuning for instance virtual interfaces (VIFs) may be specified with these properties. Incoming and outgoing traffic can be shaped independently. If not specified, no quality of service (QoS) is applied on that traffic direction. So, if you want to shape only the network's incoming traffic, use inbound only (and vice versa). The OpenStack Networking service abstracts the physical implementation of the network, allowing plugins to configure and manage physical resources. Virtual Interfaces (VIF) in the logical model are analogous to physical network interface cards (NICs). VIFs are typically owned a managed by an external service; for instance when OpenStack Networking is used for building OpenStack networks, VIFs would be created, owned, and managed in Nova. VIFs are connected to OpenStack Networking networks via ports. A port is analogous to a port on a network switch, and it has an administrative state. When a VIF is attached to a port the OpenStack Networking API creates an attachment object, which specifies the fact that a VIF with a given identifier is plugged into the port.",
            "name": "Virtual Interface QoS",
            "properties": {
                "quota:vif_inbound_average": {
                    "description": "Network Virtual Interface (VIF) inbound average in kilobytes per second. Specifies average bit rate on the interface being shaped.",
                    "title": "Quota: VIF Inbound Average",
                    "type": "integer"
                },
                "quota:vif_inbound_burst": {
                    "description": "Network Virtual Interface (VIF) inbound burst in total kilobytes. Specifies the amount of bytes that can be burst at peak speed.",
                    "title": "Quota: VIF Inbound Burst",
                    "type": "integer"
                },
                "quota:vif_inbound_peak": {
                    "description": "Network Virtual Interface (VIF) inbound peak in kilobytes per second. Specifies maximum rate at which an interface can receive data.",
                    "title": "Quota: VIF Inbound Peak",
                    "type": "integer"
                },
                "quota:vif_outbound_average": {
                    "description": "Network Virtual Interface (VIF) outbound average in kilobytes per second. Specifies average bit rate on the interface being shaped.",
                    "title": "Quota: VIF Outbound Average",
                    "type": "integer"
                },
                "quota:vif_outbound_burst": {
                    "description": "Network Virtual Interface (VIF) outbound burst in total kilobytes. Specifies the amount of bytes that can be burst at peak speed.",
                    "title": "Quota: VIF Outbound Burst",
                    "type": "integer"
                },
                "quota:vif_outbound_peak": {
                    "description": "Network Virtual Interface (VIF) outbound peak in kilobytes per second. Specifies maximum rate at which an interface can send data.",
                    "title": "Quota: VIF Outbound Burst",
                    "type": "integer"
                }
            },
            "required": [],
            "schema": "/v2/schemas/metadefs/object",
            "self": "/v2/metadefs/namespaces/OS::Compute::Quota/objects/Virtual Interface QoS"
        }
    ],
    "schema": "v2/schemas/metadefs/objects"
}
GET
/v2/metadefs/namespaces/{namespace_name}/objects/{object_name}

显示对象

显示对象的定义。

响应主体显示单个对象实体。

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

object_name

路径

字符串

对象名称。

没有请求体。

响应参数

名称

入参

类型

描述

created_at

body

字符串

创建资源的时间和日期。

日期和时间戳格式为 ISO 8601

description

body

字符串

对象的详细描述。

name

body

字符串

对象的名称,适合用作标识符。名称的长度限制为 80 个字符。

properties

body

对象

一组键值对,每个值都是一个属性实体。

必需

body

数组

此对象上必需的属性名称列表。

schema

body

字符串

描述对象的 JSON 模式的 URI。

self

body

字符串

此资源的 URI。

updated_at

body

字符串

资源上次更新的日期和时间。

日期和时间戳格式为 ISO 8601

响应示例

{
    "created_at": "2014-09-19T18:20:56Z",
    "description": "You can configure the CPU limits with control parameters.",
    "name": "CPU Limits",
    "properties": {
        "quota:cpu_period": {
            "description": "Specifies the enforcement interval (unit: microseconds) for QEMU and LXC hypervisors. Within a period, each VCPU of the domain is not allowed to consume more than the quota worth of runtime. The value should be in range [1000, 1000000]. A period with value 0 means no value.",
            "maximum": 1000000,
            "minimum": 1000,
            "title": "Quota: CPU Period",
            "type": "integer"
        },
        "quota:cpu_quota": {
            "description": "Specifies the maximum allowed bandwidth (unit: microseconds). A domain with a negative-value quota indicates that the domain has infinite bandwidth, which means that it is not bandwidth controlled. The value should be in range [1000, 18446744073709551] or less than 0. A quota with value 0 means no value. You can use this feature to ensure that all vCPUs run at the same speed.",
            "title": "Quota: CPU Quota",
            "type": "integer"
        },
        "quota:cpu_shares": {
            "description": "Specifies the proportional weighted share for the domain. If this element is omitted, the service defaults to the OS provided defaults. There is no unit for the value; it is a relative measure based on the setting of other VMs. For example, a VM configured with value 2048 gets twice as much CPU time as a VM configured with value 1024.",
            "title": "Quota: CPU Shares",
            "type": "integer"
        }
    },
    "required": [],
    "schema": "/v2/schemas/metadefs/object",
    "self": "/v2/metadefs/namespaces/OS::Compute::Quota/objects/CPU Limits",
    "updated_at": "2014-09-19T18:20:56Z"
}
PUT
/v2/metadefs/namespaces/{namespace_name}/objects/{object_name}

更新对象

在命名空间中更新对象定义。

对象资源将完全替换为您在请求主体中指定的内容。因此,如果您遗漏了任何可选参数,并且它们存在于当前对象中,则此调用将消除它们。

可以使用此调用更改对象的名称;如果这样做,请注意,对象的 URL(由 self 字段指定)将更改。

正常响应代码:200

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

object_name

路径

字符串

对象名称。

name

body

字符串

对象的名称,适合用作标识符。名称的长度限制为 80 个字符。

description (可选)

body

字符串

对象的详细描述。

properties (可选)

body

对象

一组键值对,每个值都是一个属性实体。

required (可选)

body

数组

此对象上必需的属性名称列表。

请求示例

{
    "description": "You can configure the CPU limits with control parameters.",
    "name": "CPU Limits",
    "properties": {
        "quota:cpu_shares": {
            "description": "Specifies the proportional weighted share for the domain. If this element is omitted, the service defaults to the OS provided defaults. There is no unit for the value; it is a relative measure based on the setting of other VMs. For example, a VM configured with value 2048 gets twice as much CPU time as a VM configured with value 1024.",
            "title": "Quota: CPU Shares",
            "type": "integer"
        }
    },
    "required": []
}

响应参数

名称

入参

类型

描述

created_at

body

字符串

创建资源的时间和日期。

日期和时间戳格式为 ISO 8601

description

body

字符串

对象的详细描述。

name

body

字符串

对象的名称,适合用作标识符。名称的长度限制为 80 个字符。

properties

body

对象

一组键值对,每个值都是一个属性实体。

必需

body

数组

此对象上必需的属性名称列表。

schema

body

字符串

描述对象的 JSON 模式的 URI。

self

body

字符串

此资源的 URI。

updated_at

body

字符串

资源上次更新的日期和时间。

日期和时间戳格式为 ISO 8601

响应示例

{
    "created_at": "2014-09-19T19:20:56Z",
    "description": "You can configure the CPU limits with control parameters.",
    "name": "CPU Limits",
    "properties": {
        "quota:cpu_shares": {
            "description": "Specifies the proportional weighted share for the domain. If this element is omitted, the service defaults to the OS provided defaults. There is no unit for the value; it is a relative measure based on the setting of other VMs. For example, a VM configured with value 2048 gets twice as much CPU time as a VM configured with value 1024.",
            "title": "Quota: CPU Shares",
            "type": "integer"
        }
    },
    "required": [],
    "schema": "/v2/schemas/metadefs/object",
    "self": "/v2/metadefs/namespaces/OS::Compute::Quota/objects/CPU Limits",
    "updated_at": "2014-09-19T19:20:56Z"
}
DELETE
/v2/metadefs/namespaces/{namespace_name}/objects/{object_name}

删除对象

删除对象

注意

如果包含对象的命名空间受到保护,也就是说,如果命名空间的 protected 属性为 true,则您必须首先将命名空间上的 protected 属性设置为 false,然后才能删除该对象。

  • 如果您尝试从受保护的命名空间删除对象,该调用将返回 403 响应代码。

  • 要更改命名空间的 protected 属性,请使用 更新命名空间 调用。

当您成功从命名空间删除对象时,响应为空,响应代码为 204

正常响应代码:204

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

object_name

路径

字符串

对象名称。

没有请求体。

没有响应主体。

元数据定义属性

创建、列出、显示详细信息、更新和删除元数据定义属性。

自 API v2.2 起

POST
/v2/metadefs/namespaces/{namespace_name}/properties

创建属性

在命名空间中创建一个属性定义。

模式是 JSON 属性定义模式的子集。

正常响应代码:201

错误响应代码:400、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

name

body

字符串

属性的名称。名称的长度限制为 80 个字符。

title

body

字符串

属性的标题。

type

body

字符串

属性类型。

additionalItems (可选)

body

字符串

如果使用元组类型,则描述额外的项目。如果 items 的值为数组(元组类型),并且实例的长度大于 items 中的模式列表,则此属性中的模式描述了额外的项目。如果此值为 false,则实例不能大于 items 中的模式列表。如果此值为 true,则等效于空模式(任何内容都可以)。

description (可选)

body

字符串

属性的详细描述。

default (可选)

body

字符串

默认属性描述。

items (可选)

body

字符串

数组中项目的模式。

operators (可选)

body

字符串

运算符属性描述。

enum

body

数组

属性值的枚举列表。

maximum (可选)

body

字符串

允许的最大数值。

minItems (可选)

body

字符串

数组的最小长度。

readonly (可选)

body

布尔值

指示此属性是否为只读属性。

minimum (可选)

body

字符串

允许的最小数值。

maxItems (可选)

body

字符串

数组的最大长度。

maxLength (可选)

body

字符串

允许的最大字符串长度。

uniqueItems (可选)

body

字符串

指示数组中的所有值必须不同。

pattern (可选)

body

字符串

一个正则表达式(ECMA 262),字符串值必须匹配该正则表达式。

minLength (可选)

body

字符串

允许的最小字符串长度。

请求示例

{
    "description": "The hypervisor type. It may be used by the host properties filter for scheduling. The ImagePropertiesFilter filters compute nodes that satisfy any architecture, hypervisor type, or virtual machine mode properties specified on the instance's image properties. Image properties are contained in the image dictionary in the request_spec.",
    "enum": [
        "xen",
        "qemu",
        "kvm",
        "lxc",
        "uml",
        "vmware",
        "hyperv"
    ],
    "name": "hypervisor_type",
    "title": "Hypervisor Type",
    "type": "string"
}

响应参数

名称

入参

类型

描述

additionalItems (可选)

body

字符串

如果使用元组类型,则描述额外的项目。如果 items 的值为数组(元组类型),并且实例的长度大于 items 中的模式列表,则此属性中的模式描述了额外的项目。如果此值为 false,则实例不能大于 items 中的模式列表。如果此值为 true,则等效于空模式(任何内容都可以)。

description

body

字符串

属性的详细描述。

title

body

字符串

属性的标题。

default (可选)

body

字符串

默认属性描述。

items (可选)

body

字符串

数组中项目的模式。

operators (可选)

body

字符串

运算符属性描述。

enum

body

数组

属性值的枚举列表。

maximum (可选)

body

字符串

允许的最大数值。

minItems (可选)

body

字符串

数组的最小长度。

readonly (可选)

body

布尔值

指示此属性是否为只读属性。

minimum (可选)

body

字符串

允许的最小数值。

maxItems (可选)

body

字符串

数组的最大长度。

maxLength (可选)

body

字符串

允许的最大字符串长度。

uniqueItems (可选)

body

字符串

指示数组中的所有值必须不同。

pattern (可选)

body

字符串

一个正则表达式(ECMA 262),字符串值必须匹配该正则表达式。

type

body

字符串

属性类型。

minLength (可选)

body

字符串

允许的最小字符串长度。

name

body

字符串

属性的名称。名称的长度限制为 80 个字符。

响应示例

{
    "description": "The hypervisor type. It may be used by the host properties filter for scheduling. The ImagePropertiesFilter filters compute nodes that satisfy any architecture, hypervisor type, or virtual machine mode properties specified on the instance's image properties. Image properties are contained in the image dictionary in the request_spec.",
    "enum": [
        "xen",
        "qemu",
        "kvm",
        "lxc",
        "uml",
        "vmware",
        "hyperv"
    ],
    "name": "hypervisor_type",
    "title": "Hypervisor Type",
    "type": "string"
}
GET
/v2/metadefs/namespaces/{namespace_name}/properties

列出属性

列出命名空间中的属性定义。

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

没有请求体。

响应参数

名称

入参

类型

描述

properties

body

对象

一个键值对字典,其中每个值都是由 Metadefs 属性模式 定义的属性 对象。

响应示例

{
    "properties": {
        "hw_disk_bus": {
            "description": "Specifies the type of disk controller to attach disk devices to.",
            "enum": [
                "scsi",
                "virtio",
                "uml",
                "xen",
                "ide",
                "usb",
                "fdc",
                "sata"
            ],
            "title": "Disk Bus",
            "type": "string"
        },
        "hw_machine_type": {
            "description": "Enables booting an ARM system using the specified machine type. By default, if an ARM image is used and its type is not specified, Compute uses vexpress-a15 (for ARMv7) or virt (for AArch64) machine types. Valid types can be viewed by using the virsh capabilities command (machine types are displayed in the machine tag).",
            "title": "Machine Type",
            "type": "string"
        },
        "hw_qemu_guest_agent": {
            "description": "It is a daemon program running inside the domain which is supposed to help management applications with executing functions which need assistance of the guest OS. For example, freezing and thawing filesystems, entering suspend. However, guest agent (GA) is not bullet proof, and hostile guest OS can send spurious replies.",
            "enum": [
                "yes",
                "no"
            ],
            "title": "QEMU Guest Agent",
            "type": "string"
        },
        "hw_rng_model": {
            "default": "virtio",
            "description": "Adds a random-number generator device to the image's instances. The cloud administrator can enable and control device behavior by configuring the instance's flavor. By default: The generator device is disabled. /dev/random is used as the default entropy source. To specify a physical HW RNG device, use the following option in the nova.conf file: rng_dev_path=/dev/hwrng",
            "title": "Random Number Generator Device",
            "type": "string"
        },
        "hw_scsi_model": {
            "default": "virtio-scsi",
            "description": "Enables the use of VirtIO SCSI (virtio-scsi) to provide block device access for compute instances; by default, instances use VirtIO Block (virtio-blk). VirtIO SCSI is a para-virtualized SCSI controller device that provides improved scalability and performance, and supports advanced SCSI hardware.",
            "title": "SCSI Model",
            "type": "string"
        },
        "hw_video_model": {
            "description": "The video image driver used.",
            "enum": [
                "vga",
                "cirrus",
                "vmvga",
                "xen",
                "qxl"
            ],
            "title": "Video Model",
            "type": "string"
        },
        "hw_video_ram": {
            "description": "Maximum RAM for the video image. Used only if a hw_video:ram_max_mb value has been set in the flavor's extra_specs and that value is higher than the value set in hw_video_ram.",
            "title": "Max Video Ram",
            "type": "integer"
        },
        "hw_vif_model": {
            "description": "Specifies the model of virtual network interface device to use. The valid options depend on the configured hypervisor. KVM and QEMU: e1000, ne2k_pci, pcnet, rtl8139, virtio, e1000e and vmxnet3. VMware: e1000, e1000e, VirtualE1000, VirtualE1000e, VirtualPCNet32,  and VirtualVmxnet. Xen: e1000, netfront, ne2k_pci, pcnet, and rtl8139.",
            "enum": [
                "e1000",
                "ne2k_pci",
                "pcnet",
                "rtl8139",
                "virtio",
                "e1000e",
                "vmxnet3",
                "VirtualE1000",
                "VirtualE1000e",
                "VirtualPCNet32",
                "VirtualVmxnet",
                "netfront",
                "ne2k_pci"
            ],
            "title": "Virtual Network Interface",
            "type": "string"
        },
        "os_command_line": {
            "description": "The kernel command line to be used by the libvirt driver, instead of the default. For linux containers (LXC), the value is used as arguments for initialization. This key is valid only for Amazon kernel, ramdisk, or machine images (aki, ari, or ami).",
            "title": "Kernel Command Line",
            "type": "string"
        }
    }
}
GET
/v2/metadefs/namespaces/{namespace_name}/properties/{property_name}

显示属性定义

显示属性的定义。

如果您使用 resource_type 查询参数,API 会在提交查询之前从属性名称中删除资源类型的前缀。这使您可以查找以关联资源类型的前缀开头的属性名称。

响应主体显示单个属性实体。

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

property_name

路径

字符串

属性的名称。

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

resource_type (可选)

查询

字符串

按与关联资源类型的前缀开头的属性名称进行过滤响应。API 在响应中从属性名称中删除资源类型的前缀。

响应参数

名称

入参

类型

描述

additionalItems (可选)

body

字符串

如果使用元组类型,则描述额外的项目。如果 items 的值为数组(元组类型),并且实例的长度大于 items 中的模式列表,则此属性中的模式描述了额外的项目。如果此值为 false,则实例不能大于 items 中的模式列表。如果此值为 true,则等效于空模式(任何内容都可以)。

description

body

字符串

属性的详细描述。

title

body

字符串

属性的标题。

default (可选)

body

字符串

默认属性描述。

items (可选)

body

字符串

数组中项目的模式。

operators (可选)

body

字符串

运算符属性描述。

enum

body

数组

属性值的枚举列表。

maximum (可选)

body

字符串

允许的最大数值。

minItems (可选)

body

字符串

数组的最小长度。

readonly (可选)

body

布尔值

指示此属性是否为只读属性。

minimum (可选)

body

字符串

允许的最小数值。

maxItems (可选)

body

字符串

数组的最大长度。

maxLength (可选)

body

字符串

允许的最大字符串长度。

uniqueItems (可选)

body

字符串

指示数组中的所有值必须不同。

pattern (可选)

body

字符串

一个正则表达式(ECMA 262),字符串值必须匹配该正则表达式。

type

body

字符串

属性类型。

minLength (可选)

body

字符串

允许的最小字符串长度。

name

body

字符串

属性的名称。名称的长度限制为 80 个字符。

响应示例

{
    "description": "The hypervisor type. It may be used by the host properties filter for scheduling. The ImagePropertiesFilter filters compute nodes that satisfy any architecture, hypervisor type, or virtual machine mode properties specified on the instance's image properties. Image properties are contained in the image dictionary in the request_spec.",
    "enum": [
        "xen",
        "qemu",
        "kvm",
        "lxc",
        "uml",
        "vmware",
        "hyperv"
    ],
    "name": "hypervisor_type",
    "title": "Hypervisor Type",
    "type": "string"
}
PUT
/v2/metadefs/namespaces/{namespace_name}/properties/{property_name}

更新属性定义

更新属性定义。

正常响应代码:200

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

property_name

路径

字符串

属性的名称。

name

body

字符串

属性的名称。名称的长度限制为 80 个字符。

title

body

字符串

属性的标题。

type

body

字符串

属性类型。

additionalItems (可选)

body

字符串

如果使用元组类型,则描述额外的项目。如果 items 的值为数组(元组类型),并且实例的长度大于 items 中的模式列表,则此属性中的模式描述了额外的项目。如果此值为 false,则实例不能大于 items 中的模式列表。如果此值为 true,则等效于空模式(任何内容都可以)。

description (可选)

body

字符串

命名空间的描述。

default (可选)

body

字符串

默认属性描述。

items (可选)

body

字符串

数组中项目的模式。

operators (可选)

body

字符串

运算符属性描述。

enum

body

数组

属性值的枚举列表。

maximum (可选)

body

字符串

允许的最大数值。

minItems (可选)

body

字符串

数组的最小长度。

readonly (可选)

body

布尔值

指示此属性是否为只读属性。

minimum (可选)

body

字符串

允许的最小数值。

maxItems (可选)

body

字符串

数组的最大长度。

maxLength (可选)

body

字符串

允许的最大字符串长度。

uniqueItems (可选)

body

字符串

指示数组中的所有值必须不同。

pattern (可选)

body

字符串

一个正则表达式(ECMA 262),字符串值必须匹配该正则表达式。

minLength (可选)

body

字符串

允许的最小字符串长度。

请求示例

{
    "description": "The hypervisor type. It may be used by the host properties filter for scheduling. The ImagePropertiesFilter filters compute nodes that satisfy any architecture, hypervisor type, or virtual machine mode properties specified on the instance's image properties. Image properties are contained in the image dictionary in the request_spec.",
    "enum": [
        "xen",
        "qemu",
        "kvm",
        "lxc",
        "uml",
        "vmware",
        "hyperv"
    ],
    "name": "hypervisor_type",
    "title": "Hypervisor Type",
    "type": "string"
}

响应参数

名称

入参

类型

描述

additionalItems (可选)

body

字符串

如果使用元组类型,则描述额外的项目。如果 items 的值为数组(元组类型),并且实例的长度大于 items 中的模式列表,则此属性中的模式描述了额外的项目。如果此值为 false,则实例不能大于 items 中的模式列表。如果此值为 true,则等效于空模式(任何内容都可以)。

description (可选)

body

字符串

命名空间的描述。

title

body

字符串

属性的标题。

default (可选)

body

字符串

默认属性描述。

items (可选)

body

字符串

数组中项目的模式。

operators (可选)

body

字符串

运算符属性描述。

enum

body

数组

属性值的枚举列表。

maximum (可选)

body

字符串

允许的最大数值。

minItems (可选)

body

字符串

数组的最小长度。

readonly (可选)

body

布尔值

指示此属性是否为只读属性。

minimum (可选)

body

字符串

允许的最小数值。

maxItems (可选)

body

字符串

数组的最大长度。

maxLength (可选)

body

字符串

允许的最大字符串长度。

uniqueItems (可选)

body

字符串

指示数组中的所有值必须不同。

pattern (可选)

body

字符串

一个正则表达式(ECMA 262),字符串值必须匹配该正则表达式。

type

body

字符串

属性类型。

minLength (可选)

body

字符串

允许的最小字符串长度。

name

body

字符串

属性的名称。名称的长度限制为 80 个字符。

响应示例

{
    "description": "The hypervisor type. It may be used by the host properties filter for scheduling. The ImagePropertiesFilter filters compute nodes that satisfy any architecture, hypervisor type, or virtual machine mode properties specified on the instance's image properties. Image properties are contained in the image dictionary in the request_spec.",
    "enum": [
        "xen",
        "qemu",
        "kvm",
        "lxc",
        "uml",
        "vmware",
        "hyperv"
    ],
    "name": "hypervisor_type",
    "title": "Hypervisor Type",
    "type": "string"
}
DELETE
/v2/metadefs/namespaces/{namespace_name}/properties/{property_name}

删除属性定义

从命名空间中删除属性定义。

注意

如果包含属性的命名空间受到保护,也就是说,如果命名空间的 protected 属性为 true,则您必须首先将命名空间上的 protected 属性设置为 false,然后才能删除该属性。

  • 如果您尝试从受保护的命名空间删除属性,该调用将返回 403 响应代码。

  • 要更改命名空间的 protected 属性,请使用 更新命名空间 调用。

当您成功从命名空间删除属性时,响应为空,响应代码为 204

正常响应代码:204

错误响应代码:401、403、404

请求

名称

入参

类型

描述

property_name

路径

字符串

属性的名称。

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

元数据定义标签

创建、列出、显示详细信息、更新和删除元数据定义标签。

自 API v2.2 起

POST
/v2/metadefs/namespaces/{namespace_name}/tags/{tag_name}

创建标签定义

将标签添加到命名空间标签定义的列表中。

正常响应代码:201

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

tag_name

路径

字符串

标签的名称。名称的长度限制为 80 个字符。

没有请求体。

响应参数

名称

入参

类型

描述

created_at

body

字符串

创建资源的时间和日期。

日期和时间戳格式为 ISO 8601

name

body

字符串

标签的名称。名称的长度限制为 80 个字符。

updated_at

body

字符串

资源上次更新的日期和时间。

日期和时间戳格式为 ISO 8601

响应示例

{
    "created_at": "2015-05-09T01:12:31Z",
    "name": "added-sample-tag",
    "updated_at": "2015-05-09T01:12:31Z"
}
GET
/v2/metadefs/namespaces/{namespace_name}/tags/{tag_name}

获取标签定义

获取标签的定义。

响应主体显示单个标签实体。

正常响应代码:200

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

tag_name

路径

字符串

标签的名称。名称的长度限制为 80 个字符。

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

没有请求体。

响应参数

名称

入参

类型

描述

created_at

body

字符串

创建资源的时间和日期。

日期和时间戳格式为 ISO 8601

name

body

字符串

标签的名称。名称的长度限制为 80 个字符。

updated_at

body

字符串

资源上次更新的日期和时间。

日期和时间戳格式为 ISO 8601

响应示例

{
    "created_at": "2015-05-06T23:16:12Z",
    "name": "sample-tag2",
    "updated_at": "2015-05-06T23:16:12Z"
}
PUT
/v2/metadefs/namespaces/{namespace_name}/tags/{tag_name}

更新标签定义

重命名标签定义。

正常响应代码:200

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

tag_name

路径

字符串

标签的名称。名称的长度限制为 80 个字符。

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

name

body

字符串

标签的名称。名称的长度限制为 80 个字符。

请求示例

{
    "name": "new-tag-name"
}

响应参数

名称

入参

类型

描述

created_at

body

字符串

创建资源的时间和日期。

日期和时间戳格式为 ISO 8601

name

body

字符串

标签的名称。名称的长度限制为 80 个字符。

updated_at

body

字符串

资源上次更新的日期和时间。

日期和时间戳格式为 ISO 8601

响应示例

{
    "created_at": "2016-05-21T18:49:38Z",
    "name": "new-tag-name",
    "updated_at": "2016-05-21T19:04:22Z"
}
DELETE
/v2/metadefs/namespaces/{namespace_name}/tags/{tag_name}

删除标签定义

删除命名空间中的标签定义。

注意

如果包含标签的命名空间受到保护,也就是说,如果命名空间的 protected 属性为 true,则您必须首先将命名空间上的 protected 属性设置为 false,然后才能删除该标签。

  • 如果您尝试从受保护的命名空间删除标签,该调用将返回 403 响应代码。

  • 要更改命名空间的 protected 属性,请使用 更新命名空间 调用。

当您成功从命名空间删除标签时,响应为空,响应代码为 204

正常响应代码:204

错误响应代码:400、401、403、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

tag_name

路径

字符串

标签的名称。名称的长度限制为 80 个字符。

POST
/v2/metadefs/namespaces/{namespace_name}/tags

创建标签

在命名空间中创建一个或多个标签定义。

正常响应代码:201

错误响应代码:400、401、403、404、409

请求

名称

入参

类型

描述

X-Openstack-Append (可选)

标头

字符串

如果存在且设置为 True,则新的 metadefs 标签将附加到现有的标签。否则,现有的标签将被覆盖。

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

tags

body

数组

一个标签对象列表,每个对象由 Metadefs Tag Schema 定义。

请求示例

{
    "tags": [
        {
            "name": "sample-tag1"
        },
        {
            "name": "sample-tag2"
        },
        {
            "name": "sample-tag3"
        }
    ]
}

响应参数

名称

入参

类型

描述

name

路径

字符串

资源类型的名称。名称的长度限制为 80 个字符。

tags

body

数组

一个标签对象列表,每个对象由 Metadefs Tag Schema 定义。

响应示例

{
    "tags": [
        {
            "name": "sample-tag1"
        },
        {
            "name": "sample-tag2"
        },
        {
            "name": "sample-tag3"
        }
    ]
}
GET
/v2/metadefs/namespaces/{namespace_name}/tags

列出标签

列出命名空间中的标签定义。

要手动分页浏览标签列表,请使用 limitmarker 参数。

要对此操作的结果进行排序,请使用 sort_keysort_dir 参数。API 使用 sort_key 参数的标签属性的自然排序。

正常响应代码:200

错误响应代码:401、403、404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

limit (可选)

查询

整数

请求一个标签页面大小。返回最多 limit 值个标签。使用 limit 参数进行初始的有限请求,并在后续的有限请求中使用响应中最后一个看到的标签的名称作为 marker 参数值。

marker (可选)

查询

字符串

允许指定标签名称。如果存在,将仅列出在命名标签之后发生的标签,即具有 sort_dir 方向中 sort_key 晚于该标记的那些命名空间。

sort_key (可选)

查询

字符串

按属性对响应进行排序。允许的值为 namecreated_atupdated_at。默认值为 created_at

sort_dir (可选)

查询

字符串

对响应进行排序。使用 asc 表示升序或 desc 表示降序。默认值为 desc

没有请求体。

响应参数

名称

入参

类型

描述

tags

body

数组

一个标签对象列表,每个对象由 Metadefs Tag Schema 定义。

响应示例

{
    "tags": [
        {
            "name": "sample-tag1"
        },
        {
            "name": "sample-tag2"
        },
        {
            "name": "sample-tag3"
        }
    ]
}
DELETE
/v2/metadefs/namespaces/{namespace_name}/tags

删除所有标签定义

删除命名空间内的所有标签定义。

注意

如果包含标签的命名空间受到保护,也就是说,如果命名空间的 protected 属性为 true,则必须先将命名空间上的 protected 属性设置为 false,然后才能删除标签。如果尝试从受保护的命名空间删除标签,则调用将返回 403 响应代码。

成功删除命名空间中的标签后,响应为空,响应代码为 204

正常响应代码:204

错误响应代码:403, 404

请求

名称

入参

类型

描述

namespace_name

路径

字符串

您想要查看其详细信息的命名空间的名称。(名称是命名空间的 namespace 字段的值。)

没有请求体。

没有响应主体。

元数据定义模式

获取表示元数据定义实体的 JSON 模式文档。

(自 API v2.2 起)

GET
/v2/schemas/metadefs/namespace

显示元数据定义命名空间模式

显示表示元数据定义命名空间实体的 JSON 模式文档。

以下模式文档是一个示例。权威响应是 API 调用的实际响应。

正常响应代码:200

错误响应代码:400, 401

请求

没有请求参数。调用不接受请求体。

响应示例

{
    "additionalProperties": false,
    "definitions": {
        "positiveInteger": {
            "minimum": 0,
            "type": "integer"
        },
        "positiveIntegerDefault0": {
            "allOf": [
                {
                    "$ref": "#/definitions/positiveInteger"
                },
                {
                    "default": 0
                }
            ]
        },
        "property": {
            "additionalProperties": {
                "properties": {
                    "additionalItems": {
                        "type": "boolean"
                    },
                    "default": {},
                    "description": {
                        "type": "string"
                    },
                    "enum": {
                        "type": "array"
                    },
                    "items": {
                        "properties": {
                            "enum": {
                                "type": "array"
                            },
                            "type": {
                                "enum": [
                                    "array",
                                    "boolean",
                                    "integer",
                                    "number",
                                    "object",
                                    "string",
                                    null
                                ],
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "maxItems": {
                        "$ref": "#/definitions/positiveInteger"
                    },
                    "maxLength": {
                        "$ref": "#/definitions/positiveInteger"
                    },
                    "maximum": {
                        "type": "number"
                    },
                    "minItems": {
                        "$ref": "#/definitions/positiveIntegerDefault0"
                    },
                    "minLength": {
                        "$ref": "#/definitions/positiveIntegerDefault0"
                    },
                    "minimum": {
                        "type": "number"
                    },
                    "name": {
                        "maxLength": 255,
                        "type": "string"
                    },
                    "operators": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "pattern": {
                        "format": "regex",
                        "type": "string"
                    },
                    "readonly": {
                        "type": "boolean"
                    },
                    "required": {
                        "$ref": "#/definitions/stringArray"
                    },
                    "title": {
                        "type": "string"
                    },
                    "type": {
                        "enum": [
                            "array",
                            "boolean",
                            "integer",
                            "number",
                            "object",
                            "string",
                            null
                        ],
                        "type": "string"
                    },
                    "uniqueItems": {
                        "default": false,
                        "type": "boolean"
                    }
                },
                "required": [
                    "title",
                    "type"
                ],
                "type": "object"
            },
            "type": "object"
        },
        "stringArray": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "uniqueItems": true
        }
    },
    "name": "namespace",
    "properties": {
        "created_at": {
            "description": "Date and time of namespace creation",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
        },
        "description": {
            "description": "Provides a user friendly description of the namespace.",
            "maxLength": 500,
            "type": "string"
        },
        "display_name": {
            "description": "The user friendly name for the namespace. Used by UI if available.",
            "maxLength": 80,
            "type": "string"
        },
        "namespace": {
            "description": "The unique namespace text.",
            "maxLength": 80,
            "type": "string"
        },
        "objects": {
            "items": {
                "properties": {
                    "description": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "properties": {
                        "$ref": "#/definitions/property"
                    },
                    "required": {
                        "$ref": "#/definitions/stringArray"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "owner": {
            "description": "Owner of the namespace.",
            "maxLength": 255,
            "type": "string"
        },
        "properties": {
            "$ref": "#/definitions/property"
        },
        "protected": {
            "description": "If true, namespace will not be deletable.",
            "type": "boolean"
        },
        "resource_type_associations": {
            "items": {
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "prefix": {
                        "type": "string"
                    },
                    "properties_target": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "schema": {
            "readOnly": true,
            "type": "string"
        },
        "self": {
            "readOnly": true,
            "type": "string"
        },
        "tags": {
            "items": {
                "properties": {
                    "name": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "updated_at": {
            "description": "Date and time of the last namespace modification",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
        },
        "visibility": {
            "description": "Scope of namespace accessibility.",
            "enum": [
                "public",
                "private"
            ],
            "type": "string"
        }
    },
    "required": [
        "namespace"
    ]
}
GET
/v2/schemas/metadefs/namespaces

显示元数据定义命名空间模式

显示表示元数据定义命名空间实体的 JSON 模式文档。

命名空间实体是命名空间实体的容器。

以下模式文档是一个示例。权威响应是 API 调用的实际响应。

正常响应代码:200

错误响应代码:400, 401

请求

没有请求参数。调用不接受请求体。

响应示例

{
    "definitions": {
        "positiveInteger": {
            "minimum": 0,
            "type": "integer"
        },
        "positiveIntegerDefault0": {
            "allOf": [
                {
                    "$ref": "#/definitions/positiveInteger"
                },
                {
                    "default": 0
                }
            ]
        },
        "property": {
            "additionalProperties": {
                "properties": {
                    "additionalItems": {
                        "type": "boolean"
                    },
                    "default": {},
                    "description": {
                        "type": "string"
                    },
                    "enum": {
                        "type": "array"
                    },
                    "items": {
                        "properties": {
                            "enum": {
                                "type": "array"
                            },
                            "type": {
                                "enum": [
                                    "array",
                                    "boolean",
                                    "integer",
                                    "number",
                                    "object",
                                    "string",
                                    null
                                ],
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "maxItems": {
                        "$ref": "#/definitions/positiveInteger"
                    },
                    "maxLength": {
                        "$ref": "#/definitions/positiveInteger"
                    },
                    "maximum": {
                        "type": "number"
                    },
                    "minItems": {
                        "$ref": "#/definitions/positiveIntegerDefault0"
                    },
                    "minLength": {
                        "$ref": "#/definitions/positiveIntegerDefault0"
                    },
                    "minimum": {
                        "type": "number"
                    },
                    "name": {
                        "maxLength": 255,
                        "type": "string"
                    },
                    "operators": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "pattern": {
                        "format": "regex",
                        "type": "string"
                    },
                    "readonly": {
                        "type": "boolean"
                    },
                    "required": {
                        "$ref": "#/definitions/stringArray"
                    },
                    "title": {
                        "type": "string"
                    },
                    "type": {
                        "enum": [
                            "array",
                            "boolean",
                            "integer",
                            "number",
                            "object",
                            "string",
                            null
                        ],
                        "type": "string"
                    },
                    "uniqueItems": {
                        "default": false,
                        "type": "boolean"
                    }
                },
                "required": [
                    "title",
                    "type"
                ],
                "type": "object"
            },
            "type": "object"
        },
        "stringArray": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "uniqueItems": true
        }
    },
    "links": [
        {
            "href": "{first}",
            "rel": "first"
        },
        {
            "href": "{next}",
            "rel": "next"
        },
        {
            "href": "{schema}",
            "rel": "describedby"
        }
    ],
    "name": "namespaces",
    "properties": {
        "first": {
            "type": "string"
        },
        "namespaces": {
            "items": {
                "additionalProperties": false,
                "name": "namespace",
                "properties": {
                    "created_at": {
                        "description": "Date and time of namespace creation",
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    },
                    "description": {
                        "description": "Provides a user friendly description of the namespace.",
                        "maxLength": 500,
                        "type": "string"
                    },
                    "display_name": {
                        "description": "The user friendly name for the namespace. Used by UI if available.",
                        "maxLength": 80,
                        "type": "string"
                    },
                    "namespace": {
                        "description": "The unique namespace text.",
                        "maxLength": 80,
                        "type": "string"
                    },
                    "objects": {
                        "items": {
                            "properties": {
                                "description": {
                                    "type": "string"
                                },
                                "name": {
                                    "type": "string"
                                },
                                "properties": {
                                    "$ref": "#/definitions/property"
                                },
                                "required": {
                                    "$ref": "#/definitions/stringArray"
                                }
                            },
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "owner": {
                        "description": "Owner of the namespace.",
                        "maxLength": 255,
                        "type": "string"
                    },
                    "properties": {
                        "$ref": "#/definitions/property"
                    },
                    "protected": {
                        "description": "If true, namespace will not be deletable.",
                        "type": "boolean"
                    },
                    "resource_type_associations": {
                        "items": {
                            "properties": {
                                "name": {
                                    "type": "string"
                                },
                                "prefix": {
                                    "type": "string"
                                },
                                "properties_target": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "schema": {
                        "readOnly": true,
                        "type": "string"
                    },
                    "self": {
                        "readOnly": true,
                        "type": "string"
                    },
                    "tags": {
                        "items": {
                            "properties": {
                                "name": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        },
                        "type": "array"
                    },
                    "updated_at": {
                        "description": "Date and time of the last namespace modification",
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    },
                    "visibility": {
                        "description": "Scope of namespace accessibility.",
                        "enum": [
                            "public",
                            "private"
                        ],
                        "type": "string"
                    }
                },
                "required": [
                    "namespace"
                ]
            },
            "type": "array"
        },
        "next": {
            "type": "string"
        },
        "schema": {
            "type": "string"
        }
    }
}
GET
/v2/schemas/metadefs/resource_type

显示元数据定义命名空间资源类型关联模式

显示表示元数据定义命名空间资源类型关联实体的 JSON 模式文档。

以下模式文档是一个示例。权威响应是 API 调用的实际响应。

正常响应代码:200

错误响应代码:400, 401

请求

没有请求参数。调用不接受请求体。

响应示例

{
    "additionalProperties": false,
    "name": "resource_type_association",
    "properties": {
        "created_at": {
            "description": "Date and time of resource type association",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
        },
        "name": {
            "description": "Resource type names should be aligned with Heat resource types whenever possible: https://docs.openstack.org/heat/2025.2/template_guide/openstack.html",
            "maxLength": 80,
            "type": "string"
        },
        "prefix": {
            "description": "Specifies the prefix to use for the given resource type. Any properties in the namespace should be prefixed with this prefix when being applied to the specified resource type. Must include prefix separator (e.g. a colon :).",
            "maxLength": 80,
            "type": "string"
        },
        "properties_target": {
            "description": "Some resource types allow more than one key / value pair per instance.  For example, Cinder allows user and image metadata on volumes. Only the image properties metadata is evaluated by Nova (scheduling or drivers). This property allows a namespace target to remove the ambiguity.",
            "maxLength": 80,
            "type": "string"
        },
        "updated_at": {
            "description": "Date and time of the last resource type association modification",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
        }
    },
    "required": [
        "name"
    ]
}
GET
/v2/schemas/metadefs/resource_types

显示元数据定义命名空间资源类型关联模式

显示表示元数据定义命名空间资源类型关联实体的 JSON 模式文档。

资源类型关联实体是资源类型关联实体的容器。

以下模式文档是一个示例。权威响应是 API 调用的实际响应。

正常响应代码:200

错误响应代码:400, 401

请求

没有请求参数。调用不接受请求体。

响应示例

{
    "links": [
        {
            "href": "{first}",
            "rel": "first"
        },
        {
            "href": "{next}",
            "rel": "next"
        },
        {
            "href": "{schema}",
            "rel": "describedby"
        }
    ],
    "name": "resource_type_associations",
    "properties": {
        "first": {
            "type": "string"
        },
        "next": {
            "type": "string"
        },
        "resource_type_associations": {
            "items": {
                "additionalProperties": false,
                "name": "resource_type_association",
                "properties": {
                    "created_at": {
                        "description": "Date and time of resource type association",
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    },
                    "name": {
                        "description": "Resource type names should be aligned with Heat resource types whenever possible: https://docs.openstack.org/heat/2025.2/template_guide/openstack.html",
                        "maxLength": 80,
                        "type": "string"
                    },
                    "prefix": {
                        "description": "Specifies the prefix to use for the given resource type. Any properties in the namespace should be prefixed with this prefix when being applied to the specified resource type. Must include prefix separator (e.g. a colon :).",
                        "maxLength": 80,
                        "type": "string"
                    },
                    "properties_target": {
                        "description": "Some resource types allow more than one key / value pair per instance.  For example, Cinder allows user and image metadata on volumes. Only the image properties metadata is evaluated by Nova (scheduling or drivers). This property allows a namespace target to remove the ambiguity.",
                        "maxLength": 80,
                        "type": "string"
                    },
                    "updated_at": {
                        "description": "Date and time of the last resource type association modification",
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    }
                },
                "required": [
                    "name"
                ]
            },
            "type": "array"
        },
        "schema": {
            "type": "string"
        }
    }
}
GET
/v2/schemas/metadefs/object

显示元数据定义对象模式

显示表示元数据定义对象实体的 JSON 模式文档。

以下模式文档是一个示例。权威响应是 API 调用的实际响应。

正常响应代码:200

错误响应代码:400, 401

请求

没有请求参数。调用不接受请求体。

响应示例

{
    "additionalProperties": false,
    "definitions": {
        "positiveInteger": {
            "minimum": 0,
            "type": "integer"
        },
        "positiveIntegerDefault0": {
            "allOf": [
                {
                    "$ref": "#/definitions/positiveInteger"
                },
                {
                    "default": 0
                }
            ]
        },
        "property": {
            "additionalProperties": {
                "properties": {
                    "additionalItems": {
                        "type": "boolean"
                    },
                    "default": {},
                    "description": {
                        "type": "string"
                    },
                    "enum": {
                        "type": "array"
                    },
                    "items": {
                        "properties": {
                            "enum": {
                                "type": "array"
                            },
                            "type": {
                                "enum": [
                                    "array",
                                    "boolean",
                                    "integer",
                                    "number",
                                    "object",
                                    "string",
                                    null
                                ],
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "maxItems": {
                        "$ref": "#/definitions/positiveInteger"
                    },
                    "maxLength": {
                        "$ref": "#/definitions/positiveInteger"
                    },
                    "maximum": {
                        "type": "number"
                    },
                    "minItems": {
                        "$ref": "#/definitions/positiveIntegerDefault0"
                    },
                    "minLength": {
                        "$ref": "#/definitions/positiveIntegerDefault0"
                    },
                    "minimum": {
                        "type": "number"
                    },
                    "name": {
                        "maxLength": 255,
                        "type": "string"
                    },
                    "operators": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "pattern": {
                        "format": "regex",
                        "type": "string"
                    },
                    "readonly": {
                        "type": "boolean"
                    },
                    "required": {
                        "$ref": "#/definitions/stringArray"
                    },
                    "title": {
                        "type": "string"
                    },
                    "type": {
                        "enum": [
                            "array",
                            "boolean",
                            "integer",
                            "number",
                            "object",
                            "string",
                            null
                        ],
                        "type": "string"
                    },
                    "uniqueItems": {
                        "default": false,
                        "type": "boolean"
                    }
                },
                "required": [
                    "title",
                    "type"
                ],
                "type": "object"
            },
            "type": "object"
        },
        "stringArray": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "uniqueItems": true
        }
    },
    "name": "object",
    "properties": {
        "created_at": {
            "description": "Date and time of object creation",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
        },
        "description": {
            "type": "string"
        },
        "name": {
            "maxLength": 255,
            "type": "string"
        },
        "properties": {
            "$ref": "#/definitions/property"
        },
        "required": {
            "$ref": "#/definitions/stringArray"
        },
        "schema": {
            "readOnly": true,
            "type": "string"
        },
        "self": {
            "readOnly": true,
            "type": "string"
        },
        "updated_at": {
            "description": "Date and time of the last object modification",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
        }
    },
    "required": [
        "name"
    ]
}
GET
/v2/schemas/metadefs/objects

显示元数据定义对象模式

显示表示元数据定义对象实体的 JSON 模式文档。

对象实体是对象实体的容器。

以下模式文档是一个示例。权威响应是 API 调用的实际响应。

正常响应代码:200

错误响应代码:400, 401

请求

没有请求参数。调用不接受请求体。

响应示例

{
    "definitions": {
        "positiveInteger": {
            "minimum": 0,
            "type": "integer"
        },
        "positiveIntegerDefault0": {
            "allOf": [
                {
                    "$ref": "#/definitions/positiveInteger"
                },
                {
                    "default": 0
                }
            ]
        },
        "property": {
            "additionalProperties": {
                "properties": {
                    "additionalItems": {
                        "type": "boolean"
                    },
                    "default": {},
                    "description": {
                        "type": "string"
                    },
                    "enum": {
                        "type": "array"
                    },
                    "items": {
                        "properties": {
                            "enum": {
                                "type": "array"
                            },
                            "type": {
                                "enum": [
                                    "array",
                                    "boolean",
                                    "integer",
                                    "number",
                                    "object",
                                    "string",
                                    null
                                ],
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "maxItems": {
                        "$ref": "#/definitions/positiveInteger"
                    },
                    "maxLength": {
                        "$ref": "#/definitions/positiveInteger"
                    },
                    "maximum": {
                        "type": "number"
                    },
                    "minItems": {
                        "$ref": "#/definitions/positiveIntegerDefault0"
                    },
                    "minLength": {
                        "$ref": "#/definitions/positiveIntegerDefault0"
                    },
                    "minimum": {
                        "type": "number"
                    },
                    "name": {
                        "maxLength": 255,
                        "type": "string"
                    },
                    "operators": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "pattern": {
                        "format": "regex",
                        "type": "string"
                    },
                    "readonly": {
                        "type": "boolean"
                    },
                    "required": {
                        "$ref": "#/definitions/stringArray"
                    },
                    "title": {
                        "type": "string"
                    },
                    "type": {
                        "enum": [
                            "array",
                            "boolean",
                            "integer",
                            "number",
                            "object",
                            "string",
                            null
                        ],
                        "type": "string"
                    },
                    "uniqueItems": {
                        "default": false,
                        "type": "boolean"
                    }
                },
                "required": [
                    "title",
                    "type"
                ],
                "type": "object"
            },
            "type": "object"
        },
        "stringArray": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "uniqueItems": true
        }
    },
    "links": [
        {
            "href": "{first}",
            "rel": "first"
        },
        {
            "href": "{next}",
            "rel": "next"
        },
        {
            "href": "{schema}",
            "rel": "describedby"
        }
    ],
    "name": "objects",
    "properties": {
        "first": {
            "type": "string"
        },
        "next": {
            "type": "string"
        },
        "objects": {
            "items": {
                "additionalProperties": false,
                "name": "object",
                "properties": {
                    "created_at": {
                        "description": "Date and time of object creation",
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "name": {
                        "maxLength": 255,
                        "type": "string"
                    },
                    "properties": {
                        "$ref": "#/definitions/property"
                    },
                    "required": {
                        "$ref": "#/definitions/stringArray"
                    },
                    "schema": {
                        "readOnly": true,
                        "type": "string"
                    },
                    "self": {
                        "readOnly": true,
                        "type": "string"
                    },
                    "updated_at": {
                        "description": "Date and time of the last object modification",
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    }
                },
                "required": [
                    "name"
                ]
            },
            "type": "array"
        },
        "schema": {
            "type": "string"
        }
    }
}
GET
/v2/schemas/metadefs/property

显示元数据定义属性模式

显示表示元数据定义属性实体的 JSON 模式文档。

以下模式文档是一个示例。权威响应是 API 调用的实际响应。

正常响应代码:200

错误响应代码:400, 401

请求

没有请求参数。调用不接受请求体。

响应示例

{
    "additionalProperties": false,
    "definitions": {
        "positiveInteger": {
            "minimum": 0,
            "type": "integer"
        },
        "positiveIntegerDefault0": {
            "allOf": [
                {
                    "$ref": "#/definitions/positiveInteger"
                },
                {
                    "default": 0
                }
            ]
        },
        "stringArray": {
            "items": {
                "type": "string"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
        }
    },
    "name": "property",
    "properties": {
        "additionalItems": {
            "type": "boolean"
        },
        "default": {},
        "description": {
            "type": "string"
        },
        "enum": {
            "type": "array"
        },
        "items": {
            "properties": {
                "enum": {
                    "type": "array"
                },
                "type": {
                    "enum": [
                        "array",
                        "boolean",
                        "integer",
                        "number",
                        "object",
                        "string",
                        null
                    ],
                    "type": "string"
                }
            },
            "type": "object"
        },
        "maxItems": {
            "$ref": "#/definitions/positiveInteger"
        },
        "maxLength": {
            "$ref": "#/definitions/positiveInteger"
        },
        "maximum": {
            "type": "number"
        },
        "minItems": {
            "$ref": "#/definitions/positiveIntegerDefault0"
        },
        "minLength": {
            "$ref": "#/definitions/positiveIntegerDefault0"
        },
        "minimum": {
            "type": "number"
        },
        "name": {
            "maxLength": 255,
            "type": "string"
        },
        "operators": {
            "items": {
                "type": "string"
            },
            "type": "array"
        },
        "pattern": {
            "format": "regex",
            "type": "string"
        },
        "readonly": {
            "type": "boolean"
        },
        "required": {
            "$ref": "#/definitions/stringArray"
        },
        "title": {
            "type": "string"
        },
        "type": {
            "enum": [
                "array",
                "boolean",
                "integer",
                "number",
                "object",
                "string",
                null
            ],
            "type": "string"
        },
        "uniqueItems": {
            "default": false,
            "type": "boolean"
        }
    },
    "required": [
        "type",
        "title",
        "name"
    ]
}
GET
/v2/schemas/metadefs/properties

显示元数据定义属性模式

显示表示元数据定义属性实体的 JSON 模式文档。

属性实体是属性实体的容器。

以下模式文档是一个示例。权威响应是 API 调用的实际响应。

正常响应代码:200 错误响应代码:400, 401

请求

没有请求参数。调用不接受请求体。

响应示例

{
    "definitions": {
        "positiveInteger": {
            "minimum": 0,
            "type": "integer"
        },
        "positiveIntegerDefault0": {
            "allOf": [
                {
                    "$ref": "#/definitions/positiveInteger"
                },
                {
                    "default": 0
                }
            ]
        },
        "stringArray": {
            "items": {
                "type": "string"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
        }
    },
    "links": [
        {
            "href": "{first}",
            "rel": "first"
        },
        {
            "href": "{next}",
            "rel": "next"
        },
        {
            "href": "{schema}",
            "rel": "describedby"
        }
    ],
    "name": "properties",
    "properties": {
        "first": {
            "type": "string"
        },
        "next": {
            "type": "string"
        },
        "properties": {
            "additionalProperties": {
                "additionalProperties": false,
                "name": "property",
                "properties": {
                    "additionalItems": {
                        "type": "boolean"
                    },
                    "default": {},
                    "description": {
                        "type": "string"
                    },
                    "enum": {
                        "type": "array"
                    },
                    "items": {
                        "properties": {
                            "enum": {
                                "type": "array"
                            },
                            "type": {
                                "enum": [
                                    "array",
                                    "boolean",
                                    "integer",
                                    "number",
                                    "object",
                                    "string",
                                    null
                                ],
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "maxItems": {
                        "$ref": "#/definitions/positiveInteger"
                    },
                    "maxLength": {
                        "$ref": "#/definitions/positiveInteger"
                    },
                    "maximum": {
                        "type": "number"
                    },
                    "minItems": {
                        "$ref": "#/definitions/positiveIntegerDefault0"
                    },
                    "minLength": {
                        "$ref": "#/definitions/positiveIntegerDefault0"
                    },
                    "minimum": {
                        "type": "number"
                    },
                    "name": {
                        "maxLength": 255,
                        "type": "string"
                    },
                    "operators": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "pattern": {
                        "format": "regex",
                        "type": "string"
                    },
                    "readonly": {
                        "type": "boolean"
                    },
                    "required": {
                        "$ref": "#/definitions/stringArray"
                    },
                    "title": {
                        "type": "string"
                    },
                    "type": {
                        "enum": [
                            "array",
                            "boolean",
                            "integer",
                            "number",
                            "object",
                            "string",
                            null
                        ],
                        "type": "string"
                    },
                    "uniqueItems": {
                        "default": false,
                        "type": "boolean"
                    }
                },
                "required": [
                    "type",
                    "title"
                ]
            },
            "type": "object"
        },
        "schema": {
            "type": "string"
        }
    }
}
GET
/v2/schemas/metadefs/tag

显示元数据定义标签模式

显示表示元数据定义标签实体的 JSON 模式文档。

以下模式文档是一个示例。权威响应是 API 调用的实际响应。

正常响应代码:200

错误响应代码:400, 401

请求

没有请求参数。调用不接受请求体。

响应示例

{
    "additionalProperties": false,
    "name": "tag",
    "properties": {
        "created_at": {
            "description": "Date and time of tag creation",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
        },
        "name": {
            "maxLength": 255,
            "type": "string"
        },
        "updated_at": {
            "description": "Date and time of the last tag modification",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
        }
    },
    "required": [
        "name"
    ]
}
GET
/v2/schemas/metadefs/tags

显示元数据定义标签模式

显示表示元数据定义标签实体的 JSON 模式文档。

标签实体是标签实体的容器。

以下模式文档是一个示例。权威响应是 API 调用的实际响应。

正常响应代码:200

错误响应代码:400, 401

请求

没有请求参数。调用不接受请求体。

响应示例

{
    "links": [
        {
            "href": "{first}",
            "rel": "first"
        },
        {
            "href": "{next}",
            "rel": "next"
        },
        {
            "href": "{schema}",
            "rel": "describedby"
        }
    ],
    "name": "tags",
    "properties": {
        "first": {
            "type": "string"
        },
        "next": {
            "type": "string"
        },
        "schema": {
            "type": "string"
        },
        "tags": {
            "items": {
                "additionalProperties": false,
                "name": "tag",
                "properties": {
                    "created_at": {
                        "description": "Date and time of tag creation",
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    },
                    "name": {
                        "maxLength": 255,
                        "type": "string"
                    },
                    "updated_at": {
                        "description": "Date and time of the last tag modification",
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                    }
                },
                "required": [
                    "name"
                ]
            },
            "type": "array"
        }
    }
}