コード例 #1
0
ファイル: Extensions.cs プロジェクト: zz562/azure-powershell
        public static HostnameConfiguration GetHostnameConfiguration(
            this PsApiManagementCustomHostNameConfiguration hostnameConfig)
        {
            if (hostnameConfig == null)
            {
                return(null);
            }

            var hostnameConfiguration = new HostnameConfiguration(
                Mappers.MapHostnameType(hostnameConfig.HostnameType),
                hostnameConfig.Hostname);

            if (!string.IsNullOrWhiteSpace(hostnameConfig.EncodedCertificate))
            {
                hostnameConfiguration.EncodedCertificate = hostnameConfig.EncodedCertificate;
            }

            if (hostnameConfig.CertificatePassword != null)
            {
                hostnameConfiguration.CertificatePassword = hostnameConfig.CertificatePassword;
            }

            if (!string.IsNullOrWhiteSpace(hostnameConfig.KeyVaultId))
            {
                hostnameConfiguration.KeyVaultId = hostnameConfig.KeyVaultId;
            }

            if (hostnameConfig.DefaultSslBinding.HasValue)
            {
                hostnameConfiguration.DefaultSslBinding = hostnameConfig.DefaultSslBinding.Value;
            }

            if (hostnameConfig.NegotiateClientCertificate.HasValue)
            {
                hostnameConfiguration.NegotiateClientCertificate = hostnameConfig.NegotiateClientCertificate.Value;
            }

            // if no new certificate is provided, then copy over details of existing certificate
            if (hostnameConfig.CertificateInformation != null &&
                string.IsNullOrEmpty(hostnameConfig.EncodedCertificate))
            {
                hostnameConfiguration.Certificate = hostnameConfig.CertificateInformation.GetCertificateInformation();
            }

            return(hostnameConfiguration);
        }
コード例 #2
0
        public static HostnameConfiguration GetHostnameConfiguration(
            this PsApiManagementCustomHostNameConfiguration hostnameConfig)
        {
            if (hostnameConfig == null)
            {
                return(null);
            }

            var hostnameConfiguration = new HostnameConfiguration(
                Mappers.MapHostnameType(hostnameConfig.HostnameType),
                hostnameConfig.Hostname);

            if (!string.IsNullOrWhiteSpace(hostnameConfig.EncodedCertificate))
            {
                hostnameConfiguration.EncodedCertificate = hostnameConfig.EncodedCertificate;
            }

            if (hostnameConfig.CertificatePassword != null)
            {
                hostnameConfiguration.CertificatePassword = hostnameConfig.CertificatePassword;
            }

            if (!string.IsNullOrWhiteSpace(hostnameConfig.KeyVaultId))
            {
                hostnameConfiguration.KeyVaultId = hostnameConfig.KeyVaultId;
            }

            if (hostnameConfig.DefaultSslBinding.HasValue)
            {
                hostnameConfiguration.DefaultSslBinding = hostnameConfig.DefaultSslBinding.Value;
            }

            if (hostnameConfig.NegotiateClientCertificate.HasValue)
            {
                hostnameConfiguration.NegotiateClientCertificate = hostnameConfig.NegotiateClientCertificate.Value;
            }

            return(hostnameConfiguration);
        }