Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ServiceBusManagementClient to ServiceBusAdministrationClient #13597

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/servicebus/azure-servicebus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

**Breaking Changes**

* Rename `ServiceBusManagementClient` to `ServiceBusAdministrationClient`
* Attempting to call `send_messages` on something not a `Message`, `BatchMessage`, or list of `Message`s, will now throw a `TypeError` instead of `ValueError`
* Sending a message twice will no longer result in a MessageAlreadySettled exception.
* `ServiceBusClient.close()` now closes spawned senders and receivers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from ._management_client_async import ServiceBusManagementClient
from ._management_client_async import ServiceBusAdministrationClient

__all__ = [
"ServiceBusManagementClient",
"ServiceBusAdministrationClient",
]
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from azure.core.credentials_async import AsyncTokenCredential # pylint:disable=ungrouped-imports


class ServiceBusManagementClient: #pylint:disable=too-many-public-methods
class ServiceBusAdministrationClient: #pylint:disable=too-many-public-methods
"""Use this client to create, update, list, and delete resources of a ServiceBus namespace.

:param str fully_qualified_namespace: The fully qualified host name for the Service Bus namespace.
Expand All @@ -64,7 +64,7 @@ def __init__(
self._pipeline = self._build_pipeline()
self._impl = ServiceBusManagementClientImpl(endpoint=fully_qualified_namespace, pipeline=self._pipeline)

async def __aenter__(self) -> "ServiceBusManagementClient":
async def __aenter__(self) -> "ServiceBusAdministrationClient":
await self._impl.__aenter__()
return self

Expand Down Expand Up @@ -130,11 +130,11 @@ async def _get_rule_element(self, topic_name, subscription_name, rule_name, **kw
return element

@classmethod
def from_connection_string(cls, conn_str: str, **kwargs: Any) -> "ServiceBusManagementClient":
def from_connection_string(cls, conn_str: str, **kwargs: Any) -> "ServiceBusAdministrationClient":
"""Create a client from connection string.

:param str conn_str: The connection string of the Service Bus Namespace.
:rtype: ~azure.servicebus.management.aio.ServiceBusManagementClient
:rtype: ~azure.servicebus.management.aio.ServiceBusAdministrationClient
"""
endpoint, shared_access_key_name, shared_access_key, _ = parse_conn_str(conn_str)
if "//" in endpoint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from ._management_client import ServiceBusManagementClient
from ._management_client import ServiceBusAdministrationClient
from ._generated.models import AuthorizationRule, MessageCountDetails, \
AccessRights, EntityAvailabilityStatus, EntityStatus, \
NamespaceProperties, MessagingSku, NamespaceType
Expand All @@ -14,7 +14,7 @@
SqlRuleAction

__all__ = [
'ServiceBusManagementClient',
'ServiceBusAdministrationClient',
'AuthorizationRule',
'MessageCountDetails',
'QueueProperties',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from azure.core.credentials import TokenCredential # pylint:disable=ungrouped-imports


class ServiceBusManagementClient: # pylint:disable=too-many-public-methods
class ServiceBusAdministrationClient: # pylint:disable=too-many-public-methods
"""Use this client to create, update, list, and delete resources of a ServiceBus namespace.

:param str fully_qualified_namespace: The fully qualified host name for the Service Bus namespace.
Expand Down Expand Up @@ -124,11 +124,11 @@ def _get_rule_element(self, topic_name, subscription_name, rule_name, **kwargs):

@classmethod
def from_connection_string(cls, conn_str, **kwargs):
# type: (str, Any) -> ServiceBusManagementClient
# type: (str, Any) -> ServiceBusAdministrationClient
"""Create a client from connection string.

:param str conn_str: The connection string of the Service Bus Namespace.
:rtype: ~azure.servicebus.management.ServiceBusManagementClient
:rtype: ~azure.servicebus.management.ServiceBusAdministrationClient
"""
endpoint, shared_access_key_name, shared_access_key, _ = parse_conn_str(conn_str)
if "//" in endpoint:
Expand Down
4 changes: 2 additions & 2 deletions sdk/servicebus/azure-servicebus/migration_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ semantics with the sender or receiver lifetime.
### Managing queues
| In v0.50 | Equivalent in v7 | Sample |
|---|---|---|
| `azure.servicebus.control_client.ServiceBusService().create_queue(queue_name)` | `azure.servicebus.management.ServiceBusManagementClient().create_queue(queue_name)` | [Create a queue](./samples/sync_samples/mgmt_queue.py) |
| `azure.servicebus.ServiceBusClient().list_queues()` | `azure.servicebus.management.ServiceBusManagementClient().list_queues()` | [List queues](./samples/sync_samples/mgmt_queue.py ) |
| `azure.servicebus.control_client.ServiceBusService().create_queue(queue_name)` | `azure.servicebus.management.ServiceBusAdministrationClient().create_queue(queue_name)` | [Create a queue](./samples/sync_samples/mgmt_queue.py) |
| `azure.servicebus.ServiceBusClient().list_queues()` | `azure.servicebus.management.ServiceBusAdministrationClient().list_queues()` | [List queues](./samples/sync_samples/mgmt_queue.py ) |

### Working with AutoLockRenew
| In v0.50 | Equivalent in v7 | Sample |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import os
import asyncio
from azure.servicebus.aio.management import ServiceBusManagementClient
from azure.servicebus.aio.management import ServiceBusAdministrationClient

CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR']
QUEUE_NAME = "sb_mgmt_demo_queue"
Expand Down Expand Up @@ -72,7 +72,7 @@ async def get_queue_runtime_info(servicebus_mgmt_client):


async def main():
async with ServiceBusManagementClient.from_connection_string(CONNECTION_STR) as servicebus_mgmt_client:
async with ServiceBusAdministrationClient.from_connection_string(CONNECTION_STR) as servicebus_mgmt_client:
await create_queue(servicebus_mgmt_client)
await list_queues(servicebus_mgmt_client)
await get_and_update_queue(servicebus_mgmt_client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# pylint: disable=C0111

import os
from azure.servicebus.management import ServiceBusManagementClient
from azure.servicebus.management import ServiceBusAdministrationClient

CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR']
QUEUE_NAME = "sb_mgmt_demo_queue"
Expand Down Expand Up @@ -70,7 +70,7 @@ def get_queue_runtime_info(servicebus_mgmt_client):
print("")


with ServiceBusManagementClient.from_connection_string(CONNECTION_STR) as servicebus_mgmt_client:
with ServiceBusAdministrationClient.from_connection_string(CONNECTION_STR) as servicebus_mgmt_client:
create_queue(servicebus_mgmt_client)
list_queues(servicebus_mgmt_client)
get_and_update_queue(servicebus_mgmt_client)
Expand Down
Loading