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

            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("testGridProjects", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <TestGridProject, TestGridProjectUnmarshaller>(TestGridProjectUnmarshaller.Instance);
                    response.TestGridProjects = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

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

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

            ListTestGridProjectsResponse resp = new ListTestGridProjectsResponse();

            do
            {
                ListTestGridProjectsRequest req = new ListTestGridProjectsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResult = maxItems
                };

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

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