public static VirtualNetworkProfile CreateVirtualNetworkProfile(string virtualNetworkId, string subnetName)
        {
            if (string.IsNullOrEmpty(virtualNetworkId) && string.IsNullOrEmpty(subnetName))
            {
                return(null);
            }

            VirtualNetworkProfile vnetProfile = new VirtualNetworkProfile(virtualNetworkId, string.Format("{0}/subnets/{1}", virtualNetworkId, subnetName));

            return(vnetProfile);
        }
Beispiel #2
0
        public static ComputeProfile CreateComputeProfile(OsProfile osProfile, VirtualNetworkProfile vnetProfile, Dictionary <ClusterNodeType, List <ScriptAction> > clusterScriptActions, string clusterType, int workerNodeCount, string headNodeSize, string workerNodeSize, string zookeeperNodeSize = null, string edgeNodeSize = null, bool isKafakaRestProxyEnable = false, string kafkaManagementNodeSize = null, bool isIDBrokerEnable = false, Dictionary <string, Dictionary <string, string> > defaultVmSizeConfigurations = null)
        {
            List <Role> roles = new List <Role>();

            // Create head node
            headNodeSize = headNodeSize ?? GetNodeSize(clusterType, Constants.ClusterRoleType.HeadNodeRole, defaultVmSizeConfigurations);
            List <ScriptAction> headNodeScriptActions = GetScriptActionsForRoleType(clusterScriptActions, ClusterNodeType.HeadNode);
            Role headNode = CreateHeadNodeRole(osProfile, vnetProfile, headNodeScriptActions, headNodeSize);

            roles.Add(headNode);

            // Create worker node
            workerNodeSize = workerNodeSize ?? GetNodeSize(clusterType, Constants.ClusterRoleType.WorkerNodeRole, defaultVmSizeConfigurations);
            List <ScriptAction> workerNodeScriptActions = GetScriptActionsForRoleType(clusterScriptActions, ClusterNodeType.WorkerNode);
            Role workerNode = CreateWorkerNodeRole(osProfile, vnetProfile, workerNodeScriptActions, workerNodeCount, workerNodeSize);

            roles.Add(workerNode);

            // Create Zookeeper Node
            zookeeperNodeSize = zookeeperNodeSize ?? GetNodeSize(clusterType, Constants.ClusterRoleType.ZookeeperNodeRole, defaultVmSizeConfigurations);
            List <ScriptAction> zookeeperNodeScriptActions = GetScriptActionsForRoleType(clusterScriptActions, ClusterNodeType.ZookeeperNode);
            Role zookeeperNode = CreateZookeeperNodeRole(osProfile, vnetProfile, zookeeperNodeScriptActions, zookeeperNodeSize);

            roles.Add(zookeeperNode);

            // RServer & MLServices clusters contain an additional edge node. Return here for all other types.
            if (new[] { "RServer", "MLServices" }.Contains(clusterType, StringComparer.OrdinalIgnoreCase))
            {
                // Set up edgenode and add to collection.
                const int edgeNodeCount = 1;
                edgeNodeSize = edgeNodeSize ?? GetNodeSize(clusterType, Constants.ClusterRoleType.EdgeNodeRole, defaultVmSizeConfigurations);;
                Role edgeNode = CreateEdgeNodeRole(osProfile, vnetProfile, null, edgeNodeCount, edgeNodeSize);
                roles.Add(edgeNode);
            }

            // Create Id Broker Node
            if (isIDBrokerEnable)
            {
                string idBrokerNodeSize = GetNodeSize(clusterType, Constants.ClusterRoleType.HIBNodeRole, defaultVmSizeConfigurations);
                Role   idBrokerNode     = CreateIdBrokerNodeRole(osProfile, vnetProfile, idBrokerNodeSize);
                roles.Add(idBrokerNode);
            }

            // Create Kafka Management Node
            if (isKafakaRestProxyEnable)
            {
                kafkaManagementNodeSize = kafkaManagementNodeSize ?? GetNodeSize(clusterType, Constants.ClusterRoleType.KafkaManagementNodeRole, defaultVmSizeConfigurations);
                Role kafkaManagementNode = CreateKafkaManagementNode(osProfile, vnetProfile, kafkaManagementNodeSize);
                roles.Add(kafkaManagementNode);
            }
            return(new ComputeProfile(roles));
        }
