public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonMacieConfig config = new AmazonMacieConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonMacieClient client = new AmazonMacieClient(creds, config); ListS3ResourcesResponse resp = new ListS3ResourcesResponse(); do { ListS3ResourcesRequest req = new ListS3ResourcesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListS3Resources(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.S3Resources) { 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) { ListS3ResourcesResponse response = new ListS3ResourcesResponse(); 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("s3Resources", targetDepth)) { var unmarshaller = new ListUnmarshaller <S3ResourceClassification, S3ResourceClassificationUnmarshaller>(S3ResourceClassificationUnmarshaller.Instance); response.S3Resources = unmarshaller.Unmarshall(context); continue; } } return(response); }