Ejemplo n.º 1
0
        public static DescribePrefixListsResponse Unmarshall(UnmarshallerContext _ctx)
        {
            DescribePrefixListsResponse describePrefixListsResponse = new DescribePrefixListsResponse();

            describePrefixListsResponse.HttpResponse = _ctx.HttpResponse;
            describePrefixListsResponse.RequestId    = _ctx.StringValue("DescribePrefixLists.RequestId");
            describePrefixListsResponse.NextToken    = _ctx.StringValue("DescribePrefixLists.NextToken");

            List <DescribePrefixListsResponse.DescribePrefixLists_PrefixList> describePrefixListsResponse_prefixLists = new List <DescribePrefixListsResponse.DescribePrefixLists_PrefixList>();

            for (int i = 0; i < _ctx.Length("DescribePrefixLists.PrefixLists.Length"); i++)
            {
                DescribePrefixListsResponse.DescribePrefixLists_PrefixList prefixList = new DescribePrefixListsResponse.DescribePrefixLists_PrefixList();
                prefixList.PrefixListId     = _ctx.StringValue("DescribePrefixLists.PrefixLists[" + i + "].PrefixListId");
                prefixList.PrefixListName   = _ctx.StringValue("DescribePrefixLists.PrefixLists[" + i + "].PrefixListName");
                prefixList.AddressFamily    = _ctx.StringValue("DescribePrefixLists.PrefixLists[" + i + "].AddressFamily");
                prefixList.MaxEntries       = _ctx.IntegerValue("DescribePrefixLists.PrefixLists[" + i + "].MaxEntries");
                prefixList.Description      = _ctx.StringValue("DescribePrefixLists.PrefixLists[" + i + "].Description");
                prefixList.CreationTime     = _ctx.StringValue("DescribePrefixLists.PrefixLists[" + i + "].CreationTime");
                prefixList.AssociationCount = _ctx.IntegerValue("DescribePrefixLists.PrefixLists[" + i + "].AssociationCount");

                describePrefixListsResponse_prefixLists.Add(prefixList);
            }
            describePrefixListsResponse.PrefixLists = describePrefixListsResponse_prefixLists;

            return(describePrefixListsResponse);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DescribePrefixListsResponse response = new DescribePrefixListsResponse();

            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("prefixListSet/item", targetDepth))
                    {
                        var unmarshaller = PrefixListUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.PrefixLists.Add(item);
                        continue;
                    }
                }
            }

            return(response);
        }
        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);

            DescribePrefixListsResponse resp = new DescribePrefixListsResponse();

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

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

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