protected AzureHDInsightDefaultStorageAccount GetDefaultStorageAccount(string resourceGroupName, string clusterName) { var result = HDInsightManagementClient.GetCluster(resourceGroupName, clusterName); if (result == null || result.Count == 0) { throw new CloudException(string.Format("Couldn't find cluster {0}", clusterName)); } var cluster = result.FirstOrDefault(); var coreSiteConfiguration = HDInsightManagementClient.GetClusterConfigurations(resourceGroupName, cluster.Name, ConfigurationKey.CoreSite); var clusterIdentityConfiguration = HDInsightManagementClient.GetClusterConfigurations(resourceGroupName, cluster.Name, ConfigurationKey.ClusterIdentity); var DefaultStorageAccount = ClusterConfigurationUtils.GetDefaultStorageAccountDetails( cluster.Properties.ClusterVersion, coreSiteConfiguration, clusterIdentityConfiguration ); if (DefaultStorageAccount == null) { throw new CloudException(string.Format("Couldn't find storage information for cluster {0}", clusterName)); } return(DefaultStorageAccount); }
public override void ExecuteCmdlet() { var result = HDInsightManagementClient.GetCluster(ResourceGroupName, ClusterName); var output = result.Select(cluster => new AzureHDInsightCluster(cluster)).ToList(); WriteObject(output, true); }
public override void ExecuteCmdlet() { HDInsightManagementClient.ResizeCluster(ResourceGroupName, ClusterName, resizeParams); var cluster = HDInsightManagementClient.GetCluster(ResourceGroupName, ClusterName); if (cluster != null) { WriteObject(new AzureHDInsightCluster(cluster.First())); } }
protected override void ProcessRecord() { if (ResourceGroupName == null) { ResourceGroupName = GetResourceGroupByAccountName(ClusterName); } HDInsightManagementClient.ResizeCluster(ResourceGroupName, ClusterName, resizeParams); var cluster = HDInsightManagementClient.GetCluster(ResourceGroupName, ClusterName); if (cluster != null) { WriteObject(new AzureHDInsightCluster(cluster.First())); } }
public override void ExecuteCmdlet() { if (ClusterName != null && ResourceGroupName == null) { ResourceGroupName = GetResourceGroupByAccountName(ClusterName); } var result = HDInsightManagementClient.GetCluster(ResourceGroupName, ClusterName); var output = result.Select(entry => { string resourceGroupName = ClusterConfigurationUtils.GetResourceGroupFromClusterId(entry.Id); var configuration = HDInsightManagementClient.GetClusterConfigurations(resourceGroupName, entry.Name, "core-site"); return(new AzureHDInsightCluster(entry, configuration)); }).ToList(); WriteObject(output, true); }
protected string GetClusterConnection(string resourceGroupName, string clusterName) { if (clusterName.Contains(".")) { return(clusterName); } var cluster = HDInsightManagementClient.GetCluster(resourceGroupName, clusterName); if (cluster.First() == null) { throw new NullReferenceException(string.Format("Could not find cluster {0} in resource group {1}", clusterName, resourceGroupName)); } var azurecluster = new AzureHDInsightCluster(cluster.First()); var state = azurecluster.ClusterState; if ( !(state.Equals("Running", StringComparison.OrdinalIgnoreCase) || state.Equals("Operational", StringComparison.OrdinalIgnoreCase))) { throw new NotSupportedException( string.Format("The cluster {0} is in the {1} state and canot be used at this time.", clusterName, state)); } var httpEndpoint = azurecluster.HttpEndpoint; if (httpEndpoint == null) { throw new NotSupportedException( string.Format( "Cannot use cluster {0} because HTTP is not enabled on it. Please use the {1} cmdlet to HTTP and try again.", azurecluster.Name, "Grant-" + Constants.CommandNames.AzureHDInsightHttpServicesAccess)); } return(httpEndpoint); }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new ResourceIdentifier(ResourceId); this.Name = resourceIdentifier.ResourceName; this.ResourceGroupName = resourceIdentifier.ResourceGroupName; } if (this.IsParameterBound(c => c.InputObject)) { this.Name = this.InputObject.Name; this.ResourceGroupName = this.InputObject.ResourceGroup; } if (ResourceGroupName == null) { ResourceGroupName = GetResourceGroupByAccountName(Name); } var rotateParams = new ClusterDiskEncryptionParameters { KeyName = EncryptionKeyName, KeyVersion = EncryptionKeyVersion, VaultUri = EncryptionVaultUri }; HDInsightManagementClient.RotateDiskEncryptionKey(ResourceGroupName, Name, rotateParams); var cluster = HDInsightManagementClient.GetCluster(ResourceGroupName, Name); if (cluster != null) { WriteObject(new AzureHDInsightCluster(cluster.First())); } }