protected override void Validate()
 {
     if (MaxRedirects < 0 || MaxRedirects > 10)
     {
         throw new BindingException("MaxRedirects must range from 0 to 10.");
     }
     if (ProxyPort < 0 || ProxyPort > 65535)
     {
         throw new BindingException("ProxyPort must range from 0 to 65535.");
     }
     if (AuthenticationScheme.IsOneOf(AuthenticationScheme.Basic, AuthenticationScheme.Digest))
     {
         if (UserName.IsNullOrEmpty() || Password.IsNullOrEmpty())
         {
             throw new BindingException(
                       string.Format(
                           "UserName and Password must neither be null nor empty when AuthenticationScheme is either {0} or {1}.",
                           AuthenticationScheme.Basic,
                           AuthenticationScheme.Digest));
         }
     }
     if (UseSSO && AffiliateApplicationName.IsNullOrEmpty())
     {
         throw new BindingException("AffiliateApplicationName must neither be null nor empty when SSO is used.");
     }
 }
        protected override void ProcessRecord()
        {
            WriteInformation($"SSO {nameof(AffiliateApplication)}s are being loaded...", null);
            var affiliateApplications = AffiliateApplicationName.IsNullOrEmpty()
                                ? AffiliateApplication.FindByContact()
                                : AffiliateApplicationName == AffiliateApplication.ANY_CONTACT_INFO
                                        ? AffiliateApplication.FindByContact(AffiliateApplication.ANY_CONTACT_INFO)
                                        : new[] { AffiliateApplication.FindByName(AffiliateApplicationName) };

            WriteObject(affiliateApplications, true);
            WriteInformation($"SSO {nameof(AffiliateApplication)}s have been loaded.", null);
        }
Exemple #3
0
        protected override void Prepare(IOutputAppender outputAppender)
        {
            if (AffiliateApplicationName.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(AffiliateApplicationName));
            }
            if (EnvironmentSettingsAssemblyFilePath.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(EnvironmentSettingsAssemblyFilePath));
            }
            if (TargetEnvironment.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(TargetEnvironment));
            }

            DeploymentContext.TargetEnvironment = TargetEnvironment;
            if (!EnvironmentSettingOverridesTypeName.IsNullOrEmpty())
            {
                DeploymentContext.EnvironmentSettingOverridesType = ResolveEnvironmentSettingOverridesType(outputAppender);
            }
        }
 protected override void Validate()
 {
     if (MaxRedirects is < 0 or > 10)
     {
         throw new BindingException("MaxRedirects must range from 0 to 10.");
     }
     if (ProxyPort is < 0 or > 65535)
     {
         throw new BindingException("ProxyPort must range from 0 to 65535.");
     }
     if (AuthenticationScheme is AuthenticationScheme.Basic or AuthenticationScheme.Digest)
     {
         if (UserName.IsNullOrEmpty() || Password.IsNullOrEmpty())
         {
             throw new BindingException(
                       $"UserName and Password must neither be null nor empty when AuthenticationScheme is either {AuthenticationScheme.Basic} or {AuthenticationScheme.Digest}.");
         }
     }
     if (UseSSO && AffiliateApplicationName.IsNullOrEmpty())
     {
         throw new BindingException("AffiliateApplicationName must neither be null nor empty when SSO is used.");
     }
 }