/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeExportTasksResponse response = new DescribeExportTasksResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("exportsInfo", targetDepth)) { var unmarshaller = new ListUnmarshaller <ExportInfo, ExportInfoUnmarshaller>(ExportInfoUnmarshaller.Instance); response.ExportsInfo = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("nextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } return(response); }
// snippet-start:[CloudWatchLogs.dotnetv3.DescribeExportTasksExammple] public static async Task Main() { // This client object will be associated with the same AWS Region // as the default user on this system. If you need to use a // different AWS Region, pass it as a parameter to the client // constructor. var client = new AmazonCloudWatchLogsClient(); var request = new DescribeExportTasksRequest { Limit = 5, }; var response = new DescribeExportTasksResponse(); do { response = await client.DescribeExportTasksAsync(request); response.ExportTasks.ForEach(t => { Console.WriteLine($"{t.TaskName} with ID: {t.TaskId} has status: {t.Status}"); }); }while (response.NextToken is not null); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeExportTasksResponse response = new DescribeExportTasksResponse(); 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("exportTaskSet/item", targetDepth)) { var unmarshaller = ExportTaskUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.ExportTasks.Add(item); continue; } } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonRDSConfig config = new AmazonRDSConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonRDSClient client = new AmazonRDSClient(creds, config); DescribeExportTasksResponse resp = new DescribeExportTasksResponse(); do { DescribeExportTasksRequest req = new DescribeExportTasksRequest { Marker = resp.Marker , MaxRecords = maxItems }; resp = client.DescribeExportTasks(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.ExportTasks) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeExportTasksResponse 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("ExportTasks/ExportTask", targetDepth)) { var unmarshaller = ExportTaskUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.ExportTasks.Add(item); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); continue; } } } return; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeExportTasksResponse response = new DescribeExportTasksResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("DescribeExportTasksResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonEC2Config config = new AmazonEC2Config(); config.RegionEndpoint = region; ConfigureClient(config); AmazonEC2Client client = new AmazonEC2Client(creds, config); DescribeExportTasksResponse resp = new DescribeExportTasksResponse(); DescribeExportTasksRequest req = new DescribeExportTasksRequest { }; resp = client.DescribeExportTasks(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.ExportTasks) { AddObject(obj); } }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribeExportTasksResponse response = new DescribeExportTasksResponse(); int targetDepth = 2; while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("exportTaskSet/item", targetDepth)) { response.ExportTasks.Add(ExportTaskUnmarshaller.GetInstance().Unmarshall(context)); continue; } } } return(response); }