Skip to content

Commit e105e79

Browse files
committed
Merge pull request #2182 from solankisamir/sasolank_updatepowershell
[Release-1.4.0] Better Error communication in case of Long Running Operation
2 parents a029d26 + 7a73cb3 commit e105e79

9 files changed

+22
-18
lines changed

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/ApiManagementClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ public TenantConfigurationLongRunningOperation BeginSaveTenantGitConfiguration(
16891689
context.ServiceName,
16901690
saveConfigurationParams);
16911691

1692-
return TenantConfigurationLongRunningOperation.CreateLongRunningOperation("Save-AzureRmApiManagement", longrunningResponse);
1692+
return TenantConfigurationLongRunningOperation.CreateLongRunningOperation("Save-AzureRmApiManagementTenantGitConfiguration", longrunningResponse);
16931693
}
16941694

16951695
public TenantConfigurationLongRunningOperation BeginPublishTenantGitConfiguration(
@@ -1707,7 +1707,7 @@ public TenantConfigurationLongRunningOperation BeginPublishTenantGitConfiguratio
17071707
context.ServiceName,
17081708
deployConfigurationParams);
17091709

1710-
return TenantConfigurationLongRunningOperation.CreateLongRunningOperation("Publish-AzureRmApiManagement", longrunningResponse);
1710+
return TenantConfigurationLongRunningOperation.CreateLongRunningOperation("Publish-AzureRmApiManagementTenantGitConfiguration", longrunningResponse);
17111711
}
17121712

17131713
public TenantConfigurationLongRunningOperation BeginValidateTenantGitConfiguration(
@@ -1725,7 +1725,7 @@ public TenantConfigurationLongRunningOperation BeginValidateTenantGitConfigurati
17251725
context.ServiceName,
17261726
deployConfigurationParams);
17271727

1728-
return TenantConfigurationLongRunningOperation.CreateLongRunningOperation("Publish-AzureRmApiManagement -ValidateOnly", longrunningResponse);
1728+
return TenantConfigurationLongRunningOperation.CreateLongRunningOperation("Publish-AzureRmApiManagementTenantGitConfiguration -ValidateOnly", longrunningResponse);
17291729
}
17301730

17311731
public PsApiManagementTenantConfigurationSyncState GetTenantConfigurationSyncState(

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/AzureApiManagementCmdletBase.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ protected TenantConfigurationLongRunningOperation WaitForOperationToComplete(Ten
107107

108108
protected void ExecuteTenantConfigurationLongRunningCmdletWrap(
109109
Func<TenantConfigurationLongRunningOperation> func,
110-
bool passThru = false,
111-
object passThruValue = null)
110+
bool passThru = false)
112111
{
113112
try
114113
{
@@ -121,12 +120,21 @@ protected void ExecuteTenantConfigurationLongRunningCmdletWrap(
121120
longRunningOperation.OperationResult.Error.Message
122121
: longRunningOperation.OperationName;
123122

123+
WriteObject(longRunningOperation.OperationResult);
124+
if (longRunningOperation.OperationResult.Error != null)
125+
{
126+
WriteObject(longRunningOperation.OperationResult.Error);
127+
if (longRunningOperation.OperationResult.Error.Details != null)
128+
{
129+
WriteObject(longRunningOperation.OperationResult.Error.Details, true);
130+
}
131+
}
132+
124133
WriteErrorWithTimestamp(errorMessage);
125-
WriteObject(passThruValue ?? longRunningOperation.OperationResult);
126134
}
127135
else if (passThru)
128136
{
129-
WriteObject(passThruValue ?? longRunningOperation.OperationResult);
137+
WriteObject(longRunningOperation.OperationResult);
130138
}
131139
}
132140
catch (ArgumentException ex)

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/NewAzureApiManagementProduct.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,10 @@ public override void ExecuteApiManagementCmdlet()
8888
string productId = ProductId ?? Guid.NewGuid().ToString("N");
8989

9090
bool? approvalRequired = null;
91-
if (SubscriptionRequired.HasValue && SubscriptionRequired.Value)
92-
{
93-
approvalRequired = ApprovalRequired ?? false;
94-
}
95-
9691
Int32? subscriptionsLimit = null;
9792
if (SubscriptionRequired.HasValue && SubscriptionRequired.Value)
9893
{
94+
approvalRequired = ApprovalRequired ?? false;
9995
subscriptionsLimit = SubscriptionsLimit ?? 1;
10096
}
10197

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/NewAzureApiManagmentProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class NewAzureApiManagementProperty : AzureApiManagementCmdletBase
5757
ValueFromPipelineByPropertyName = true,
5858
Mandatory = false,
5959
HelpMessage = "Determines whether the value is a secret and should be encrypted or not." +
60-
" This parameter is optional. Default Value is not Secret.")]
60+
" This parameter is optional. Default Value is false.")]
6161
public SwitchParameter Secret { get; set; }
6262

6363
[Parameter(

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/PublishAzureApiManagementTenantConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class PublishAzureApiManagementTenantConfiguration : AzureApiManagementCm
5858
ValueFromPipelineByPropertyName = true,
5959
Mandatory = false,
6060
HelpMessage = "If specified then instance of Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOperationResult" +
61-
" type representing the operation result.")]
61+
" type representing the operation result will be written to output.")]
6262
public SwitchParameter PassThru { get; set; }
6363

6464
public override void ExecuteApiManagementCmdlet()

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/SaveAzureApiManagementTenantConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class SaveAzureApiManagementTenantConfiguration : AzureApiManagementCmdle
5151
Mandatory = false,
5252
HelpMessage = "If specified then instance of" +
5353
" Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOperationResult type" +
54-
" representing the operation result.")]
54+
" representing the operation result will be written to output.")]
5555
public SwitchParameter PassThru { get; set; }
5656

5757
public override void ExecuteApiManagementCmdlet()

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/SetAzureApiManagementLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class SetAzureApiManagementLogger : AzureApiManagementCmdletBase
6868
Mandatory = false,
6969
HelpMessage = "If specified then instance of " +
7070
"Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementLogger type " +
71-
" representing the modified logger.")]
71+
" representing the modified logger will be written to output.")]
7272
public SwitchParameter PassThru { get; set; }
7373

7474
public override void ExecuteApiManagementCmdlet()

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/SetAzureApiManagementOpenIdConnectProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class SetAzureApiManagementOpenIdConnectProvider : AzureApiManagementCmdl
7171
Mandatory = false,
7272
HelpMessage = "If specified then instance of " +
7373
"Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOpenIdConnectProvider type" +
74-
" representing the modified OpenId Connect Provider.")]
74+
" representing the modified OpenId Connect Provider will be written to output.")]
7575
public SwitchParameter PassThru { get; set; }
7676

7777
public override void ExecuteApiManagementCmdlet()

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/SetAzureApiManagementProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public class SetAzureApiManagementProperty : AzureApiManagementCmdletBase
6969
Mandatory = false,
7070
HelpMessage = "If specified then instance of " +
7171
"Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementProperty type " +
72-
"representing the modified property.")]
72+
"representing the modified property will be written to output.")]
7373
public SwitchParameter PassThru { get; set; }
7474

7575
public override void ExecuteApiManagementCmdlet()

0 commit comments

Comments
 (0)