/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeEnvironmentHealthResponse response = new DescribeEnvironmentHealthResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("DescribeEnvironmentHealthResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeEnvironmentHealthResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("ApplicationMetrics", targetDepth)) { var unmarshaller = ApplicationMetricsUnmarshaller.Instance; response.ApplicationMetrics = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Causes/member", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Causes.Add(item); continue; } if (context.TestExpression("Color", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Color = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("EnvironmentName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.EnvironmentName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("HealthStatus", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.HealthStatus = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("InstancesHealth", targetDepth)) { var unmarshaller = InstanceHealthSummaryUnmarshaller.Instance; response.InstancesHealth = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("RefreshedAt", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.RefreshedAt = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Status", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Status = unmarshaller.Unmarshall(context); continue; } } } return; }