Ejemplo n.º 1
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeAlarmsForMetricResponse 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("MetricAlarms/member", targetDepth))
                    {
                        var unmarshaller = MetricAlarmUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.MetricAlarms.Add(item);
                        continue;
                    }
                }
            }

            return;
        }
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)
        {
            DescribeAlarmsForMetricResponse response = new DescribeAlarmsForMetricResponse();

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

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

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

            return(response);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// <para> Retrieves all alarms for a single metric. Specify a statistic,
        /// period, or unit to filter the set of alarms further. </para>
        /// </summary>
        ///
        /// <param name="describeAlarmsForMetricRequest">Container for the
        ///           necessary parameters to execute the DescribeAlarmsForMetric service
        ///           method on AmazonCloudWatch.</param>
        ///
        /// <returns>The response from the DescribeAlarmsForMetric service method,
        ///         as returned by AmazonCloudWatch.</returns>
        ///
        public DescribeAlarmsForMetricResponse DescribeAlarmsForMetric(DescribeAlarmsForMetricRequest describeAlarmsForMetricRequest)
        {
            IRequest <DescribeAlarmsForMetricRequest> request  = new DescribeAlarmsForMetricRequestMarshaller().Marshall(describeAlarmsForMetricRequest);
            DescribeAlarmsForMetricResponse           response = Invoke <DescribeAlarmsForMetricRequest, DescribeAlarmsForMetricResponse> (request, this.signer, DescribeAlarmsForMetricResponseUnmarshaller.GetInstance());

            return(response);
        }
Ejemplo n.º 4
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeAlarmsForMetricResponse 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("MetricAlarms/member", targetDepth))
                    {
                        response.MetricAlarms.Add(MetricAlarmUnmarshaller.GetInstance().Unmarshall(context));

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



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

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

            DescribeAlarmsForMetricResponse resp = new DescribeAlarmsForMetricResponse();
            DescribeAlarmsForMetricRequest  req  = new DescribeAlarmsForMetricRequest
            {
            };

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

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

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


            return(response);
        }