private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeAlarmHistoryResponse 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("AlarmHistoryItems/member", targetDepth)) { var unmarshaller = AlarmHistoryItemUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.AlarmHistoryItems.Add(item); continue; } if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } } return; }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeAlarmHistoryResponse response = new DescribeAlarmHistoryResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if(context.TestExpression("DescribeAlarmHistoryResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return response; }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeAlarmHistoryResponse response = new DescribeAlarmHistoryResponse(); while (context.Read()) { if (context.IsStartElement) { if(context.TestExpression("DescribeAlarmHistoryResult", 2)) { response.DescribeAlarmHistoryResult = DescribeAlarmHistoryResultUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return response; }
private static void UnmarshallResult(XmlUnmarshallerContext context,DescribeAlarmHistoryResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) targetDepth += 2; while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("AlarmHistoryItems/member", targetDepth)) { response.AlarmHistoryItems.Add(AlarmHistoryItemUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("NextToken", targetDepth)) { response.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
public static void CWDescribeAlarmHistory() { #region CWDescribeAlarmHistory var client = new AmazonCloudWatchClient(); var request = new DescribeAlarmHistoryRequest { AlarmName = "awseb-e-kkbEXAMPLE-stack-CloudwatchAlarmLow-1WVXD9EXAMPLE", EndDate = DateTime.Today, HistoryItemType = HistoryItemType.Action, MaxRecords = 1, StartDate = DateTime.Today.Subtract(TimeSpan.FromDays(30)) }; var response = new DescribeAlarmHistoryResponse(); do { response = client.DescribeAlarmHistory(request); foreach (var item in response.AlarmHistoryItems) { Console.WriteLine(item.AlarmName); Console.WriteLine(item.HistorySummary); Console.WriteLine(); } request.NextToken = response.NextToken; } while (!string.IsNullOrEmpty(response.NextToken)); #endregion Console.ReadLine(); }