public AzureHDInsightCluster(Cluster cluster)
        {
            Id                  = cluster.Id;
            Name                = cluster.Name;
            Location            = cluster.Location;
            ClusterVersion      = cluster.Properties.ClusterVersion;
            OperatingSystemType = cluster.Properties.OperatingSystemType;
            ClusterTier         = cluster.Properties.ClusterTier;
            ClusterState        = cluster.Properties.ClusterState;
            ClusterType         = cluster.Properties.ClusterDefinition.ClusterType;
            CoresUsed           = cluster.Properties.QuotaInfo.CoresUsed;
            var httpEndpoint =
                cluster.Properties.ConnectivityEndpoints.FirstOrDefault(c => c.Name.Equals("HTTPS", StringComparison.OrdinalIgnoreCase));

            HttpEndpoint     = httpEndpoint != null ? httpEndpoint.Location : null;
            Error            = cluster.Properties.ErrorInfos.Select(s => s.Message).FirstOrDefault();
            ResourceGroup    = ClusterConfigurationUtils.GetResourceGroupFromClusterId(cluster.Id);
            ComponentVersion = new List <string>();
            foreach (var componentVersion in cluster.Properties.ClusterDefinition.ComponentVersion)
            {
                ComponentVersion.Add(componentVersion.ToString());
            }
            var clusterSecurityProfile = cluster.Properties.SecurityProfile;

            SecurityProfile = clusterSecurityProfile != null ? new AzureHDInsightSecurityProfile()
            {
                Domain = clusterSecurityProfile.Domain,
                //We should not be returning the actual password to the user
                DomainUserCredential = new PSCredential(clusterSecurityProfile.DomainUsername, "***".ConvertToSecureString()),
                OrganizationalUnitDN = clusterSecurityProfile.OrganizationalUnitDN,
                LdapsUrls            = clusterSecurityProfile.LdapsUrls != null?clusterSecurityProfile.LdapsUrls.ToArray() : null,
                                           ClusterUsersGroupDNs = clusterSecurityProfile.ClusterUsersGroupDNs != null?clusterSecurityProfile.ClusterUsersGroupDNs.ToArray() : null,
            } : null;
        }
        public AzureHDInsightCluster(Cluster cluster, IDictionary <string, string> clusterConfiguration, IDictionary <string, string> clusterIdentity)
            : this(cluster)
        {
            if (clusterConfiguration != null)
            {
                var defaultAccount = ClusterConfigurationUtils.GetDefaultStorageAccountDetails(
                    cluster.Properties.ClusterVersion,
                    clusterConfiguration,
                    clusterIdentity
                    );

                if (defaultAccount != null)
                {
                    DefaultStorageAccount = defaultAccount.StorageAccountName;

                    var wasbAccount = defaultAccount as AzureHDInsightWASBDefaultStorageAccount;
                    var adlAccount  = defaultAccount as AzureHDInsightDataLakeDefaultStorageAccount;

                    if (wasbAccount != null)
                    {
                        DefaultStorageContainer = wasbAccount.StorageContainerName;
                    }
                    else if (adlAccount != null)
                    {
                        DefaultStorageRootPath = adlAccount.StorageRootPath;
                    }
                    else
                    {
                        DefaultStorageContainer = string.Empty;
                    }

                    AdditionalStorageAccounts = ClusterConfigurationUtils.GetAdditionStorageAccounts(clusterConfiguration, DefaultStorageAccount);
                }
            }
        }
