Skip to content

Commit d8ce3da

Browse files
committed
mgr/dashboard: fix ceph-users api doc
Fixes: https://tracker.ceph.com/issues/67224 Signed-off-by: Nizamudeen A <[email protected]>
1 parent 59acb54 commit d8ce3da

File tree

2 files changed

+63
-25
lines changed

2 files changed

+63
-25
lines changed

src/pybind/mgr/dashboard/controllers/ceph_users.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from ..security import Scope
77
from ..services.ceph_service import CephService, SendCommandError
88
from . import APIDoc, APIRouter, CRUDCollectionMethod, CRUDEndpoint, \
9-
EndpointDoc, RESTController, SecretStr
9+
EndpointDoc, Param, RESTController, SecretStr
1010
from ._crud import ArrayHorizontalContainer, CRUDMeta, Form, FormField, \
1111
FormTaskInfo, Icon, MethodType, SelectionType, TableAction, Validator, \
1212
VerticalContainer
@@ -40,17 +40,15 @@ def _run_auth_command(command: str, *args, **kwargs):
4040
@staticmethod
4141
def user_list(_):
4242
"""
43-
Get list of ceph users and its respective data
43+
Get list of ceph users and its associated data
4444
"""
4545
return CephUserEndpoints._run_auth_command('auth ls')["auth_dump"]
4646

