Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{Maps} Support managed maps creator operations #18450

Merged
merged 21 commits into from
Jul 13, 2021
Merged
12 changes: 6 additions & 6 deletions src/azure-cli/azure/cli/command_modules/maps/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
--linked-resources id="/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Mic\
rosoft.Storage/accounts/mystorageacc" unique-name="myBatchStorageAccount" --linked-resources \
id="/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.Storage/acco\
unts/mystorageacc" unique-name="myBlobDataSource" --name "G2" --tags test="true" --account-name "myMapsAccount" \
unts/mystorageacc" unique-name="myBlobDataSource" --tags test="true" --account-name "myMapsAccount" \
--resource-group "myResourceGroup" --sku "S0"
- name: Create Gen1 Account
text: |-
az maps account create --kind "Gen1" --disable-local-auth false --name "S0" --tags \
az maps account create --kind "Gen1" --disable-local-auth false --tags \
test="true" --account-name "myMapsAccount" --resource-group "myResourceGroup" --sku "S0"
- name: Create Gen2 Account
text: |-
az maps account create --kind "Gen2" --disable-local-auth true --name "G2" --tags \
az maps account create --kind "Gen2" --disable-local-auth true --tags \
test="true" --account-name "myMapsAccount" --resource-group "myResourceGroup" --sku "S0"
"""

Expand Down Expand Up @@ -122,18 +122,18 @@
"{\\"/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIden\
tity/userAssignedIdentities/identityName\\":{}}" --kind "Gen2" --linked-resources id="/subscriptions/{subscriptionId}/r\
esourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}" unique-name="myBatchStorageAccoun\
t" --name "G2" --account-name "myMapsAccount" --resource-group "myResourceGroup" --sku "S1"
t" --account-name "myMapsAccount" --resource-group "myResourceGroup" --sku "S1"
- name: Update Account Tags
text: |-
az maps account update --tags specialTag="true" --account-name "myMapsAccount" --resource-group \
"myResourceGroup" --sku "S0"
- name: Update to Gen1 Account
text: |-
az maps account update --kind "Gen1" --name "S1" --account-name "myMapsAccount" --resource-group \
az maps account update --kind "Gen1" --account-name "myMapsAccount" --resource-group \
"myResourceGroup" --sku "S0"
- name: Update to Gen2 Account
text: |-
az maps account update --kind "Gen2" --name "G2" --account-name "myMapsAccount" --resource-group \
az maps account update --kind "Gen2" --account-name "myMapsAccount" --resource-group \
"myResourceGroup" --sku "S0"
Jing-song marked this conversation as resolved.
Show resolved Hide resolved
"""

Expand Down
30 changes: 20 additions & 10 deletions src/azure-cli/azure/cli/command_modules/maps/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,19 @@ def maps_account_create(client,
if disable_local_auth is None:
disable_local_auth = False
maps_account = {}
maps_account['tags'] = tags
if tags is not None:
maps_account['tags'] = tags
maps_account['location'] = ACCOUNT_LOCATION
maps_account['kind'] = "Gen1" if kind is None else kind
maps_account['properties'] = {}
maps_account['properties']['disable_local_auth'] = False if disable_local_auth is None else disable_local_auth
maps_account['properties']['linked_resources'] = linked_resources
if linked_resources is not None:
maps_account['properties']['linked_resources'] = linked_resources
maps_account['identity'] = {}
maps_account['identity']['type'] = type_
maps_account['identity']['user_assigned_identities'] = user_assigned_identities
if type_ is not None:
maps_account['identity']['type'] = type_
if user_assigned_identities is not None:
maps_account['identity']['user_assigned_identities'] = user_assigned_identities
maps_account['sku'] = {}
maps_account['sku']['name'] = name
return client.create_or_update(resource_group_name=resource_group_name,
Expand Down Expand Up @@ -96,13 +100,17 @@ def maps_account_update(client,
if disable_local_auth is None:
disable_local_auth = False
maps_account_update_parameters = {}
maps_account_update_parameters['tags'] = tags
if tags is not None:
maps_account_update_parameters['tags'] = tags
maps_account_update_parameters['kind'] = "Gen1" if kind is None else kind
maps_account_update_parameters['disable_local_auth'] = False if disable_local_auth is None else disable_local_auth
Jing-song marked this conversation as resolved.
Show resolved Hide resolved
maps_account_update_parameters['linked_resources'] = linked_resources
if linked_resources is not None:
maps_account_update_parameters['linked_resources'] = linked_resources
maps_account_update_parameters['identity'] = {}
maps_account_update_parameters['identity']['type'] = type_
maps_account_update_parameters['identity']['user_assigned_identities'] = user_assigned_identities
if type_ is not None:
maps_account_update_parameters['identity']['type'] = type_
if user_assigned_identities is not None:
maps_account_update_parameters['identity']['user_assigned_identities'] = user_assigned_identities
maps_account_update_parameters['sku'] = {}
maps_account_update_parameters['sku']['name'] = name
Jing-song marked this conversation as resolved.
Show resolved Hide resolved
return client.update(resource_group_name=resource_group_name,
Jing-song marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -163,7 +171,8 @@ def maps_creator_create(client,
storage_units,
tags=None):
creator_resource = {}
creator_resource['tags'] = tags
if tags is not None:
creator_resource['tags'] = tags
creator_resource['location'] = location
creator_resource['properties'] = {}
creator_resource['properties']['storage_units'] = storage_units
Expand All @@ -180,7 +189,8 @@ def maps_creator_update(client,
tags=None,
storage_units=None):
creator_update_parameters = {}
creator_update_parameters['tags'] = tags
if tags is not None:
creator_update_parameters['tags'] = tags
creator_update_parameters['storage_units'] = storage_units
return client.update(resource_group_name=resource_group_name,
account_name=account_name,
Expand Down