Beispiel #3
0
        private static IList <Role> GetRoleCollection(ClusterCreateParameters createProperties)
        {
            List <Role> roles = new List <Role>();

            OsProfile             osProfile   = GetOsProfile(createProperties);
            VirtualNetworkProfile vnetProfile = GetVnetProfile(createProperties);

            //Set up headnode and add to collection.
            List <ScriptAction> headNodeScriptActions = GetScriptActionsForRoleType(createProperties, ClusterNodeType.HeadNode);
            string headNodeSize          = GetNodeSize(createProperties, ClusterNodeType.HeadNode);
            int    headNodeInstanceCount = createProperties.ClusterType.Equals("Sandbox", StringComparison.OrdinalIgnoreCase) ? 1 : 2;
            Role   headNode = GetRole(osProfile, vnetProfile, ClusterNodeType.HeadNode, headNodeScriptActions, headNodeInstanceCount, headNodeSize);

            roles.Add(headNode);

            //Sandbox clusters only contain a headnode. Return here.
            if (createProperties.ClusterType.Equals("Sandbox", StringComparison.OrdinalIgnoreCase))
            {
                return(roles);
            }

            //Set up workernode and add to collection.
            List <ScriptAction> workerNodeScriptActions = GetScriptActionsForRoleType(createProperties, ClusterNodeType.WorkerNode);
            string workerNodeSize = GetNodeSize(createProperties, ClusterNodeType.WorkerNode);
            Role   workerNode     = GetRole(osProfile, vnetProfile, ClusterNodeType.WorkerNode, workerNodeScriptActions, createProperties.ClusterSizeInNodes, workerNodeSize);

            workerNode.DataDisksGroups = createProperties.WorkerNodeDataDisksGroups;
            roles.Add(workerNode);

            //Set up zookeepernode and add to collection.
            List <ScriptAction> zookeeperNodeScriptActions = GetScriptActionsForRoleType(createProperties, ClusterNodeType.ZookeeperNode);
            string zookeeperNodeSize = GetNodeSize(createProperties, ClusterNodeType.ZookeeperNode);
            Role   zookeeperNode     = GetRole(osProfile, vnetProfile, ClusterNodeType.ZookeeperNode, zookeeperNodeScriptActions, 3, zookeeperNodeSize);

            roles.Add(zookeeperNode);

            //RServer & MLServices clusters contain an additional edge node. Return here for all other types.
            if (!new[] { "RServer", "MLServices" }.Contains(createProperties.ClusterType, StringComparer.OrdinalIgnoreCase))
            {
                return(roles);
            }

            //Set up edgenode and add to collection.
            string edgeNodeSize = GetNodeSize(createProperties, ClusterNodeType.EdgeNode);
            Role   edgeNode     = GetRole(osProfile, vnetProfile, ClusterNodeType.EdgeNode, null, 1, edgeNodeSize);

            roles.Add(edgeNode);

            return(roles);
        }
 private static Role CreateCommonRole(OsProfile osProfile, VirtualNetworkProfile vnetProfile, AzureHDInsightClusterNodeType nodeType, List <ScriptAction> scriptActions, int instanceCount,
                                      string vmSize)
 {
     return(new Role
     {
         Name = nodeType.ToString().ToLower(),
         TargetInstanceCount = instanceCount,
         HardwareProfile = vmSize != null ? new HardwareProfile
         {
             VmSize = vmSize
         } : null,
         VirtualNetworkProfile = vnetProfile,
         OsProfile = osProfile,
         ScriptActions = scriptActions
     });
 }
