Ejemplo n.º 1
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DescribeSpotPriceHistoryResponse response = new DescribeSpotPriceHistoryResponse();

            int targetDepth = 2;

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("spotPriceHistorySet/item", targetDepth))
                    {
                        response.SpotPriceHistory.Add(SpotPriceUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("nextToken", targetDepth))
                    {
                        response.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
            }


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

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

            DescribeSpotPriceHistoryResponse resp = new DescribeSpotPriceHistoryResponse();

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

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

                foreach (var obj in resp.SpotPriceHistory)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Ejemplo n.º 3
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DescribeSpotPriceHistoryResponse response = new DescribeSpotPriceHistoryResponse();

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth = 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("nextToken", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.NextToken = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("spotPriceHistorySet/item", targetDepth))
                    {
                        var unmarshaller = SpotPriceUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.SpotPriceHistory.Add(item);
                        continue;
                    }
                }
            }

            return(response);
        }
        public static DescribeSpotPriceHistoryResponse Unmarshall(UnmarshallerContext _ctx)
        {
            DescribeSpotPriceHistoryResponse describeSpotPriceHistoryResponse = new DescribeSpotPriceHistoryResponse();

            describeSpotPriceHistoryResponse.HttpResponse = _ctx.HttpResponse;
            describeSpotPriceHistoryResponse.RequestId    = _ctx.StringValue("DescribeSpotPriceHistory.RequestId");
            describeSpotPriceHistoryResponse.NextOffset   = _ctx.IntegerValue("DescribeSpotPriceHistory.NextOffset");
            describeSpotPriceHistoryResponse.Currency     = _ctx.StringValue("DescribeSpotPriceHistory.Currency");

            List <DescribeSpotPriceHistoryResponse.DescribeSpotPriceHistory_SpotPriceType> describeSpotPriceHistoryResponse_spotPrices = new List <DescribeSpotPriceHistoryResponse.DescribeSpotPriceHistory_SpotPriceType>();

            for (int i = 0; i < _ctx.Length("DescribeSpotPriceHistory.SpotPrices.Length"); i++)
            {
                DescribeSpotPriceHistoryResponse.DescribeSpotPriceHistory_SpotPriceType spotPriceType = new DescribeSpotPriceHistoryResponse.DescribeSpotPriceHistory_SpotPriceType();
                spotPriceType.ZoneId       = _ctx.StringValue("DescribeSpotPriceHistory.SpotPrices[" + i + "].ZoneId");
                spotPriceType.InstanceType = _ctx.StringValue("DescribeSpotPriceHistory.SpotPrices[" + i + "].InstanceType");
                spotPriceType.IoOptimized  = _ctx.StringValue("DescribeSpotPriceHistory.SpotPrices[" + i + "].IoOptimized");
                spotPriceType.Timestamp    = _ctx.StringValue("DescribeSpotPriceHistory.SpotPrices[" + i + "].Timestamp");
                spotPriceType.NetworkType  = _ctx.StringValue("DescribeSpotPriceHistory.SpotPrices[" + i + "].NetworkType");
                spotPriceType.SpotPrice    = _ctx.FloatValue("DescribeSpotPriceHistory.SpotPrices[" + i + "].SpotPrice");
                spotPriceType.OriginPrice  = _ctx.FloatValue("DescribeSpotPriceHistory.SpotPrices[" + i + "].OriginPrice");

                describeSpotPriceHistoryResponse_spotPrices.Add(spotPriceType);
            }
            describeSpotPriceHistoryResponse.SpotPrices = describeSpotPriceHistoryResponse_spotPrices;

            return(describeSpotPriceHistoryResponse);
        }