private static AzureTestCredentials CloneForEnvironment(AzureTestCredentials orig, int index) { var retval = new AzureTestCredentials(); retval.AzurePassword = orig.AzurePassword; retval.AzureUserName = orig.AzureUserName; retval.Certificate = orig.Certificate; retval.CredentialsName = orig.CredentialsName; retval.HadoopUserName = orig.HadoopUserName; retval.InvalidCertificate = orig.InvalidCertificate; retval.SubscriptionId = orig.SubscriptionId; retval.ResourceProviderProperties = orig.ResourceProviderProperties; retval.WellKnownCluster = new KnownCluster { Cluster = orig.WellKnownCluster.Cluster, DnsName = orig.WellKnownCluster.DnsName, Version = orig.WellKnownCluster.Version }; retval.Environments = new CreationDetails[0]; CreationDetails env = retval.Environments[0] = new CreationDetails(); CreationDetails origEnv = orig.Environments[index]; retval.CloudServiceName = orig.CloudServiceName; env.DefaultStorageAccount = new StorageAccountCredentials { Container = origEnv.DefaultStorageAccount.Container, Key = origEnv.DefaultStorageAccount.Key, Name = origEnv.DefaultStorageAccount.Name }; retval.Endpoint = orig.Endpoint; env.Location = origEnv.Location; retval.EnvironmentType = orig.EnvironmentType; var storageAccounts = new List <StorageAccountCredentials>(); foreach (StorageAccountCredentials storageAccountCredentials in origEnv.AdditionalStorageAccounts) { var account = new StorageAccountCredentials { Container = storageAccountCredentials.Container, Key = storageAccountCredentials.Key, Name = storageAccountCredentials.Name }; storageAccounts.Add(account); } env.AdditionalStorageAccounts = storageAccounts.ToArray(); var stores = new List <MetastoreCredentials>(); foreach (MetastoreCredentials metastoreCredentials in origEnv.HiveStores) { var metaStore = new MetastoreCredentials { Database = metastoreCredentials.Database, Description = metastoreCredentials.Description, SqlServer = metastoreCredentials.SqlServer }; } env.HiveStores = stores.ToArray(); stores.Clear(); foreach (MetastoreCredentials metastoreCredentials in origEnv.OozieStores) { var metaStore = new MetastoreCredentials { Database = metastoreCredentials.Database, Description = metastoreCredentials.Description, SqlServer = metastoreCredentials.SqlServer }; } env.OozieStores = stores.ToArray(); return(retval); }
private static AzureTestCredentials CloneForEnvironment(AzureTestCredentials orig, int index) { var retval = new AzureTestCredentials(); retval.AzurePassword = orig.AzurePassword; retval.AzureUserName = orig.AzureUserName; retval.Certificate = orig.Certificate; retval.CredentialsName = orig.CredentialsName; retval.HadoopUserName = orig.HadoopUserName; retval.InvalidCertificate = orig.InvalidCertificate; retval.SubscriptionId = orig.SubscriptionId; retval.ResourceProviderProperties = orig.ResourceProviderProperties; retval.WellKnownCluster = new KnownCluster { Cluster = orig.WellKnownCluster.Cluster, DnsName = orig.WellKnownCluster.DnsName, Version = orig.WellKnownCluster.Version }; retval.Environments = new CreationDetails[0]; CreationDetails env = retval.Environments[0] = new CreationDetails(); CreationDetails origEnv = orig.Environments[index]; retval.CloudServiceName = orig.CloudServiceName; env.DefaultStorageAccount = new StorageAccountCredentials { Container = origEnv.DefaultStorageAccount.Container, Key = origEnv.DefaultStorageAccount.Key, Name = origEnv.DefaultStorageAccount.Name }; retval.Endpoint = orig.Endpoint; env.Location = origEnv.Location; retval.EnvironmentType = orig.EnvironmentType; var storageAccounts = new List<StorageAccountCredentials>(); foreach (StorageAccountCredentials storageAccountCredentials in origEnv.AdditionalStorageAccounts) { var account = new StorageAccountCredentials { Container = storageAccountCredentials.Container, Key = storageAccountCredentials.Key, Name = storageAccountCredentials.Name }; storageAccounts.Add(account); } env.AdditionalStorageAccounts = storageAccounts.ToArray(); var stores = new List<MetastoreCredentials>(); foreach (MetastoreCredentials metastoreCredentials in origEnv.HiveStores) { var metaStore = new MetastoreCredentials { Database = metastoreCredentials.Database, Description = metastoreCredentials.Description, SqlServer = metastoreCredentials.SqlServer }; } env.HiveStores = stores.ToArray(); stores.Clear(); foreach (MetastoreCredentials metastoreCredentials in origEnv.OozieStores) { var metaStore = new MetastoreCredentials { Database = metastoreCredentials.Database, Description = metastoreCredentials.Description, SqlServer = metastoreCredentials.SqlServer }; } env.OozieStores = stores.ToArray(); return retval; }