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

EventHub - cli extension #37

Merged
merged 13 commits into from
Jan 25, 2018
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
/src/image-copy/ @tamirkamara

/src/servicebus/ @v-ajnava

/src/eventhubs/ @v-ajnava
34 changes: 34 additions & 0 deletions src/eventhubs/azext_eventhub/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# --------------------------------------------------------------------------------------------
# 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

# pylint: disable=unused-import
# pylint: disable=line-too-long

from ._help import helps


class EventhubCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
eventhub_custom = CliCommandType(operations_tmpl='azext_eventhub.custom#{}')
super(EventhubCommandsLoader, self).__init__(cli_ctx=cli_ctx, custom_command_type=eventhub_custom, min_profile="2017-03-10-profile")

def load_command_table(self, args):
from azext_eventhub.commands import load_command_table
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_eventhub._params import load_arguments_namespace, load_arguments_eventhub, load_arguments_consumergroup, load_arguments_geodr
load_arguments_namespace(self, command)
load_arguments_eventhub(self, command)
load_arguments_consumergroup(self, command)
load_arguments_geodr(self, command)


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


def cf_eventhub(cli_ctx, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_eventhub.eventhub import EventHubManagementClient
return get_mgmt_service_client(cli_ctx, EventHubManagementClient)


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


def event_hub_mgmt_client_factory(cli_ctx, _):
return cf_eventhub(cli_ctx).event_hubs


def consumer_groups_mgmt_client_factory(cli_ctx, _):
return cf_eventhub(cli_ctx).consumer_groups


def disaster_recovery_mgmt_client_factory(cli_ctx, _):
return cf_eventhub(cli_ctx).disaster_recovery_configs
Loading