private SettingsTypeSection GenerateUpgradeOrchestrationServiceSection()
        {
            List <SettingsTypeSectionParameter> parameterList = new List <SettingsTypeSectionParameter>()
            {
                new SettingsTypeSectionParameter()
                {
                    Name  = StringConstants.ParameterName.ClusterId,
                    Value = this.ClusterId
                },
                new SettingsTypeSectionParameter()
                {
                    Name  = StringConstants.ParameterName.AutoupgradeEnabled,
                    Value = this.TargetCsmConfig.AutoupgradeEnabled.ToString()
                },
                new SettingsTypeSectionParameter()
                {
                    Name  = StringConstants.ParameterName.AutoupgradeInstallEnabled,
                    Value = (this.TargetCsmConfig != null && this.TargetCsmConfig.CodeVersion == DMConstants.AutoupgradeCodeVersion) ? "True" : "False"
                },
                new SettingsTypeSectionParameter()
                {
                    Name  = StringConstants.ParameterName.GoalStateExpirationReminderInDays,
                    Value = (this.TargetCsmConfig != null && this.TargetCsmConfig.GoalStateExpirationReminderInDays > 0) ? this.TargetCsmConfig.GoalStateExpirationReminderInDays.ToString() : DMConstants.DefaultGoalStateExpirationReminderInDays.ToString()
                }
            };

            parameterList.AddRange(StandAloneFabricSettingsGenerator.GenerateStatefulSvcReplicaParameters(this.TargetCsmConfig));

            return(new SettingsTypeSection()
            {
                Name = StringConstants.SectionName.UpgradeOrchestrationService,
                Parameter = parameterList.ToArray(),
            });
        }
        protected static List <SettingsTypeSection> GenerateDnsServiceSection(IUserConfig targetCsmConfig)
        {
            List <SettingsTypeSection> result = new List <SettingsTypeSection>();

            bool intendToCreate = targetCsmConfig.AddonFeatures.Contains(AddonFeature.DnsService);

            if (intendToCreate)
            {
                List <SettingsTypeSectionParameter> parameterList = new List <SettingsTypeSectionParameter>()
                {
                    new SettingsTypeSectionParameter
                    {
                        Name  = StringConstants.ParameterName.IsEnabled,
                        Value = true.ToString(),
                    }
                };

                int instanceCount = targetCsmConfig.IsScaleMin ? 1 : -1;
                parameterList.AddRange(StandAloneFabricSettingsGenerator.GenerateStatelessSvcInstanceParameters(instanceCount));

                result.Add(
                    new SettingsTypeSection
                {
                    Name      = StringConstants.SectionName.DnsService,
                    Parameter = parameterList.ToArray(),
                });
            }

            return(result);
        }
        protected static List <SettingsTypeSection> GenerateRepairManagerSection(IUserConfig targetCsmConfig)
        {
            List <SettingsTypeSection> result = new List <SettingsTypeSection>();

            bool intendToCreate = targetCsmConfig.AddonFeatures.Contains(AddonFeature.RepairManager);

            if (intendToCreate)
            {
                List <SettingsTypeSectionParameter> parameterList = new List <SettingsTypeSectionParameter>()
                {
                    new SettingsTypeSectionParameter
                    {
                        Name  = StringConstants.ParameterName.EnableHealthChecks,
                        Value = true.ToString()
                    }
                };
                parameterList.AddRange(StandAloneFabricSettingsGenerator.GenerateStatefulSvcReplicaParameters(targetCsmConfig));

                result.Add(
                    new SettingsTypeSection
                {
                    Name      = StringConstants.SectionName.RepairManager,
                    Parameter = parameterList.ToArray(),
                });
            }

            return(result);
        }
        protected static List <SettingsTypeSection> GenerateSecretStoreSections(IUserConfig targetCsmConfig)
        {
            List <SettingsTypeSection> result = new List <SettingsTypeSection>();

            if (!targetCsmConfig.AddonFeatures.Contains(AddonFeature.SecretStoreService))
            {
                return(result);
            }

            result.Add(
                new SettingsTypeSection
            {
                Name      = StringConstants.SectionName.CentralSecretService,
                Parameter = StandAloneFabricSettingsGenerator.GenerateStatefulSvcReplicaParameters(targetCsmConfig),
            });

            return(result);
        }
        protected static List <SettingsTypeSection> GenerateEventStoreServiceSection(IUserConfig targetCsmConfig)
        {
            List <SettingsTypeSection> result = new List <SettingsTypeSection>();

            bool intendToCreate = targetCsmConfig.AddonFeatures.Contains(AddonFeature.EventStoreService);

            if (intendToCreate)
            {
                var parameterListArray = StandAloneFabricSettingsGenerator.GenerateStatefulSvcReplicaParameters(targetCsmConfig);

                result.Add(
                    new SettingsTypeSection
                {
                    Name      = StringConstants.SectionName.EventStoreService,
                    Parameter = parameterListArray,
                });
            }

            return(result);
        }
        protected static List <SettingsTypeSection> GenerateGatewayResourceManagerSection(IUserConfig targetCsmConfig)
        {
            List <SettingsTypeSection> result = new List <SettingsTypeSection>();

            bool intendToCreate = targetCsmConfig.AddonFeatures.Contains(AddonFeature.GatewayResourceManager);

            if (intendToCreate)
            {
                List <SettingsTypeSectionParameter> parameterList = new List <SettingsTypeSectionParameter>()
                {
                    new SettingsTypeSectionParameter
                    {
                        Name  = StringConstants.ParameterName.WindowsProxyImageName,
                        Value = "seabreeze/service-fabric-reverse-proxy:windows-0.20.0",
                    },
                    new SettingsTypeSectionParameter
                    {
                        Name  = StringConstants.ParameterName.LinuxProxyImageName,
                        Value = "microsoft/service-fabric-reverse-proxy:0.20.0",
                    },
                    new SettingsTypeSectionParameter
                    {
                        Name  = StringConstants.ParameterName.ProxyReplicaCount,
                        Value = "1",
                    },
                };

                parameterList.AddRange(StandAloneFabricSettingsGenerator.GenerateStatefulSvcReplicaParameters(targetCsmConfig));

                result.Add(
                    new SettingsTypeSection
                {
                    Name      = StringConstants.SectionName.GatewayResourceManager,
                    Parameter = parameterList.ToArray(),
                });
            }

            return(result);
        }
        protected override List <SettingsTypeSection> OnGenerateFabricSettings(
            Security security,
            CertificateDescription thumbprintFileStoreCert,
            List <string> thumbprintClusterCertList,
            ServerCertificateCommonNames commonNameFileStoreCert,
            Dictionary <string, string> commonNameClusterCertList,
            int currentClusterSize = -1)
        {
            var result = new List <SettingsTypeSection>();

            // GenerateSecuritySection always returns a non-null value
            var securitySections = this.GenerateSecuritySection(security, thumbprintClusterCertList, commonNameClusterCertList);

            result.AddRange(securitySections);

            var runAsSection = this.GenerateRunAsSection(security);

            if (runAsSection != null)
            {
                result.Add(runAsSection);
            }

            var httpApplicationGatewaySection = this.GenerateHttpApplicationGatewaySection();

            if (httpApplicationGatewaySection != null)
            {
                result.Add(httpApplicationGatewaySection);
            }

            if (security == null || security.WindowsIdentities == null || security.WindowsIdentities.ClustergMSAIdentity == null)
            {
                var fileStoreSection = this.GenerateFileStoreServiceSection(
                    thumbprintFileStoreCert,
                    commonNameFileStoreCert,
                    this.currentPrimaryAccountNtlmPassword,
                    this.currentSecondaryAccountNtlmPassword,
                    this.currentCommonNameNtlmPassword);

                if (fileStoreSection != null)
                {
                    result.Add(fileStoreSection);
                }
            }

            var failoverManagerSection = currentClusterSize == -1 ? this.GenerateFailoverManagerSection() : this.GenerateFailoverManagerSection(currentClusterSize);

            result.Add(failoverManagerSection);

            if (this.TargetCsmConfig.DiagnosticsStoreInformation != null)
            {
                var dcaSections = this.GenerateDcaSections();
                if (dcaSections != null)
                {
                    result.AddRange(dcaSections);
                }
            }

            result.AddRange(this.GenerateClusterManagerSection());

            var upgradeOrchestrationServiceSection = this.GenerateUpgradeOrchestrationServiceSection();

            result.Add(upgradeOrchestrationServiceSection);

            result.AddRange(this.GenerateCommonSection());

            result.AddRange(StandAloneFabricSettingsGenerator.GenerateSecretStoreSections(this.TargetCsmConfig));
            result.AddRange(StandAloneFabricSettingsGenerator.GenerateRepairManagerSection(this.TargetCsmConfig));
            result.AddRange(StandAloneFabricSettingsGenerator.GenerateDnsServiceSection(this.TargetCsmConfig));
            result.AddRange(StandAloneFabricSettingsGenerator.GenerateBackupRestoreServiceSection(this.TargetCsmConfig));
            result.AddRange(StandAloneFabricSettingsGenerator.GenerateResourceMonitorServiceSection(this.TargetCsmConfig));
            result.AddRange(StandAloneFabricSettingsGenerator.GenerateSFVolumeDiskServiceSection(this.TargetCsmConfig));
            result.AddRange(StandAloneFabricSettingsGenerator.GenerateEventStoreServiceSection(this.TargetCsmConfig));
            result.AddRange(StandAloneFabricSettingsGenerator.GenerateGatewayResourceManagerSection(this.TargetCsmConfig));

            return(result);
        }