public static void Validate(this RemoveClientCertArgs args)
 {
     if (!args.IsPackageSourceSettingProvided())
     {
         throw new CommandLineArgumentCombinationException(string.Format(CultureInfo.CurrentCulture,
                                                                         Strings.Error_PropertyCannotBeNullOrEmpty,
                                                                         nameof(PackageSource)));
     }
 }
Exemple #2
0
        public static void Run(RemoveClientCertArgs args, Func <ILogger> getLogger)
        {
            args.Validate();

            var settings = RunnerHelper.GetSettings(args.Configfile);
            var clientCertificateProvider = new ClientCertificateProvider(settings);

            var item = clientCertificateProvider.GetClientCertificate(args.PackageSource);

            if (item == null)
            {
                getLogger().LogInformation(string.Format(CultureInfo.CurrentCulture,
                                                         Strings.NoClientCertificatesMatching,
                                                         args.PackageSource));
                return;
            }

            clientCertificateProvider.Remove(new[] { item });

            getLogger().LogInformation(string.Format(CultureInfo.CurrentCulture, Strings.ClientCertificateSuccessfullyRemoved, args.PackageSource));
        }