Skip to content

Modify HDInsight config cmdlets to use shared copy method to preserve parameters #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -54,35 +54,7 @@ public AddAzureHDInsightConfigValuesCmdlet()
public AzureHDInsightConfig Config
{
get { return this.command.Config; }
set
{
if (value.IsNull())
{
throw new ArgumentNullException("value", "The value for the configuration can not be null.");
}

this.command.Config.ClusterSizeInNodes = value.ClusterSizeInNodes;
this.command.Config.DefaultStorageAccount = value.DefaultStorageAccount;
this.command.Config.AdditionalStorageAccounts.AddRange(value.AdditionalStorageAccounts);
this.command.Config.ConfigActions.AddRange(value.ConfigActions);
this.command.Config.HiveMetastore = value.HiveMetastore ?? this.command.Config.HiveMetastore;
this.command.Config.OozieMetastore = value.OozieMetastore ?? this.command.Config.OozieMetastore;
this.command.Config.CoreConfiguration.AddRange(value.CoreConfiguration);
this.command.Config.YarnConfiguration.AddRange(value.YarnConfiguration);
this.command.Config.HdfsConfiguration.AddRange(value.HdfsConfiguration);
this.command.Config.MapReduceConfiguration.ConfigurationCollection.AddRange(value.MapReduceConfiguration.ConfigurationCollection);
this.command.Config.MapReduceConfiguration.CapacitySchedulerConfigurationCollection.AddRange(
value.MapReduceConfiguration.CapacitySchedulerConfigurationCollection);
this.command.Config.HiveConfiguration.ConfigurationCollection.AddRange(value.HiveConfiguration.ConfigurationCollection);
this.command.Config.OozieConfiguration.ConfigurationCollection.AddRange(value.OozieConfiguration.ConfigurationCollection);
this.command.Config.HeadNodeVMSize = value.HeadNodeVMSize;
this.command.Config.ClusterType = value.ClusterType;
this.command.Config.VirtualNetworkId = value.VirtualNetworkId;
this.command.Config.SubnetName = value.SubnetName;
this.command.Config.StormConfiguration.AddRange(value.StormConfiguration);
this.command.Config.HBaseConfiguration.ConfigurationCollection.AddRange(value.HBaseConfiguration.ConfigurationCollection);
this.command.Config.SparkConfiguration.AddRange(value.SparkConfiguration);
}
set { this.command.Config.CopyFrom(value); }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,7 @@ public AddAzureHDInsightMetastoreCmdlet()
public AzureHDInsightConfig Config
{
get { return this.command.Config; }
set
{
if (value.IsNull())
{
throw new ArgumentNullException("value", "The value for the configuration can not be null.");
}

this.command.Config.ClusterSizeInNodes = value.ClusterSizeInNodes;
this.command.Config.DefaultStorageAccount = value.DefaultStorageAccount;
this.command.Config.AdditionalStorageAccounts.AddRange(value.AdditionalStorageAccounts);
this.command.Config.ConfigActions.AddRange(value.ConfigActions);
this.command.Config.HiveMetastore = value.HiveMetastore ?? this.command.Config.HiveMetastore;
this.command.Config.OozieMetastore = value.OozieMetastore ?? this.command.Config.OozieMetastore;
this.command.Config.CoreConfiguration.AddRange(value.CoreConfiguration);
this.command.Config.YarnConfiguration.AddRange(value.YarnConfiguration);
this.command.Config.HdfsConfiguration.AddRange(value.HdfsConfiguration);
this.command.Config.MapReduceConfiguration.ConfigurationCollection.AddRange(value.MapReduceConfiguration.ConfigurationCollection);
this.command.Config.MapReduceConfiguration.CapacitySchedulerConfigurationCollection.AddRange(
value.MapReduceConfiguration.CapacitySchedulerConfigurationCollection);
this.command.Config.HiveConfiguration.ConfigurationCollection.AddRange(value.HiveConfiguration.ConfigurationCollection);
this.command.Config.OozieConfiguration.ConfigurationCollection.AddRange(value.OozieConfiguration.ConfigurationCollection);
this.command.Config.HeadNodeVMSize = value.HeadNodeVMSize;
this.command.Config.ClusterType = value.ClusterType;
this.command.Config.VirtualNetworkId = value.VirtualNetworkId;
this.command.Config.SubnetName = value.SubnetName;
this.command.Config.StormConfiguration.AddRange(value.StormConfiguration);
this.command.Config.HBaseConfiguration.ConfigurationCollection.AddRange(value.HBaseConfiguration.ConfigurationCollection);
}
set { this.command.Config.CopyFrom(value); }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,34 +53,7 @@ public AddAzureHDInsightScriptActionCmdlet()
public AzureHDInsightConfig Config
{
get { return this.command.Config; }
set
{
if (value.IsNull())
{
throw new ArgumentNullException("value", "The value for the configuration can not be null.");
}

this.command.Config.ClusterSizeInNodes = value.ClusterSizeInNodes;
this.command.Config.DefaultStorageAccount = value.DefaultStorageAccount;
this.command.Config.AdditionalStorageAccounts.AddRange(value.AdditionalStorageAccounts);
this.command.Config.ConfigActions.AddRange(value.ConfigActions);
this.command.Config.HiveMetastore = value.HiveMetastore ?? this.command.Config.HiveMetastore;
this.command.Config.OozieMetastore = value.OozieMetastore ?? this.command.Config.OozieMetastore;
this.command.Config.CoreConfiguration.AddRange(value.CoreConfiguration);
this.command.Config.YarnConfiguration.AddRange(value.YarnConfiguration);
this.command.Config.HdfsConfiguration.AddRange(value.HdfsConfiguration);
this.command.Config.MapReduceConfiguration.ConfigurationCollection.AddRange(value.MapReduceConfiguration.ConfigurationCollection);
this.command.Config.MapReduceConfiguration.CapacitySchedulerConfigurationCollection.AddRange(
value.MapReduceConfiguration.CapacitySchedulerConfigurationCollection);
this.command.Config.HiveConfiguration.ConfigurationCollection.AddRange(value.HiveConfiguration.ConfigurationCollection);
this.command.Config.OozieConfiguration.ConfigurationCollection.AddRange(value.OozieConfiguration.ConfigurationCollection);
this.command.Config.HeadNodeVMSize = value.HeadNodeVMSize;
this.command.Config.ClusterType = value.ClusterType;
this.command.Config.VirtualNetworkId = value.VirtualNetworkId;
this.command.Config.SubnetName = value.SubnetName;
this.command.Config.StormConfiguration.AddRange(value.StormConfiguration);
this.command.Config.HBaseConfiguration.ConfigurationCollection.AddRange(value.HBaseConfiguration.ConfigurationCollection);
}
set { this.command.Config.CopyFrom(value); }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,7 @@ public AddAzureHDInsightStorageCmdlet()
public AzureHDInsightConfig Config
{
get { return this.command.Config; }
set
{
if (value.IsNull())
{
throw new ArgumentNullException("value", "The value for the configuration can not be null.");
}

this.command.Config.ClusterSizeInNodes = value.ClusterSizeInNodes;
this.command.Config.DefaultStorageAccount = value.DefaultStorageAccount;
this.command.Config.AdditionalStorageAccounts.AddRange(value.AdditionalStorageAccounts);
this.command.Config.ConfigActions.AddRange(value.ConfigActions);
this.command.Config.HiveMetastore = value.HiveMetastore ?? this.command.Config.HiveMetastore;
this.command.Config.OozieMetastore = value.OozieMetastore ?? this.command.Config.OozieMetastore;
this.command.Config.CoreConfiguration.AddRange(value.CoreConfiguration);
this.command.Config.YarnConfiguration.AddRange(value.YarnConfiguration);
this.command.Config.HdfsConfiguration.AddRange(value.HdfsConfiguration);
this.command.Config.MapReduceConfiguration.ConfigurationCollection.AddRange(value.MapReduceConfiguration.ConfigurationCollection);
this.command.Config.MapReduceConfiguration.CapacitySchedulerConfigurationCollection.AddRange(
value.MapReduceConfiguration.CapacitySchedulerConfigurationCollection);
this.command.Config.HiveConfiguration.ConfigurationCollection.AddRange(value.HiveConfiguration.ConfigurationCollection);
this.command.Config.OozieConfiguration.ConfigurationCollection.AddRange(value.OozieConfiguration.ConfigurationCollection);
this.command.Config.HeadNodeVMSize = value.HeadNodeVMSize;
this.command.Config.ClusterType = value.ClusterType;
this.command.Config.VirtualNetworkId = value.VirtualNetworkId;
this.command.Config.SubnetName = value.SubnetName;
this.command.Config.StormConfiguration.AddRange(value.StormConfiguration);
this.command.Config.HBaseConfiguration.ConfigurationCollection.AddRange(value.HBaseConfiguration.ConfigurationCollection);
}
set { this.command.Config.CopyFrom(value); }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,7 @@ public SetAzureHDInsightDefaultStorageCmdlet()
public AzureHDInsightConfig Config
{
get { return this.command.Config; }
set
{
if (value.IsNull())
{
throw new ArgumentNullException("value", "The value for the configuration can not be null.");
}

this.command.Config.ClusterSizeInNodes = value.ClusterSizeInNodes;
this.command.Config.DefaultStorageAccount = value.DefaultStorageAccount;
this.command.Config.AdditionalStorageAccounts.AddRange(value.AdditionalStorageAccounts);
this.command.Config.ConfigActions.AddRange(value.ConfigActions);
this.command.Config.HiveMetastore = value.HiveMetastore ?? this.command.Config.HiveMetastore;
this.command.Config.OozieMetastore = value.OozieMetastore ?? this.command.Config.OozieMetastore;
this.command.Config.CoreConfiguration.AddRange(value.CoreConfiguration);
this.command.Config.YarnConfiguration.AddRange(value.YarnConfiguration);
this.command.Config.HdfsConfiguration.AddRange(value.HdfsConfiguration);
this.command.Config.MapReduceConfiguration.ConfigurationCollection.AddRange(value.MapReduceConfiguration.ConfigurationCollection);
this.command.Config.MapReduceConfiguration.CapacitySchedulerConfigurationCollection.AddRange(
value.MapReduceConfiguration.CapacitySchedulerConfigurationCollection);
this.command.Config.HiveConfiguration.ConfigurationCollection.AddRange(value.HiveConfiguration.ConfigurationCollection);
this.command.Config.OozieConfiguration.ConfigurationCollection.AddRange(value.OozieConfiguration.ConfigurationCollection);
this.command.Config.HeadNodeVMSize = value.HeadNodeVMSize;
this.command.Config.ClusterType = value.ClusterType;
this.command.Config.VirtualNetworkId = value.VirtualNetworkId;
this.command.Config.SubnetName = value.SubnetName;
this.command.Config.StormConfiguration.AddRange(value.StormConfiguration);
this.command.Config.HBaseConfiguration.ConfigurationCollection.AddRange(value.HBaseConfiguration.ConfigurationCollection);
}
set { this.command.Config.CopyFrom(value); }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using Microsoft.WindowsAzure.Management.HDInsight.ClusterProvisioning.Data;
using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions;

namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects
{
Expand Down Expand Up @@ -158,5 +160,50 @@ public AzureHDInsightConfig()
/// Gets a collection of configuration properties to customize the HBase service.
/// </summary>
public HBaseConfiguration HBaseConfiguration { get; private set; }


/// <summary>
/// Copies all parameters from the provided AzureHDInsightConfig object into this object, replacing
/// single-value attributes, and merging collection attributes.
/// </summary>
public virtual void CopyFrom(AzureHDInsightConfig value)
{
if (value==null)
{
throw new ArgumentNullException("value", "The value for the configuration cannot be null.");
}

this.ClusterSizeInNodes = value.ClusterSizeInNodes;
this.DefaultStorageAccount = new AzureHDInsightDefaultStorageAccount(value.DefaultStorageAccount);
this.AdditionalStorageAccounts.AddRange(value.AdditionalStorageAccounts);
this.ConfigActions.AddRange(value.ConfigActions);
this.HiveMetastore = value.HiveMetastore ?? this.HiveMetastore;
this.OozieMetastore = value.OozieMetastore ?? this.OozieMetastore;
this.CoreConfiguration.AddRange(value.CoreConfiguration);
this.YarnConfiguration.AddRange(value.YarnConfiguration);
this.HdfsConfiguration.AddRange(value.HdfsConfiguration);
this.MapReduceConfiguration.ConfigurationCollection.AddRange(value.MapReduceConfiguration.ConfigurationCollection);
this.MapReduceConfiguration.CapacitySchedulerConfigurationCollection.AddRange(
value.MapReduceConfiguration.CapacitySchedulerConfigurationCollection);
this.HiveConfiguration.ConfigurationCollection.AddRange(value.HiveConfiguration.ConfigurationCollection);
this.HiveConfiguration.AdditionalLibraries =
value.HiveConfiguration.AdditionalLibraries ?? this.HiveConfiguration.AdditionalLibraries;
this.OozieConfiguration.ConfigurationCollection.AddRange(value.OozieConfiguration.ConfigurationCollection);
this.OozieConfiguration.AdditionalActionExecutorLibraries =
value.OozieConfiguration.AdditionalActionExecutorLibraries ?? this.OozieConfiguration.AdditionalActionExecutorLibraries;
this.OozieConfiguration.AdditionalSharedLibraries =
value.OozieConfiguration.AdditionalSharedLibraries ?? this.OozieConfiguration.AdditionalSharedLibraries;
this.HeadNodeVMSize = value.HeadNodeVMSize;
this.DataNodeVMSize = value.DataNodeVMSize;
this.ZookeeperNodeVMSize = value.ZookeeperNodeVMSize;
this.ClusterType = value.ClusterType;
this.VirtualNetworkId = value.VirtualNetworkId;
this.SubnetName = value.SubnetName;
this.StormConfiguration.AddRange(value.StormConfiguration);
this.HBaseConfiguration.ConfigurationCollection.AddRange(value.HBaseConfiguration.ConfigurationCollection);
this.HBaseConfiguration.AdditionalLibraries =
value.HBaseConfiguration.AdditionalLibraries ?? this.HBaseConfiguration.AdditionalLibraries;
this.SparkConfiguration.AddRange(value.SparkConfiguration);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects
/// </summary>
public class AzureHDInsightDefaultStorageAccount : AzureHDInsightStorageAccount
{
/// <summary>
/// Creates a new default storage account object with the same attributes as the passed in storage account
/// </summary>
public AzureHDInsightDefaultStorageAccount(AzureHDInsightDefaultStorageAccount value) : base()
{
this.StorageAccountName = value.StorageAccountName;
this.StorageAccountKey = value.StorageAccountKey;
this.StorageContainerName = value.StorageContainerName;
}

/// <summary>
/// Creates an empty default storage account
/// </summary>
public AzureHDInsightDefaultStorageAccount() : base()
{
}

/// <summary>
/// Gets or sets the Storage Container for the Default Storage Account.
/// </summary>
Expand Down