Merge pull request #1146 from wknet123/dev-update-swagger

Updates Swagger YAML for new added API.
NMT
This commit is contained in:
yhua123 2016-12-08 15:44:39 +08:00 committed by GitHub
commit ead0985d20
2 changed files with 60 additions and 2 deletions

View File

@ -1309,7 +1309,45 @@ paths:
403:
description: User does not have permission of admin role.
500:
description: Unexpected internal errors.
description: Unexpected internal errors.
/systeminfo/volumes:
get:
summary: Get system volume info (total/free size).
description: |
This endpoint is for retrieving system volume info that only provides for admin user.
tags:
- Products
responses:
200:
description: Get system volumes successfully.
schema:
type: object
items:
$ref: '#/definitions/SystemInfo'
401:
description: User need to log in first.
403:
description: User does not have permission of admin role.
500:
description: Unexpected internal errors.
/systeminfo/getcert:
get:
summary: Get default root certificate under OVA deployment.
description: |
This endpoint is for downloading a default root certificate that only provides for admin user under OVA deployment.
tags:
- Products
responses:
200:
description: Get default root certificate successfully.
401:
description: User need to log in first.
403:
description: User does not have permission of admin role.
404:
description: Not found the default root certificate.
500:
description: Unexpected internal errors.
definitions:
Search:
type: object
@ -1741,3 +1779,22 @@ definitions:
comment:
type: string
description: The new comment.
Storage:
type: object
properties:
total:
type: integer
format: int64
description: Total volume size.
free:
type: integer
format: int64
description: Free volume size.
SystemInfo:
type: object
properties:
storage:
type: array
description: The storage of system.
items:
$ref: '#/definitions/Storage'

View File

@ -73,6 +73,7 @@ func (sia *SystemInfoAPI) GetVolumeInfo() {
func (sia *SystemInfoAPI) GetCert() {
if sia.isAdmin {
if _, err := os.Stat(defaultRootCert); !os.IsNotExist(err) {
sia.Ctx.Output.Header("Content-Type", "application/octet-stream")
sia.Ctx.Output.Header("Content-Disposition", "attachment; filename=ca.crt")
http.ServeFile(sia.Ctx.ResponseWriter, sia.Ctx.Request, defaultRootCert)
} else {
@ -80,5 +81,5 @@ func (sia *SystemInfoAPI) GetCert() {
sia.CustomAbort(http.StatusNotFound, "No certificate found.")
}
}
sia.CustomAbort(http.StatusUnauthorized, "")
sia.CustomAbort(http.StatusForbidden, "")
}