コード例 #1
0
        /// <summary>
        /// Validates the options and also ensures that all <c>null</c> properties are
        /// initialized to their default values.
        /// </summary>
        /// <param name="clusterDefinition">The cluster definition.</param>
        /// <exception cref="ClusterDefinitionException">Thrown if the definition is not valid.</exception>
        public void Validate(ClusterDefinition clusterDefinition)
        {
            Covenant.Requires <ArgumentNullException>(clusterDefinition != null, nameof(clusterDefinition));

            var acmeIssuerPrefix = $"{nameof(AcmeIssuer)}";

            if (string.IsNullOrEmpty(Server))
            {
                Server = "https://acme-v02.api.letsencrypt.org/directory";
            }

            Solvers = Solvers ?? new List <AcmeChallengeSolver>();

            if (!Solvers.Any(solver => solver.Dns01?.Webhook?.SolverName == "neoncluster_io"))
            {
                var neonWebhookSolver = new AcmeIssuerDns01ProviderWebhook()
                {
                    Config = new Dictionary <string, object>()
                    {
                        { "Registrar", "route53" }
                    },
                    GroupName  = "acme.neoncloud.io",
                    SolverName = "neoncluster_io"
                };

                Solvers.Add(new AcmeChallengeSolver()
                {
                    Dns01 = new AcmeChallengeSolverDns01()
                    {
                        Webhook = neonWebhookSolver
                    },
                    Selector = new CertificateDnsNameSelector()
                    {
                        DnsZones = new List <string>()
                        {
                            "neoncluster.io"
                        }
                    }
                });
            }

            foreach (var solver in Solvers)
            {
                solver.Validate(clusterDefinition);
            }

            PrivateKeySecretRef = PrivateKeySecretRef ?? new AcmeSecretKeySelector()
            {
                Name = "neon-acme-issuer-account-key",
                Key  = "tls.key"
            };

            if (ExternalAccountBinding != null)
            {
                ExternalAccountBinding.Validate(clusterDefinition);
            }
        }
コード例 #2
0
        public CurlingSimViewModel()
        {
            GenerateRandomCommand = new SimpleDelegateCommand(() => GenerateRandom());
            SolveCommand          = new SimpleDelegateCommand(() => Solve());
            CloseCommand          = new SimpleDelegateCommand(() => Close());

            Solvers.Add(new CurlingSimSolverRunner("Discrete Solver", (r, x) => new DiscreteSolver(r, x)));
            Solvers.Add(new CurlingSimSolverRunner("Proximity Solver", (r, x) => new ProximitySolver(r, x)));
            Solvers.Add(new CurlingSimSolverRunner("Brute Solver", (r, x) => new BruteSolver(r, x)));
        }
コード例 #3
0
ファイル: Solver.cs プロジェクト: Levvy055/AiRTech
 protected Solver(SubjectType subjectType)
 {
     SubjectType = subjectType;
     Solvers.Add(subjectType, this);
 }