Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
00b9235
{Docs} Remove stale reference in README to closed issue about extensi…
dkmiller Apr 27, 2020
ab16df0
Merge remote-tracking branch 'upstream/release'
azclibot Apr 28, 2020
03436bc
Merge remote-tracking branch 'upstream/release'
azclibot Apr 30, 2020
7d98b1f
Merge remote-tracking branch 'upstream/release'
azclibot May 19, 2020
06f6ec5
Merge remote-tracking branch 'upstream/release'
azclibot Jun 2, 2020
125406f
Merge branch 'master' of git://github.com/Azure/azure-cli into dev
Jun 16, 2020
a497390
Preliminary changes made to add support for template-specs
Jun 22, 2020
e43a151
Reconfiguration
Jun 22, 2020
adab2d2
Merge remote-tracking branch 'upstream/release'
azclibot Jun 23, 2020
37c8522
Merge branch 'master' of git://github.com/Azure/azure-cli into dev
Jun 23, 2020
ef1e3f2
Merge remote-tracking branch 'upstream/dev' into dev
Jun 26, 2020
50e7c9c
validate function error rectified
Jun 27, 2020
68f47fd
validate command works for template-uri
Jun 29, 2020
7f184f8
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Jun 29, 2020
bf962b1
Template-specs deployment works at resource-group level
Jun 29, 2020
4b90edd
Group deployment updated to function with 2020 SDK
Jun 30, 2020
4f39504
validate with template specs added
Jun 30, 2020
2e04882
Management scope and tenant scope errors fixed
Jul 1, 2020
7be894f
Testing Complete
Jul 2, 2020
87ccc2e
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Jul 6, 2020
4f1348c
Template-Specs Deployment Added
Jul 6, 2020
9eb09f2
Template-Specs Deployment Added
Jul 6, 2020
44362eb
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Jul 6, 2020
cf7b97a
Updated test cases and removed unnecessary comments
Jul 6, 2020
fb78986
Removed test cases from launch.json
Jul 6, 2020
504fda7
Uncommented test case
Jul 6, 2020
8f21f7c
Cleaned up repo
Jul 6, 2020
e73132c
Cleaned up repo
Jul 6, 2020
e8153f8
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Jul 7, 2020
eac8414
Style checks complete, template_spec parameter placed at the end, tim…
Jul 8, 2020
74666fe
Merged with /dev
Jul 8, 2020
0e28ed8
Fixed failing CLI Check Test
Jul 8, 2020
583352f
Added fixes for deployment create_or_update and validate usage
Jul 9, 2020
a6344b8
Merge branch 'dev' of git://github.com/Azure/azure-cli into dev
Jul 9, 2020
2b43c88
Fix getting resource API version in ARM cmdlt
eladperets Aug 5, 2020
045b6e1
resetting branch
Aug 6, 2020
9b3fa34
reset
Aug 6, 2020
d737883
@eladperets Fix getting resource API version in ARM cmdlt
Aug 6, 2020
e684558
requirements updated to 10.2.0
Aug 6, 2020
33836f6
reverted changes to launch.json
Aug 6, 2020
970f33a
Remove useless object inheritance
Aug 6, 2020
11c0d1d
@eladperets Fix getting resource API version in ARM cmdlt
Aug 6, 2020
7bdde2b
Merge branch 'dev' of git://github.com/Azure/azure-cli into daetienn/…
Aug 6, 2020
94d334a
Merged with dev
Aug 12, 2020
49aa80b
Merge branch 'dev' of git://github.com/Azure/azure-cli into daetienn/…
Aug 13, 2020
40b76f7
Merge branch 'dev' of git://github.com/Azure/azure-cli into daetienn/…
Aug 18, 2020
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
Prev Previous commit
Next Next commit
validate command works for template-uri
  • Loading branch information
