当前位置: 首页>>代码示例>>C#>>正文


C# Extensions.ExtensionConfigurationInput类代码示例

本文整理汇总了C#中Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.ExtensionConfigurationInput的典型用法代码示例。如果您正苦于以下问题:C# ExtensionConfigurationInput类的具体用法?C# ExtensionConfigurationInput怎么用?C# ExtensionConfigurationInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExtensionConfigurationInput类属于Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions命名空间,在下文中一共展示了ExtensionConfigurationInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteCommand

        public void ExecuteCommand()
        {
            InitializeAntimalwareSettings();
            ValidateParameters();

            RemoveAntimalwareExtension();
            RemoveExistingAntimalwareMonitoringConfig();

            ExtensionConfigurationInput[] extConfigInputs = null;
            if (AntimalwareExtensionConfigurationInput != null && AntimalwareMonitoringExtensionConfigurationInput != null)
            {
                extConfigInputs = new ExtensionConfigurationInput[2];
                extConfigInputs[0] = AntimalwareMonitoringExtensionConfigurationInput;
                extConfigInputs[1] = AntimalwareExtensionConfigurationInput;
            }
            else if (AntimalwareExtensionConfigurationInput != null)
            {
                extConfigInputs = new ExtensionConfigurationInput[1];
                extConfigInputs[0] = AntimalwareExtensionConfigurationInput;
            }
            else if (AntimalwareMonitoringExtensionConfigurationInput != null)
            {
                extConfigInputs = new ExtensionConfigurationInput[1];
                extConfigInputs[0] = AntimalwareMonitoringExtensionConfigurationInput;
            }

            // process any pending deployment changes
            if (extConfigInputs != null)
            {
                ExtensionConfiguration newExtConfig = ExtensionManager.Add(Deployment, extConfigInputs, Slot);
                ChangeDeployment(newExtConfig);
            }
        }
开发者ID:kangyangthu,项目名称:azure-sdk-tools,代码行数:33,代码来源:RemoveAzureServiceAntimalwareExtension.cs

示例2: NewAzureDeploymentCmdletInfo

        public NewAzureDeploymentCmdletInfo(string serviceName, string packagePath, string configName, string slot,
            string label, string name, bool doNotStart, bool warning, ExtensionConfigurationInput config)
    {
        cmdletName = Utilities.NewAzureDeploymentCmdletName;

        cmdletParams.Add(new CmdletParam("ServiceName", serviceName));
        cmdletParams.Add(new CmdletParam("Package", packagePath));
        cmdletParams.Add(new CmdletParam("Configuration", configName));
        cmdletParams.Add(new CmdletParam("Slot", slot));

        if (label != null)
        {
            cmdletParams.Add(new CmdletParam("Label", label));
        }
        if (name != null)
        {
            cmdletParams.Add(new CmdletParam("Name", name));
        }
        if (doNotStart)
        {
            cmdletParams.Add(new CmdletParam("DoNotStart"));
        }
        if (warning)
        {
            cmdletParams.Add(new CmdletParam("TreatWarningsAsError"));
        }
        if (config != null)
        {
            cmdletParams.Add(new CmdletParam("ExtensionConfiguration", config));
        }
    }
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:31,代码来源:NewAzureDeploymentCmdletInfo.cs

示例3: SetAzureDeploymentConfigCmdletInfo

        public static SetAzureDeploymentCmdletInfo SetAzureDeploymentConfigCmdletInfo(string serviceName, string slot, string configPath, ExtensionConfigurationInput extConfig = null)
        {
            SetAzureDeploymentCmdletInfo result = new SetAzureDeploymentCmdletInfo(serviceName, slot);

            result.cmdletParams.Add(new CmdletParam("Config"));
            result.cmdletParams.Add(new CmdletParam("Configuration", configPath));

            if (extConfig != null)
            {
                result.cmdletParams.Add(new CmdletParam("ExtensionConfiguration", extConfig));
            }

            return result;
        }
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:14,代码来源:SetAzureDeploymentCmdletInfo.cs

