/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListStatementsResponse response = new ListStatementsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Statements", targetDepth)) { var unmarshaller = new ListUnmarshaller <StatementData, StatementDataUnmarshaller>(StatementDataUnmarshaller.Instance); response.Statements = unmarshaller.Unmarshall(context); continue; } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonRedshiftDataAPIServiceConfig config = new AmazonRedshiftDataAPIServiceConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonRedshiftDataAPIServiceClient client = new AmazonRedshiftDataAPIServiceClient(creds, config); ListStatementsResponse resp = new ListStatementsResponse(); do { ListStatementsRequest req = new ListStatementsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListStatements(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Statements) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }