如何使用openstacksdk资源中的`resource_key`和`resources_key`?

How to use the `resource_key ` and `resources_key ` in openstacksdk Resource?

如何使用openstacksdk资源中的resource_keyresources_key

openstack/compute/v2/Image中:

class Image(resource2.Resource, metadata.MetadataMixin):
    resource_key = 'image'
    resources_key = 'images'
    base_path = '/images'
    service = compute_service.ComputeService()

    # capabilities
    allow_get = True
    allow_delete = True
    allow_list = True

resource_keyresources_keybase_path。 这个代表是像rest_framework这样的资源路径吗?

如何在openstacksdk中使用resource_keyresources_keybase_path

resource_key 和 resources_key 用于与后端服务(例如 nova 计算、cinder 存储)的内部交互。用户不应直接使用它们。

但是,如果您打算帮助改进 openstacksdk,您需要了解 resources_key 是您的 URL 路径的组件,用于对对象集合进行操作,而 resource_key 是您与特定实例交互的另一个路径组件。阅读一些原始 API 设计将有助于您理解它。