private static void ConfigSparkComponent(SparkComponent spark, HDInsight.ClusterCreateParametersV2 inputs)
 {
     spark.SparkConfiguration.AddRange(inputs.SparkConfiguration.Select(prop => new Property { Name = prop.Key, Value = prop.Value }));
 }
        /// <summary>
        /// Generate ClusterCreateParameters object for 3.X cluster with Hadoop and Spark.
        /// </summary>
        /// <param name="inputs">Cluster creation parameter inputs.</param>
        /// <returns>The corresponding ClusterCreateParameter object.</returns>
        internal static ClusterCreateParameters Create3XClusterForMapReduceAndSparkTemplate(HDInsight.ClusterCreateParametersV2 inputs)
        {
            if (inputs == null)
            {
                throw new ArgumentNullException("inputs");
            }

            var cluster = Create3XClusterFromMapReduceTemplate(inputs);

            var masterRole = cluster.Components.OfType<YarnComponent>().Single().ResourceManagerRole;
            var workerRole = cluster.Components.OfType<YarnComponent>().Single().NodeManagerRole;

            //Add Spark component
            SparkComponent spark = new SparkComponent
            {
                MasterRole = masterRole,
                WorkerRole = workerRole
            };
            ConfigSparkComponent(spark, inputs);
            cluster.Components.Add(spark);

            return cluster;
        }