Exemplo n.º 1
0
        private Task <string> SendAsync(AwsRequest request)
        {
            request.Add("Version", Version);

            var httpRequest = new HttpRequestMessage(HttpMethod.Post, Endpoint)
            {
                Content = new FormUrlEncodedContent(request.Parameters)
            };

            return(SendAsync(httpRequest));
        }
Exemplo n.º 2
0
        public AwsRequest ToParams()
        {
            var parameters = new AwsRequest {
                { "Action", "ListMetrics" }
            };

            if (MetricName != null)
            {
                parameters.Add("MetricName", MetricName);
            }
            if (Namespace != null)
            {
                parameters.Add("Namespace", Namespace);
            }
            if (NextToken != null)
            {
                parameters.Add("NextToken", NextToken);
            }

            return(parameters);
        }
Exemplo n.º 3
0
        protected AwsRequest GetParameters(string actionName)
        {
            #region Preconditions

            if (actionName == null)
            {
                throw new ArgumentNullException(nameof(actionName));
            }

            #endregion

            var parameters = new AwsRequest {
                { "Action", actionName }
            };

            var i = 1;

            foreach (var filter in Filters)
            {
                var prefix = "Filter." + i + ".";

                parameters.Add(prefix + "Name", filter.Name);
                parameters.Add(prefix + "Value", filter.Value);

                i++;
            }

            if (MaxResults != null)
            {
                parameters.Add("MaxResults", MaxResults.Value);
            }

            if (NextToken != null)
            {
                parameters.Add("NextToken", NextToken);
            }

            return(parameters);
        }
Exemplo n.º 4
0
        protected void AddIds(AwsRequest request, string idName, List <string> ids)
        {
            var i = 1;

            foreach (var id in ids)
            {
                // e.g. VpcId.1

                request.Add(idName + "." + i, id);

                i++;
            }
        }
Exemplo n.º 5
0
        public AwsRequest ToParams()
        {
            var parameters = new AwsRequest {
                { "Action", "PutMetricData" }
            };

            if (Namespace != null)
            {
                parameters.Add("Namespace", Namespace);
            }

            for (int i = 0; i < Count; i++)
            {
                var datum = this[i];

                var prefix = "MetricData.member." + (i + 1) + ".";

                parameters.Add(prefix + "MetricName", datum.MetricName);
                parameters.Add(prefix + "Unit", datum.Unit);
                parameters.Add(prefix + "Value", datum.Value.ToString());

                if (datum.Dimensions != null)
                {
                    for (int i2 = 0; i < datum.Dimensions.Length; i++)
                    {
                        var dimension = datum.Dimensions[i2];

                        var prefix2 = prefix + "Dimensions.member." + (i2 + 1) + ".";

                        parameters.Add(prefix2 + "Name", dimension.Name);
                        parameters.Add(prefix2 + "Value", dimension.Name);
                    }
                }
            }

            return(parameters);
        }
Exemplo n.º 6
0
        /*
         * public async Task SetAlarmStateAsync()
         * {
         * }
         */

        #region Helpers

        private FormUrlEncodedContent GetPostContent(AwsRequest request)
        {
            request.Add("Version", Version);

            return(new FormUrlEncodedContent(request.Parameters));
        }