{ARM} Bump api-version for Microsoft.Resources from 2021-04-01 to 2022-09-01#25434
{ARM} Bump api-version for Microsoft.Resources from 2021-04-01 to 2022-09-01#25434zhoxing-ms merged 187 commits intoAzure:devfrom
Conversation
| MGMT_RESOURCE_DEPLOYMENTSCRIPTS = ('azure.mgmt.resource.deploymentscripts', 'DeploymentScriptsClient') | ||
| MGMT_RESOURCE_TEMPLATESPECS = ('azure.mgmt.resource.templatespecs', 'TemplateSpecsClient') | ||
| MGMT_RESOURCE_PRIVATELINKS = ('azure.mgmt.resource.privatelinks', 'ResourcePrivateLinkClient') | ||
| MGMT_RESOURCE_MANAGEDAPPLICATIONS = ('azure.mgmt.resource.managedapplications', 'ApplicationClient') |
There was a problem hiding this comment.
This new resource type seems not being used, why?
There was a problem hiding this comment.
Good question! Thanks for your reminding!
In the past, azure.mgmt.resource.managedapplications was a single version directory, the client path in _resource_managedapps_client_factory was directly imported by hardcode without using ResourceType.
In all
managedapplications related custom methods, _resource_managedapps_client_factory() is directly called without using the client defined by command registration, such as:azure-cli/src/azure-cli/azure/cli/command_modules/resource/custom.py
Lines 1417 to 1432 in 946e67e
Due to a breaking change in the SDK azure.mgmt.resource.managedapplications, an additional directory version folder v2018_06_01 has been added to the original directory, resulting in the ModuleNotFoundError: No module named 'azure.mgmt.resource.managedapplications.operations' issue. issue link: #25828
Therefore, we have added the new ResourceType MGMT_RESOURCE_MANAGEDAPPLICATIONS to solve the ModuleNotFoundError, because this way specifies the version path of the azure.mgmt.resource.managedapplications.operations
More context: #24211 (comment)
Currently, there is indeed no direct use of the new resource type, which is not a good implementation way and can be confusing. I will refine the legacy code here
There was a problem hiding this comment.
Refined the legacy code, please help review again~
| @@ -3322,15 +3322,15 @@ def create_or_update_tag_at_scope(cmd, resource_id=None, tags=None, tag_name=Non | |||
| tag_obj = Tags(tags=tags) | |||
| TagsResource = cmd.get_models('TagsResource') | |||
| tags_resource = TagsResource(properties=tag_obj) | |||
| return rcf.tags.create_or_update_at_scope(scope=resource_id, parameters=tags_resource) | |||
| return rcf.tags.begin_create_or_update_at_scope(scope=resource_id, parameters=tags_resource) | |||
There was a problem hiding this comment.
Shouldn't adding begin_ prefix be done during Track 2 migration? Does this create_or_update_at_scope work currently?
There was a problem hiding this comment.
This should be due to the sudden breaking change in the Python SDK, which forced us to do the compatibility logic. Before that, the resource module had completed the migration of most sub RPs.
The method create_or_update_at_scope no longer exists in the Python SDK, it is directly replaced by begin_create_or_update_at_scope.
@Jing-song Could you please help confirm whether my explanation is correct?
7226abd

Related command
Issue Close: #25049 #25828
Description
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.