-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[ARM] Migrate resource to track2 SDK #17783
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
Conversation
383c07b to
cbaa422
Compare
|
ARM |
fe95df2 to
782fff3
Compare
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_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
| # Prepare x-ms-client-request-id header, used by RequestIdPolicy | |
| if 'x-ms-client-request-id' in cli_ctx.data['headers']: | |
| client_kwargs['request_id'] = cli_ctx.data['headers']['x-ms-client-request-id'] |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get the Deployment model from SDK which api-version less than 2019-10-01
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.
Yes, because in track 2, the SDK before version 2019-10-01 has added this model
Related code: code link
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.
Same concern as above.
b3efbbb to
e247f5d
Compare
256d1dd to
4c096c6
Compare
qwordy
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.
Approve vm part
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.