Skip to content

Commit

Permalink
Switched DT instance create --tags parameter to common CLI tags_type …
Browse files Browse the repository at this point in the history
…property (#266)
  • Loading branch information
c-ryan-k authored Oct 30, 2020
1 parent c010a3a commit 3e28cd6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion azext_iot/digitaltwins/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def load_digitaltwins_help():
- name: Create instance in target resource group with specified location and tags.
text: >
az dt create -n {instance_name} -g {resouce_group} -l westcentralus --tags "a=b;c=d"
az dt create -n {instance_name} -g {resouce_group} -l westcentralus --tags a=b c=d
"""

helps["dt show"] = """
Expand Down
4 changes: 3 additions & 1 deletion azext_iot/digitaltwins/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from azure.cli.core.commands.parameters import (
resource_group_name_type,
get_three_state_flag,
tags_type
)

depfor_type = CLIArgumentType(
Expand Down Expand Up @@ -55,7 +56,8 @@ def load_digitaltwins_arguments(self, _):
context.argument(
"tags",
options_list=["--tags"],
help="Digital Twins instance tags. Property bag in key-value pairs with the following format: a=b;c=d.",
arg_type=tags_type,
help="Digital Twins instance tags. Property bag in key-value pairs with the following format: a=b c=d",
)
context.argument(
"endpoint_name",
Expand Down
4 changes: 1 addition & 3 deletions azext_iot/digitaltwins/providers/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
EventHub as EventHubEndpointProperties,
ServiceBus as ServiceBusEndpointProperties,
)
from azext_iot.common.utility import validate_key_value_pairs, unpack_msrest_error
from azext_iot.common.utility import unpack_msrest_error
from knack.util import CLIError


Expand All @@ -26,8 +26,6 @@ def __init__(self, cmd):
self.rbac = RbacProvider()

def create(self, name, resource_group_name, location=None, tags=None, timeout=60):
if tags:
tags = validate_key_value_pairs(tags)

if not location:
from azext_iot.common.embedded_cli import EmbeddedCLI
Expand Down
3 changes: 1 addition & 2 deletions azext_iot/tests/digitaltwins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from azext_iot.common.embedded_cli import EmbeddedCLI


MOCK_RESOURCE_TAGS = "a=b;c=d"
MOCK_ENDPOINT_TAGS = "key0=value0;key1=value1;"
MOCK_RESOURCE_TAGS = "a=b c=d"
MOCK_DEAD_LETTER_SECRET = 'https://accountname.blob.core.windows.net/containerName?sasToken'


Expand Down

0 comments on commit 3e28cd6

Please sign in to comment.