Skip to content

Commit 0e6ccd1

Browse files
authored
Merge pull request ceph#61075 from rhcs-dashboard/topicmanagment
mgr/dashboard: Add RGW topics endpoint creation for create ,delete and list in dashboard
2 parents 5f16ece + 94aebfc commit 0e6ccd1

File tree

4 files changed

+551
-2
lines changed

4 files changed

+551
-2
lines changed

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

Lines changed: 112 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
# pylint: disable=C0302
4+
45
import json
56
import logging
67
import re
@@ -16,7 +17,8 @@
1617
from ..services.auth import AuthManager, JwtManager
1718
from ..services.ceph_service import CephService
1819
from ..services.rgw_client import _SYNC_GROUP_ID, NoRgwDaemonsException, \
19-
RgwClient, RgwMultisite, RgwMultisiteAutomation, RgwRateLimit
20+
RgwClient, RgwMultisite, RgwMultisiteAutomation, RgwRateLimit, \
21+
RgwTopicmanagement
2022
from ..services.rgw_iam import RgwAccounts
2123
from ..services.service import RgwServiceManager, wait_for_daemon_to_start
2224
from ..tools import json_str_to_object, str_to_bool
@@ -1405,3 +1407,112 @@ def get_user_list(self, zoneName=None, realmName=None):
14051407
multisite_instance = RgwMultisite()
14061408
result = multisite_instance.get_user_list(zoneName, realmName)
14071409
return result
1410+
1411+
1412+
@APIRouter('/rgw/topic', Scope.RGW)
1413+
@APIDoc("RGW Topic Management API", "RGW Topic Management")
1414+
class RgwTopic(RESTController):
1415+
1416+
@EndpointDoc(
1417+
"Create a new RGW Topic",
1418+
parameters={
1419+
"name": (str, "Name of the topic"),
1420+
"push_endpoint": (str, "Push Endpoint"),
1421+
"opaque_data": (str, " opaque data"),
1422+
"persistent": (bool, "persistent"),
1423+
"time_to_live": (str, "Time to live"),
1424+
"max_retries": (str, "max retries"),
1425+
"retry_sleep_duration": (str, "retry sleep duration"),
1426+
"policy": (str, "policy"),
1427+
"verify_ssl": (bool, 'verify ssl'),
1428+
"cloud_events": (str, 'cloud events'),
1429+
"user": (str, 'user'),
1430+
"password": (str, 'password'),
1431+
"vhost": (str, 'vhost'),
1432+
"ca_location": (str, 'ca location'),
1433+
"amqp_exchange": (str, 'amqp exchange'),
1434+
"amqp_ack_level": (str, 'amqp ack level'),
1435+
"use_ssl": (bool, 'use ssl'),
1436+
"kafka_ack_level": (str, 'kafka ack level'),
1437+
"kafka_brokers": (str, 'kafka brokers'),
1438+
"mechanism": (str, 'mechanism'),
1439+
},
1440+
)
1441+
def create(
1442+
self,
1443+
name: str,
1444+
daemon_name=None,
1445+
owner=None,
1446+
push_endpoint: Optional[str] = None,
1447+
opaque_data: Optional[str] = None,
1448+
persistent: Optional[bool] = False,
1449+
time_to_live: Optional[str] = None,
1450+
max_retries: Optional[str] = None,
1451+
retry_sleep_duration: Optional[str] = None,
1452+
policy: Optional[str] = None,
1453+
verify_ssl: Optional[bool] = False,
1454+
cloud_events: Optional[bool] = False,
1455+
ca_location: Optional[str] = None,
1456+
amqp_exchange: Optional[str] = None,
1457+
amqp_ack_level: Optional[str] = None,
1458+
use_ssl: Optional[bool] = False,
1459+
kafka_ack_level: Optional[str] = None,
1460+
kafka_brokers: Optional[str] = None,
1461+
mechanism: Optional[str] = None
1462+
):
1463+
rgw_topic_instance = RgwClient.instance(owner, daemon_name=daemon_name)
1464+
return rgw_topic_instance.create_topic(
1465+
name=name,
1466+
push_endpoint=push_endpoint,
1467+
opaque_data=opaque_data,
1468+
persistent=persistent,
1469+
time_to_live=time_to_live,
1470+
max_retries=max_retries,
1471+
retry_sleep_duration=retry_sleep_duration,
1472+
policy=policy,
1473+
verify_ssl=verify_ssl,
1474+
cloud_events=cloud_events,
1475+
ca_location=ca_location,
1476+
amqp_exchange=amqp_exchange,
1477+
amqp_ack_level=amqp_ack_level,
1478+
use_ssl=use_ssl,
1479+
kafka_ack_level=kafka_ack_level,
1480+
kafka_brokers=kafka_brokers,
1481+
mechanism=mechanism
1482+
)
1483+
1484+
@EndpointDoc(
1485+
"Get RGW Topic List",
1486+
parameters={
1487+
"uid": (str, "Name of the user"),
1488+
"tenant": (str, "Name of the tenant"),
1489+
},
1490+
)
1491+
def list(self, uid: Optional[str] = None, tenant: Optional[str] = None):
1492+
rgw_topic_instance = RgwTopicmanagement()
1493+
result = rgw_topic_instance.list_topics(uid, tenant)
1494+
return result
1495+
1496+
@EndpointDoc(
1497+
"Get RGW Topic",
1498+
parameters={
1499+
"name": (str, "Name of the user"),
1500+
"tenant": (str, "Name of the tenant"),
1501+
},
1502+
)
1503+
def get(self, name: str, tenant: Optional[str] = None):
1504+
rgw_topic_instance = RgwTopicmanagement()
1505+
result = rgw_topic_instance.get_topic(name, tenant)
1506+
return result
1507+
1508+
@EndpointDoc(
1509+
"Delete RGW Topic",
1510+
parameters={
1511+
"name": (str, "Name of the user"),
1512+
"tenant": (str, "Name of the tenant"),
1513+
},
1514+
)
1515+
def delete(self, name: str, tenant: Optional[str] = None):
1516+
rgw_topic_instance = RgwTopicmanagement()
1517+
result = rgw_topic_instance.delete_topic(name=name, tenant=tenant)
1518+
return result

