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