Dania Etienne committed Jun 29, 2020
commit 68f47fde05867e5d6a8df3d7e0009e6698e4d914
8 changes: 7 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
"program": "${workspaceRoot}/src/azure-cli/azure/cli/__main__.py",
"cwd": "${workspaceRoot}",
"args": [
"--help"
"deployment",
"group",
"create",
"--resource-group",
"giant-deep",
"--template-spec",
"/subscriptions/996a2f3f-ee01-4ffd-9765-d2c3fc98f30a/resourceGroups/giants-deep/providers/Microsoft.Resources/templateSpecs/BasicLinked01/versions/1.0"
],
"console": "integratedTerminal",
"debugOptions": [
Expand Down
2 changes: 1 addition & 1 deletion scripts/activate
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ deactivate () {
# unset irrelevant variables
deactivate nondestructive

VIRTUAL_ENV="C:\Users\daetienn\Desktop\Ramp-up-tasks\TemplateSpecs_CLI\azure-cli"
VIRTUAL_ENV="C:\Users\daetienn\Desktop\azure-cli"
export VIRTUAL_ENV

_OLD_VIRTUAL_PATH="$PATH"
Expand Down
2 changes: 1 addition & 1 deletion scripts/activate.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if defined _OLD_CODEPAGE (
"%SystemRoot%\System32\chcp.com" 65001 > nul
)

set VIRTUAL_ENV=C:\Users\daetienn\Desktop\Ramp-up-tasks\TemplateSpecs_CLI\azure-cli
set VIRTUAL_ENV=C:\Users\daetienn\Desktop\azure-cli

if not defined PROMPT set PROMPT=$P$G

Expand Down
3 changes: 2 additions & 1 deletion src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ResourceType(Enum): # pylint: disable=too-few-public-methods
MGMT_RESOURCE_RESOURCES = ('azure.mgmt.resource.resources', 'ResourceManagementClient')
MGMT_RESOURCE_SUBSCRIPTIONS = ('azure.mgmt.resource.subscriptions', 'SubscriptionClient')
MGMT_RESOURCE_DEPLOYMENTSCRIPTS = ('azure.mgmt.resource.deploymentscripts', 'DeploymentScriptsClient')
MGMT_RESOURCE_TEMPLATESPECS = ('azure.mgmt.resource.templatespecs', 'TemplateSpecsClient')
MGMT_MONITOR = ('azure.mgmt.monitor', 'MonitorManagementClient')
DATA_KEYVAULT = ('azure.keyvault', 'KeyVaultClient')
MGMT_EVENTHUB = ('azure.mgmt.eventhub', 'EventHubManagementClient')
Expand Down Expand Up @@ -145,10 +146,10 @@ def default_api_version(self):
ResourceType.MGMT_RESOURCE_LINKS: '2016-09-01',
ResourceType.MGMT_RESOURCE_LOCKS: '2016-09-01',
ResourceType.MGMT_RESOURCE_POLICY: '2019-09-01',
#ResourceType.MGMT_RESOURCE_RESOURCES: '2019-07-01',
ResourceType.MGMT_RESOURCE_RESOURCES: '2020-06-01',
ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS: '2019-06-01',
ResourceType.MGMT_RESOURCE_DEPLOYMENTSCRIPTS: '2019-10-01-preview',
ResourceType.MGMT_RESOURCE_TEMPLATESPECS : '2019-06-01-preview',
ResourceType.MGMT_NETWORK_DNS: '2018-05-01',
ResourceType.MGMT_KEYVAULT: '2019-09-01',
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2018-09-01-preview', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def _resource_deploymentscripts_client_factory(cli_ctx, **_):
from azure.cli.core.profiles import ResourceType
return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_DEPLOYMENTSCRIPTS)


def _authorization_management_client(cli_ctx, **_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.cli.core.profiles import ResourceType
Expand All @@ -57,6 +56,10 @@ def _resource_managementgroups_client_factory(cli_ctx, **_):
from azure.mgmt.managementgroups import ManagementGroupsAPI
return get_mgmt_service_client(cli_ctx, ManagementGroupsAPI, subscription_bound=False)

def _resource_templatespecs_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_TEMPLATESPECS)

def cf_resource_groups(cli_ctx, _):
return _resource_client_factory(cli_ctx).resource_groups
Expand Down Expand Up @@ -105,7 +108,6 @@ def cf_resource_links(cli_ctx, _):
def cf_resource_deploymentscripts(cli_ctx, _):
return _resource_deploymentscripts_client_factory(cli_ctx).deployment_scripts


def cf_resource_managedapplications(cli_ctx, _):
return _resource_managedapps_client_factory(cli_ctx).applications

Expand All @@ -120,3 +122,6 @@ def cf_management_groups(cli_ctx, _):

def cf_management_group_subscriptions(cli_ctx, _):
return _resource_managementgroups_client_factory(cli_ctx).management_group_subscriptions

def cf_resource_templatespecs(cli_ctx, _):
return _resource_templatespecs_client_factory(cli_ctx).templatespecs
3 changes: 1 addition & 2 deletions src/azure-cli/azure/cli/command_modules/resource/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ def load_arguments(self, _):
deployment_template_file_type = CLIArgumentType(options_list=['--template-file', '-f'], completer=FilesCompleter(), type=file_type,
help="a template file path in the file system")
deployment_template_uri_type = CLIArgumentType(options_list=['--template-uri', '-u'], help='a uri to a remote template file')
deployment_template_spec_type = CLIArgumentType(options_list=['--template-spec', '-s'], completer=FilesCompleter(), type=file_type, help='The resource id to the template-spec', is_preview=True, min_api='2019-06-01')
deployment_template_spec_type = CLIArgumentType(options_list=['--template-spec', '-s'], help='The resource id to the template-spec', is_preview=True, min_api='2019-06-01')
deployment_parameters_type = CLIArgumentType(options_list=['--parameters', '-p'], action='append', nargs='+', completer=FilesCompleter(), help='the deployment parameters')
filter_type = CLIArgumentType(options_list=['--filter'], is_preview=True,
help='Filter expression using OData notation. You can use --filter "provisioningState eq \'{state}\'" to filter provisioningState. '
'To get more information, please visit https://docs.microsoft.com/en-us/rest/api/resources/deployments/listatsubscriptionscope#uri-parameters')
no_prompt = CLIArgumentType(arg_type=get_three_state_flag(), help='The option to disable the prompt of missing parameters for ARM template. '
'When the value is true, the prompt requiring users to provide missing parameter will be ignored. The default value is false.')

deployment_what_if_result_format_type = CLIArgumentType(options_list=['--result-format', '-r'],
arg_type=get_enum_type(WhatIfResultFormat, "FullResourcePayloads"),
is_preview=True, min_api='2019-07-01')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ def _validate_deployment_name(namespace):
template_filename = namespace.template_file
if namespace.template_uri and urlparse(namespace.template_uri).scheme:
template_filename = urlsplit(namespace.template_uri).path
if namespace.template_spec: #REVIEW
from msrestazure.tools import parse_resource_id, is_valid_resource_id
if not is_valid_resource_id(namespace.template_spec):
raise CLIError('--template-spec is not a valid resource ID. ')
template_filename = parse_resource_id(namespace.template_spec).get('resource_name') #REVIEW.get
if template_filename:
template_filename = os.path.basename(template_filename)
namespace.deployment_name = os.path.splitext(template_filename)[0]
Expand All @@ -32,8 +37,8 @@ def _validate_deployment_name(namespace):


def process_deployment_create_namespace(namespace):
if bool(namespace.template_uri) == bool(namespace.template_file):
raise CLIError('incorrect usage: --template-file FILE | --template-uri URI')
if bool(namespace.template_uri) == bool(namespace.template_file) == bool(namespace.template_spec):
raise CLIError('incorrect usage: --template-file FILE | --template-uri URI | --template-spec ID')
_validate_deployment_name(namespace)


Expand Down
14 changes: 13 additions & 1 deletion src/azure-cli/azure/cli/command_modules/resource/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from azure.cli.command_modules.resource._client_factory import (
cf_resource_groups, cf_providers, cf_features, cf_tags, cf_deployments,
cf_deployment_operations, cf_policy_definitions, cf_policy_set_definitions, cf_resource_links,
cf_resource_deploymentscripts, cf_resource_managedapplications, cf_resource_managedappdefinitions, cf_management_groups, cf_management_group_subscriptions)
cf_resource_deploymentscripts, cf_resource_managedapplications, cf_resource_managedappdefinitions, cf_management_groups, cf_management_group_subscriptions, cf_resource_templatespecs)
from azure.cli.command_modules.resource._validators import process_deployment_create_namespace

