// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.gcp.networksecurity.outputs;

import com.pulumi.core.annotations.CustomType;
import com.pulumi.gcp.networksecurity.outputs.ServerTlsPolicyMtlsPolicyClientValidationCa;
import java.lang.String;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class ServerTlsPolicyMtlsPolicy {
    /**
     * @return Required if the policy is to be used with Traffic Director. For external HTTPS load balancers it must be empty.
     * Defines the mechanism to obtain the Certificate Authority certificate to validate the client certificate.
     * Structure is documented below.
     * 
     */
    private @Nullable List<ServerTlsPolicyMtlsPolicyClientValidationCa> clientValidationCas;
    /**
     * @return When the client presents an invalid certificate or no certificate to the load balancer, the clientValidationMode specifies how the client connection is handled.
     * Required if the policy is to be used with the external HTTPS load balancing. For Traffic Director it must be empty.
     * Possible values are: `CLIENT_VALIDATION_MODE_UNSPECIFIED`, `ALLOW_INVALID_OR_MISSING_CLIENT_CERT`, `REJECT_INVALID`.
     * 
     */
    private @Nullable String clientValidationMode;
    /**
     * @return Reference to the TrustConfig from certificatemanager.googleapis.com namespace.
     * If specified, the chain validation will be performed against certificates configured in the given TrustConfig.
     * Allowed only if the policy is to be used with external HTTPS load balancers.
     * 
     */
    private @Nullable String clientValidationTrustConfig;

    private ServerTlsPolicyMtlsPolicy() {}
    /**
     * @return Required if the policy is to be used with Traffic Director. For external HTTPS load balancers it must be empty.
     * Defines the mechanism to obtain the Certificate Authority certificate to validate the client certificate.
     * Structure is documented below.
     * 
     */
    public List<ServerTlsPolicyMtlsPolicyClientValidationCa> clientValidationCas() {
        return this.clientValidationCas == null ? List.of() : this.clientValidationCas;
    }
    /**
     * @return When the client presents an invalid certificate or no certificate to the load balancer, the clientValidationMode specifies how the client connection is handled.
     * Required if the policy is to be used with the external HTTPS load balancing. For Traffic Director it must be empty.
     * Possible values are: `CLIENT_VALIDATION_MODE_UNSPECIFIED`, `ALLOW_INVALID_OR_MISSING_CLIENT_CERT`, `REJECT_INVALID`.
     * 
     */
    public Optional<String> clientValidationMode() {
        return Optional.ofNullable(this.clientValidationMode);
    }
    /**
     * @return Reference to the TrustConfig from certificatemanager.googleapis.com namespace.
     * If specified, the chain validation will be performed against certificates configured in the given TrustConfig.
     * Allowed only if the policy is to be used with external HTTPS load balancers.
     * 
     */
    public Optional<String> clientValidationTrustConfig() {
        return Optional.ofNullable(this.clientValidationTrustConfig);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static Builder builder(ServerTlsPolicyMtlsPolicy defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable List<ServerTlsPolicyMtlsPolicyClientValidationCa> clientValidationCas;
        private @Nullable String clientValidationMode;
        private @Nullable String clientValidationTrustConfig;
        public Builder() {}
        public Builder(ServerTlsPolicyMtlsPolicy defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.clientValidationCas = defaults.clientValidationCas;
    	      this.clientValidationMode = defaults.clientValidationMode;
    	      this.clientValidationTrustConfig = defaults.clientValidationTrustConfig;
        }

        @CustomType.Setter
        public Builder clientValidationCas(@Nullable List<ServerTlsPolicyMtlsPolicyClientValidationCa> clientValidationCas) {
            this.clientValidationCas = clientValidationCas;
            return this;
        }
        public Builder clientValidationCas(ServerTlsPolicyMtlsPolicyClientValidationCa... clientValidationCas) {
            return clientValidationCas(List.of(clientValidationCas));
        }
        @CustomType.Setter
        public Builder clientValidationMode(@Nullable String clientValidationMode) {
            this.clientValidationMode = clientValidationMode;
            return this;
        }
        @CustomType.Setter
        public Builder clientValidationTrustConfig(@Nullable String clientValidationTrustConfig) {
            this.clientValidationTrustConfig = clientValidationTrustConfig;
            return this;
        }
        public ServerTlsPolicyMtlsPolicy build() {
            final var o = new ServerTlsPolicyMtlsPolicy();
            o.clientValidationCas = clientValidationCas;
            o.clientValidationMode = clientValidationMode;
            o.clientValidationTrustConfig = clientValidationTrustConfig;
            return o;
        }
    }
}