Beispiel #5
0
 public static void ValidateVnet(VirtualNetworkProfile vnetProfile, ClusterCreateParameters createParams)
 {
     if (string.IsNullOrEmpty(createParams.VirtualNetworkId) && string.IsNullOrEmpty(createParams.SubnetName))
     {
         Assert.Null(vnetProfile);
         return;
     }
     Assert.NotNull(vnetProfile);
     if (!string.IsNullOrEmpty(createParams.VirtualNetworkId))
     {
         Assert.Equal(createParams.VirtualNetworkId, vnetProfile.Id);
     }
     if (!string.IsNullOrEmpty(createParams.SubnetName))
     {
         Assert.Equal(createParams.SubnetName, vnetProfile.Subnet);
     }
 }
Beispiel #6
0
        private static VirtualNetworkProfile GetVnetProfile(ClusterCreateParameters createProperties)
        {
            VirtualNetworkProfile vnetProfile = new VirtualNetworkProfile();

            if (!string.IsNullOrEmpty(createProperties.VirtualNetworkId))
            {
                vnetProfile.Id = createProperties.VirtualNetworkId;
            }
            if (!string.IsNullOrEmpty(createProperties.SubnetName))
            {
                vnetProfile.Subnet = createProperties.SubnetName;
            }
            if (string.IsNullOrEmpty(createProperties.VirtualNetworkId) && string.IsNullOrEmpty(createProperties.SubnetName))
            {
                vnetProfile = null;
            }
            return(vnetProfile);
        }
 internal AppServiceEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string kind, ProvisioningState?provisioningState, HostingEnvironmentStatus?status, VirtualNetworkProfile virtualNetwork, LoadBalancingMode?internalLoadBalancingMode, string multiSize, int?multiRoleCount, int?ipsslAddressCount, string dnsSuffix, int?maximumNumberOfMachines, int?frontEndScaleFactor, bool?suspended, IList <NameValuePair> clusterSettings, IList <string> userWhitelistedIPRanges, bool?hasLinuxWorkers, int?dedicatedHostCount, bool?zoneRedundant) : base(id, name, resourceType, systemData, tags, location, kind)
 {
     ProvisioningState         = provisioningState;
     Status                    = status;
     VirtualNetwork            = virtualNetwork;
     InternalLoadBalancingMode = internalLoadBalancingMode;
     MultiSize                 = multiSize;
     MultiRoleCount            = multiRoleCount;
     IpsslAddressCount         = ipsslAddressCount;
     DnsSuffix                 = dnsSuffix;
     MaximumNumberOfMachines   = maximumNumberOfMachines;
     FrontEndScaleFactor       = frontEndScaleFactor;
     Suspended                 = suspended;
     ClusterSettings           = clusterSettings;
     UserWhitelistedIPRanges   = userWhitelistedIPRanges;
     HasLinuxWorkers           = hasLinuxWorkers;
     DedicatedHostCount        = dedicatedHostCount;
     ZoneRedundant             = zoneRedundant;
 }
        private static IEnumerable <Role> GetRoleCollection(ClusterCreateParameters clusterCreateParameters)
        {
            //OS Profile
            var osProfile = new OsProfile();

            if (clusterCreateParameters.OSType == OSType.Windows)
            {
                RdpSettings rdpSettings = null;
                if (!string.IsNullOrEmpty(clusterCreateParameters.RdpUsername))
                {
                    rdpSettings = new RdpSettings
                    {
                        UserName   = clusterCreateParameters.RdpUsername,
                        Password   = clusterCreateParameters.RdpPassword,
                        ExpiryDate = clusterCreateParameters.RdpAccessExpiry
                    };
                }

                osProfile = new OsProfile
                {
                    WindowsOperatingSystemProfile = new WindowsOperatingSystemProfile
                    {
                        RdpSettings = rdpSettings
                    }
                };
            }
            else if (clusterCreateParameters.OSType == OSType.Linux)
            {
                var sshPublicKeys = new List <SshPublicKey>();
                if (!string.IsNullOrEmpty(clusterCreateParameters.SshPublicKey))
                {
                    var sshPublicKey = new SshPublicKey
                    {
                        CertificateData = clusterCreateParameters.SshPublicKey
                    };
                    sshPublicKeys.Add(sshPublicKey);
                }

                SshProfile sshProfile;
                if (sshPublicKeys.Count > 0)
                {
                    sshProfile = new SshProfile
                    {
                        SshPublicKeys = sshPublicKeys
                    };
                }
                else
                {
                    sshProfile = null;
                }

                osProfile = new OsProfile
                {
                    LinuxOperatingSystemProfile = new LinuxOperatingSystemProfile
                    {
                        UserName   = clusterCreateParameters.SshUserName,
                        Password   = clusterCreateParameters.SshPassword,
                        SshProfile = sshProfile
                    }
                };
            }

            //VNet Profile
            var vnetProfile = new VirtualNetworkProfile();

            if (!string.IsNullOrEmpty(clusterCreateParameters.VirtualNetworkId))
            {
                vnetProfile.Id = clusterCreateParameters.VirtualNetworkId;
            }
            if (!string.IsNullOrEmpty(clusterCreateParameters.SubnetName))
            {
                vnetProfile.SubnetName = clusterCreateParameters.SubnetName;
            }
            if (string.IsNullOrEmpty(vnetProfile.Id) && string.IsNullOrEmpty(vnetProfile.SubnetName))
            {
                vnetProfile = null;
            }

            List <ScriptAction> workernodeactions    = null;
            List <ScriptAction> headnodeactions      = null;
            List <ScriptAction> zookeepernodeactions = null;

            //Script Actions
            foreach (var scriptAction in clusterCreateParameters.ScriptActions)
            {
                if (scriptAction.Key.ToString().ToLower().Equals("workernode"))
                {
                    workernodeactions = scriptAction.Value;
                }
                else if (scriptAction.Key.ToString().ToLower().Equals("headnode"))
                {
                    headnodeactions = scriptAction.Value;
                }
                else if (scriptAction.Key.ToString().ToLower().Equals("zookeepernode"))
                {
                    zookeepernodeactions = scriptAction.Value;
                }
            }

            //Roles
            var roles        = new List <Role>();
            var headNodeSize = GetHeadNodeSize(clusterCreateParameters);
            var headNode     = new Role
            {
                Name = "headnode",
                TargetInstanceCount = 2,
                HardwareProfile     = new HardwareProfile
                {
                    VmSize = headNodeSize
                },
                OsProfile             = osProfile,
                VirtualNetworkProfile = vnetProfile,
                ScriptActions         = headnodeactions
            };

            roles.Add(headNode);

            var workerNodeSize = GetWorkerNodeSize(clusterCreateParameters);
            var workerNode     = new Role
            {
                Name = "workernode",
                TargetInstanceCount = clusterCreateParameters.ClusterSizeInNodes,
                HardwareProfile     = new HardwareProfile
                {
                    VmSize = workerNodeSize
                },
                OsProfile     = osProfile,
                ScriptActions = workernodeactions
            };

            roles.Add(workerNode);

            if (clusterCreateParameters.OSType == OSType.Windows)
            {
                if (clusterCreateParameters.ClusterType.Equals("Hadoop", StringComparison.OrdinalIgnoreCase) ||
                    clusterCreateParameters.ClusterType.Equals("Spark", StringComparison.OrdinalIgnoreCase))
                {
                    return(roles);
                }
            }

            if (clusterCreateParameters.OSType == OSType.Linux)
            {
                if (clusterCreateParameters.ClusterType.Equals("Hadoop", StringComparison.OrdinalIgnoreCase) ||
                    clusterCreateParameters.ClusterType.Equals("Spark", StringComparison.OrdinalIgnoreCase))
                {
                    clusterCreateParameters.ZookeeperNodeSize = "Small";
                }
            }

            string zookeeperNodeSize = clusterCreateParameters.ZookeeperNodeSize ?? "Medium";
            var    zookeepernode     = new Role
            {
                Name                = "zookeepernode",
                ScriptActions       = zookeepernodeactions,
                TargetInstanceCount = 3,
                OsProfile           = osProfile,
                HardwareProfile     = new HardwareProfile
                {
                    VmSize = zookeeperNodeSize
                }
            };

            roles.Add(zookeepernode);

            return(roles);
        }
        public override void ExecuteCmdlet()
        {
            foreach (var component in ComponentVersion.Where(component => !clusterComponentVersion.ContainsKey(component.Key)))
            {
                clusterComponentVersion.Add(component.Key, component.Value);
            }
            // Construct Configurations
            foreach (var config in Configurations.Where(config => !clusterConfigurations.ContainsKey(config.Key)))
            {
                clusterConfigurations.Add(config.Key, config.Value);
            }

            // Add cluster username/password to gateway config.
            ClusterCreateHelper.AddClusterCredentialToGatewayConfig(HttpCredential, clusterConfigurations);

            // Construct OS Profile
            OsProfile osProfile = ClusterCreateHelper.CreateOsProfile(SshCredential, SshPublicKey);

            // Construct Virtual Network Profile
            VirtualNetworkProfile vnetProfile = ClusterCreateHelper.CreateVirtualNetworkProfile(VirtualNetworkId, SubnetName);

            // Handle storage account
            StorageProfile storageProfile = new StorageProfile()
            {
                Storageaccounts = new List <StorageAccount> {
                }
            };

            if (StorageAccountType == null || StorageAccountType == StorageType.AzureStorage)
            {
                var azureStorageAccount = ClusterCreateHelper.CreateAzureStorageAccount(ClusterName, StorageAccountResourceId, StorageAccountKey, StorageContainer, this.DefaultContext.Environment.StorageEndpointSuffix);
                storageProfile.Storageaccounts.Add(azureStorageAccount);
            }
            else if (StorageAccountType == StorageType.AzureDataLakeStore)
            {
                ClusterCreateHelper.AddAzureDataLakeStorageGen1ToCoreConfig(StorageAccountResourceId, StorageRootPath, this.DefaultContext.Environment.AzureDataLakeStoreFileSystemEndpointSuffix, clusterConfigurations);
            }
            else if (StorageAccountType == StorageType.AzureDataLakeStorageGen2)
            {
                var adlsgen2Account = ClusterCreateHelper.CreateAdlsGen2StorageAccount(ClusterName, StorageAccountResourceId, StorageAccountKey, StorageFileSystem, StorageAccountManagedIdentity, this.DefaultContext.Environment.StorageEndpointSuffix);
                storageProfile.Storageaccounts.Add(adlsgen2Account);
            }

            // Handle additional storage accounts
            foreach (
                var storageAccount in
                AdditionalStorageAccounts.Where(
                    storageAccount => !clusterAdditionalStorageAccounts.ContainsKey(storageAccount.Key)))
            {
                clusterAdditionalStorageAccounts.Add(storageAccount.Key, storageAccount.Value);
            }
            ClusterCreateHelper.AddAdditionalStorageAccountsToCoreConfig(clusterAdditionalStorageAccounts, clusterConfigurations);

            // Handle script action
            foreach (var action in ScriptActions.Where(action => clusterScriptActions.ContainsKey(action.Key)))
            {
                clusterScriptActions.Add(action.Key,
                                         action.Value.Select(a => a.GetScriptActionFromPSModel()).ToList());
            }

            // Handle metastore
            if (OozieMetastore != null)
            {
                ClusterCreateHelper.AddOozieMetastoreToConfigurations(OozieMetastore, clusterConfigurations);
            }
            if (HiveMetastore != null)
            {
                ClusterCreateHelper.AddHiveMetastoreToConfigurations(HiveMetastore, clusterConfigurations);
            }

            // Handle ADLSGen1 identity
            if (!string.IsNullOrEmpty(CertificatePassword))
            {
                if (!string.IsNullOrEmpty(CertificateFilePath))
                {
                    CertificateFileContents = File.ReadAllBytes(CertificateFilePath);
                }

                ClusterCreateHelper.AddDataLakeStorageGen1IdentityToIdentityConfig(
                    GetApplicationId(ApplicationId), GetTenantId(AadTenantId), CertificateFileContents, CertificatePassword, clusterConfigurations,
                    this.DefaultContext.Environment.ActiveDirectoryAuthority, this.DefaultContext.Environment.DataLakeEndpointResourceId);
            }

            // Handle Kafka Rest Proxy
            KafkaRestProperties kafkaRestProperties = null;

            if (KafkaClientGroupId != null && KafkaClientGroupName != null)
            {
                kafkaRestProperties = new KafkaRestProperties()
                {
                    ClientGroupInfo = new ClientGroupInfo(KafkaClientGroupName, KafkaClientGroupId)
                };
            }

            // Compute profile contains headnode, workernode, zookeepernode, edgenode, kafkamanagementnode, idbrokernode, etc.
            ComputeProfile computeProfile = ClusterCreateHelper.CreateComputeProfile(osProfile, vnetProfile, clusterScriptActions, ClusterType, ClusterSizeInNodes, HeadNodeSize, WorkerNodeSize, ZookeeperNodeSize, EdgeNodeSize, KafkaManagementNodeSize, EnableIDBroker.IsPresent);

            // Handle SecurityProfile
            SecurityProfile securityProfile = ClusterCreateHelper.ConvertAzureHDInsightSecurityProfileToSecurityProfile(SecurityProfile, AssignedIdentity);

            // Handle DisksPerWorkerNode feature
            Role workerNode = Utils.ExtractRole(ClusterNodeType.WorkerNode.ToString(), computeProfile);

            if (DisksPerWorkerNode > 0)
            {
                workerNode.DataDisksGroups = new List <DataDisksGroups>()
                {
                    new DataDisksGroups()
                    {
                        DisksPerNode = DisksPerWorkerNode
                    }
                };
            }

            // Handle ClusterIdentity
            ClusterIdentity clusterIdentity = null;

            if (AssignedIdentity != null || StorageAccountManagedIdentity != null)
            {
                clusterIdentity = new ClusterIdentity
                {
                    Type = ResourceIdentityType.UserAssigned,
                    UserAssignedIdentities = new Dictionary <string, ClusterIdentityUserAssignedIdentitiesValue>()
                };
                if (AssignedIdentity != null)
                {
                    clusterIdentity.UserAssignedIdentities.Add(AssignedIdentity, new ClusterIdentityUserAssignedIdentitiesValue());
                }
                if (StorageAccountManagedIdentity != null)
                {
                    clusterIdentity.UserAssignedIdentities.Add(StorageAccountManagedIdentity, new ClusterIdentityUserAssignedIdentitiesValue());
                }
            }

            // Handle CMK feature
            DiskEncryptionProperties diskEncryptionProperties = null;

            if (EncryptionKeyName != null && EncryptionKeyVersion != null && EncryptionVaultUri != null)
            {
                diskEncryptionProperties = new DiskEncryptionProperties()
                {
                    KeyName             = EncryptionKeyName,
                    KeyVersion          = EncryptionKeyVersion,
                    VaultUri            = EncryptionVaultUri,
                    EncryptionAlgorithm = EncryptionAlgorithm != null ? EncryptionAlgorithm : JsonWebKeyEncryptionAlgorithm.RSAOAEP,
                    MsiResourceId       = AssignedIdentity
                };
            }

            // Handle encryption at host feature
            if (EncryptionAtHost != null)
            {
                if (diskEncryptionProperties != null)
                {
                    diskEncryptionProperties.EncryptionAtHost = EncryptionAtHost;
                }
                else
                {
                    diskEncryptionProperties = new DiskEncryptionProperties()
                    {
                        EncryptionAtHost = EncryptionAtHost
                    };
                }
            }

            // Handle autoscale featurer
            Autoscale autoscaleParameter = null;

            if (AutoscaleConfiguration != null)
            {
                autoscaleParameter = AutoscaleConfiguration.ToAutoscale();
                workerNode.AutoscaleConfiguration = autoscaleParameter;
            }

            // Construct cluster create parameter
            ClusterCreateParametersExtended createParams = new ClusterCreateParametersExtended
            {
                Location = Location,
                //Tags = Tags,  //To Do add this Tags parameter
                Properties = new ClusterCreateProperties
                {
                    Tier = ClusterTier,
                    ClusterDefinition = new ClusterDefinition
                    {
                        Kind             = ClusterType ?? "Hadoop",
                        ComponentVersion = clusterComponentVersion,
                        Configurations   = clusterConfigurations
                    },
                    ClusterVersion      = Version ?? "default",
                    KafkaRestProperties = kafkaRestProperties,
                    ComputeProfile      = computeProfile,
                    OsType                   = OSType,
                    SecurityProfile          = securityProfile,
                    StorageProfile           = storageProfile,
                    DiskEncryptionProperties = diskEncryptionProperties,
                    //handle Encryption In Transit feature
                    EncryptionInTransitProperties = EncryptionInTransit != null ? new EncryptionInTransitProperties()
                    {
                        IsEncryptionInTransitEnabled = EncryptionInTransit
                    } : null,
                    MinSupportedTlsVersion = MinSupportedTlsVersion
                },
                Identity = clusterIdentity
            };

            var cluster = HDInsightManagementClient.CreateCluster(ResourceGroupName, ClusterName, createParams);

            if (cluster != null)
            {
                WriteObject(new AzureHDInsightCluster(cluster));
            }
        }
        public static Role CreateKafkaManagementNode(OsProfile osProfile, VirtualNetworkProfile vnetProfile, string kafkaManagementNodeSize)
        {
            const int kafkaManagementNodeCount = 2;

            return(CreateCommonRole(osProfile, vnetProfile, AzureHDInsightClusterNodeType.KafkaManagementNode, null, kafkaManagementNodeCount, kafkaManagementNodeSize));
        }
        public static Role CreateIdBrokerNodeRole(OsProfile osProfile, VirtualNetworkProfile vnetProfile)
        {
            const int idBrokerNodeCount = 2;

            return(CreateCommonRole(null, vnetProfile, AzureHDInsightClusterNodeType.IdBrokerNode, null, idBrokerNodeCount, null));
        }
 public static Role CreateEdgeNodeRole(OsProfile osProfile, VirtualNetworkProfile vnetProfile, List <ScriptAction> edgeNodeScriptActions, int edgeNodeCount, string edgeNodeSize)
 {
     return(CreateCommonRole(osProfile, vnetProfile, AzureHDInsightClusterNodeType.EdgeNode, edgeNodeScriptActions, edgeNodeCount, edgeNodeSize));
 }
        public static Role CreateZookeeperNodeRole(OsProfile osProfile, VirtualNetworkProfile vnetProfile, List <ScriptAction> zookeeperNodeScriptActions, string zookeeperNodeSize)
        {
            const int zookeeperNodeCount = 3;

            return(CreateCommonRole(osProfile, vnetProfile, AzureHDInsightClusterNodeType.ZookeeperNode, zookeeperNodeScriptActions, zookeeperNodeCount, zookeeperNodeSize));
        }
        public static Role CreateHeadNodeRole(OsProfile osProfile, VirtualNetworkProfile vnetProfile, List <ScriptAction> headNodeScriptActions, string headNodeSize)
        {
            const int headNodeCount = 2;

            return(CreateCommonRole(osProfile, vnetProfile, AzureHDInsightClusterNodeType.HeadNode, headNodeScriptActions, headNodeCount, headNodeSize));
        }
 public AzureHDInsightVirtualNetworkProfile(VirtualNetworkProfile virtualNetworkProfile)
 {
     Id     = virtualNetworkProfile.Id;
     Subnet = virtualNetworkProfile.Subnet;
 }
