Skip to content

Commit

Permalink
add tags for create command (#18783)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenmuxiaosen authored Jul 10, 2021
1 parent ea62f59 commit 37b16e9
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 95 deletions.
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/appconfig/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
type: command
short-summary: Create an App Configuration.
examples:
- name: Create an App Configuration with name, location, sku and resource group.
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --sku Standard
- name: Create an App Configuration with name, location, sku, tags and resource group.
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --sku Standard --tags key1=value1 key2=value2
- name: Create an App Configuration with name, location, sku and resource group with system assigned identity.
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --sku Standard --assign-identity
- name: Create an App Configuration with name, location, sku and resource group with user assigned identity.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def load_arguments(self, _):

with self.argument_context('appconfig create') as c:
c.argument('location', options_list=['--location', '-l'], arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group)
c.argument('tags', arg_type=tags_type, help="Space-separated tags: key[=value] [key[=value] ...].")
c.argument('assign_identity', arg_type=identities_arg_type,
help='Space-separated list of managed identities to be assigned. Use "[system]" to refer to system-assigned managed identity or a resource ID to refer to user-assigned managed identity. If this argument is provided without any value, system-assigned managed identity will be assigned by default. If this argument is not provided, no managed identities will be assigned to this App Configuration store.')
c.argument('enable_public_network', options_list=['--enable-public-network', '-e'], arg_type=get_three_state_flag(), is_preview=True,
Expand Down
4 changes: 3 additions & 1 deletion src/azure-cli/azure/cli/command_modules/appconfig/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def create_configstore(client,
name,
location,
sku="Standard",
tags=None,
assign_identity=None,
enable_public_network=None,
disable_local_auth=None):
Expand All @@ -46,6 +47,7 @@ def create_configstore(client,
configstore_params = ConfigurationStore(location=location.lower(),
identity=__get_resource_identity(assign_identity) if assign_identity else None,
sku=Sku(name=sku),
tags=tags,
public_network_access=public_network_access,
disable_local_auth=disable_local_auth)

Expand Down Expand Up @@ -90,7 +92,7 @@ def update_configstore(cmd,
public_network_access = None
if enable_public_network is not None:
public_network_access = 'Enabled' if enable_public_network else 'Disabled'
update_params = ConfigurationStoreUpdateParameters(tags=tags if tags else None,
update_params = ConfigurationStoreUpdateParameters(tags=tags,
sku=Sku(name=sku) if sku else None,
public_network_access=public_network_access,
disable_local_auth=disable_local_auth)
Expand Down
Loading

0 comments on commit 37b16e9

Please sign in to comment.