-
Notifications
You must be signed in to change notification settings - Fork 3.3k
On-board Maps #6303
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
On-board Maps #6303
Conversation
- Add the Preview Terms agreement requirement - Remove location, custom_header, and raw parameters for account operations.
[Fix] --key-type, -t are now --key
[Refactor] get_account command now specifically throws error only if it's a 404 response.
[Output] Added recordings
|
View a preview at https://prompt.ws/r/Azure/azure-cli/6303 |
|
@jp94 which dev are you working with on the CLI side? |
|
@tjprescott package is released: |
|
The build error states,
I diff checked, but it says they are identical. |
| logger = get_logger(__name__) | ||
|
|
||
|
|
||
| # pylint: disable=line-too-long |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Break line instead of disabling pylint.
|
See #5716 for intial review. |
|
@derekbekoe what is the fix for the bdist wheel issue? |
tjprescott
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. A couple feedback points for your consideration. Would like @sptramer to review the help entries and then I'll sign-off.
| completer=get_resource_name_completion_list( | ||
| 'Microsoft.Maps/accounts'), | ||
| help='The name of the Maps Account', | ||
| validator=validate_account_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As your module grows, this will get very cumbersome. Most modules simply put one entry on one line and disable pylint's "line-too-long" warning. Up to you. Opinions vary (mine is pretty clearly in favor of long lines)
| options_list=['--sku', '-s'], | ||
| help='The name of the SKU, in standard format (such as S0).', | ||
| arg_type=get_enum_type(['S0']), | ||
| required=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need required=False. If your method signature has sku_name=None the CLI will already deduce this.
| if not ACCOUNT_NAME_MIN_LENGTH <= char_len <= ACCOUNT_NAME_MAX_LENGTH: | ||
| raise CLIError("Input account-name is invalid. Account name character length must be between 2 and 64.") | ||
| if not re.match(ACCOUNT_NAME_REGEX, account_name): | ||
| raise CLIError("Input account-name is invalid. Allowed regex: " + ACCOUNT_NAME_REGEX.pattern + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If your service error is clear enough, I'd recommend you avoid putting this client-side validation in. Otherwise, if the service later becomes more forgiving, the CLI will artificially restrict valid names. If the service error is not good enough, then this is an okay workaround.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You make a good point here.
|
@jp94 This is the azure_bdist_wheel.py file in your PR - https://github.com/Azure/azure-cli/pull/6303/files#diff-3423f41d513e4e7b0cb1d04b1d23b5c7. This is the one that it compares against - https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure_bdist_wheel.py. They are not the same. |
Removed validators.py. Will be adding checks in REST API specs and our backend routes to avoid redundancy. Updated azure_bdist_wheel.py Introduced minor fixes.
|
Looks like I didn't pull the latest code from the dev branch, and I was still seeing the old azure_bdist_wheel.py Removed validators.py. This results in error stacktrace with a generic response "Operation returned an invalid status code 'Bad Request'". We will be adding checks in REST API specs and our backend routes to avoid redundancy. I'll talk to my manager about getting this in. Let me know if this change should be reverted for the duration, or if this is okay. |
sptramer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some help copyedit changes.
|
|
||
| helps['maps'] = """ | ||
| type: group | ||
| short-summary: Manage Azure Maps accounts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical to the maps account description, which indicates the subgroup is unnecessary. If the toplevel namespace is used for future expansion, change this description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So should I remove the helps['maps'] or helps['maps account']?
I removed helps['maps'], because removing helps['maps account'] makes "az maps account -h" to not give a short summary.
|
|
||
| helps['maps account list'] = """ | ||
| type: command | ||
| short-summary: Show all Maps accounts in a Subscription or in a Resource Group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lowercase subscription and resource group. Only capitalize Maps if used as Azure Maps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've lowercase'd all "Maps" to "maps", except for "Azure Maps".
This includes "the Maps APIs" to "the maps APIs" as well correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maps APIs refers directly to a product name, so Maps should be capitalized there.
| helps['maps account create'] = """ | ||
| type: command | ||
| short-summary: Create a Maps account. | ||
| long-summary: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this long summary is needed; does not add information.
| helps['maps account keys list'] = """ | ||
| type: command | ||
| short-summary: List the keys to use with the Maps APIs. | ||
| long-summary: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the first sentence. long-description is always a supplement to short-description.
| helps['maps account keys renew'] = """ | ||
| type: command | ||
| short-summary: Renew either the primary or secondary key for use with the Maps APIs. | ||
| long-summary: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrite as This command immediately invalidates old API keys. Only the renewed keys can be used to connect to maps.
| # Argument Definition | ||
| maps_name_type = CLIArgumentType(options_list=['--name', '-n'], | ||
| completer=get_resource_name_completion_list('Microsoft.Maps/accounts'), | ||
| help='The name of the Maps Account') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lowercase maps and account
| with self.argument_context('maps account') as c: | ||
| c.argument('sku_name', | ||
| options_list=['--sku', '-s'], | ||
| help='The name of the SKU, in standard format (such as S0).', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove everything after the , - the valid values are enumerated in help.
|
|
||
| with self.argument_context('maps account keys renew') as c: | ||
| c.argument('key_type', | ||
| options_list=['--key'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the help for this argument pulled from elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This help is being pulled from the Azure Python SDK (Maps).
Command
az maps account keys renew: Renew either the primary or secondary key for use with the maps
APIs.
This command immediately invalidates old API keys. Only the renewed keys can be used to
connect to maps.
Arguments
--key [Required]: Whether the operation refers to the primary or secondary key. Allowed
values: primary, secondary.
--name -n [Required]: The name of the maps account.
--resource-group -g : Resource group name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Misinterpreted PR comment.
|
I've been trying to resolve For example, my previous commit passed for module-load-perf: https://travis-ci.org/Azure/azure-cli/jobs/376134725 But after merging with dev branch, it failed: https://travis-ci.org/Azure/azure-cli/jobs/376565890 |
|
@tjprescott the module local perf test keep failing in service fabric. Any idea? |
|
thanks, guys. |
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR has modified HISTORY.rst describing any customer-facing, functional changes. Note that this does not include changes only to help content. (see Modifying change log).
I adhere to the Command Guidelines.
Refer to #5716
We were having a service rename from Location Based Services to Maps.
Since the timeline was short and that there was an embargo on "Azure Maps" name, the PR was canceled.
We are ready to on-board Azure Maps command module now.
@lmazuel @tjprescott