Skip to content

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

Merged
merged 11 commits into from
Oct 27, 2020

Conversation

Xynoclafe
Copy link
Contributor

@Xynoclafe Xynoclafe commented Oct 20, 2020

Description

Checklist

  • I have read the Submitting Changes section of CONTRIBUTING.md
  • The title of the PR is clear and informative
  • The appropriate ChangeLog.md file(s) has been updated:
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header -- no new version header should be added
  • The PR does not introduce breaking changes
  • If applicable, the changes made in the PR have proper test coverage
  • For public API changes to cmdlets:
    • a cmdlet design review was approved for the changes in this repository (Microsoft internal only)
    • the markdown help files have been regenerated using the commands listed here

@Xynoclafe Xynoclafe requested a review from filizt October 20, 2020 20:28
@Xynoclafe Xynoclafe closed this Oct 20, 2020
@Xynoclafe Xynoclafe reopened this Oct 20, 2020
@Xynoclafe Xynoclafe marked this pull request as draft October 20, 2020 20:53
@Xynoclafe Xynoclafe marked this pull request as ready for review October 22, 2020 15:37
@Xynoclafe
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@isra-fel isra-fel self-assigned this Oct 23, 2020
Options = this.GetExportOptions(),
};

var exportedTemplate = ResourceManagerSdkClient.ExportResourceGroup(ResourceGroupName, parameters);
Copy link
Contributor

@filizt filizt Oct 23, 2020

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. We'll chat offline.


In reply to: 510976108 [](ancestors = 510976108)

Copy link
Member

@isra-fel isra-fel left a 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.

@Xynoclafe
Copy link
Contributor Author

I'm good with the implmenetation. Please fix the test erorrs.

Test errors are fixed and all checks seem to be passing

Copy link
Member

@isra-fel isra-fel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@isra-fel isra-fel merged commit dec1b04 into Azure:master Oct 27, 2020
var template = JToken.FromObject(JObject.Parse(resultString)["template"]);

if (JObject.Parse(resultString)["error"] != null)
if (this.IsParameterBound(c => c.ApiVersion))
Copy link
Contributor

@filizt filizt Oct 27, 2020

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()
Copy link
Contributor

@filizt filizt Oct 27, 2020

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"

@filizt
Copy link
Contributor

filizt commented Oct 27, 2020

    private const string DefaultApiVersion = "2020-06-01";

And no need for this const.


Refers to: src/Resources/ResourceManager/Implementation/ResourceGroups/ExportAzureResourceGroupCmdlet.cs:44 in fbcb08b. [](commit_id = fbcb08b, deletion_comment = False)

Xynoclafe added a commit to Xynoclafe/azure-powershell that referenced this pull request Oct 27, 2020
isra-fel pushed a commit that referenced this pull request Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants