Add missing operationId in swagger.yaml (#14722)

Add operationId for systeminfo api
Add operationId for configure api
Update api test after adding operationId

Fixes #14617

Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
stonezdj(Daojun Zhang) 2021-04-27 12:35:00 +08:00 committed by GitHub
parent af12f9aa01
commit 46dcf7b0cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 10 deletions

View File

@ -196,6 +196,7 @@ paths:
/internalconfig:
get:
summary: Get internal configurations.
operationId: getInternalconfig
description: |
This endpoint is for retrieving system configurations that only provides for internal api call.
tags:
@ -216,6 +217,7 @@ paths:
/configurations:
get:
summary: Get system configurations.
operationId: getConfigurations
description: |
This endpoint is for retrieving system configurations that only provides for admin user.
tags:
@ -235,6 +237,7 @@ paths:
description: Unexpected internal errors.
put:
summary: Modify system configurations.
operationId: updateConfigurations
description: |
This endpoint is for modifying system configurations that only provides for admin user.
tags:
@ -3607,6 +3610,7 @@ paths:
/systeminfo:
get:
summary: Get general system info
operationId: getSystemInfo
description: |
This API is for retrieving general system info, this can be called by anonymous request. Some attributes will be omitted in the response when this API is called by anonymous request.
tags:
@ -3621,6 +3625,7 @@ paths:
/systeminfo/volumes:
get:
summary: Get system volume info (total/free size).
operationId: getVolumes
description: |
This endpoint is for retrieving system volume info that only provides for admin user. Note that the response only reflects the storage status of local disk.
tags:
@ -3641,6 +3646,7 @@ paths:
/systeminfo/getcert:
get:
summary: Get default root certificate.
operationId: getCert
description: |
This endpoint is for downloading a default root certificate.
tags:

View File

@ -70,7 +70,7 @@ func (c *configAPI) GetConfigurations(ctx context.Context, params configure.GetC
return configure.NewGetConfigurationsOK().WithPayload(payload)
}
func (c *configAPI) PutConfigurations(ctx context.Context, params configure.PutConfigurationsParams) middleware.Responder {
func (c *configAPI) UpdateConfigurations(ctx context.Context, params configure.UpdateConfigurationsParams) middleware.Responder {
if err := c.RequireSystemAccess(ctx, rbac.ActionUpdate, rbac.ResourceConfiguration); err != nil {
return c.SendError(ctx, err)
}
@ -82,7 +82,7 @@ func (c *configAPI) PutConfigurations(ctx context.Context, params configure.PutC
if err != nil {
return c.SendError(ctx, err)
}
return configure.NewPutConfigurationsOK()
return configure.NewUpdateConfigurationsOK()
}
func (c *configAPI) GetInternalconfig(ctx context.Context, params configure.GetInternalconfigParams) middleware.Responder {

View File

@ -22,7 +22,7 @@ func newSystemInfoAPI() *sysInfoAPI {
}
}
func (s *sysInfoAPI) GetSysteminfo(ctx context.Context, params systeminfo.GetSysteminfoParams) middleware.Responder {
func (s *sysInfoAPI) GetSystemInfo(ctx context.Context, params systeminfo.GetSystemInfoParams) middleware.Responder {
opt := si.Options{}
sc, ok := security.FromContext(ctx)
if ok && sc.IsAuthenticated() {
@ -32,18 +32,18 @@ func (s *sysInfoAPI) GetSysteminfo(ctx context.Context, params systeminfo.GetSys
if err != nil {
return s.SendError(ctx, err)
}
return systeminfo.NewGetSysteminfoOK().WithPayload(s.convertInfo(data))
return systeminfo.NewGetSystemInfoOK().WithPayload(s.convertInfo(data))
}
func (s *sysInfoAPI) GetSysteminfoGetcert(ctx context.Context, params systeminfo.GetSysteminfoGetcertParams) middleware.Responder {
func (s *sysInfoAPI) GetCert(ctx context.Context, params systeminfo.GetCertParams) middleware.Responder {
f, err := s.ctl.GetCA(ctx)
if err != nil {
return s.SendError(ctx, err)
}
return systeminfo.NewGetSysteminfoGetcertOK().WithContentDisposition("attachment; filename=ca.crt").WithPayload(f)
return systeminfo.NewGetCertOK().WithContentDisposition("attachment; filename=ca.crt").WithPayload(f)
}
func (s *sysInfoAPI) GetSysteminfoVolumes(ctx context.Context, params systeminfo.GetSysteminfoVolumesParams) middleware.Responder {
func (s *sysInfoAPI) GetVolumes(ctx context.Context, params systeminfo.GetVolumesParams) middleware.Responder {
if err := s.RequireSystemAccess(ctx, rbac.ActionRead, rbac.ResourceSystemVolumes); err != nil {
return s.SendError(ctx, err)
}
@ -51,7 +51,7 @@ func (s *sysInfoAPI) GetSysteminfoVolumes(ctx context.Context, params systeminfo
if err != nil {
return s.SendError(ctx, err)
}
return systeminfo.NewGetSysteminfoVolumesOK().WithPayload(&models.SystemInfo{
return systeminfo.NewGetVolumesOK().WithPayload(&models.SystemInfo{
Storage: []*models.Storage{
{
Free: c.Free,

View File

@ -27,7 +27,7 @@ def set_configurations(client, expect_status_code = 200, expect_response_body =
conf["ldap_group_admin_dn"] = config.get("ldap_group_admin_dn")
try:
_, status_code, _ = client.configurations_put_with_http_info(conf)
_, status_code, _ = client.update_configurations_with_http_info(conf)
except ApiException as e:
base._assert_status_code(expect_status_code, e.status)
if expect_response_body is not None:
@ -44,7 +44,7 @@ class Configurations(base.Base, object):
client = self._get_client(**kwargs)
try:
data, status_code, _ = client.configurations_get_with_http_info()
data, status_code, _ = client.get_configurations_with_http_info()
except ApiException as e:
base._assert_status_code(expect_status_code, e.status)
if expect_response_body is not None: