private static IDictionary <string, string> ConvertAddJobFlowSteps(AddJobFlowStepsRequest request)
        {
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["Action"] = "AddJobFlowSteps";
            if (request.IsSetJobFlowId())
            {
                dictionary["JobFlowId"] = request.JobFlowId;
            }
            List <StepConfig> steps = request.Steps;
            int num = 1;

            foreach (StepConfig config in steps)
            {
                if (config.IsSetName())
                {
                    dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "Name" })] = config.Name;
                }
                if (config.IsSetActionOnFailure())
                {
                    dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "ActionOnFailure" })] = config.ActionOnFailure;
                }
                if (config.IsSetHadoopJarStep())
                {
                    HadoopJarStepConfig hadoopJarStep = config.HadoopJarStep;
                    List <KeyValue>     properties    = hadoopJarStep.Properties;
                    int num2 = 1;
                    foreach (KeyValue value2 in properties)
                    {
                        if (value2.IsSetKey())
                        {
                            dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "HadoopJarStep", ".", "Properties", ".member.", num2, ".", "Key" })] = value2.Key;
                        }
                        if (value2.IsSetValue())
                        {
                            dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "HadoopJarStep", ".", "Properties", ".member.", num2, ".", "Value" })] = value2.Value;
                        }
                        num2++;
                    }
                    if (hadoopJarStep.IsSetJar())
                    {
                        dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "HadoopJarStep", ".", "Jar" })] = hadoopJarStep.Jar;
                    }
                    if (hadoopJarStep.IsSetMainClass())
                    {
                        dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "HadoopJarStep", ".", "MainClass" })] = hadoopJarStep.MainClass;
                    }
                    List <string> args = hadoopJarStep.Args;
                    int           num3 = 1;
                    foreach (string str in args)
                    {
                        dictionary[string.Concat(new object[] { "Steps", ".member.", num, ".", "HadoopJarStep", ".", "Args", ".member.", num3 })] = str;
                        num3++;
                    }
                }
                num++;
            }
            return(dictionary);
        }
Exemple #2
0
        /**
         * Convert AddJobFlowStepsRequest to name value pairs
         */
        private static IDictionary <string, string> ConvertAddJobFlowSteps(AddJobFlowStepsRequest request)
        {
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["Action"] = "AddJobFlowSteps";
            if (request.IsSetJobFlowId())
            {
                parameters["JobFlowId"] = request.JobFlowId;
            }
            List <StepConfig> addJobFlowStepsRequestStepsList = request.Steps;
            int addJobFlowStepsRequestStepsListIndex          = 1;

            foreach (StepConfig addJobFlowStepsRequestSteps in addJobFlowStepsRequestStepsList)
            {
                if (addJobFlowStepsRequestSteps.IsSetName())
                {
                    parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "Name")] = addJobFlowStepsRequestSteps.Name;
                }
                if (addJobFlowStepsRequestSteps.IsSetActionOnFailure())
                {
                    parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "ActionOnFailure")] = addJobFlowStepsRequestSteps.ActionOnFailure;
                }
                if (addJobFlowStepsRequestSteps.IsSetHadoopJarStep())
                {
                    HadoopJarStepConfig stepsHadoopJarStep          = addJobFlowStepsRequestSteps.HadoopJarStep;
                    List <KeyValue>     hadoopJarStepPropertiesList = stepsHadoopJarStep.Properties;
                    int hadoopJarStepPropertiesListIndex            = 1;
                    foreach (KeyValue hadoopJarStepProperties in hadoopJarStepPropertiesList)
                    {
                        if (hadoopJarStepProperties.IsSetKey())
                        {
                            parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "HadoopJarStep", ".", "Properties", ".member.", hadoopJarStepPropertiesListIndex, ".", "Key")] = hadoopJarStepProperties.Key;
                        }
                        if (hadoopJarStepProperties.IsSetValue())
                        {
                            parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "HadoopJarStep", ".", "Properties", ".member.", hadoopJarStepPropertiesListIndex, ".", "Value")] = hadoopJarStepProperties.Value;
                        }

                        hadoopJarStepPropertiesListIndex++;
                    }
                    if (stepsHadoopJarStep.IsSetJar())
                    {
                        parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "HadoopJarStep", ".", "Jar")] = stepsHadoopJarStep.Jar;
                    }
                    if (stepsHadoopJarStep.IsSetMainClass())
                    {
                        parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "HadoopJarStep", ".", "MainClass")] = stepsHadoopJarStep.MainClass;
                    }
                    List <string> hadoopJarStepArgsList      = stepsHadoopJarStep.Args;
                    int           hadoopJarStepArgsListIndex = 1;
                    foreach (string hadoopJarStepArgs in hadoopJarStepArgsList)
                    {
                        parameters[String.Concat("Steps", ".member.", addJobFlowStepsRequestStepsListIndex, ".", "HadoopJarStep", ".", "Args", ".member.", hadoopJarStepArgsListIndex)] = hadoopJarStepArgs;
                        hadoopJarStepArgsListIndex++;
                    }
                }

                addJobFlowStepsRequestStepsListIndex++;
            }

            return(parameters);
        }