コード例 #1
0
        public async void RenewAll(bool autoRenewalsOnly)
        {
            //FIXME: currently user can run renew all again while renewals are still in progress

            Dictionary <string, Progress <RequestProgressState> > itemTrackers = new Dictionary <string, Progress <RequestProgressState> >();

            foreach (var s in ManagedSites)
            {
                if ((autoRenewalsOnly && s.IncludeInAutoRenew) || !autoRenewalsOnly)
                {
                    var progressState = new RequestProgressState {
                        ManagedItem = s
                    };
                    if (!itemTrackers.ContainsKey(s.Id))
                    {
                        itemTrackers.Add(s.Id, new Progress <RequestProgressState>(progressState.ProgressReport));

                        //begin monitoring progress
                        BeginTrackingProgress(progressState);
                    }
                }
            }

            var results = await certifyManager.PerformRenewalAllManagedSites(autoRenewalsOnly, itemTrackers);

            //TODO: store results in log
            //return results;
        }
コード例 #2
0
        private async Task <System.Collections.Generic.List <CertificateRequestResult> > PerformAutoRenew()
        {
            //go through list of items configured for auto renew, perform renewal and report the result
            var certifyManager = new CertifyManager();
            var results        = await certifyManager.PerformRenewalAllManagedSites();

            return(results);
        }
コード例 #3
0
        internal async Task <System.Collections.Generic.List <CertificateRequestResult> > PerformAutoRenew()
        {
            if (tc == null)
            {
                InitTelematics();
            }
            if (tc != null)
            {
                tc.TrackEvent("CLI_BeginAutoRenew");
            }

            Console.ForegroundColor = ConsoleColor.White;
            System.Console.WriteLine("\nPerforming Auto Renewals..\n");

            //go through list of items configured for auto renew, perform renewal and report the result
            var certifyManager = new CertifyManager();
            var results        = await certifyManager.PerformRenewalAllManagedSites(autoRenewalOnly : true);

            foreach (var r in results)
            {
                if (r.ManagedItem != null)
                {
                    System.Console.WriteLine("--------------------------------------");
                    if (r.IsSuccess)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        System.Console.WriteLine(r.ManagedItem.Name);
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.DarkYellow;
                        System.Console.WriteLine(r.ManagedItem.Name);

                        if (r.Message != null)
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            System.Console.WriteLine(r.Message);
                        }
                    }
                }
            }
            Console.ForegroundColor = ConsoleColor.White;

            System.Console.WriteLine("Completed:" + results.Where(r => r.IsSuccess == true).Count());
            if (results.Any(r => r.IsSuccess == false))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                System.Console.WriteLine("Failed:" + results.Where(r => r.IsSuccess == false).Count());
                Console.ForegroundColor = ConsoleColor.White;
            }
            return(results);
        }
コード例 #4
0
        private async void toolStripButtonRenewAll_Click(object sender, EventArgs e)
        {
            //check if there are any managed sites to renewal, if so offer to renew them

            var certifyManager = new CertifyManager();

            if (certifyManager.HasManagedSites)
            {
                if (MessageBox.Show("Perform renewal requests for all managed sites now?", "Renew All Certificates", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    //TODO: background worker
                    var results = await certifyManager.PerformRenewalAllManagedSites(false);
                }
            }
            else
            {
                MessageBox.Show("You have no managed sites saved. These are created when you complete a New Certificate request.");
            }
        }
コード例 #5
0
ファイル: AppModel.cs プロジェクト: mangonugen/certify
        public async Task <List <Certify.Models.CertificateRequestResult> > RenewAll()
        {
            var results = await certifyManager.PerformRenewalAllManagedSites(false);

            return(results);
        }