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 CLI Extension #31

Merged
merged 16 commits into from
Jan 18, 2018
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/src/index.json @derekbekoe

/src/image-copy/ @tamirkamara

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

# pylint: disable=unused-import

from azure.cli.core import AzCommandsLoader
from ._help import helps


class ServicebusCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
servicebus_custom = CliCommandType(operations_tmpl='azext_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 azext_servicebus.commands import load_command_table
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_servicebus._params import load_arguments_namespace, load_arguments_queue, load_arguments_topic,\
load_arguments_subscription, load_arguments_rule, load_arguments_geodr
load_arguments_namespace(self, command)
load_arguments_queue(self, command)
load_arguments_topic(self, command)
load_arguments_subscription(self, command)
load_arguments_rule(self, command)
load_arguments_geodr(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 azext_servicebus.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
Loading