public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonSyntheticsConfig config = new AmazonSyntheticsConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonSyntheticsClient client = new AmazonSyntheticsClient(creds, config); DescribeCanariesResponse resp = new DescribeCanariesResponse(); do { DescribeCanariesRequest req = new DescribeCanariesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.DescribeCanaries(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Canaries) { 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) { DescribeCanariesResponse response = new DescribeCanariesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Canaries", targetDepth)) { var unmarshaller = new ListUnmarshaller <Canary, CanaryUnmarshaller>(CanaryUnmarshaller.Instance); response.Canaries = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } return(response); }