4747
@staticmethod
4848
def user_create(_, user_entity: str = '', capabilities: Optional[List[Cap]] = None,
4949
import_data: str = ''):
5050
"""
51-
Add a ceph user with its defined capabilities.
52-
:param user_entity: Entity to change
53-
:param capabilities: List of capabilities to add to user_entity
51+
Add a Ceph user, with its defined capabilities.
5452
"""
5553
# Caps are represented as a vector in mon auth add commands.
5654
# Look at AuthMonitor.cc::valid_caps for reference.
@@ -75,7 +73,6 @@ def user_create(_, user_entity: str = '', capabilities: Optional[List[Cap]] = No
7573
def user_delete(_, user_entity: str):
7674
"""
7775
Delete a ceph user and it's defined capabilities.
78-
:param user_entity: Entity to delete
7976
"""
8077
logger.debug("Sending command 'auth del' of entity '%s'", user_entity)
8178
CephUserEndpoints._run_auth_command('auth del', entity=user_entity)
@@ -94,8 +91,6 @@ def user_edit(_, user_entity: str = '', capabilities: List[Cap] = None):
9491
"""
9592
Change the ceph user capabilities.
9693
Setting new capabilities will overwrite current ones.
97-
:param user_entity: Entity to change
98-
:param capabilities: List of updated capabilities to user_entity
9994
"""
10095
caps = []
10196
for cap in capabilities:
@@ -188,19 +183,36 @@ def model(user_entity: str):
188183
resource='user',
189184
get_all=CRUDCollectionMethod(
190185
func=CephUserEndpoints.user_list,
191-
doc=EndpointDoc("Get Ceph Users")
186+
doc=EndpointDoc("Get list of ceph users")
192187
),
193188
create=CRUDCollectionMethod(
194189
func=CephUserEndpoints.user_create,
195-
doc=EndpointDoc("Create Ceph User")
190+
doc=EndpointDoc("Create Ceph User",
191+
parameters={
192+
"user_entity": Param(str, "Entity to add"),
193+
'capabilities': Param([{
194+
"entity": (str, "Entity to add"),
195+
"cap": (str, "Capability to add; eg. allow *")
196+
}], 'List of capabilities to add to user_entity')
197+
})
196198
),
197199
edit=CRUDCollectionMethod(
198200
func=CephUserEndpoints.user_edit,
199-
doc=EndpointDoc("Edit Ceph User")
201+
doc=EndpointDoc("Edit Ceph User Capabilities",
202+
parameters={
203+
"user_entity": Param(str, "Entity to edit"),
204+
'capabilities': Param([{
205+
"entity": (str, "Entity to edit"),
206+
"cap": (str, "Capability to edit; eg. allow *")
207+
}], 'List of updated capabilities to user_entity')
208+
})
200209
),
201210
delete=CRUDCollectionMethod(
202211
func=CephUserEndpoints.user_delete,
203-
doc=EndpointDoc("Delete Ceph User")
212+
doc=EndpointDoc("Delete Ceph User",
213+
parameters={
214+
"user_entity": Param(str, "Entity to delete")
215+
})
204216
),
205217
extra_endpoints=[
206218
('export', CRUDCollectionMethod(

src/pybind/mgr/dashboard/openapi.yaml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3691,7 +3691,7 @@ paths:
36913691
- Upgrade
36923692
/api/cluster/user:
36933693
get:
3694-
description: "\n Get list of ceph users and its respective data\n \
3694+
description: "\n Get list of ceph users and its associated data\n \
36953695
\ "
36963696
parameters: []
36973697
responses:
@@ -3711,26 +3711,39 @@ paths:
37113711
trace.
37123712
security:
37133713
- jwt: []
3714-
summary: Get Ceph Users
3714+
summary: Get list of ceph users
37153715
tags:
37163716
- Cluster
37173717
post:
3718-
description: "\n Add a ceph user with its defined capabilities.\n \
3719-
\ :param user_entity: Entity to change\n :param capabilities: List\
3720-
\ of capabilities to add to user_entity\n "
3718+
description: "\n Add a Ceph user, with its defined capabilities.\n \
3719+
\ "
37213720
parameters: []
37223721
requestBody:
37233722
content:
37243723
application/json:
37253724
schema:
37263725
properties:
37273726
capabilities:
3728-
type: string
3727+
description: List of capabilities to add to user_entity
3728+
items:
3729+
properties:
3730+
cap:
3731+
description: Capability to add; eg. allow *
3732+
type: string
3733+
entity:
3734+
description: Entity to add
3735+
type: string
3736+
required:
3737+
- entity
3738+
- cap
3739+
type: object
3740+
type: array
37293741
import_data:
37303742
default: ''
37313743
type: string
37323744
user_entity:
37333745
default: ''
3746+
description: Entity to add
37343747
type: string
37353748
type: object
37363749
responses:
@@ -3760,19 +3773,31 @@ paths:
37603773
- Cluster
37613774
put:
37623775
description: "\n Change the ceph user capabilities.\n Setting\
3763-
\ new capabilities will overwrite current ones.\n :param user_entity:\
3764-
\ Entity to change\n :param capabilities: List of updated capabilities\
3765-
\ to user_entity\n "
3776+
\ new capabilities will overwrite current ones.\n "
37663777
parameters: []
37673778
requestBody:
37683779
content:
37693780
application/json:
37703781
schema:
37713782
properties:
37723783
capabilities:
3773-
type: string
3784+
description: List of updated capabilities to user_entity
3785+
items:
3786+
properties:
3787+
cap:
3788+
description: Capability to edit; eg. allow *
3789+
type: string
3790+
entity:
3791+
description: Entity to edit
3792+
type: string
3793+
required:
3794+
- entity
3795+
- cap
3796+
type: object
3797+
type: array
37743798
user_entity:
37753799
default: ''
3800+
description: Entity to edit
37763801
type: string
37773802
type: object
37783803
responses:
@@ -3797,7 +3822,7 @@ paths:
37973822
trace.
37983823
security:
37993824
- jwt: []
3800-
summary: Edit Ceph User
3825+
summary: Edit Ceph User Capabilities
38013826
tags:
38023827
- Cluster
38033828
/api/cluster/user/export:
@@ -3841,9 +3866,10 @@ paths:
38413866
/api/cluster/user/{user_entity}:
38423867
delete:
38433868
description: "\n Delete a ceph user and it's defined capabilities.\n\
3844-
\ :param user_entity: Entity to delete\n "
3869+
\ "
38453870
parameters:
3846-
- in: path
3871+
- description: Entity to delete
3872+
in: path
38473873
name: user_entity
38483874
required: true
38493875
schema:

0 commit comments

Comments
 (0)