@@ -56,13 +56,20 @@ def _convert_xml_to_object(queue_name, et, clazz):
56
56
57
57
58
58
class ServiceBusManagementClient :
59
+ """Use this client to create, update, list, and delete resources of a ServiceBus namespace
60
+
61
+ :param str fully_qualified_namespace:
62
+ :param credential:
63
+ :type credential: Union[TokenCredential, ServiceBusSharedKeyCredential]
64
+ :keyword Pipeline pipeline: If omitted, the standard pipeline is used.
65
+ :keyword HttpTransport transport: If omitted, the standard pipeline is used.
66
+ :keyword List[HTTPPolicy] policies: If omitted, the standard pipeline is used.
67
+
68
+ For keyword arguments, refer to TODO: add a link here
69
+ """
59
70
60
71
def __init__ (self , fully_qualified_namespace , credential , ** kwargs ):
61
72
# type: (str, Union[TokenCredential, ServiceBusSharedKeyCredential], Dict[str, Any]) -> None
62
- """
63
- :param fully_qualified_namespace:
64
- :param kwargs:
65
- """
66
73
self .fully_qualified_namespace = fully_qualified_namespace
67
74
self ._credential = credential
68
75
self ._endpoint = "https://" + fully_qualified_namespace
@@ -95,12 +102,14 @@ def _build_pipeline(self, **kwargs): # pylint: disable=no-self-use
95
102
return Pipeline (transport , policies )
96
103
97
104
@classmethod
98
- def from_connection_string (cls , connection_string ):
99
- # type: (str) -> ServiceBusManagementClient
100
- """
105
+ def from_connection_string (cls , connection_string , ** kwargs ):
106
+ # type: (str, Any ) -> ServiceBusManagementClient
107
+ """Create a client from connection string
101
108
102
109
:param str connection_string:
103
- :return:
110
+ :keyword Pipeline pipeline: If omitted, the standard pipeline is used.
111
+ :keyword HttpTransport transport: If omitted, the standard pipeline is used.
112
+ :keyword List[HTTPPolicy] policies: If omitted, the standard pipeline is used.
104
113
"""
105
114
endpoint , shared_access_key_name , shared_access_key , _ = parse_conn_str (connection_string )
106
115
if "//" in endpoint :
@@ -143,15 +152,30 @@ def _list_queues(self, skip, max_count, clazz):
143
152
144
153
def get_queue (self , queue_name ):
145
154
# type: (str) -> QueueDescription
155
+ """Get a QueueDescription
156
+
157
+ :param str queue_name: The name of the queue
158
+ """
146
159
return self ._get_queue_object (queue_name , QueueDescription )
147
160
148
161
def get_queue_runtime_info (self , queue_name ):
149
162
# type: (str) -> QueueRuntimeInfo
163
+ """Get the runtime information of a queue
164
+
165
+ :param str queue_name: The name of the queue
166
+ """
150
167
return self ._get_queue_object (queue_name , QueueRuntimeInfo )
151
168
152
169
def create_queue (self , queue ):
153
170
# type: (Union[str, QueueDescription]) -> QueueDescription
154
- """Create a queue"""
171
+ """Create a queue
172
+
173
+ :param queue: The queue name or a `QueueDescription` instance. When it's a str, it will be the name
174
+ of the created queue. Other properties of the created queue will have default values decided by the
175
+ ServiceBus. Use a `QueueDesceiption` if you want to set queue properties other than the queue name.
176
+ :type queue: Union[str, QueueDescription].
177
+ :returns: `QueueDescription` returned from ServiceBus.
178
+ """
155
179
156
180
try : # queue is a QueueDescription
157
181
queue_name = queue .queue_name
@@ -179,7 +203,13 @@ def create_queue(self, queue):
179
203
180
204
def update_queue (self , queue_description ):
181
205
# type: (QueueDescription) -> QueueDescription
182
- """Update a queue"""
206
+ """
207
+
208
+ :param queue_description: The properties of this `QueueDescription` will be applied to the queue in
209
+ ServiceBus. Only a portion of properties can be updated.
210
+ Refer to https://docs.microsoft.com/en-us/rest/api/servicebus/update-queue.
211
+ :type queue_description: QueueDescription
212
+ """
183
213
if not queue_description .queue_name :
184
214
raise ValueError ("queue_description must have a non-empty queue_name" )
185
215
@@ -205,7 +235,10 @@ def update_queue(self, queue_description):
205
235
206
236
def delete_queue (self , queue_name ):
207
237
# type: (str) -> None
208
- """Create a queue"""
238
+ """Delete a queue
239
+
240
+ :param str queue_name: The name of the queue
241
+ """
209
242
210
243
if not queue_name :
211
244
raise ValueError ("queue_name must not be None or empty" )
@@ -214,8 +247,20 @@ def delete_queue(self, queue_name):
214
247
215
248
def list_queues (self , skip = 0 , max_count = 100 ):
216
249
# type: (int, int) -> List[QueueDescription]
250
+ """List the queues of a ServiceBus namespace
251
+
252
+ :param int skip: skip this number of queues
253
+ :param int max_count: return at most this number of queues if there are more than this number in
254
+ the ServiceBus namespace
255
+ """
217
256
return self ._list_queues (skip , max_count , QueueDescription )
218
257
219
258
def list_queues_runtime_info (self , skip = 0 , max_count = 100 ):
220
259
# type: (int, int) -> List[QueueRuntimeInfo]
260
+ """List the queues runtime info of a ServiceBus namespace
261
+
262
+ :param int skip: skip this number of queues
263
+ :param int max_count: return at most this number of queues if there are more than this number in
264
+ the ServiceBus namespace
265
+ """
221
266
return self ._list_queues (skip , max_count , QueueRuntimeInfo )
0 commit comments