12
12
// limitations under the License.
13
13
// ----------------------------------------------------------------------------------
14
14
15
- using Microsoft . Azure . Management . HDInsight . Models ;
16
15
using System ;
17
16
using System . Collections . Generic ;
18
17
using System . Linq ;
19
18
using System . Management . Automation ;
20
19
using Microsoft . WindowsAzure . Commands . Common ;
20
+ using Azure . ResourceManager . HDInsight ;
21
+ using Azure . ResourceManager . HDInsight . Models ;
21
22
22
23
namespace Microsoft . Azure . Commands . HDInsight . Models
23
24
{
24
25
public class AzureHDInsightCluster
25
26
{
26
- public AzureHDInsightCluster ( Cluster cluster )
27
+ public AzureHDInsightCluster ( HDInsightClusterData cluster )
27
28
{
28
29
Id = cluster . Id ;
29
30
Name = cluster . Name ;
30
31
Location = cluster . Location ;
31
32
ClusterId = cluster . Properties . ClusterId ;
32
33
ClusterVersion = cluster . Properties . ClusterVersion ;
33
- OperatingSystemType = cluster . Properties . OsType ;
34
- ClusterTier = cluster . Properties . Tier ;
34
+ OperatingSystemType = cluster . Properties . OSType . ToString ( ) ;
35
+ ClusterTier = cluster . Properties . Tier . ToString ( ) ;
35
36
ClusterState = cluster . Properties . ClusterState ;
36
37
ClusterType = cluster . Properties . ClusterDefinition . Kind ;
37
- CoresUsed = cluster . Properties . QuotaInfo . CoresUsed ?? 0 ;
38
+ CoresUsed = cluster . Properties . QuotaInfoCoresUsed ?? 0 ;
38
39
var httpEndpoint =
39
40
cluster . Properties . ConnectivityEndpoints ? . FirstOrDefault ( c => c . Name . Equals ( "HTTPS" , StringComparison . OrdinalIgnoreCase ) ) ;
40
- HttpEndpoint = httpEndpoint != null ? httpEndpoint . Location : null ;
41
+ HttpEndpoint = httpEndpoint != null ? httpEndpoint . EndpointLocation : null ;
41
42
ConnectivityEndpoints = cluster ? . Properties ? . ConnectivityEndpoints ? . Select ( endpoint => new AzureHDInsightConnectivityEndpoint ( endpoint ) ) . ToList ( ) ;
42
43
Error = cluster . Properties . Errors ? . Select ( s => s . Message ) . FirstOrDefault ( ) ;
43
44
ResourceGroup = ClusterConfigurationUtils . GetResourceGroupFromClusterId ( cluster . Id ) ;
@@ -49,10 +50,10 @@ public AzureHDInsightCluster(Cluster cluster)
49
50
ComponentVersion . Add ( componentVersion . ToString ( ) ) ;
50
51
}
51
52
}
52
- WorkerNodeDataDisksGroups = new List < DataDisksGroups > ( ) ;
53
- if ( cluster . Properties . ComputeProfile != null && cluster . Properties . ComputeProfile . Roles . Any ( ) )
53
+ WorkerNodeDataDisksGroups = new List < HDInsightClusterDataDiskGroup > ( ) ;
54
+ if ( cluster . Properties . ComputeRoles != null && cluster . Properties . ComputeRoles . Any ( ) )
54
55
{
55
- var rolesWithDataDisksGroups = cluster . Properties . ComputeProfile . Roles . Where ( x => x . DataDisksGroups != null ) ;
56
+ var rolesWithDataDisksGroups = cluster . Properties . ComputeRoles . Where ( x => x . DataDisksGroups != null ) ;
56
57
foreach ( var role in rolesWithDataDisksGroups )
57
58
{
58
59
WorkerNodeDataDisksGroups . AddRange ( role . DataDisksGroups ) ;
@@ -65,27 +66,27 @@ public AzureHDInsightCluster(Cluster cluster)
65
66
//We should not be returning the actual password to the user
66
67
DomainUserCredential = new PSCredential ( clusterSecurityProfile . DomainUsername , "***" . ConvertToSecureString ( ) ) ,
67
68
OrganizationalUnitDN = clusterSecurityProfile . OrganizationalUnitDN ,
68
- LdapsUrls = clusterSecurityProfile . LdapsUrls != null ? clusterSecurityProfile . LdapsUrls . ToArray ( ) : null ,
69
+ LdapsUrls = clusterSecurityProfile . LdapUris != null ? clusterSecurityProfile . LdapUris . Select ( uri => uri . ToString ( ) ) . ToArray ( ) : null ,
69
70
ClusterUsersGroupDNs = clusterSecurityProfile . ClusterUsersGroupDNs != null ? clusterSecurityProfile . ClusterUsersGroupDNs . ToArray ( ) : null ,
70
71
} : null ;
71
72
72
73
MinSupportedTlsVersion = cluster . Properties . MinSupportedTlsVersion ;
73
74
DiskEncryption = cluster . Properties . DiskEncryptionProperties ;
74
75
AssignedIdentity = new AzureHDInsightClusterIdentity ( cluster . Identity ) ;
75
- EncryptionInTransit = cluster . Properties ? . EncryptionInTransitProperties ? . IsEncryptionInTransitEnabled ;
76
- PrivateEndpoint = cluster . Properties ? . ConnectivityEndpoints ? . FirstOrDefault ( endpoint => endpoint . Name . Equals ( "HTTPS-INTERNAL" ) ) ? . Location ;
77
- var vnet = Utils . ExtractRole ( AzureHDInsightClusterNodeType . WorkerNode . ToString ( ) , cluster . Properties . ComputeProfile ) ? . VirtualNetworkProfile ;
76
+ EncryptionInTransit = cluster . Properties ? . IsEncryptionInTransitEnabled ;
77
+ PrivateEndpoint = cluster . Properties ? . ConnectivityEndpoints ? . FirstOrDefault ( endpoint => endpoint . Name . Equals ( "HTTPS-INTERNAL" ) ) ? . EndpointLocation ;
78
+ var vnet = Utils . ExtractRole ( AzureHDInsightClusterNodeType . WorkerNode . ToString ( ) , cluster . Properties . ComputeRoles ) ? . VirtualNetworkProfile ;
78
79
VirtualNetworkId = vnet ? . Id ;
79
80
SubnetName = Utils . GetResourceNameFromResourceId ( vnet ? . Subnet ) ;
80
- ComputeProfile = cluster . Properties ? . ComputeProfile != null ? new AzureHDInsightComputeProfile ( cluster . Properties . ComputeProfile ) : null ;
81
+ ComputeProfile = cluster . Properties . ComputeRoles != null ? new AzureHDInsightComputeProfile ( cluster . Properties . ComputeRoles ) : null ;
81
82
KafkaRestProperties = cluster ? . Properties ? . KafkaRestProperties != null ? new AzureHDInsightKafkaRestProperties ( cluster . Properties . KafkaRestProperties ) : null ;
82
83
NetworkProperties = cluster ? . Properties ? . NetworkProperties != null ? new AzureHDInsightNetworkProperties ( cluster . Properties . NetworkProperties ) : null ;
83
84
ComputeIsolationProperties = cluster ? . Properties ? . ComputeIsolationProperties != null ? new AzureHDInsightComputeIsolationProperties ( cluster . Properties . ComputeIsolationProperties ) : null ;
84
85
PrivateLinkConfigurations = cluster ? . Properties ? . PrivateLinkConfigurations ? . Select ( config => new AzureHDInsightPrivateLinkConfiguration ( config ) ) . ToList ( ) ;
85
86
PrivateEndpointConnections = cluster ? . Properties ? . PrivateEndpointConnections ? . Select ( connection => new AzureHDInsightPrivateEndpointConnection ( connection ) ) . ToList ( ) ;
86
87
}
87
88
88
- public AzureHDInsightCluster ( Cluster cluster , IDictionary < string , string > clusterConfiguration , IDictionary < string , string > clusterIdentity )
89
+ public AzureHDInsightCluster ( HDInsightClusterData cluster , IReadOnlyDictionary < string , string > clusterConfiguration , IReadOnlyDictionary < string , string > clusterIdentity )
89
90
: this ( cluster )
90
91
{
91
92
if ( clusterConfiguration != null )
@@ -220,7 +221,7 @@ public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> cluste
220
221
/// <summary>
221
222
/// Data Disks Group Properties for the Worker Role.
222
223
/// </summary>
223
- public List < DataDisksGroups > WorkerNodeDataDisksGroups { get ; set ; }
224
+ public List < HDInsightClusterDataDiskGroup > WorkerNodeDataDisksGroups { get ; set ; }
224
225
225
226
/// <summary>
226
227
/// Gets or sets the security profile.
@@ -238,7 +239,7 @@ public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> cluste
238
239
/// <summary>
239
240
/// Gets or sets the disk encryption properties.
240
241
/// </summary>
241
- public DiskEncryptionProperties DiskEncryption { get ; set ; }
242
+ public HDInsightDiskEncryptionProperties DiskEncryption { get ; set ; }
242
243
243
244
/// <summary>
244
245
/// Gets or sets the assigned identity.
0 commit comments