public virtual async Task <Status> BootHostSSL(EnterpriseArchitectClient entArch, string parentEntApiKey)
        {
            if (!State.NewEnterpriseAPIKey.IsNullOrEmpty() && !State.EnvironmentLookup.IsNullOrEmpty())
            {
                var resp = await entArch.EnsureHostsSSL(new EnsureHostsSSLRequest()
                {
                    Hosts = new List <string>()
                    {
                        State.Host
                    }
                }, State.NewEnterpriseAPIKey, State.EnvironmentLookup, parentEntApiKey);

                return(resp.Status);
            }
            else
            {
                return(Status.GeneralError.Clone("Boot not properly configured."));
            }
        }
        public virtual async Task <NapkinIDESetupState> Finalize()
        {
            logger.LogInformation("Finalizing Napkin IDE Setup");

            await HasDevOpsOAuth();

            if (state.HasDevOpsOAuth)
            {
                var authAppEnsured = await entArch.EnsureHostAuthApp(state.NewEnterpriseAPIKey, state.Host, state.EnvironmentLookup);

                if (authAppEnsured.Status)
                {
                    var hostEnsured = await entArch.EnsureHost(new EnsureHostRequest()
                    {
                        EnviromentLookup = state.EnvironmentLookup
                    }, state.NewEnterpriseAPIKey, state.Host, state.EnvironmentLookup, details.EnterpriseAPIKey);

                    if (hostEnsured.Status)
                    {
                        var sslEnsured = await entArch.EnsureHostsSSL(new EnsureHostsSSLRequest()
                        {
                            Hosts = new List <string>()
                            {
                                state.Host
                            }
                        }, state.NewEnterpriseAPIKey, state.EnvironmentLookup, details.EnterpriseAPIKey);

                        if (sslEnsured.Status)
                        {
                            var runtimeEnsured = await entArch.EnsureLCURuntime(state.NewEnterpriseAPIKey, state.EnvironmentLookup);

                            if (runtimeEnsured.Status)
                            {
                                state.Step = NapkinIDESetupStepTypes.Complete;
                            }
                        }
                    }
                }
            }

            return(state);
        }
示例#3
0
        public virtual async Task <Status> RenewCertificatesForHostEnvironment([ActivityTrigger] Dictionary <string, RenewalEnvironment> renewalEnvs, ILogger log)
        {
            log.LogInformation($"RenewCertificatesForHostEnvironment executing for: {renewalEnvs.ToJSON()}");

            var status = Status.Initialized;

            await renewalEnvs.Each(async renewalEnv =>
            {
                var ensureCerts = await entArch.EnsureHostsSSL(new EnsureHostsSSLRequest()
                {
                    Hosts = new List <string>()
                    {
                        renewalEnv.Value.Host
                    }
                }, renewalEnv.Value.EnterpriseAPIKey, renewalEnv.Value.EnvironmentLookup, parentEntApiKey: renewalEnv.Key);

                status = ensureCerts.Status;

                return(!status);
            });


            return(status);
        }