private static void UnmarshallResult(XmlUnmarshallerContext context, GetChangeResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 1; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("ChangeInfo", targetDepth)) { var unmarshaller = ChangeInfoUnmarshaller.Instance; response.ChangeInfo = unmarshaller.Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { GetChangeResponse response = new GetChangeResponse(); UnmarshallResult(context, response); return(response); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { GetChangeResponse response = new GetChangeResponse(); while (context.Read()) { if (context.IsStartElement) { response.GetChangeResult = GetChangeResultUnmarshaller.GetInstance().Unmarshall(context); break; } } return(response); }
private async Task <bool> WaitForChange(AmazonRoute53Client client, string id, int interval = 10000, int maxIterations = 60) { bool pending = true; bool timeout = (maxIterations > 0); int count = 0; while (pending && !timeout) { //Check Status GetChangeResponse response = await client.GetChangeAsync(new GetChangeRequest(id)); if ((response != null) && (response.HttpStatusCode == HttpStatusCode.OK)) { if (ChangeStatus.INSYNC == response.ChangeInfo.Status) { pending = false; } } else { timeout = true; } //Sleep if (count < maxIterations) { Console.WriteLine("Change is pending..."); Thread.Sleep(interval); } else { timeout = true; } count++; } return(timeout); }