src/pybind/mgr/dashboard/openapi.yaml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12944,6 +12944,209 @@ paths:
1294412944
- jwt: []
1294512945
tags:
1294612946
- RgwSite
12947+
/api/rgw/topic:
12948+
get:
12949+
parameters:
12950+
- allowEmptyValue: true
12951+
description: Name of the user
12952+
in: query
12953+
name: uid
12954+
schema:
12955+
type: string
12956+
- allowEmptyValue: true
12957+
description: Name of the tenant
12958+
in: query
12959+
name: tenant
12960+
schema:
12961+
type: string
12962+
responses:
12963+
'200':
12964+
content:
12965+
application/vnd.ceph.api.v1.0+json:
12966+
type: object
12967+
description: OK
12968+
'400':
12969+
description: Operation exception. Please check the response body for details.
12970+
'401':
12971+
description: Unauthenticated access. Please login first.
12972+
'403':
12973+
description: Unauthorized access. Please check your permissions.
12974+
'500':
12975+
description: Unexpected error. Please check the response body for the stack
12976+
trace.
12977+
security:
12978+
- jwt: []
12979+
summary: Get RGW Topic List
12980+
tags:
12981+
- RGW Topic Management
12982+
post:
12983+
parameters: []
12984+
requestBody:
12985+
content:
12986+
application/json:
12987+
schema:
12988+
properties:
12989+
amqp_ack_level:
12990+
description: amqp ack level
12991+
type: string
12992+
amqp_exchange:
12993+
description: amqp exchange
12994+
type: string
12995+
ca_location:
12996+
description: ca location
12997+
type: string
12998+
cloud_events:
12999+
default: false
13000+
description: cloud events
13001+
type: string
13002+
daemon_name:
13003+
type: string
13004+
kafka_ack_level:
13005+
description: kafka ack level
13006+
type: string
13007+
kafka_brokers:
13008+
description: kafka brokers
13009+
type: string
13010+
max_retries:
13011+
description: max retries
13012+
type: string
13013+
mechanism:
13014+
description: mechanism
13015+
type: string
13016+
name:
13017+
description: Name of the topic
13018+
type: string
13019+
opaque_data:
13020+
description: ' opaque data'
13021+
type: string
13022+
owner:
13023+
type: string
13024+
persistent:
13025+
default: false
13026+
description: persistent
13027+
type: boolean
13028+
policy:
13029+
description: policy
13030+
type: string
13031+
push_endpoint:
13032+
description: Push Endpoint
13033+
type: string
13034+
retry_sleep_duration:
13035+
description: retry sleep duration
13036+
type: string
13037+
time_to_live:
13038+
description: Time to live
13039+
type: string
13040+
use_ssl:
13041+
default: false
13042+
description: use ssl
13043+
type: boolean
13044+
verify_ssl:
13045+
default: false
13046+
description: verify ssl
13047+
type: boolean
13048+
required:
13049+
- name
13050+
type: object
13051+
responses:
13052+
'201':
13053+
content:
13054+
application/vnd.ceph.api.v1.0+json:
13055+
type: object
13056+
description: Resource created.
13057+
'202':
13058+
content:
13059+
application/vnd.ceph.api.v1.0+json:
13060+
type: object
13061+
description: Operation is still executing. Please check the task queue.
13062+
'400':
13063+
description: Operation exception. Please check the response body for details.
13064+
'401':
13065+
description: Unauthenticated access. Please login first.
13066+
'403':
13067+
description: Unauthorized access. Please check your permissions.
13068+
'500':
13069+
description: Unexpected error. Please check the response body for the stack
13070+
trace.
13071+
security:
13072+
- jwt: []
13073+
summary: Create a new RGW Topic
13074+
tags:
13075+
- RGW Topic Management
13076+
/api/rgw/topic/{name}:
13077+
delete:
13078+
parameters:
13079+
- description: Name of the user
13080+
in: path
13081+
name: name
13082+
required: true
13083+
schema:
13084+
type: string
13085+
- allowEmptyValue: true
13086+
description: Name of the tenant
13087+
in: query
13088+
name: tenant
13089+
schema:
13090+
type: string
13091+
responses:
13092+
'202':
13093+
content:
13094+
application/vnd.ceph.api.v1.0+json:
13095+
type: object
13096+
description: Operation is still executing. Please check the task queue.
13097+
'204':
13098+
content:
13099+
application/vnd.ceph.api.v1.0+json:
13100+
type: object
13101+
description: Resource deleted.
13102+
'400':
13103+
description: Operation exception. Please check the response body for details.
13104+
'401':
13105+
description: Unauthenticated access. Please login first.
13106+
'403':
13107+
description: Unauthorized access. Please check your permissions.
13108+
'500':
13109+
description: Unexpected error. Please check the response body for the stack
13110+
trace.
13111+
security:
13112+
- jwt: []
13113+
summary: Delete RGW Topic
13114+
tags:
13115+
- RGW Topic Management
13116+
get:
13117+
parameters:
13118+
- description: Name of the user
13119+
in: path
13120+
name: name
13121+
required: true
13122+
schema:
13123+
type: string
13124+
- allowEmptyValue: true
13125+
description: Name of the tenant
13126+
in: query
13127+
name: tenant
13128+
schema:
13129+
type: string
13130+
responses:
13131+
'200':
13132+
content:
13133+
application/vnd.ceph.api.v1.0+json:
13134+
type: object
13135+
description: OK
13136+
'400':
13137+
description: Operation exception. Please check the response body for details.
13138+
'401':
13139+
description: Unauthenticated access. Please login first.
13140+
'403':
13141+
description: Unauthorized access. Please check your permissions.
13142+
'500':
13143+
description: Unexpected error. Please check the response body for the stack
13144+
trace.
13145+
security:
13146+
- jwt: []
13147+
summary: Get RGW Topic
13148+
tags:
13149+
- RGW Topic Management
1294713150
/api/rgw/user:
1294813151
get:
1294913152
parameters:
@@ -17840,6 +18043,8 @@ tags:
1784018043
name: PrometheusNotifications
1784118044
- description: List of RGW roles
1784218045
name: RGW
18046+
- description: RGW Topic Management API
18047+
name: RGW Topic Management
1784318048
- description: RBD Management API
1784418049
name: Rbd
1784518050
- description: RBD Mirroring Management API

0 commit comments

Comments
 (0)