Ejemplo n.º 3
0
        public AzureHDInsightCluster(Cluster cluster)
        {
            Id                  = cluster.Id;
            Name                = cluster.Name;
            Location            = cluster.Location;
            ClusterId           = cluster.Properties.ClusterId;
            ClusterVersion      = cluster.Properties.ClusterVersion;
            OperatingSystemType = cluster.Properties.OsType ?? OSType.Linux;
            ClusterTier         = cluster.Properties.Tier ?? Tier.Standard;
            ClusterState        = cluster.Properties.ClusterState;
            ClusterType         = cluster.Properties.ClusterDefinition.Kind;
            CoresUsed           = cluster.Properties.QuotaInfo.CoresUsed ?? 0;
            var httpEndpoint =
                cluster.Properties.ConnectivityEndpoints?.FirstOrDefault(c => c.Name.Equals("HTTPS", StringComparison.OrdinalIgnoreCase));

            HttpEndpoint     = httpEndpoint != null ? httpEndpoint.Location : null;
            Error            = cluster.Properties.Errors?.Select(s => s.Message).FirstOrDefault();
            ResourceGroup    = ClusterConfigurationUtils.GetResourceGroupFromClusterId(cluster.Id);
            ComponentVersion = new List <string>();
            if (cluster.Properties.ClusterDefinition.ComponentVersion != null && cluster.Properties.ClusterDefinition.ComponentVersion.Any())
            {
                foreach (var componentVersion in cluster.Properties.ClusterDefinition.ComponentVersion)
                {
                    ComponentVersion.Add(componentVersion.ToString());
                }
            }
            WorkerNodeDataDisksGroups = new List <DataDisksGroups>();
            if (cluster.Properties.ComputeProfile != null && cluster.Properties.ComputeProfile.Roles.Any())
            {
                var rolesWithDataDisksGroups = cluster.Properties.ComputeProfile.Roles.Where(x => x.DataDisksGroups != null);
                foreach (var role in rolesWithDataDisksGroups)
                {
                    WorkerNodeDataDisksGroups.AddRange(role.DataDisksGroups);
                }
            }
            var clusterSecurityProfile = cluster.Properties.SecurityProfile;

            SecurityProfile = clusterSecurityProfile != null ? new AzureHDInsightSecurityProfile()
            {
                DomainResourceId = clusterSecurityProfile.AaddsResourceId,
                //We should not be returning the actual password to the user
                DomainUserCredential = new PSCredential(clusterSecurityProfile.DomainUsername, "***".ConvertToSecureString()),
                OrganizationalUnitDN = clusterSecurityProfile.OrganizationalUnitDN,
                LdapsUrls            = clusterSecurityProfile.LdapsUrls != null?clusterSecurityProfile.LdapsUrls.ToArray() : null,
                                           ClusterUsersGroupDNs = clusterSecurityProfile.ClusterUsersGroupDNs != null?clusterSecurityProfile.ClusterUsersGroupDNs.ToArray() : null,
            } : null;

            MinSupportedTlsVersion = cluster.Properties.MinSupportedTlsVersion;
            DiskEncryption         = cluster.Properties.DiskEncryptionProperties;
            AssignedIdentity       = cluster.Identity;
            EncryptionInTransit    = cluster.Properties?.EncryptionInTransitProperties?.IsEncryptionInTransitEnabled;
            PrivateEndpoint        = cluster.Properties?.ConnectivityEndpoints?.FirstOrDefault(endpoint => endpoint.Name.Equals("HTTPS-INTERNAL"))?.Location;
            var vnet = Utils.ExtractRole(AzureHDInsightClusterNodeType.WorkerNode.ToString(), cluster.Properties.ComputeProfile)?.VirtualNetworkProfile;

            VirtualNetworkId    = vnet?.Id;
            SubnetName          = Utils.GetResourceNameFromResourceId(vnet?.Subnet);
            ComputeProfile      = cluster.Properties?.ComputeProfile != null ? new AzureHDInsightComputeProfile(cluster.Properties.ComputeProfile) : null;
            KafkaRestProperties = cluster?.Properties?.KafkaRestProperties != null ? new AzureHDInsightKafkaRestProperties(cluster.Properties.KafkaRestProperties) : null;
            NetworkProperties   = cluster?.Properties?.NetworkProperties != null ? new AzureHDInsightNetworkProperties(cluster.Properties.NetworkProperties) : null;
        }
        public AzureHDInsightCluster(Cluster cluster, IDictionary <string, string> clusterConfiguration)
            : this(cluster)
        {
            if (clusterConfiguration != null)
            {
                var defaultAccount = ClusterConfigurationUtils.GetDefaultStorageAccountDetails(
                    clusterConfiguration,
                    cluster.Properties.ClusterVersion);

                DefaultStorageAccount   = defaultAccount.StorageAccountName;
                DefaultStorageContainer = defaultAccount.StorageContainerName;

                AdditionalStorageAccounts = ClusterConfigurationUtils.GetAdditionStorageAccounts(clusterConfiguration, DefaultStorageAccount);
            }
        }
        public AzureHDInsightCluster(Cluster cluster)
        {
            Id                  = cluster.Id;
            Name                = cluster.Name;
            Location            = cluster.Location;
            ClusterVersion      = cluster.Properties.ClusterVersion;
            OperatingSystemType = cluster.Properties.OsType ?? OSType.Linux;
            ClusterTier         = cluster.Properties.Tier ?? Tier.Standard;
            ClusterState        = cluster.Properties.ClusterState;
            ClusterType         = cluster.Properties.ClusterDefinition.Kind;
            CoresUsed           = cluster.Properties.QuotaInfo.CoresUsed ?? 0;
            var httpEndpoint =
                cluster.Properties.ConnectivityEndpoints?.FirstOrDefault(c => c.Name.Equals("HTTPS", StringComparison.OrdinalIgnoreCase));

            HttpEndpoint     = httpEndpoint != null ? httpEndpoint.Location : null;
            Error            = cluster.Properties.Errors?.Select(s => s.Message).FirstOrDefault();
            ResourceGroup    = ClusterConfigurationUtils.GetResourceGroupFromClusterId(cluster.Id);
            ComponentVersion = new List <string>();
            if (cluster.Properties.ClusterDefinition.ComponentVersion != null && cluster.Properties.ClusterDefinition.ComponentVersion.Any())
            {
                foreach (var componentVersion in cluster.Properties.ClusterDefinition.ComponentVersion)
                {
                    ComponentVersion.Add(componentVersion.ToString());
                }
            }
            WorkerNodeDataDisksGroups = new List <DataDisksGroups>();
            if (cluster.Properties.ComputeProfile != null && cluster.Properties.ComputeProfile.Roles.Any())
            {
                var rolesWithDataDisksGroups = cluster.Properties.ComputeProfile.Roles.Where(x => x.DataDisksGroups != null);
                foreach (var role in rolesWithDataDisksGroups)
                {
                    WorkerNodeDataDisksGroups.AddRange(role.DataDisksGroups);
                }
            }
            var clusterSecurityProfile = cluster.Properties.SecurityProfile;

            SecurityProfile = clusterSecurityProfile != null ? new AzureHDInsightSecurityProfile()
            {
                Domain = clusterSecurityProfile.Domain,
                //We should not be returning the actual password to the user
                DomainUserCredential = new PSCredential(clusterSecurityProfile.DomainUsername, "***".ConvertToSecureString()),
                OrganizationalUnitDN = clusterSecurityProfile.OrganizationalUnitDN,
                LdapsUrls            = clusterSecurityProfile.LdapsUrls != null?clusterSecurityProfile.LdapsUrls.ToArray() : null,
                                           ClusterUsersGroupDNs = clusterSecurityProfile.ClusterUsersGroupDNs != null?clusterSecurityProfile.ClusterUsersGroupDNs.ToArray() : null,
            } : null;

            MinSupportedTlsVersion = cluster.Properties.MinSupportedTlsVersion;
        }
Ejemplo n.º 6
0
        public AzureHDInsightCluster(Cluster cluster)
        {
            Id                  = cluster.Id;
            Name                = cluster.Name;
            Location            = cluster.Location;
            ClusterVersion      = cluster.Properties.ClusterVersion;
            OperatingSystemType = cluster.Properties.OperatingSystemType;
            ClusterState        = cluster.Properties.ClusterState;
            ClusterType         = cluster.Properties.ClusterDefinition.ClusterType;
            CoresUsed           = cluster.Properties.QuotaInfo.CoresUsed;
            var httpEndpoint =
                cluster.Properties.ConnectivityEndpoints.FirstOrDefault(c => c.Name.Equals("HTTPS", StringComparison.OrdinalIgnoreCase));

            HttpEndpoint  = httpEndpoint != null ? httpEndpoint.Location : null;
            Error         = cluster.Properties.ErrorInfos.Select(s => s.Message).FirstOrDefault();
            ResourceGroup = ClusterConfigurationUtils.GetResourceGroupFromClusterId(cluster.Id);
        }