-
Notifications
You must be signed in to change notification settings - Fork 4k
Updated Export-AzResourceGroup cmdlet to use the SDK. #13275
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
Updated Export-AzResourceGroup cmdlet to use the SDK. #13275
Conversation
…to xynoclafe/exportTemplateSDK
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
src/Resources/ResourceManager/Implementation/ResourceGroups/ExportAzureResourceGroupCmdlet.cs
Outdated
Show resolved
Hide resolved
src/Resources/ResourceManager/Implementation/ResourceGroups/ExportAzureResourceGroupCmdlet.cs
Outdated
Show resolved
Hide resolved
src/Resources/ResourceManager/Implementation/ResourceGroups/ExportAzureResourceGroupCmdlet.cs
Outdated
Show resolved
Hide resolved
src/Resources/ResourceManager/Implementation/ResourceGroups/ExportAzureResourceGroupCmdlet.cs
Outdated
Show resolved
Hide resolved
Options = this.GetExportOptions(), | ||
}; | ||
|
||
var exportedTemplate = ResourceManagerSdkClient.ExportResourceGroup(ResourceGroupName, parameters); |
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.
Have you had a chance to test export async route? AFAIK, the service side goes into async operation based on the time it takes to export or based on the number of resources (I think it was >= 20 resources). It might be easier to test async route by trying more than 20 resources to export rather than trying to hit the timebound. Do you mind testing this scenario, if you haven't already.
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 don't quite understand the scenario.
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.
src/Resources/ResourceManager/Implementation/ResourceGroups/ExportAzureResourceGroupCmdlet.cs
Show resolved
Hide resolved
src/Resources/ResourceManager/Implementation/ResourceGroups/ExportAzureResourceGroupCmdlet.cs
Outdated
Show resolved
Hide resolved
…clafe/azure-powershell into xynoclafe/exportTemplateSDK
…to xynoclafe/exportTemplateSDK
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'm good with the implmenetation. Please fix the test erorrs.
…to xynoclafe/exportTemplateSDK
Test errors are fixed and all checks seem to be passing |
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.
LGTM
var template = JToken.FromObject(JObject.Parse(resultString)["template"]); | ||
|
||
if (JObject.Parse(resultString)["error"] != null) | ||
if (this.IsParameterBound(c => c.ApiVersion)) |
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 logic seems like it should be reversed - if we have an apiVersion provided we should go through the Rest API client, otherwise SDK client.
Options = this.GetExportOptions(), | ||
}; | ||
var apiVersion = this.ApiVersion ?? DefaultApiVersion; | ||
var operationResult = this.GetResourcesClient() |
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 also wouldn't need this line after "this.IsParameterBound(c => c.ApiVersion"
Description
Checklist
CONTRIBUTING.md
ChangeLog.md
file(s) has been updated:ChangeLog.md
file can be found atsrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
## Upcoming Release
header -- no new version header should be added