Esempio n. 1
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);

            DescribeLocalGatewayRouteTableVpcAssociationsResponse resp = new DescribeLocalGatewayRouteTableVpcAssociationsResponse();

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

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

                foreach (var obj in resp.LocalGatewayRouteTableVpcAssociations)
                {
                    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(XmlUnmarshallerContext context)
        {
            DescribeLocalGatewayRouteTableVpcAssociationsResponse response = new DescribeLocalGatewayRouteTableVpcAssociationsResponse();

            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("localGatewayRouteTableVpcAssociationSet/item", targetDepth))
                    {
                        var unmarshaller = LocalGatewayRouteTableVpcAssociationUnmarshaller.Instance;
                        var item = unmarshaller.Unmarshall(context);
                        response.LocalGatewayRouteTableVpcAssociations.Add(item);
                        continue;
                    }
                    if (context.TestExpression("nextToken", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.NextToken = unmarshaller.Unmarshall(context);
                        continue;
                    }
                } 
            }

            return response;
        }