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

ServiceBus: Added sb extension #20

Closed
wants to merge 4 commits into from
Closed
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
4 changes: 4 additions & 0 deletions src/servicebus/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/servicebus/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/servicebus/.idea/servicebus.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

184 changes: 184 additions & 0 deletions src/servicebus/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions src/servicebus/azext_servicebus/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader

import azure.cli.command_modules.servicebus._help # pylint: disable=unused-import


class ServicebusCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.sdk.util import CliCommandType
servicebus_custom = CliCommandType(operations_tmpl='azure.cli.command_modules.servicebus.custom#{}')
super(ServicebusCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=servicebus_custom,
min_profile="2017-03-10-profile")

def load_command_table(self, args):
from azure.cli.command_modules.servicebus.commands import load_command_table
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azure.cli.command_modules.servicebus._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = ServicebusCommandsLoader
50 changes: 50 additions & 0 deletions src/servicebus/azext_servicebus/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------


def cf_servicebus(cli_ctx, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.mgmt.servicebus import ServiceBusManagementClient
return get_mgmt_service_client(cli_ctx, ServiceBusManagementClient)


def namespaces_mgmt_client_factory(cli_ctx, _):
return cf_servicebus(cli_ctx).namespaces


def queues_mgmt_client_factory(cli_ctx, _):
return cf_servicebus(cli_ctx).queues


def topics_mgmt_client_factory(cli_ctx, _):
return cf_servicebus(cli_ctx).topics


def subscriptions_mgmt_client_factory(cli_ctx, _):
return cf_servicebus(cli_ctx).subscriptions


def rules_mgmt_client_factory(cli_ctx, _):
return cf_servicebus(cli_ctx).rules


def regions_mgmt_client_factory(cli_ctx, _):
return cf_servicebus(cli_ctx).regions


def premium_messaging_mgmt_client_factory(cli_ctx, _):
return cf_servicebus(cli_ctx).premium_messaging


def event_subscriptions_mgmt_client_factory(cli_ctx, _):
return cf_servicebus(cli_ctx).event_subscriptions


def event_hubs_mgmt_client_factory(cli_ctx, _):
return cf_servicebus(cli_ctx).event_hubs


def disaster_recovery_mgmt_client_factory(cli_ctx, _):
return cf_servicebus(cli_ctx).disaster_recovery_configs
17 changes: 17 additions & 0 deletions src/servicebus/azext_servicebus/_exception_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from knack.util import CLIError


def servicebus_exception_handler(ex):
from azure.mgmt.servicebus.models import ErrorResponseException
if isinstance(ex, ErrorResponseException):
message = ex.error.error.message
raise CLIError(message)
else:
import sys
from six import reraise
reraise(*sys.exc_info())
21 changes: 21 additions & 0 deletions src/servicebus/azext_servicebus/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from knack.help_files import helps

helps['servicebus'] = """
type: group
short-summary: Manage Azure .
"""

helps['servicebus namespace'] = """
type: group
short-summary: Get .
"""

helps['servicebus queue'] = """
type: group
short-summary: Get .
"""
Loading