Skip to content

[Release-1.4.0] Better Error communication in case of Long Running Operation #2182

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 2 commits into from
Apr 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,7 @@ public TenantConfigurationLongRunningOperation BeginSaveTenantGitConfiguration(
context.ServiceName,
saveConfigurationParams);

return TenantConfigurationLongRunningOperation.CreateLongRunningOperation("Save-AzureRmApiManagement", longrunningResponse);
return TenantConfigurationLongRunningOperation.CreateLongRunningOperation("Save-AzureRmApiManagementTenantGitConfiguration", longrunningResponse);
}

public TenantConfigurationLongRunningOperation BeginPublishTenantGitConfiguration(
Expand All @@ -1707,7 +1707,7 @@ public TenantConfigurationLongRunningOperation BeginPublishTenantGitConfiguratio
context.ServiceName,
deployConfigurationParams);

return TenantConfigurationLongRunningOperation.CreateLongRunningOperation("Publish-AzureRmApiManagement", longrunningResponse);
return TenantConfigurationLongRunningOperation.CreateLongRunningOperation("Publish-AzureRmApiManagementTenantGitConfiguration", longrunningResponse);
}

public TenantConfigurationLongRunningOperation BeginValidateTenantGitConfiguration(
Expand All @@ -1725,7 +1725,7 @@ public TenantConfigurationLongRunningOperation BeginValidateTenantGitConfigurati
context.ServiceName,
deployConfigurationParams);

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

public PsApiManagementTenantConfigurationSyncState GetTenantConfigurationSyncState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ protected TenantConfigurationLongRunningOperation WaitForOperationToComplete(Ten

protected void ExecuteTenantConfigurationLongRunningCmdletWrap(
Func<TenantConfigurationLongRunningOperation> func,
bool passThru = false,
object passThruValue = null)
bool passThru = false)
{
try
{
Expand All @@ -121,12 +120,21 @@ protected void ExecuteTenantConfigurationLongRunningCmdletWrap(
longRunningOperation.OperationResult.Error.Message
: longRunningOperation.OperationName;

WriteObject(longRunningOperation.OperationResult);
if (longRunningOperation.OperationResult.Error != null)
{
WriteObject(longRunningOperation.OperationResult.Error);
if (longRunningOperation.OperationResult.Error.Details != null)
{
WriteObject(longRunningOperation.OperationResult.Error.Details, true);
}
}

WriteErrorWithTimestamp(errorMessage);
WriteObject(passThruValue ?? longRunningOperation.OperationResult);
}
else if (passThru)
{
WriteObject(passThruValue ?? longRunningOperation.OperationResult);
WriteObject(longRunningOperation.OperationResult);
}
}
catch (ArgumentException ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,10 @@ public override void ExecuteApiManagementCmdlet()
string productId = ProductId ?? Guid.NewGuid().ToString("N");

bool? approvalRequired = null;
if (SubscriptionRequired.HasValue && SubscriptionRequired.Value)
{
approvalRequired = ApprovalRequired ?? false;
}

Int32? subscriptionsLimit = null;
if (SubscriptionRequired.HasValue && SubscriptionRequired.Value)
{
approvalRequired = ApprovalRequired ?? false;
subscriptionsLimit = SubscriptionsLimit ?? 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class NewAzureApiManagementProperty : AzureApiManagementCmdletBase
ValueFromPipelineByPropertyName = true,
Mandatory = false,
HelpMessage = "Determines whether the value is a secret and should be encrypted or not." +
" This parameter is optional. Default Value is not Secret.")]
" This parameter is optional. Default Value is false.")]
public SwitchParameter Secret { get; set; }

[Parameter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class PublishAzureApiManagementTenantConfiguration : AzureApiManagementCm
ValueFromPipelineByPropertyName = true,
Mandatory = false,
HelpMessage = "If specified then instance of Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOperationResult" +
" type representing the operation result.")]
" type representing the operation result will be written to output.")]
public SwitchParameter PassThru { get; set; }

public override void ExecuteApiManagementCmdlet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class SaveAzureApiManagementTenantConfiguration : AzureApiManagementCmdle
Mandatory = false,
HelpMessage = "If specified then instance of" +
" Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOperationResult type" +
" representing the operation result.")]
" representing the operation result will be written to output.")]
public SwitchParameter PassThru { get; set; }

public override void ExecuteApiManagementCmdlet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class SetAzureApiManagementLogger : AzureApiManagementCmdletBase
Mandatory = false,
HelpMessage = "If specified then instance of " +
"Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementLogger type " +
" representing the modified logger.")]
" representing the modified logger will be written to output.")]
public SwitchParameter PassThru { get; set; }

public override void ExecuteApiManagementCmdlet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class SetAzureApiManagementOpenIdConnectProvider : AzureApiManagementCmdl
Mandatory = false,
HelpMessage = "If specified then instance of " +
"Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOpenIdConnectProvider type" +
" representing the modified OpenId Connect Provider.")]
" representing the modified OpenId Connect Provider will be written to output.")]
public SwitchParameter PassThru { get; set; }

public override void ExecuteApiManagementCmdlet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class SetAzureApiManagementProperty : AzureApiManagementCmdletBase
Mandatory = false,
HelpMessage = "If specified then instance of " +
"Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementProperty type " +
"representing the modified property.")]
"representing the modified property will be written to output.")]
public SwitchParameter PassThru { get; set; }

public override void ExecuteApiManagementCmdlet()
Expand Down