Skip to content

Commit 05cd407

Browse files
authored
Merge pull request ceph#57462 from rhcs-dashboard/rgw-policy-group
mgr/dashboard: rgw policy group management api Reviewed-by: Pedro Gonzalez Gomez <[email protected]> Reviewed-by: Ankush Behl <[email protected]>
2 parents 6e2527c + 73db54b commit 05cd407

File tree

3 files changed

+683
-4
lines changed

3 files changed

+683
-4
lines changed

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

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
from ..services.rgw_client import NoRgwDaemonsException, RgwClient, RgwMultisite
1818
from ..tools import json_str_to_object, str_to_bool
1919
from . import APIDoc, APIRouter, BaseController, CreatePermission, \
20-
CRUDCollectionMethod, CRUDEndpoint, Endpoint, EndpointDoc, ReadPermission, \
21-
RESTController, UIRouter, UpdatePermission, allow_empty_body
20+
CRUDCollectionMethod, CRUDEndpoint, DeletePermission, Endpoint, \
21+
EndpointDoc, ReadPermission, RESTController, UIRouter, UpdatePermission, \
22+
allow_empty_body
2223
from ._crud import CRUDMeta, Form, FormField, FormTaskInfo, Icon, MethodType, \
2324
TableAction, Validator, VerticalContainer
2425
from ._version import APIVersion
@@ -114,15 +115,98 @@ def migrate(self, daemon_name=None, realm_name=None, zonegroup_name=None, zone_n
114115

115116
@APIRouter('rgw/multisite', Scope.RGW)
116117
@APIDoc("RGW Multisite Management API", "RgwMultisite")
117-
class RgwMultisiteSyncStatus(RESTController):
118-
@RESTController.Collection(method='GET', path='/sync_status')
118+
class RgwMultisiteController(RESTController):
119+
@Endpoint(path='/sync_status')
120+
@EndpointDoc("Get the sync status")
121+
@ReadPermission
119122
@allow_empty_body
120123
# pylint: disable=W0102,W0613
121124
def get_sync_status(self):
122125
multisite_instance = RgwMultisite()
123126
result = multisite_instance.get_multisite_sync_status()
124127
return result
125128

129+
@Endpoint(path='/sync-policy')
130+
@EndpointDoc("Get the sync policy")
131+
@ReadPermission
132+
def get_sync_policy(self, bucket_name='', zonegroup_name=''):
133+
multisite_instance = RgwMultisite()
134+
return multisite_instance.get_sync_policy(bucket_name, zonegroup_name)
135+
136+
@Endpoint(path='/sync-policy-group')
137+
@EndpointDoc("Get the sync policy group")
138+
@ReadPermission
139+
def get_sync_policy_group(self, group_id: str, bucket_name=''):
140+
multisite_instance = RgwMultisite()
141+
return multisite_instance.get_sync_policy_group(group_id, bucket_name)
142+
143+
@Endpoint(method='POST', path='/sync-policy-group')
144+
@EndpointDoc("Create the sync policy group")
145+
@CreatePermission
146+
def create_sync_policy_group(self, group_id: str, status: str, bucket_name=''):
147+
multisite_instance = RgwMultisite()
148+
return multisite_instance.create_sync_policy_group(group_id, status, bucket_name)
149+
150+
@Endpoint(method='PUT', path='/sync-policy-group')
151+
@EndpointDoc("Update the sync policy group")
152+
@UpdatePermission
153+
def update_sync_policy_group(self, group_id: str, status: str, bucket_name=''):
154+
multisite_instance = RgwMultisite()
155+
return multisite_instance.update_sync_policy_group(group_id, status, bucket_name)
156+
157+
@Endpoint(method='DELETE', path='/sync-policy-group')
158+
@EndpointDoc("Remove the sync policy group")
159+
@DeletePermission
160+
def remove_sync_policy_group(self, group_id: str, bucket_name=''):
161+
multisite_instance = RgwMultisite()
162+
return multisite_instance.remove_sync_policy_group(group_id, bucket_name)
163+
164+
@Endpoint(method='PUT', path='/sync-flow')
165+
@EndpointDoc("Create or update the sync flow")
166+
@CreatePermission
167+
def create_sync_flow(self, flow_id: str, flow_type: str, group_id: str,
168+
source_zone='', destination_zone='', zones: Optional[List[str]] = None,
169+
bucket_name=''):
170+
multisite_instance = RgwMultisite()
171+
return multisite_instance.create_sync_flow(group_id, flow_id, flow_type, zones,
172+
bucket_name, source_zone, destination_zone)
173+
174+
@Endpoint(method='DELETE', path='/sync-flow')
175+
@EndpointDoc("Remove the sync flow")
176+
@DeletePermission
177+
def remove_sync_flow(self, flow_id: str, flow_type: str, group_id: str,
178+
source_zone='', destination_zone='', zones: Optional[List[str]] = None,
179+
bucket_name=''):
180+
multisite_instance = RgwMultisite()
181+
return multisite_instance.remove_sync_flow(group_id, flow_id, flow_type, source_zone,
182+
destination_zone, zones, bucket_name)
183+
184+
@Endpoint(method='PUT', path='/sync-pipe')
185+
@EndpointDoc("Create or update the sync pipe")
186+
@CreatePermission
187+
def create_sync_pipe(self, group_id: str, pipe_id: str,
188+
source_zones: Optional[List[str]] = None,
189+
destination_zones: Optional[List[str]] = None,
190+
destination_buckets: Optional[List[str]] = None,
191+
bucket_name: str = ''):
192+
multisite_instance = RgwMultisite()
193+
return multisite_instance.create_sync_pipe(group_id, pipe_id, source_zones,
194+
destination_zones, destination_buckets,
195+
bucket_name)
196+
197+
@Endpoint(method='DELETE', path='/sync-pipe')
198+
@EndpointDoc("Remove the sync pipe")
199+
@DeletePermission
200+
def remove_sync_pipe(self, group_id: str, pipe_id: str,
201+
source_zones: Optional[List[str]] = None,
202+
destination_zones: Optional[List[str]] = None,
203+
destination_buckets: Optional[List[str]] = None,
204+
bucket_name: str = ''):
205+
multisite_instance = RgwMultisite()
206+
return multisite_instance.remove_sync_pipe(group_id, pipe_id, source_zones,
207+
destination_zones, destination_buckets,
208+
bucket_name)
209+
126210

127211
@APIRouter('/rgw/daemon', Scope.RGW)
128212
@APIDoc("RGW Daemon Management API", "RgwDaemon")

0 commit comments

Comments
 (0)