[ARM] Migrate resource to track2 SDK#17783
Conversation
383c07b to
cbaa422
Compare
|
ARM |
fe95df2 to
782fff3
Compare
There was a problem hiding this comment.
Consider using per_call_policies introduced by Azure/azure-sdk-for-python#17340.
It requires azure-core 1.13.0 which is bumped by #17671.
There was a problem hiding this comment.
_prepare_client_kwargs_track2 from core already configures x-ms-client-request-id.
azure-cli/src/azure-cli-core/azure/cli/core/commands/client_factory.py
Lines 156 to 158 in 039fa21
I would suggest we provide a method for users to revert back to old versions of Azure CLI because these are not small changes and may break extensions, especially those not in azure-cli-extensions (#13653). |
2bed04b to
344efa0
Compare
There was a problem hiding this comment.
Can we get the Deployment model from SDK which api-version less than 2019-10-01
There was a problem hiding this comment.
Yes, because in track 2, the SDK before version 2019-10-01 has added this model
Related code: code link
b3efbbb to
e247f5d
Compare
256d1dd to
4c096c6
Compare
Description
This PR upgrades the Python SDK version of
azure-mgmt-resourcefrom12.1.0to16.1.0Here are the main changes for resource migration to track2:
begin_xxx_xxx. For example in track1, the name iscreate_or_update; while in track2, the name isbegin_create_or_update.api-versionis less than2019-10-01, the parameters of all deployment operations are changed fromDeploymentPropertiestoDeployment, which is consistent with the SDK after version2019-10-01.begin_what_if():DeploymentWhatIfProperties-->DeploymentWhatIfbegin_what_if_at_subscription_scope()/...:DeploymentWhatIfProperties-->ScopedDeploymentWhatIfbegin_export_template(): flattened parameters -->ExportTemplateRequestbegin_move_resources(): flattened parameters -->ResourcesMoveInfolinks_client.create_or_update():ResourceLinkProperties-->ResourceLinktags.create_or_update_at_scope(): flattened parameters -->TagsResourcetags.update_at_scope(): flattened parameters -->TagsPatchResourceget()ofResourcesOperations, some parameters are passed in through**kwargsinsteadCloudErrorandHttpOperationErrorare replaced byHttpResponseErrorDeploymentOperationsbecomesDeploymentOperationsOperationsFor more details, please refer to this issue: remove double "operations" in operation group names autorest.python#910 (comment)
configin management client becomes a private variable_config.policy_definitions.create_or_update_at_management_group(), the positions of parametersmanagement_groupandparametersare reversed.generate_client_request_idinResourceManagementClientConfigurationno longer needs, SDK automatically addx-ms-request-idnow through theRequestIdPolicyaccept_languageis no longer supported inResourceManagementClientConfiguration, so the fixed valueen-USin track 2 is hard coded.msresttoazure-core. And when doing ARM deployment, the pipeline needs to add custom policyJsonCTemplatePolicy()to support JSON templates.get_by_id()andget()ofResourcesOperationsno longer support parameterraw, but passes in a callback methodclsinstead. So the custom callback functionadd_response_body()is used to realize the logic ofinclude_response_body.POSToperation in Swagger, so for the time being,AzureOperationPollerofmsrestis still used for low-cost migration. And the request way is changed topipeline.runin track 2.2019-08-01,get_by_id()andget()ofResourcesOperationslacked parameterapi-version. The problem was solved by modifying the Swagger to regenerate a new Python SDK. PR link: Swagger PRKnown commands that are not covered by test
appservice domain createappservice ase createMigration for extension
PR link: Azure/azure-cli-extensions#3355
Live Test
result link
TODO
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 feature.
This 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.