/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListSimulationJobsResponse response = new ListSimulationJobsResponse();

            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("simulationJobSummaries", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <SimulationJobSummary, SimulationJobSummaryUnmarshaller>(SimulationJobSummaryUnmarshaller.Instance);
                    response.SimulationJobSummaries = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Exemplo n.º 2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonRoboMakerConfig config = new AmazonRoboMakerConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonRoboMakerClient client = new AmazonRoboMakerClient(creds, config);

            ListSimulationJobsResponse resp = new ListSimulationJobsResponse();

            do
            {
                ListSimulationJobsRequest req = new ListSimulationJobsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.ListSimulationJobs(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.SimulationJobSummaries)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }