Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,3 @@ def cf_accounts(cli_ctx, *_):

def cf_map(cli_ctx, *_):
return cf_maps(cli_ctx).maps


def cf_creator(cli_ctx, *_):
return cf_maps(cli_ctx).creators
56 changes: 0 additions & 56 deletions src/azure-cli/azure/cli/command_modules/maps/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,59 +171,3 @@
text: |-
az maps map list-operation
"""

helps['maps creator'] = """
type: group
short-summary: Manage creator with maps
"""

helps['maps creator list'] = """
type: command
short-summary: "Get all Creator instances for an Azure Maps Account."
examples:
- name: List Creator Resources By Account
text: |-
az maps creator list --account-name "myMapsAccount" --resource-group "myResourceGroup"
"""

helps['maps creator show'] = """
type: command
short-summary: "Get a Maps Creator resource."
examples:
- name: Get Creator Resource
text: |-
az maps creator show --account-name "myMapsAccount" --creator-name "myCreator" --resource-group \
"myResourceGroup"
"""

helps['maps creator create'] = """
type: command
short-summary: "Create a Maps Creator resource. Creator resource will manage Azure resources required to populate \
a custom set of mapping data. It requires an account to exist before it can be created."
examples:
- name: Create Creator Resource
text: |-
az maps creator create --location "eastus2" --storage-units 5 --tags test="true" --account-name \
"myMapsAccount" --creator-name "myCreator" --resource-group "myResourceGroup"
"""

helps['maps creator update'] = """
type: command
short-summary: "Updates the Maps Creator resource. Only a subset of the parameters may be updated after creation, \
such as Tags."
examples:
- name: Update Creator Resource
text: |-
az maps creator update --storage-units 10 --tags specialTag="true" --account-name "myMapsAccount" \
--creator-name "myCreator" --resource-group "myResourceGroup"
"""

helps['maps creator delete'] = """
type: command
short-summary: "Delete a Maps Creator resource."
examples:
- name: Delete Creator Resource
text: |-
az maps creator delete --account-name "myMapsAccount" --creator-name "myCreator" --resource-group \
"myResourceGroup"
"""
36 changes: 2 additions & 34 deletions src/azure-cli/azure/cli/command_modules/maps/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def load_arguments(self, _):
with self.argument_context('maps account create') as c:
c.argument('kind', options_list=['--kind'], arg_type=get_enum_type(['Gen1', 'Gen2']),
help='Get or Set Kind property.')
Comment thread
necusjz marked this conversation as resolved.
c.argument('location', options_list=['--location', '-l'], arg_type=get_location_type(self.cli_ctx),
required=False, validator=get_default_location_from_resource_group)
c.argument('disable_local_auth', options_list=['--disable-local-auth'], arg_type=get_three_state_flag(),
help='Allows toggle functionality on Azure '
'Policy to disable Azure Maps local authentication support. This will disable Shared Keys '
Expand Down Expand Up @@ -96,37 +98,3 @@ def load_arguments(self, _):
options_list=['--key'],
arg_type=get_enum_type(KeyType),
help='Whether the operation refers to the primary or secondary key')

with self.argument_context('maps creator') as c:
c.argument('tags', arg_type=tags_type)

with self.argument_context('maps creator create') as c:
c.argument('creator_name', options_list=['--creator-name'], type=str, help='The name of the '
'Maps Creator instance.')
c.argument('location', options_list=['--location', '-l'], arg_type=get_location_type(self.cli_ctx),
required=False, validator=get_default_location_from_resource_group)
c.argument('storage_units', options_list=['--storage-units'], type=int,
help='The storage units to be allocated. Integer values from 1 to 100, inclusive.')

with self.argument_context('maps creator update') as c:
c.argument('creator_name', options_list=['--creator-name'], type=str, help='The name of the '
'Maps Creator instance.', id_part='child_name_1')
c.argument('storage_units', options_list=['--storage-units'], type=int,
help='The storage units to be allocated. Integer values from 1 to 100, inclusive.')

with self.argument_context('maps creator delete') as c:
c.argument('creator_name', options_list=['--creator-name'], type=str, help='The name of the '
'Maps Creator instance.', id_part='child_name_1')

with self.argument_context('maps creator show') as c:
c.argument('creator_name', options_list=['--creator-name'], type=str, help='The name of the '
'Maps Creator instance.', id_part='child_name_1')

with self.argument_context('maps creator list') as c:
c.argument('resource_group_name',
arg_type=resource_group_name_type,
id_part=None,
help='Resource group name')
c.argument('account_name',
id_part=None,
arg_type=maps_name_type)
12 changes: 1 addition & 11 deletions src/azure-cli/azure/cli/command_modules/maps/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# --------------------------------------------------------------------------------------------

from azure.cli.core.commands import CliCommandType
from azure.cli.command_modules.maps._client_factory import cf_accounts, cf_map, cf_creator
from azure.cli.command_modules.maps._client_factory import cf_accounts, cf_map


def load_command_table(self, _):
Expand All @@ -29,13 +29,3 @@ def load_command_table(self, _):

with self.command_group('maps map', maps_map, client_factory=cf_map) as g:
g.custom_command('list-operation', 'maps_map_list_operation')

maps_creator = CliCommandType(
operations_tmpl='azure.mgmt.maps.operations._creators_operations#CreatorsOperations.{}',
client_factory=cf_creator)
with self.command_group('maps creator', maps_creator, client_factory=cf_creator) as g:
g.custom_command('list', 'maps_creator_list')
g.custom_show_command('show', 'maps_creator_show')
g.custom_command('create', 'maps_creator_create')
g.custom_command('update', 'maps_creator_update')
g.custom_command('delete', 'maps_creator_delete', confirmation=True)
70 changes: 3 additions & 67 deletions src/azure-cli/azure/cli/command_modules/maps/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from knack.prompting import prompt_y_n
from knack.util import CLIError

ACCOUNT_LOCATION = 'global'

logger = get_logger(__name__)


Expand All @@ -18,6 +16,7 @@ def maps_account_create(client,
name,
tags=None,
kind=None,
location=None,
disable_local_auth=None,
linked_resources=None,
type_=None,
Expand All @@ -44,15 +43,13 @@ def maps_account_create(client,
option = prompt_y_n(hint)
if not option:
raise CLIError(client_denied_terms)
if kind is None:
kind = "Gen1"
if disable_local_auth is None:
disable_local_auth = False
maps_account = {}
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['kind'] = kind or 'Gen2'
maps_account['location'] = location or 'eastus'
Comment thread
necusjz marked this conversation as resolved.
maps_account['properties'] = {}
maps_account['properties']['disable_local_auth'] = False if disable_local_auth is None else disable_local_auth
if linked_resources is not None:
Expand Down Expand Up @@ -143,64 +140,3 @@ def maps_account_regenerate_key(client,

def maps_map_list_operation(client):
return client.list_operations()


def maps_creator_list(client,
resource_group_name,
account_name):
return client.list_by_account(resource_group_name=resource_group_name,
account_name=account_name)


def maps_creator_show(client,
resource_group_name,
account_name,
creator_name):
return client.get(resource_group_name=resource_group_name,
account_name=account_name,
creator_name=creator_name)


def maps_creator_create(client,
resource_group_name,
account_name,
creator_name,
location,
storage_units,
tags=None):
creator_resource = {}
if tags is not None:
creator_resource['tags'] = tags
creator_resource['location'] = location
creator_resource['properties'] = {}
creator_resource['properties']['storage_units'] = storage_units
return client.create_or_update(resource_group_name=resource_group_name,
account_name=account_name,
creator_name=creator_name,
creator_resource=creator_resource)


def maps_creator_update(client,
resource_group_name,
account_name,
creator_name,
tags=None,
storage_units=None):
creator_update_parameters = {}
if tags is not None:
creator_update_parameters['tags'] = tags
if storage_units is not None:
creator_update_parameters['storage_units'] = storage_units
return client.update(resource_group_name=resource_group_name,
account_name=account_name,
creator_name=creator_name,
creator_update_parameters=creator_update_parameters)


def maps_creator_delete(client,
resource_group_name,
account_name,
creator_name):
return client.delete(resource_group_name=resource_group_name,
account_name=account_name,
creator_name=creator_name)
Loading