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

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("MaxResults", targetDepth))
                {
                    var unmarshaller = IntUnmarshaller.Instance;
                    response.MaxResults = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("ResolverRules", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <ResolverRule, ResolverRuleUnmarshaller>(ResolverRuleUnmarshaller.Instance);
                    response.ResolverRules = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

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

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

            ListResolverRulesResponse resp = new ListResolverRulesResponse();

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

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

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