Skip to content

Commit

Permalink
ServiceBus CLI Extension (#31)
Browse files Browse the repository at this point in the history
* ServiceBus CLI Extension

* updated Codeowners

* changed sb to servicebus

* fixed lint error

* updated help

* Review comments resolved

* Review comments resolved

* fixed the lint error

* lint error of trailing whitespace fixed

* test fixture

* resolved help review comments

* Review comments for help and params

* Added Matadat file
  • Loading branch information
Ajit Navasare authored and derekbekoe committed Jan 18, 2018
1 parent 55f351c commit 5e43e0e
Show file tree
Hide file tree
Showing 76 changed files with 11,898 additions and 0 deletions.
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

0 comments on commit 5e43e0e

Please sign in to comment.