/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListExperimentsResponse response = new ListExperimentsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("ExperimentSummaries", targetDepth)) { var unmarshaller = new ListUnmarshaller <ExperimentSummary, ExperimentSummaryUnmarshaller>(ExperimentSummaryUnmarshaller.Instance); response.ExperimentSummaries = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonFISConfig config = new AmazonFISConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonFISClient client = new AmazonFISClient(creds, config); ListExperimentsResponse resp = new ListExperimentsResponse(); do { ListExperimentsRequest req = new ListExperimentsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListExperiments(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Experiments) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public static ListExperimentsResponse Unmarshall(UnmarshallerContext _ctx) { ListExperimentsResponse listExperimentsResponse = new ListExperimentsResponse(); listExperimentsResponse.HttpResponse = _ctx.HttpResponse; listExperimentsResponse.RequestId = _ctx.StringValue("ListExperiments.requestId"); List <ListExperimentsResponse.ListExperiments_ResultItem> listExperimentsResponse_result = new List <ListExperimentsResponse.ListExperiments_ResultItem>(); for (int i = 0; i < _ctx.Length("ListExperiments.Result.Length"); i++) { ListExperimentsResponse.ListExperiments_ResultItem resultItem = new ListExperimentsResponse.ListExperiments_ResultItem(); resultItem.ExperimentId = _ctx.StringValue("ListExperiments.Result[" + i + "].experimentId"); resultItem.Name = _ctx.StringValue("ListExperiments.Result[" + i + "].name"); resultItem.Description = _ctx.StringValue("ListExperiments.Result[" + i + "].description"); resultItem.Status = _ctx.StringValue("ListExperiments.Result[" + i + "].status"); resultItem._Base = _ctx.BooleanValue("ListExperiments.Result[" + i + "].base"); resultItem.OnlineTime = _ctx.StringValue("ListExperiments.Result[" + i + "].onlineTime"); resultItem.OfflineTime = _ctx.StringValue("ListExperiments.Result[" + i + "].offlineTime"); List <string> resultItem_buckets = new List <string>(); for (int j = 0; j < _ctx.Length("ListExperiments.Result[" + i + "].Buckets.Length"); j++) { resultItem_buckets.Add(_ctx.StringValue("ListExperiments.Result[" + i + "].Buckets[" + j + "]")); } resultItem.Buckets = resultItem_buckets; listExperimentsResponse_result.Add(resultItem); } listExperimentsResponse.Result = listExperimentsResponse_result; return(listExperimentsResponse); }