Beispiel #16
0
        internal static AppServiceEnvironmentData DeserializeAppServiceEnvironmentData(JsonElement element)
        {
            Optional <string>            kind                             = default;
            IDictionary <string, string> tags                             = default;
            AzureLocation                       location                  = default;
            ResourceIdentifier                  id                        = default;
            string                              name                      = default;
            ResourceType                        type                      = default;
            SystemData                          systemData                = default;
            Optional <ProvisioningState>        provisioningState         = default;
            Optional <HostingEnvironmentStatus> status                    = default;
            Optional <VirtualNetworkProfile>    virtualNetwork            = default;
            Optional <LoadBalancingMode>        internalLoadBalancingMode = default;
            Optional <string>                   multiSize                 = default;
            Optional <int>                      multiRoleCount            = default;
            Optional <int>                      ipsslAddressCount         = default;
            Optional <string>                   dnsSuffix                 = default;
            Optional <int>                      maximumNumberOfMachines   = default;
            Optional <int>                      frontEndScaleFactor       = default;
            Optional <bool>                     suspended                 = default;
            Optional <IList <NameValuePair> >   clusterSettings           = default;
            Optional <IList <string> >          userWhitelistedIpRanges   = default;
            Optional <bool>                     hasLinuxWorkers           = default;
            Optional <int>                      dedicatedHostCount        = default;
            Optional <bool>                     zoneRedundant             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = property0.Value.GetString().ToProvisioningState();
                            continue;
                        }
                        if (property0.NameEquals("status"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            status = property0.Value.GetString().ToHostingEnvironmentStatus();
                            continue;
                        }
                        if (property0.NameEquals("virtualNetwork"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualNetwork = VirtualNetworkProfile.DeserializeVirtualNetworkProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("internalLoadBalancingMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            internalLoadBalancingMode = new LoadBalancingMode(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("multiSize"))
                        {
                            multiSize = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("multiRoleCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            multiRoleCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("ipsslAddressCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            ipsslAddressCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("dnsSuffix"))
                        {
                            dnsSuffix = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("maximumNumberOfMachines"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            maximumNumberOfMachines = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("frontEndScaleFactor"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            frontEndScaleFactor = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("suspended"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            suspended = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("clusterSettings"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <NameValuePair> array = new List <NameValuePair>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(NameValuePair.DeserializeNameValuePair(item));
                            }
                            clusterSettings = array;
                            continue;
                        }
                        if (property0.NameEquals("userWhitelistedIpRanges"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            userWhitelistedIpRanges = array;
                            continue;
                        }
                        if (property0.NameEquals("hasLinuxWorkers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hasLinuxWorkers = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("dedicatedHostCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            dedicatedHostCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("zoneRedundant"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            zoneRedundant = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new AppServiceEnvironmentData(id, name, type, systemData, tags, location, kind.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(status), virtualNetwork.Value, Optional.ToNullable(internalLoadBalancingMode), multiSize.Value, Optional.ToNullable(multiRoleCount), Optional.ToNullable(ipsslAddressCount), dnsSuffix.Value, Optional.ToNullable(maximumNumberOfMachines), Optional.ToNullable(frontEndScaleFactor), Optional.ToNullable(suspended), Optional.ToList(clusterSettings), Optional.ToList(userWhitelistedIpRanges), Optional.ToNullable(hasLinuxWorkers), Optional.ToNullable(dedicatedHostCount), Optional.ToNullable(zoneRedundant)));
        }
 public PSVirtualNetworkProfile(VirtualNetworkProfile virtualNetworkProfile)
 {
     this.VirtualNetworkProfileComputeSubnetId = virtualNetworkProfile?.ComputeSubnetId;
 }