Skip to content

Commit cc893be

Browse files
committed
Review fixes
1 parent e72e11e commit cc893be

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/Resources/ResourceManager/Implementation/ResourceGroups/ExportAzureResourceGroupCmdlet.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2222
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.ResourceIds;
2323
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
2424
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities;
25-
using Microsoft.Azure.Management.Internal.ResourceManager.Version2018_05_01.Models;
2625
using Microsoft.Azure.Management.ResourceManager.Models;
2726
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2827
using Microsoft.WindowsAzure.Commands.Utilities.Common;
@@ -99,7 +98,7 @@ public class ExportAzureResourceGroupCmdlet : ResourceManagerCmdletBaseWithApiVe
9998
/// <summary>
10099
/// Gets or sets the API version.
101100
/// </summary>
102-
[CmdletParameterBreakingChange("ApiVersion", ChangeDescription = "Parameter is being deprecated without being replaced")]
101+
[CmdletParameterBreakingChange("ApiVersion", ChangeDescription = "Parameter is being deprecated without being replaced. Using the lastest possible API version will become the default behavior.")]
103102
[Parameter(Mandatory = false, HelpMessage = "When set, indicates the version of the resource provider API to use. If not specified, the API version is automatically determined as the latest available.")]
104103
[ValidateNotNullOrEmpty]
105104
public override string ApiVersion { get; set; }
@@ -110,14 +109,14 @@ public class ExportAzureResourceGroupCmdlet : ResourceManagerCmdletBaseWithApiVe
110109
protected override void OnProcessRecord()
111110
{
112111
base.OnProcessRecord();
113-
String contents;
112+
string contents;
114113

115114
if (ShouldProcess(ResourceGroupName, VerbsData.Export))
116115
{
117116

118117
var resourceGroupId = this.GetResourceGroupId();
119118

120-
if (this.ApiVersion is null)
119+
if (this.IsParameterBound(c => c.ApiVersion))
121120
{
122121
var parameters = new Management.ResourceManager.Models.ExportTemplateRequest
123122
{
@@ -131,6 +130,15 @@ protected override void OnProcessRecord()
131130
contents = template.ToString();
132131

133132
var error = exportedTemplate.Error;
133+
134+
if(error != null)
135+
{
136+
WriteWarning(string.Format("{0} : {1}", error.Code, error.Message));
137+
foreach (var detail in error.Details)
138+
{
139+
WriteWarning(string.Format("{0} : {1}", detail.Code, detail.Message));
140+
}
141+
}
134142
}
135143
else
136144
{
@@ -165,8 +173,7 @@ protected override void OnProcessRecord()
165173

166174
if (JObject.Parse(resultString)["error"] != null)
167175
{
168-
ExtendedErrorInfo error;
169-
if (JObject.Parse(resultString)["error"].TryConvertTo(out error))
176+
if (JObject.Parse(resultString)["error"].TryConvertTo(out ExtendedErrorInfo error))
170177
{
171178
WriteWarning(string.Format("{0} : {1}", error.Code, error.Message));
172179
foreach (var detail in error.Details)

0 commit comments

Comments
 (0)