示例4: InstallExtension

        public ExtensionConfiguration InstallExtension(ExtensionConfigurationInput context, string slot,
            DeploymentGetResponse deployment, DeploymentGetResponse peerDeployment)
        {
            Func<DeploymentGetResponse, ExtensionConfiguration> func = (d) => d == null ? null : d.ExtensionConfiguration;

            ExtensionConfiguration extConfig = func(deployment);
            ExtensionConfiguration secondSlotExtConfig = func(peerDeployment);

            return InstallExtension(context, slot, extConfig, secondSlotExtConfig);
        }
开发者ID:rturnage,项目名称:azure-powershell,代码行数:10,代码来源:ExtensionManager.cs

示例5: AddNewAntimalwareMonitoringConfig

 private void AddNewAntimalwareMonitoringConfig()
 {
     // install diagnostics provider with a new antimalware event monitoring config
     InitializeDiagnosticsSettings();
     ExtensionConfigurationInput diagExtConfigInput = new ExtensionConfigurationInput
     {
         ProviderNameSpace = ProviderNamespace,
         Type = ExtensionName,
         CertificateThumbprint = CertificateThumbprint,
         ThumbprintAlgorithm = ThumbprintAlgorithm,
         X509Certificate = X509Certificate,
         PublicConfiguration = PublicConfiguration,
         PrivateConfiguration = PrivateConfiguration,
         Roles = new ExtensionRoleList(Role != null && Role.Any() ? Role.Select(r => new ExtensionRole(r)) : Enumerable.Repeat(new ExtensionRole(), 1))
     };
     AntimalwareMonitoringExtensionConfigurationInput = diagExtConfigInput;
 }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:17,代码来源:SetAzureServiceAntimalwareExtension.cs

