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

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

            DescribeMLModelsResponse resp = new DescribeMLModelsResponse();

            do
            {
                DescribeMLModelsRequest req = new DescribeMLModelsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    Limit = maxItems
                };

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

                foreach (var obj in resp.Results)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeMLModelsResponse response = new DescribeMLModelsResponse();

            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("Results", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <MLModel, MLModelUnmarshaller>(MLModelUnmarshaller.Instance);
                    response.Results = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }