From 0056edb81d217fd1b5ea3d86d09b69372e94e112 Mon Sep 17 00:00:00 2001 From: ioito Date: Mon, 16 Sep 2019 14:50:29 +0800 Subject: [PATCH] hotfix: add storagecache api docs --- docs/index.yaml | 7 ++++ docs/parameters/common.yaml | 10 +++++ docs/parameters/storagecache.yaml | 22 +++++++++++ docs/schemas/storage.yaml | 2 +- docs/schemas/storagecache.yaml | 56 ++++++++++++++++++++++++++++ docs/storage/storage.yaml | 2 +- docs/storagecache/cache-image.yaml | 14 +++++++ docs/storagecache/storagecache.yaml | 11 ++++++ docs/storagecache/storagecaches.yaml | 19 ++++++++++ 9 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 docs/parameters/storagecache.yaml create mode 100644 docs/schemas/storagecache.yaml create mode 100644 docs/storagecache/cache-image.yaml create mode 100644 docs/storagecache/storagecache.yaml create mode 100644 docs/storagecache/storagecaches.yaml diff --git a/docs/index.yaml b/docs/index.yaml index 3873b27a40..8b63ea84ec 100644 --- a/docs/index.yaml +++ b/docs/index.yaml @@ -49,6 +49,13 @@ paths: /storages/{storageId}/offline: $ref: "./storage/storage.yaml#/offline" + /storagecaches: + $ref: "./storagecache/storagecaches.yaml" + /storagecaches/{storagecacheId}: + $ref: "./storagecache/storagecache.yaml" + /storagecaches/{storagecacheId}/cache-image: + $ref: "./storagecache/cache-image.yaml" + /disks: $ref: "./disk/disks.yaml" /disks/{diskId}: diff --git a/docs/parameters/common.yaml b/docs/parameters/common.yaml index 91f519c168..a6baa8bd61 100644 --- a/docs/parameters/common.yaml +++ b/docs/parameters/common.yaml @@ -131,3 +131,13 @@ private_cloud: in: query type: boolean description: 过滤公有云资源 +is_on_premise: + name: is_on_premise + in: query + type: boolean + description: 过滤本地IDC资源 +is_managed: + name: is_managed + in: query + type: boolean + description: 过滤通过云账号导入进来的资源 diff --git a/docs/parameters/storagecache.yaml b/docs/parameters/storagecache.yaml new file mode 100644 index 0000000000..7765142f06 --- /dev/null +++ b/docs/parameters/storagecache.yaml @@ -0,0 +1,22 @@ +storagecacheId: + name: storagecacheId + required: true + in: path + type: string + description: 存储缓存名称或ID +image: + name: image + in: body + required: true + type: string + description: 镜像名称或ID +is_force: + name: is_force + in: body + type: string + description: 是否强制缓存镜像(会覆盖之前已缓存的镜像) +format: + name: format + in: body + type: string + description: 缓存镜像的格式(有的云对镜像有特殊格式要求,会导致此参数失效) diff --git a/docs/schemas/storage.yaml b/docs/schemas/storage.yaml index 7c16729e9e..c144f4d814 100644 --- a/docs/schemas/storage.yaml +++ b/docs/schemas/storage.yaml @@ -95,7 +95,7 @@ Storage: is_emulated: type: boolean example: false - description: 是否是虚拟出来的实例 + description: 是否是虚拟出来的存储 provider: type: string example: Qcloud diff --git a/docs/schemas/storagecache.yaml b/docs/schemas/storagecache.yaml new file mode 100644 index 0000000000..741f5f420b --- /dev/null +++ b/docs/schemas/storagecache.yaml @@ -0,0 +1,56 @@ +StorageCacheResponse: + type: object + properties: + storagecache: + type: object + $ref: '#/StorageCache' + +StorageCache: + type: object + description: 存储缓存 + properties: + id: + type: string + example: f227c4ce-6870-19f3-8257-f53e63f40361 + description: 存储缓存uuid + readOnly: true + name: + type: string + description: 存储h缓存名称 + example: storage-r4hilqks + readOnly: true + is_emulated: + type: boolean + example: false + description: 是否是虚拟出来的缓存 + update_version: + type: integer + example: 2 + description: 资源被更新的次数 + updated_at: + type: string + example: "2019-05-30T06:36:39.000000Z" + description: 资源最近一次更新时间 + external_id: + type: string + example: f27b21ea-514e-4933-8ff5-4bf0c261873a-Huawei/ap-southeast-1 + description: 外部id + path: + type: string + example: /vmfs/volumes/5a017148-0fa691a9-6b8a-0022b70cc59e/image_cache + description: 镜像存储位置 + +StorageCacheListResponse: + type: object + properties: + limit: + type: integer + example: 20 + storagecachess: + type: array + items: + $ref: '#/StorageCache' + total: + type: integer + example: 124 + diff --git a/docs/storage/storage.yaml b/docs/storage/storage.yaml index b8665a13ec..06a4fac1dc 100644 --- a/docs/storage/storage.yaml +++ b/docs/storage/storage.yaml @@ -88,4 +88,4 @@ offline: schema: $ref: '../schemas/storage.yaml#/StorageResponse' tags: - - storages \ No newline at end of file + - storages diff --git a/docs/storagecache/cache-image.yaml b/docs/storagecache/cache-image.yaml new file mode 100644 index 0000000000..6fff7528e7 --- /dev/null +++ b/docs/storagecache/cache-image.yaml @@ -0,0 +1,14 @@ +post: + summary: 缓存镜像到此存储缓存上 + parameters: + - $ref: "../parameters/storagecache.yaml#/storagecacheId" + - $ref: "../parameters/storagecache.yaml#/image" + - $ref: "../parameters/storagecache.yaml#/is_force" + - $ref: "../parameters/storagecache.yaml#/format" + responses: + 200: + description: 存储缓存信息 + schema: + $ref: "../schemas/storagecache.yaml#StorageCacheResponse" + tags: + - storagecaches diff --git a/docs/storagecache/storagecache.yaml b/docs/storagecache/storagecache.yaml new file mode 100644 index 0000000000..ee6d2a80d6 --- /dev/null +++ b/docs/storagecache/storagecache.yaml @@ -0,0 +1,11 @@ +get: + summary: 获取指定存储缓存详情信息 + parameters: + - $ref: '../parameters/storagecache.yaml#/storagecacheId' + responses: + 200: + description: 存储缓存详情信息 + schema: + $ref: '../schemas/storagecache.yaml#/StorageCacheResponse' + tags: + - storagecaches diff --git a/docs/storagecache/storagecaches.yaml b/docs/storagecache/storagecaches.yaml new file mode 100644 index 0000000000..cf8f4c2225 --- /dev/null +++ b/docs/storagecache/storagecaches.yaml @@ -0,0 +1,19 @@ +get: + summary: 按指定条件列出存储缓存列表 + parameters: + - $ref: '../parameters/common.yaml#/limit' + - $ref: '../parameters/common.yaml#/offset' + - $ref: '../parameters/common.yaml#/cloudprovider' + - $ref: '../parameters/common.yaml#/cloudaccount' + - $ref: '../parameters/common.yaml#/provider' + - $ref: '../parameters/common.yaml#/brand' + - $ref: '../parameters/common.yaml#/cloud_env' + - $ref: '../parameters/common.yaml#/is_on_premise' + - $ref: '../parameters/common.yaml#/is_managed' + responses: + 200: + description: 存储缓存列表信息 + schema: + $ref: '../schemas/storagecache.yaml#/StorageCacheListResponse' + tags: + - storagecaches