Beispiel #1
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonCognitoIdentityConfig config = new AmazonCognitoIdentityConfig();

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

            ListIdentityPoolsResponse resp = new ListIdentityPoolsResponse();

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

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

                foreach (var obj in resp.IdentityPools)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListIdentityPoolsResponse response = new ListIdentityPoolsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("IdentityPools", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <IdentityPoolShortDescription, IdentityPoolShortDescriptionUnmarshaller>(IdentityPoolShortDescriptionUnmarshaller.Instance);
                    response.IdentityPools = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListIdentityPoolsResponse listIdentityPoolsResponse = new ListIdentityPoolsResponse();

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

            while (context.ReadAtDepth(currentDepth))
            {
                if (context.TestExpression("IdentityPools", currentDepth))
                {
                    ListUnmarshaller <IdentityPoolShortDescription, IdentityPoolShortDescriptionUnmarshaller> listUnmarshaller = new ListUnmarshaller <IdentityPoolShortDescription, IdentityPoolShortDescriptionUnmarshaller>(IdentityPoolShortDescriptionUnmarshaller.Instance);
                    listIdentityPoolsResponse.IdentityPools = listUnmarshaller.Unmarshall(context);
                }
                else if (context.TestExpression("NextToken", currentDepth))
                {
                    StringUnmarshaller instance = StringUnmarshaller.Instance;
                    listIdentityPoolsResponse.NextToken = instance.Unmarshall(context);
                }
            }
            return(listIdentityPoolsResponse);
        }