public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeRaidArraysResponse response = new DescribeRaidArraysResponse();

            context.Read();

            UnmarshallResult(context, response);
            return(response);
        }
Esempio n. 2
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeRaidArraysResponse response = new DescribeRaidArraysResponse();

            context.Read();

            response.DescribeRaidArraysResult = DescribeRaidArraysResultUnmarshaller.GetInstance().Unmarshall(context);

            return(response);
        }
Esempio n. 3
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)
        {
            DescribeRaidArraysResponse response = new DescribeRaidArraysResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("RaidArrays", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <RaidArray, RaidArrayUnmarshaller>(RaidArrayUnmarshaller.Instance);
                    response.RaidArrays = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonOpsWorksConfig config = new AmazonOpsWorksConfig();

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

            DescribeRaidArraysResponse resp = new DescribeRaidArraysResponse();
            DescribeRaidArraysRequest  req  = new DescribeRaidArraysRequest
            {
            };

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

            foreach (var obj in resp.RaidArrays)
            {
                AddObject(obj);
            }
        }
        private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeRaidArraysResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("RaidArrays", targetDepth))
                {
                    context.Read();
                    response.RaidArrays = new List <RaidArray>();
                    RaidArrayUnmarshaller unmarshaller = RaidArrayUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.RaidArrays.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return;
                }
            }

            return;
        }