diff options
author | Nizamudeen A <nia@redhat.com> | 2023-10-18 08:38:21 +0200 |
---|---|---|
committer | Nizamudeen A <nia@redhat.com> | 2023-11-27 13:43:41 +0100 |
commit | 5c28d78a45d87d2be6b9ea2961be42689673e252 (patch) | |
tree | 3ceebd5b875bb2191b87791c725fde5feb3c7b91 /src/pybind/mgr/dashboard/services | |
parent | mgr/dashboard: support rgw roles removal (diff) | |
download | ceph-5c28d78a45d87d2be6b9ea2961be42689673e252.tar.xz ceph-5c28d78a45d87d2be6b9ea2961be42689673e252.zip |
mgr/dashboard: support rgw roles updating
Right now only the modification of max_session_duration is supported via
the roles update command. To update, we need to use `policy modify`
command which is not added in this PR. That should be done separately
Refer: https://docs.ceph.com/en/latest/radosgw/role/#update-a-role
Fixes: https://tracker.ceph.com/issues/63230
Signed-off-by: Nizamudeen A <nia@redhat.com>
Diffstat (limited to 'src/pybind/mgr/dashboard/services')
-rw-r--r-- | src/pybind/mgr/dashboard/services/rgw_client.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/pybind/mgr/dashboard/services/rgw_client.py b/src/pybind/mgr/dashboard/services/rgw_client.py index fe7b8c66898..6358d397976 100644 --- a/src/pybind/mgr/dashboard/services/rgw_client.py +++ b/src/pybind/mgr/dashboard/services/rgw_client.py @@ -851,7 +851,24 @@ class RgwClient(RestClient): 'Looks like the document has a wrong format.' f' For more information about the format look at {link}') raise DashboardException(msg=msg, component='rgw') - + + def get_role(self, role_name: str): + rgw_get_role_command = ['role', 'get', '--role-name', role_name] + code, role, _err = mgr.send_rgwadmin_command(rgw_get_role_command) + if code != 0: + raise DashboardException(msg=f'Error getting role with code {code}: {_err}', + component='rgw') + return role + + def update_role(self, role_name: str, max_session_duration: str): + rgw_update_role_command = ['role', 'update', '--role-name', + role_name, '--max_session_duration', max_session_duration] + code, _, _err = mgr.send_rgwadmin_command(rgw_update_role_command, + stdout_as_json=False) + if code != 0: + raise DashboardException(msg=f'Error updating role with code {code}: {_err}', + component='rgw') + def delete_role(self, role_name: str) -> None: rgw_delete_role_command = ['role', 'delete', '--role-name', role_name] code, _, _err = mgr.send_rgwadmin_command(rgw_delete_role_command, |