/** * Convert CreateOrUpdateScalingTriggerRequest to name value pairs */ private static IDictionary <string, string> ConvertCreateOrUpdateScalingTrigger(CreateOrUpdateScalingTriggerRequest request) { IDictionary <string, string> parameters = new Dictionary <string, string>(); parameters["Action"] = "CreateOrUpdateScalingTrigger"; if (request.IsSetTriggerName()) { parameters["TriggerName"] = request.TriggerName; } if (request.IsSetAutoScalingGroupName()) { parameters["AutoScalingGroupName"] = request.AutoScalingGroupName; } if (request.IsSetMeasureName()) { parameters["MeasureName"] = request.MeasureName; } if (request.IsSetStatistic()) { parameters["Statistic"] = request.Statistic; } List <Dimension> createOrUpdateScalingTriggerRequestDimensionsList = request.Dimensions; int createOrUpdateScalingTriggerRequestDimensionsListIndex = 1; foreach (Dimension createOrUpdateScalingTriggerRequestDimensions in createOrUpdateScalingTriggerRequestDimensionsList) { if (createOrUpdateScalingTriggerRequestDimensions.IsSetName()) { parameters[String.Concat("Dimensions", ".member.", createOrUpdateScalingTriggerRequestDimensionsListIndex, ".", "Name")] = createOrUpdateScalingTriggerRequestDimensions.Name; } if (createOrUpdateScalingTriggerRequestDimensions.IsSetValue()) { parameters[String.Concat("Dimensions", ".member.", createOrUpdateScalingTriggerRequestDimensionsListIndex, ".", "Value")] = createOrUpdateScalingTriggerRequestDimensions.Value; } createOrUpdateScalingTriggerRequestDimensionsListIndex++; } if (request.IsSetPeriod()) { parameters["Period"] = request.Period.ToString(); } if (request.IsSetUnit()) { parameters["Unit"] = request.Unit; } if (request.IsSetCustomUnit()) { parameters["CustomUnit"] = request.CustomUnit; } if (request.IsSetNamespace()) { parameters["Namespace"] = request.Namespace; } if (request.IsSetLowerThreshold()) { parameters["LowerThreshold"] = request.LowerThreshold.ToString(); } if (request.IsSetLowerBreachScaleIncrement()) { parameters["LowerBreachScaleIncrement"] = request.LowerBreachScaleIncrement; } if (request.IsSetUpperThreshold()) { parameters["UpperThreshold"] = request.UpperThreshold.ToString(); } if (request.IsSetUpperBreachScaleIncrement()) { parameters["UpperBreachScaleIncrement"] = request.UpperBreachScaleIncrement; } if (request.IsSetBreachDuration()) { parameters["BreachDuration"] = request.BreachDuration.ToString(); } return(parameters); }
private static IDictionary <string, string> ConvertCreateOrUpdateScalingTrigger(CreateOrUpdateScalingTriggerRequest request) { IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary["Action"] = "CreateOrUpdateScalingTrigger"; if (request.IsSetTriggerName()) { dictionary["TriggerName"] = request.TriggerName; } if (request.IsSetAutoScalingGroupName()) { dictionary["AutoScalingGroupName"] = request.AutoScalingGroupName; } if (request.IsSetMeasureName()) { dictionary["MeasureName"] = request.MeasureName; } if (request.IsSetStatistic()) { dictionary["Statistic"] = request.Statistic; } List <Dimension> dimensions = request.Dimensions; int num = 1; foreach (Dimension dimension in dimensions) { if (dimension.IsSetName()) { dictionary[string.Concat(new object[] { "Dimensions", ".member.", num, ".", "Name" })] = dimension.Name; } if (dimension.IsSetValue()) { dictionary[string.Concat(new object[] { "Dimensions", ".member.", num, ".", "Value" })] = dimension.Value; } num++; } if (request.IsSetPeriod()) { dictionary["Period"] = request.Period.ToString(); } if (request.IsSetUnit()) { dictionary["Unit"] = request.Unit; } if (request.IsSetCustomUnit()) { dictionary["CustomUnit"] = request.CustomUnit; } if (request.IsSetNamespace()) { dictionary["Namespace"] = request.Namespace; } if (request.IsSetLowerThreshold()) { dictionary["LowerThreshold"] = request.LowerThreshold.ToString(); } if (request.IsSetLowerBreachScaleIncrement()) { dictionary["LowerBreachScaleIncrement"] = request.LowerBreachScaleIncrement; } if (request.IsSetUpperThreshold()) { dictionary["UpperThreshold"] = request.UpperThreshold.ToString(); } if (request.IsSetUpperBreachScaleIncrement()) { dictionary["UpperBreachScaleIncrement"] = request.UpperBreachScaleIncrement; } if (request.IsSetBreachDuration()) { dictionary["BreachDuration"] = request.BreachDuration.ToString(); } return(dictionary); }