private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeInstanceHealthResponse response)
        {
            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("InstanceStates/member", targetDepth))
                    {
                        var unmarshaller = InstanceStateUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.InstanceStates.Add(item);
                        continue;
                    }
                }
            }

            return;
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DescribeInstanceHealthResponse response = new DescribeInstanceHealthResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("DescribeInstanceHealthResult", 2))
                    {
                        UnmarshallResult(context, response);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return(response);
        }
Esempio n. 3
0
        /// <summary>
        /// <para> Returns the current state of the instances of the specified LoadBalancer. If no instances are specified, the state of all the
        /// instances for the LoadBalancer is returned. </para> <para><b>NOTE:</b> The client must have created the specified input LoadBalancer in
        /// order to retrieve this information; the client must provide the same account credentials as those that were used to create the LoadBalancer.
        /// </para>
        /// </summary>
        ///
        /// <param name="describeInstanceHealthRequest">Container for the necessary parameters to execute the DescribeInstanceHealth service method on
        ///           AmazonElasticLoadBalancing.</param>
        ///
        /// <returns>The response from the DescribeInstanceHealth service method, as returned by AmazonElasticLoadBalancing.</returns>
        ///
        /// <exception cref="InvalidInstanceException"/>
        /// <exception cref="LoadBalancerNotFoundException"/>
        public DescribeInstanceHealthResponse DescribeInstanceHealth(DescribeInstanceHealthRequest describeInstanceHealthRequest)
        {
            IRequest <DescribeInstanceHealthRequest> request  = new DescribeInstanceHealthRequestMarshaller().Marshall(describeInstanceHealthRequest);
            DescribeInstanceHealthResponse           response = Invoke <DescribeInstanceHealthRequest, DescribeInstanceHealthResponse> (request, this.signer, DescribeInstanceHealthResponseUnmarshaller.GetInstance());

            return(response);
        }
Esempio n. 4
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeInstanceHealthResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("InstanceStates/member", targetDepth))
                    {
                        response.InstanceStates.Add(InstanceStateUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }



            return;
        }
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonElasticLoadBalancingConfig config = new AmazonElasticLoadBalancingConfig();

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

            DescribeInstanceHealthResponse resp = new DescribeInstanceHealthResponse();
            DescribeInstanceHealthRequest  req  = new DescribeInstanceHealthRequest
            {
            };

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

            foreach (var obj in resp.InstanceStates)
            {
                AddObject(obj);
            }
        }
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DescribeInstanceHealthResponse response = new DescribeInstanceHealthResponse();

            while (context.Read())
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("DescribeInstanceHealthResult", 2))
                    {
                        response.DescribeInstanceHealthResult = DescribeInstanceHealthResultUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context);
                    }
                }
            }


            return(response);
        }