Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
previenting name clash (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zim Kalinowski authored Jun 4, 2020
1 parent 2457087 commit 582707f
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/plugins/azgenerator/TemplateAzureCliClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function GenerateAzureCliClientFactory(model: CodeModelAz) : string[] {
model.SelectFirstCommandGroup();
output.push("");
output.push("");
output.push("def cf_" + model.Extension_NameUnderscored + "(cli_ctx, *_):");
output.push("def cf_" + model.Extension_NameUnderscored + "_cl(cli_ctx, *_):");
output.push(" from azure.cli.core.commands.client_factory import get_mgmt_service_client");
output.push(" from ..vendored_sdks." + model.PythonOperationsName + " import " + model.PythonMgmtClient);

Expand All @@ -38,7 +38,7 @@ export function GenerateAzureCliClientFactory(model: CodeModelAz) : string[] {
output.push("");

output.push("def cf_" + model.GetModuleOperationName() + "(cli_ctx, *_):");
output.push(" return cf_" + model.Extension_NameUnderscored + "(cli_ctx)." + model.GetModuleOperationNamePython());
output.push(" return cf_" + model.Extension_NameUnderscored + "_cl(cli_ctx)." + model.GetModuleOperationNamePython());
}
} while (model.SelectNextCommandGroup());
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/azgenerator/TemplateAzureCliInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export function GenerateAzureCliInit(model: CodeModelAz) : string[] {
output.push("");
output.push(" def __init__(self, cli_ctx=None):");
output.push(" from azure.cli.core.commands import CliCommandType");
output.push(" from azext_" + model.Extension_NameUnderscored + ".generated._client_factory import cf_" + model.Extension_NameUnderscored + "");
output.push(" from azext_" + model.Extension_NameUnderscored + ".generated._client_factory import cf_" + model.Extension_NameUnderscored + "_cl");
output.push(" " + model.Extension_NameUnderscored + "_custom = CliCommandType(");
output.push(" operations_tmpl='azext_" + model.Extension_NameUnderscored + ".custom#{}',");
output.push(" client_factory=cf_" + model.Extension_NameUnderscored + ")");
output.push(" client_factory=cf_" + model.Extension_NameUnderscored + "_cl)");
output.push(` parent = super(${model.Extension_NameClass}CommandsLoader, self)`);
ToMultiLine(` parent.__init__(cli_ctx=cli_ctx, custom_command_type=${model.Extension_NameUnderscored}_custom)`, output);
output.push("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class AttestationManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_attestation.generated._client_factory import cf_attestation
from azext_attestation.generated._client_factory import cf_attestation_cl
attestation_custom = CliCommandType(
operations_tmpl='azext_attestation.custom#{}',
client_factory=cf_attestation)
client_factory=cf_attestation_cl)
parent = super(AttestationManagementClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=attestation_custom)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
# --------------------------------------------------------------------------


def cf_attestation(cli_ctx, *_):
def cf_attestation_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.attestation import AttestationManagementClient
return get_mgmt_service_client(cli_ctx, AttestationManagementClient)


def cf_operation(cli_ctx, *_):
return cf_attestation(cli_ctx).operation
return cf_attestation_cl(cli_ctx).operation


def cf_attestation_provider(cli_ctx, *_):
return cf_attestation(cli_ctx).attestation_provider
return cf_attestation_cl(cli_ctx).attestation_provider
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class DFAZManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_datafactory.generated._client_factory import cf_datafactory
from azext_datafactory.generated._client_factory import cf_datafactory_cl
datafactory_custom = CliCommandType(
operations_tmpl='azext_datafactory.custom#{}',
client_factory=cf_datafactory)
client_factory=cf_datafactory_cl)
parent = super(DFAZManagementClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=datafactory_custom)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
# --------------------------------------------------------------------------


def cf_datafactory(cli_ctx, *_):
def cf_datafactory_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.datafactory import DFAZManagementClient
return get_mgmt_service_client(cli_ctx, DFAZManagementClient)


def cf_factory(cli_ctx, *_):
return cf_datafactory(cli_ctx).factory
return cf_datafactory_cl(cli_ctx).factory


def cf_trigger(cli_ctx, *_):
return cf_datafactory(cli_ctx).trigger
return cf_datafactory_cl(cli_ctx).trigger


def cf_integration_runtime(cli_ctx, *_):
return cf_datafactory(cli_ctx).integration_runtime
return cf_datafactory_cl(cli_ctx).integration_runtime
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class ManagedNetworkManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_managed_network.generated._client_factory import cf_managed_network
from azext_managed_network.generated._client_factory import cf_managed_network_cl
managed_network_custom = CliCommandType(
operations_tmpl='azext_managed_network.custom#{}',
client_factory=cf_managed_network)
client_factory=cf_managed_network_cl)
parent = super(ManagedNetworkManagementClientCommandsLoader, self)
parent.__init__(cli_ctx=cli_ctx, custom_command_type=managed_network_custom)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
# --------------------------------------------------------------------------


def cf_managed_network(cli_ctx, *_):
def cf_managed_network_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.managednetwork import ManagedNetworkManagementClient
return get_mgmt_service_client(cli_ctx, ManagedNetworkManagementClient)


def cf_mn(cli_ctx, *_):
return cf_managed_network(cli_ctx).managed_network
return cf_managed_network_cl(cli_ctx).managed_network


def cf_scope_assignment(cli_ctx, *_):
return cf_managed_network(cli_ctx).scope_assignment
return cf_managed_network_cl(cli_ctx).scope_assignment


def cf_managed_network_group(cli_ctx, *_):
return cf_managed_network(cli_ctx).managed_network_group
return cf_managed_network_cl(cli_ctx).managed_network_group


def cf_managed_network_peering_policy(cli_ctx, *_):
return cf_managed_network(cli_ctx).managed_network_peering_policy
return cf_managed_network_cl(cli_ctx).managed_network_peering_policy

0 comments on commit 582707f

Please sign in to comment.