Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,4 @@ cmd_coverage/*

# Ignore test results
test_results.xml
/e11
48 changes: 29 additions & 19 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"configurations": [
{
"name": "Azure CLI Debug (Integrated Console)",
"type": "python",
"type": "debugpy",
"request": "launch",
"python": "${command:python.interpreterPath}",
"program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py",
Expand All @@ -12,16 +12,11 @@
"--help"
],
"console": "integratedTerminal",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
],
"justMyCode": false
},
{
"name": "Azure CLI Debug (External Console)",
"type": "python",
"type": "debugpy",
"request": "launch",
"stopOnEntry": true,
"python": "${command:python.interpreterPath}",
Expand All @@ -30,28 +25,43 @@
"args": [
"--help"
],
"console": "externalTerminal",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit"
]
"console": "externalTerminal"
},
{
"name": "Azure CLI Debug interactive",
"type": "debugpy",
"request": "launch",
"stopOnEntry": true,
"python": "${command:python.interpreterPath}",
"program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py",
"cwd": "${workspaceRoot}",
"args": [
"interactive"
],
"console": "externalTerminal"
},
{
"name": "Azdev Scripts",
"type": "python",
"type": "debugpy",
"request": "launch",
"python": "${command:python.interpreterPath}",
"program": "${workspaceRoot}/tools/automation/__main__.py",
"cwd": "${workspaceRoot}",
"args": [
"--help"
],
"console": "integratedTerminal",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
"console": "integratedTerminal"
},
{
"name": "Python test debug",
"type": "debugpy",
"request": "launch",
"stopOnEntry": true,
"python": "${command:python.interpreterPath}",
"purpose": ["debug-test"],
"cwd": "${workspaceRoot}",
"console": "externalTerminal",
"justMyCode": false
}
]
}
8,384 changes: 7,074 additions & 1,310 deletions azure-cli.pyproj

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions azure-cli.sln
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio Version 17
VisualStudioVersion = 17.12.35707.178 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "azure-cli", "azure-cli.pyproj", "{938454F7-93BD-41A7-84B2-3C89D64B969D}"
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "azure-cli", "azure-cli.pyproj", "{1F900175-4FC3-4CBB-8B60-2E5AD889D3B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{938454F7-93BD-41A7-84B2-3C89D64B969D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{938454F7-93BD-41A7-84B2-3C89D64B969D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F900175-4FC3-4CBB-8B60-2E5AD889D3B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F900175-4FC3-4CBB-8B60-2E5AD889D3B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1,050 changes: 1,050 additions & 0 deletions azure-cliOld.pyproj

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions azure-cliOld.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "azure-cli", "azure-cli.pyproj", "{938454F7-93BD-41A7-84B2-3C89D64B969D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{938454F7-93BD-41A7-84B2-3C89D64B969D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{938454F7-93BD-41A7-84B2-3C89D64B969D}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
resource_group_name_type, get_enum_type)

from azure.cli.command_modules.resource._completers import (
get_policy_set_completion_list, get_policy_completion_list,
get_policy_assignment_completion_list, get_providers_completion_list, get_resource_types_completion_list)
# get_policy_set_completion_list, get_policy_completion_list,
# get_policy_assignment_completion_list,
get_providers_completion_list, get_resource_types_completion_list)

from ._validators import (validate_resource, validate_expand)
from azure.cli.command_modules.resource._validators import validate_metadata
Expand Down Expand Up @@ -59,19 +60,19 @@ def load_arguments(self, _):
c.argument(
'policy_set_definition_name',
options_list=['--policy-set-definition', '-s'],
completer=get_policy_set_completion_list,
#completer=get_policy_set_completion_list,
arg_group='Scope',
help='Name of policy set definition.')
c.argument(
'policy_definition_name',
options_list=['--policy-definition', '-d'],
completer=get_policy_completion_list,
#completer=get_policy_completion_list,
arg_group='Scope',
help='Name of policy definition.')
c.argument(
'policy_assignment_name',
options_list=['--policy-assignment', '-a'],
completer=get_policy_assignment_completion_list,
#completer=get_policy_assignment_completion_list,
arg_group='Scope',
help='Name of policy assignment.')
c.argument(
Expand Down Expand Up @@ -141,7 +142,7 @@ def load_arguments(self, _):
c.argument(
'policy_assignment',
options_list=['--policy-assignment', '-a'],
completer=get_policy_assignment_completion_list,
#completer=get_policy_assignment_completion_list,
help='Name or resource ID of the policy assignment.')
c.argument(
'definition_reference_id',
Expand Down Expand Up @@ -187,7 +188,7 @@ def load_arguments(self, _):
options_list=['--policy-assignment-id',
'--policy-assignment', '-a'],
arg_group="Properties",
completer=get_policy_assignment_completion_list,
#completer=get_policy_assignment_completion_list,
help="The resource ID of the policy assignment that the attestation is setting the state for."
)
c.argument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ def _resource_feature_client_factory(cli_ctx, **_):
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_FEATURES)


def _resource_policy_client_factory(cli_ctx, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.cli.core.profiles import ResourceType
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_POLICY)
# def _resource_policy_client_factory(cli_ctx, **_):
# from azure.cli.core.commands.client_factory import get_mgmt_service_client
# from azure.cli.core.profiles import ResourceType
# return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_POLICY)


def _resource_lock_client_factory(cli_ctx, **_):
Expand Down Expand Up @@ -108,16 +108,16 @@ def cf_feature_registrations(cli_ctx, _):
return _resource_feature_client_factory(cli_ctx).subscription_feature_registrations


def cf_policy_definitions(cli_ctx, _):
return _resource_policy_client_factory(cli_ctx).policy_definitions
# def cf_policy_definitions(cli_ctx, _):
# return _resource_policy_client_factory(cli_ctx).policy_definitions


def cf_policy_set_definitions(cli_ctx, _):
return _resource_policy_client_factory(cli_ctx).policy_set_definitions
# def cf_policy_set_definitions(cli_ctx, _):
# return _resource_policy_client_factory(cli_ctx).policy_set_definitions


def cf_policy_exemptions(cli_ctx, _):
return _resource_policy_client_factory(cli_ctx).policy_exemptions
# def cf_policy_exemptions(cli_ctx, _):
# return _resource_policy_client_factory(cli_ctx).policy_exemptions


def cf_management_locks(cli_ctx, _):
Expand Down
43 changes: 22 additions & 21 deletions src/azure-cli/azure/cli/command_modules/resource/_completers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,36 @@
from azure.cli.core.decorators import Completer

from azure.cli.command_modules.resource._client_factory import (
_resource_policy_client_factory, _resource_client_factory)
#_resource_policy_client_factory,
_resource_client_factory)


@Completer
def get_policy_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
policy_client = _resource_policy_client_factory(cmd.cli_ctx)
result = policy_client.policy_definitions.list()
return [i.name for i in result]
# @Completer
# def get_policy_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
# policy_client = _resource_policy_client_factory(cmd.cli_ctx)
# result = policy_client.policy_definitions.list()
# return [i.name for i in result]


@Completer
def get_policy_set_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
policy_client = _resource_policy_client_factory(cmd.cli_ctx)
result = policy_client.policy_set_definitions.list()
return [i.name for i in result]
# @Completer
# def get_policy_set_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
# policy_client = _resource_policy_client_factory(cmd.cli_ctx)
# result = policy_client.policy_set_definitions.list()
# return [i.name for i in result]


@Completer
def get_policy_assignment_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
policy_client = _resource_policy_client_factory(cmd.cli_ctx)
result = policy_client.policy_assignments.list()
return [i.name for i in result]
# @Completer
# def get_policy_assignment_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
# policy_client = _resource_policy_client_factory(cmd.cli_ctx)
# result = policy_client.policy_assignments.list()
# return [i.name for i in result]


@Completer
def get_policy_exemption_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
policy_client = _resource_policy_client_factory(cmd.cli_ctx)
result = policy_client.policy_exemptions.list()
return [i.name for i in result]
# @Completer
# def get_policy_exemption_completion_list(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
# policy_client = _resource_policy_client_factory(cmd.cli_ctx)
# result = policy_client.policy_exemptions.list()
# return [i.name for i in result]


@Completer
Expand Down
Loading