示例6: ExecuteCommand

        public void ExecuteCommand()
        {
            ValidateParameters();

            // set diagnostics extension
            switch (monitoringAction)
            {
                case MonitoringActionType.Enable : EnableMonitoring(); break;
                case MonitoringActionType.Disable : RemoveExistingAntimalwareMonitoringConfig(); break;
                default: break;
            }

            // set antimalware extension 
            InitializeAntimalwareSettings();
            ExtensionConfigurationInput amExtConfigInput = new ExtensionConfigurationInput
            {
                ProviderNameSpace = ProviderNamespace,
                Type = ExtensionName,
                PublicConfiguration = PublicConfiguration,
                PrivateConfiguration = PrivateConfiguration,
                Roles = new ExtensionRoleList(Role != null && Role.Any() ? Role.Select(r => new ExtensionRole(r)) : Enumerable.Repeat(new ExtensionRole(), 1))
            };
            AntimalwareExtensionConfigurationInput = amExtConfigInput;

            ExtensionConfigurationInput[] extConfigInputs = null;
            if (AntimalwareExtensionConfigurationInput != null && AntimalwareMonitoringExtensionConfigurationInput != null)
            {
                extConfigInputs = new ExtensionConfigurationInput[2];
                extConfigInputs[0] = AntimalwareMonitoringExtensionConfigurationInput;
                extConfigInputs[1] = AntimalwareExtensionConfigurationInput;
            }
            else if (AntimalwareExtensionConfigurationInput != null)
            {
                extConfigInputs = new ExtensionConfigurationInput[1];
                extConfigInputs[0] = AntimalwareExtensionConfigurationInput;
            }
            else if (AntimalwareMonitoringExtensionConfigurationInput!=null)
            {
                extConfigInputs = new ExtensionConfigurationInput[1];
                extConfigInputs[0] = AntimalwareMonitoringExtensionConfigurationInput;
            }

            // process any pending deployment changes
            if (extConfigInputs != null)
            {
                ExtensionConfiguration newExtConfig = ExtensionManager.Add(Deployment, extConfigInputs, Slot);
                ChangeDeployment(newExtConfig);
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:49,代码来源:SetAzureServiceAntimalwareExtension.cs

示例7: ExecuteCommand

        public void ExecuteCommand()
        {
            ValidateParameters();
            ExtensionConfigurationInput context = new ExtensionConfigurationInput
            {
                Version = Version,
                ProviderNameSpace = ProviderNamespace,
                Type = ExtensionName,
                CertificateThumbprint = CertificateThumbprint,
                ThumbprintAlgorithm = ThumbprintAlgorithm,
                X509Certificate = X509Certificate,
                PublicConfiguration = PublicConfiguration,
                PrivateConfiguration = PrivateConfiguration,
                Roles = new ExtensionRoleList(Role != null && Role.Any() ? Role.Select(r => new ExtensionRole(r)) : Enumerable.Repeat(new ExtensionRole(), 1))
            };

            var secondSlotDeployment = GetDeployment(this.Slot == DeploymentSlotType.Production ? DeploymentSlotType.Staging : DeploymentSlotType.Production);
            Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration secondSlotExtensionConfiguration = 
                secondSlotDeployment != null ? secondSlotDeployment.ExtensionConfiguration : null;

            var extConfig = ExtensionManager.InstallExtension(context, Slot, Deployment.ExtensionConfiguration, secondSlotExtensionConfiguration);
            ChangeDeployment(extConfig);
        }
开发者ID:ldattilo,项目名称:azure-powershell,代码行数:23,代码来源:SetAzureServiceDiagnosticsExtension.cs

示例8: Add

 public ExtensionConfigurationBuilder Add(ExtensionConfigurationInput context, string extensionId)
 {
     if (context != null && context.Roles != null)
     {
         context.Roles.ForEach(r => Add(r, extensionId));
     }
     return this;
 }
开发者ID:NordPool,项目名称:azure-sdk-tools,代码行数:8,代码来源:ExtensionConfigurationBuilder.cs

示例9: VerifyExtensionConfigRDP

        private bool VerifyExtensionConfigRDP(ExtensionConfigurationInput resultConfig, string user, string pass, List<string> roles, DateTime exp, string thumbprint = null, string algorithm = null, X509Certificate2 cert = null)
        {
            try
            {
                string resultUserName = GetInnerText(resultConfig.PublicConfiguration, "UserName");
                string resultPassword = GetInnerText(resultConfig.PrivateConfiguration, "Password");
                string resultExpDate = GetInnerText(resultConfig.PublicConfiguration, "Expiration");

                Console.WriteLine("Type: {0}, UserName:{1}, Password: {2}, ExpirationDate: {3}, CertificateThumbprint: {4}, ThumbprintAlgorithm: {5}, X509Certificate: {6}",
                    resultConfig.Type, resultUserName, resultPassword, resultExpDate, resultConfig.CertificateThumbprint, resultConfig.ThumbprintAlgorithm, resultConfig.X509Certificate);

                Assert.AreEqual(resultConfig.Type, "RDP", "Type is not equal!");
                Assert.AreEqual(resultUserName, user);
                Assert.AreEqual(resultPassword, pass);
                Assert.IsTrue(Utilities.CompareDateTime(exp, resultExpDate));

                if (string.IsNullOrWhiteSpace(thumbprint))
                {
                    Assert.IsTrue(string.IsNullOrWhiteSpace(resultConfig.CertificateThumbprint));
                }
                else
                {
                    Assert.AreEqual(resultConfig.CertificateThumbprint, thumbprint, "Certificate thumbprint is not equal!");
                }

                if (string.IsNullOrWhiteSpace(algorithm))
                {
                    Assert.IsTrue(string.IsNullOrWhiteSpace(resultConfig.ThumbprintAlgorithm));
                }
                else
                {
                    Assert.AreEqual(resultConfig.ThumbprintAlgorithm, algorithm, "Thumbprint algorithm is not equal!");
                }
                Assert.AreEqual(resultConfig.X509Certificate, cert, "X509Certificate is not equal!");
                if (resultConfig.Roles.Count == 1 && string.IsNullOrEmpty(resultConfig.Roles[0].RoleName))
                {
                    Assert.IsTrue(roles.Contains(resultConfig.Roles[0].RoleType.ToString()));
                }
                else
                {
                    foreach (ExtensionRole role in resultConfig.Roles)
                    {
                        Assert.IsTrue(roles.Contains(role.RoleName));
                    }
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
开发者ID:khoatle,项目名称:azure-powershell,代码行数:53,代码来源:FunctionalTest.cs

示例10: VerifyExtensionConfigDiag

        private bool VerifyExtensionConfigDiag(ExtensionConfigurationInput resultConfig, string storage, List<string> roles, XmlDocument wadconfig = null, string thumbprint = null, string algorithm = null, X509Certificate2 cert = null)
        {
            try
            {
                string resultStorageAccount = GetInnerText(resultConfig.PublicConfiguration, "StorageAccount");
                string resultWadCfg = Utilities.GetInnerXml(resultConfig.PublicConfiguration, "WadCfg");
                if (string.IsNullOrWhiteSpace(resultWadCfg))
                {
                    resultWadCfg = null;
                }
                string resultStorageKey = GetInnerValue(resultConfig.PrivateConfiguration, "StorageAccount", "key");

                Console.WriteLine("Type: {0}, StorageAccountName:{1}, StorageKey: {2}, WadCfg: {3}, CertificateThumbprint: {4}, ThumbprintAlgorithm: {5}, X509Certificate: {6}",
                    resultConfig.Type, resultStorageAccount, resultStorageKey, resultWadCfg, resultConfig.CertificateThumbprint, resultConfig.ThumbprintAlgorithm, resultConfig.X509Certificate);

                Assert.AreEqual("PaaSDiagnostics", resultConfig.Type, "Type is not equal!");
                Assert.AreEqual(storage, resultStorageAccount);
                Assert.IsTrue(Utilities.CompareWadCfg(resultWadCfg, wadconfig));

                if (string.IsNullOrWhiteSpace(thumbprint))
                {
                    Assert.IsTrue(string.IsNullOrWhiteSpace(resultConfig.CertificateThumbprint));
                }
                else
                {
                    Assert.AreEqual(thumbprint, resultConfig.CertificateThumbprint, "Certificate thumbprint is not equal!");
                }
                if (string.IsNullOrWhiteSpace(algorithm))
                {
                    Assert.IsTrue(string.IsNullOrWhiteSpace(resultConfig.ThumbprintAlgorithm));
                }
                else
                {
                    Assert.AreEqual(algorithm, resultConfig.ThumbprintAlgorithm, "Thumbprint algorithm is not equal!");
                }
                Assert.AreEqual(cert, resultConfig.X509Certificate, "X509Certificate is not equal!");
                if (resultConfig.Roles.Count == 1 && string.IsNullOrEmpty(resultConfig.Roles[0].RoleName))
                {
                    Assert.IsTrue(roles.Contains(resultConfig.Roles[0].RoleType.ToString()));
                }
                else
                {
                    foreach (ExtensionRole role in resultConfig.Roles)
                    {
                        Assert.IsTrue(roles.Contains(role.RoleName));
                    }
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
开发者ID:khoatle,项目名称:azure-powershell,代码行数:55,代码来源:FunctionalTest.cs

示例11: PostProcessExtensionConfigAfterInstallExtension

        /// <summary>
        /// The configuration must be defined in either allRoles or namedRoles.
        /// Otherwise, it will fail for trying to apply the same extension.
        /// We only apply the fix here but not in ExtensionManager, so other commands won't get affected.
        /// </summary>
        /// <param name="configInput">The configuration used for InstallExtension()</param>
        /// <param name="extConfig">The extension config after InstallExtension()</param>
        private Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration PostProcessExtensionConfigAfterInstallExtension(
            ExtensionConfigurationInput configInput,
            Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration extConfig)
        {
            ExtensionConfigurationBuilder builder = ExtensionManager.GetBuilder(extConfig);
            if (configInput.Roles.All(r => r.Default))
            {
                // If the configuration applies to all roles, remove the ones defined in each named roles
                foreach (var role in Deployment.Roles)
                {
                    builder.Remove(role.RoleName, ProviderNamespace, ExtensionName);
                }
            }
            else
            {
                // If the configuration applies to some specific roles and there is already extension defined in allRoles,
                // we remove the setting from allRoles and move it to specific namedRoles.
                if (builder.ExistDefault(ProviderNamespace, ExtensionName))
                {
                    var diagnosticExtensionId = extConfig.AllRoles.FirstOrDefault(ext =>
                    {
                        var e = ExtensionManager.GetExtension(ext.Id);
                        return e != null && e.ProviderNamespace == ProviderNamespace && e.Type == ExtensionName;
                    }).Id;
                    builder.RemoveDefault(diagnosticExtensionId);

                    foreach (var role in Deployment.Roles)
                    {
                        // The role is previously configured by allRoles, move it to the namedRole itself
                        if (!configInput.Roles.Exists(r => r.RoleName == role.RoleName))
                        {
                            builder.Add(role.RoleName, diagnosticExtensionId);
                        }
                    }
                }
            }

            return builder.ToConfiguration();
        }
开发者ID:rturnage,项目名称:azure-powershell,代码行数:46,代码来源:SetAzureServiceDiagnosticsExtension.cs

示例12: RemoveExistingAntimalwareMonitoringConfig

        protected void RemoveExistingAntimalwareMonitoringConfig()
        {
            // this does not remove the diagnostics extension entirely, it only removes the portion of the 
            // diagnostics configuration that monitors antimalware events- everything else will remain 
            // in order to avoid doing harm to any other users who may be sharing the diagnostics extension 

            var ext = GetDiagnosticsExtension();
            if (ext != null)
            {
                string tmpXmlString = ext.PublicConfiguration;
                string AntimalwareDataSourceName = "System!*[System[Provider[@Name='Microsoft Antimalware']]]";
                string DiagnosticsConfigXmlNamespace = @"http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration";

                // remove the data source element with the antimalware event provider 
                XmlDocument tmpXmlDoc = new XmlDocument();
                tmpXmlDoc.LoadXml(tmpXmlString);

                // retrieve storage account name from public configuration
                string stgAcctNameXPath = string.Format(@"//*[local-name()='{0}' and namespace-uri()='{1}']", StorageAccountElemStr, DiagnosticsConfigXmlNamespace);
                XmlNode stgAcctNameNode = tmpXmlDoc.DocumentElement.SelectSingleNode(stgAcctNameXPath);
                if (stgAcctNameNode != null)
                {
                    StorageAccountName = stgAcctNameNode.InnerText;
                }
                if (string.IsNullOrWhiteSpace(StorageAccountName))
                {
                    // do not modify diagnostics config without including the storage account
                    // throw terminating exception since it is not possible to preserve the 
                    // existing storage account with the configuration if it doesn't have a  
                    // hint to what the last storage account was in the public configuration 
                    ThrowTerminatingError(new ErrorRecord(
                        new Exception(Resources.ServiceExtensionCannotFindStorageAccountName),
                        string.Empty,
                        ErrorCategory.InvalidData,
                        null));

                    return;
                }
                else
                {
                    // check the storage account and initialize for use
                    ValidateStorageAccount();
                }

                // locate the antimalware data source node in the document 
                string antimalwareDataSourceXPath = string.Format(@"//*[local-name()='{0}' and @name=""{1}"" and namespace-uri()='{2}']", "DataSource", AntimalwareDataSourceName, DiagnosticsConfigXmlNamespace);
                XmlNode antimalwareDataSourceNode = tmpXmlDoc.DocumentElement.SelectSingleNode(antimalwareDataSourceXPath);
                if (antimalwareDataSourceNode != null)
                {
                    XmlNode windowsEventLogNode = antimalwareDataSourceNode.ParentNode;
                    if (windowsEventLogNode.RemoveChild(antimalwareDataSourceNode) != null)
                    {
                        // remove the windows event log if there are no other child data sources present
                        // as will be required for schema validation to succeed when sending the new config
                        // any other data sources outside of the windows event log are left untouched 
                        if (!windowsEventLogNode.HasChildNodes)
                        {
                            windowsEventLogNode.ParentNode.RemoveChild(windowsEventLogNode);
                        }
                    }

                    // now reinstall the diagnostics extension with the updated configuration
                    InitializeDiagnosticsSettings();
                    ExtensionConfigurationInput diagExtConfigInput = new ExtensionConfigurationInput
                    {
                        ProviderNameSpace = ProviderNamespace,
                        Type = ExtensionName,
                        CertificateThumbprint = CertificateThumbprint,
                        ThumbprintAlgorithm = ThumbprintAlgorithm,
                        X509Certificate = X509Certificate,
                        PublicConfiguration = tmpXmlDoc.OuterXml,
                        PrivateConfiguration = PrivateConfiguration,
                        Roles = new ExtensionRoleList(Role != null && Role.Any() ? Role.Select(r => new ExtensionRole(r)) : Enumerable.Repeat(new ExtensionRole(), 1))
                    };
                    AntimalwareMonitoringExtensionConfigurationInput = diagExtConfigInput;
                }
                else
                {
                    // no existing antimalware data source was found needing removal
                    return;
                }
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:83,代码来源:BaseAzureServiceAntimalwareExtension.cs

示例13: NewAzureDeployment

        private void NewAzureDeployment(ExtensionConfigurationInput domainJoinExtensionConfig = null)
        {
            //Create a new Azure Iaas VM and set Domain Join extension, get domain join extension and then remove domain join extension
            Console.WriteLine("Creating a new Azure Iaas VM");

            vmPowershellCmdlets.NewAzureService(_serviceName, _serviceName, null, AffinityGroupName);

            Console.WriteLine("Service, {0}, is created.", _serviceName);

            vmPowershellCmdlets.AddAzureCertificate(_serviceName, _rdpCertPath.FullName, password);

            if (domainJoinExtensionConfig == null)
            {
                vmPowershellCmdlets.NewAzureDeployment(_serviceName, _packagePath1.FullName, _configPath1.FullName, DeploymentSlotType.Production, _deploymentLabel, _deploymentName, false, false);
                Console.WriteLine("New deployment created successfully.");
            }
            else
            {
                vmPowershellCmdlets.NewAzureDeployment(_serviceName, _packagePath1.FullName, _configPath1.FullName, DeploymentSlotType.Production, _deploymentLabel, _deploymentName, false, false, domainJoinExtensionConfig);
                Console.WriteLine("{0}:New deployment {1} with domain join {2} created successfully.", DateTime.Now, _serviceName, domainJoinExtensionConfig.Type);
            }
        }
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:22,代码来源:AzureServiceADDomainJoinExtensionTests.cs

示例14: Set

        public ExtensionConfiguration Set(DeploymentGetResponse currentDeployment, DeploymentGetResponse peerDeployment, ExtensionConfigurationInput[] inputs, string slot)
        {
            string errorConfigInput = null;
            if (!Validate(inputs, out errorConfigInput))
            {
                throw new Exception(string.Format(Resources.ServiceExtensionCannotApplyExtensionsInSameType, errorConfigInput));
            }

            ExtensionConfigurationBuilder configBuilder = this.GetBuilder();
            foreach (ExtensionConfigurationInput context in inputs)
            {
                if (context != null)
                {
                    ExtensionConfiguration currentConfig = this.InstallExtension(context, slot, currentDeployment, peerDeployment);

                    foreach (var r in currentConfig.AllRoles)
                    {
                        if (currentDeployment == null || !this.GetBuilder(currentDeployment.ExtensionConfiguration).ExistAny(r.Id))
                        {
                            configBuilder.AddDefault(r.Id);
                        }
                    }
                    foreach (var r in currentConfig.NamedRoles)
                    {
                        foreach (var e in r.Extensions)
                        {
                            if (currentDeployment == null || !this.GetBuilder(currentDeployment.ExtensionConfiguration).ExistAny(e.Id))
                            {
                                configBuilder.Add(r.RoleName, e.Id);
                            }
                        }
                    }
                }
            }

            var extConfig = configBuilder.ToConfiguration();

            return extConfig;
        }
开发者ID:rturnage,项目名称:azure-powershell,代码行数:39,代码来源:ExtensionManager.cs

示例15: Validate

        public static bool Validate(ExtensionConfigurationInput[] inputs, out string errorConfigInput)
        {
            var roleList = (from c in inputs
                            where c != null
                            from r in c.Roles
                            select r).GroupBy(r => r.ToString()).Select(g => g.First());

            foreach (var role in roleList)
            {
                var result = from c in inputs
                             where c != null && c.Roles.Any(r => r.ToString() == role.ToString())
                             select string.Format("{0}.{1}", c.ProviderNameSpace, c.Type);
                foreach (var s in result)
                {
                    if (result.Count(t => t == s) > 1)
                    {
                        errorConfigInput = s;
                        return false;
                    }
                }
            }

            errorConfigInput = null;
            return true;
        }
开发者ID:rturnage,项目名称:azure-powershell,代码行数:25,代码来源:ExtensionManager.cs


注:本文中的Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.ExtensionConfigurationInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。