/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { CreateFirewallRuleResponse response = new CreateFirewallRuleResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("FirewallRule", targetDepth)) { var unmarshaller = FirewallRuleUnmarshaller.Instance; response.FirewallRule = unmarshaller.Unmarshall(context); continue; } } return(response); }
private async Task <CreateFirewallRuleResponse> DoHandleCreateFirewallRuleRequest(CreateFirewallRuleParams firewallRule) { var result = new CreateFirewallRuleResponse(); // Note: currently not catching the exception. Expect the caller to this message to handle error cases by // showing the error string and responding with a clean failure message to the user try { AuthenticationService authService = ServiceProvider.GetService <AuthenticationService>(); IUserAccount account = await authService.SetCurrentAccountAsync(firewallRule.Account, firewallRule.SecurityTokenMappings); FirewallRuleResponse response = await firewallRuleService.CreateFirewallRuleAsync(firewallRule.ServerName, firewallRule.StartIpAddress, firewallRule.EndIpAddress); result.Result = true; } catch (FirewallRuleException ex) { result.Result = false; result.ErrorMessage = ex.Message; } return(result); }