from ._exception_handler import managementgroups_exception_handler
Expand Down Expand Up @@ -157,6 +157,12 @@ def load_command_table(self, _):
exception_handler=managementgroups_exception_handler
)

resource_templatespecs_sdk = CliCommandType(
operations_tmpl='azure.mgmt.resource.templatespecs.operations#ResourceLinksOperations.{}',
client_factory=cf_resource_templatespecs,
resource_type=ResourceType.MGMT_RESOURCE_TEMPLATESPECS
)

with self.command_group('account lock', resource_lock_sdk, resource_type=ResourceType.MGMT_RESOURCE_LOCKS) as g:
g.custom_command('create', 'create_lock')
g.custom_command('delete', 'delete_lock')
Expand Down Expand Up @@ -288,6 +294,12 @@ def load_command_table(self, _):
g.custom_command('show-log', 'get_deployment_script_logs')
g.custom_command('delete', 'delete_deployment_script', confirmation=True)

with self.command_group('template-spec', resource_templatespecs_sdk, resource_type=ResourceType.MGMT_RESOURCE_TEMPLATESPECS, is_preview=True) as g:
g.custom_command('list', 'list_template_specs')
g.custom_show_command('show', 'get_template_spec')
g.custom_command('show-log', 'get_template_spec_logs')
g.custom_command('delete', 'delete_template_spec', confirmation=True)

# az deployment group
with self.command_group('deployment group', resource_deployment_sdk, resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g:
g.custom_command('list', 'list_deployments_at_resource_group', table_transformer=transform_deployments_list)
Expand Down
Loading