Skip to content

Commit 73db54b

Browse files
committed
mgr/dashboard: manage flow and pipes apis
Fixes: https://tracker.ceph.com/issues/66238 Signed-off-by: Nizamudeen A <[email protected]>
1 parent 73a7602 commit 73db54b

File tree

3 files changed

+594
-22
lines changed

3 files changed

+594
-22
lines changed

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

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
from ..security import Permission, Scope
1515
from ..services.auth import AuthManager, JwtManager
1616
from ..services.ceph_service import CephService
17-
from ..services.rgw_client import NoRgwDaemonsException, RgwClient, RgwMultisite, \
18-
SyncStatus
17+
from ..services.rgw_client import NoRgwDaemonsException, RgwClient, RgwMultisite
1918
from ..tools import json_str_to_object, str_to_bool
2019
from . import APIDoc, APIRouter, BaseController, CreatePermission, \
21-
CRUDCollectionMethod, CRUDEndpoint, Endpoint, EndpointDoc, ReadPermission, \
22-
RESTController, UIRouter, UpdatePermission, allow_empty_body, DeletePermission
20+
CRUDCollectionMethod, CRUDEndpoint, DeletePermission, Endpoint, \
21+
EndpointDoc, ReadPermission, RESTController, UIRouter, UpdatePermission, \
22+
allow_empty_body
2323
from ._crud import CRUDMeta, Form, FormField, FormTaskInfo, Icon, MethodType, \
2424
TableAction, Validator, VerticalContainer
2525
from ._version import APIVersion
@@ -118,6 +118,7 @@ def migrate(self, daemon_name=None, realm_name=None, zonegroup_name=None, zone_n
118118
class RgwMultisiteController(RESTController):
119119
@Endpoint(path='/sync_status')
120120
@EndpointDoc("Get the sync status")
121+
@ReadPermission
121122
@allow_empty_body
122123
# pylint: disable=W0102,W0613
123124
def get_sync_status(self):
@@ -128,9 +129,9 @@ def get_sync_status(self):
128129
@Endpoint(path='/sync-policy')
129130
@EndpointDoc("Get the sync policy")
130131
@ReadPermission
131-
def get_sync_policy(self, bucket_name = ''):
132+
def get_sync_policy(self, bucket_name='', zonegroup_name=''):
132133
multisite_instance = RgwMultisite()
133-
return multisite_instance.get_sync_policy(bucket_name)
134+
return multisite_instance.get_sync_policy(bucket_name, zonegroup_name)
134135

135136
@Endpoint(path='/sync-policy-group')
136137
@EndpointDoc("Get the sync policy group")
@@ -142,14 +143,14 @@ def get_sync_policy_group(self, group_id: str, bucket_name=''):
142143
@Endpoint(method='POST', path='/sync-policy-group')
143144
@EndpointDoc("Create the sync policy group")
144145
@CreatePermission
145-
def create_sync_policy_group(self, group_id: str, status: SyncStatus, bucket_name=''):
146+
def create_sync_policy_group(self, group_id: str, status: str, bucket_name=''):
146147
multisite_instance = RgwMultisite()
147148
return multisite_instance.create_sync_policy_group(group_id, status, bucket_name)
148149

149150
@Endpoint(method='PUT', path='/sync-policy-group')
150151
@EndpointDoc("Update the sync policy group")
151152
@UpdatePermission
152-
def update_sync_policy_group(self, group_id: str, status: SyncStatus, bucket_name=''):
153+
def update_sync_policy_group(self, group_id: str, status: str, bucket_name=''):
153154
multisite_instance = RgwMultisite()
154155
return multisite_instance.update_sync_policy_group(group_id, status, bucket_name)
155156

@@ -160,6 +161,52 @@ def remove_sync_policy_group(self, group_id: str, bucket_name=''):
160161
multisite_instance = RgwMultisite()
161162
return multisite_instance.remove_sync_policy_group(group_id, bucket_name)
162163

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+
163210

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

0 commit comments

Comments
 (0)