Exemplo n.º 1
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)
        {
            DescribeDhcpOptionsResponse response = new DescribeDhcpOptionsResponse();

            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("dhcpOptionsSet/item", targetDepth))
                    {
                        var unmarshaller = DhcpOptionsUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.DhcpOptions.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);

            DescribeDhcpOptionsResponse resp = new DescribeDhcpOptionsResponse();

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

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

                foreach (var obj in resp.DhcpOptions)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Exemplo n.º 3
0
        public List <DescribeDhcpOptionsSetModel> MapForDescribe(DescribeDhcpOptionsResponse describeDhcpOptionsResponse)
        {
            var model = new List <DescribeDhcpOptionsSetModel>();

            foreach (var dhcpOptionsSet in describeDhcpOptionsResponse.DhcpOptions)
            {
                model.Add(new DescribeDhcpOptionsSetModel()
                {
                    DhcpOptionsSetId = dhcpOptionsSet.DhcpOptionsId
                });
            }

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

            DescribeDhcpOptionsResponse resp = new DescribeDhcpOptionsResponse();
            DescribeDhcpOptionsRequest  req  = new DescribeDhcpOptionsRequest
            {
            };

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

            foreach (var obj in resp.DhcpOptions)
            {
                AddObject(obj);
            }
        }
Exemplo n.º 5
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DescribeDhcpOptionsResponse response = new DescribeDhcpOptionsResponse();

            int targetDepth = 2;

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("dhcpOptionsSet/item", targetDepth))
                    {
                        response.DhcpOptions.Add(DhcpOptionsUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
            }


            return(response);
        }