// *** 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.sql.outputs;

import com.pulumi.core.annotations.CustomType;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class DatabaseInstanceReplicaConfiguration {
    /**
     * @return PEM representation of the trusted CA&#39;s x509
     * certificate.
     * 
     */
    private @Nullable String caCertificate;
    /**
     * @return PEM representation of the replica&#39;s x509
     * certificate.
     * 
     */
    private @Nullable String clientCertificate;
    /**
     * @return PEM representation of the replica&#39;s private key. The
     * corresponding public key in encoded in the `client_certificate`.
     * 
     */
    private @Nullable String clientKey;
    /**
     * @return The number of seconds
     * between connect retries. MySQL&#39;s default is 60 seconds.
     * 
     */
    private @Nullable Integer connectRetryInterval;
    /**
     * @return Path to a SQL file in GCS from which replica
     * instances are created. Format is `gs://bucket/filename`.
     * 
     */
    private @Nullable String dumpFilePath;
    /**
     * @return Specifies if the replica is the failover target.
     * If the field is set to true the replica will be designated as a failover replica.
     * If the master instance fails, the replica instance will be promoted as
     * the new master instance.
     * &gt; **NOTE:** Not supported for Postgres database.
     * 
     */
    private @Nullable Boolean failoverTarget;
    /**
     * @return Time in ms between replication
     * heartbeats.
     * 
     */
    private @Nullable Integer masterHeartbeatPeriod;
    /**
     * @return Password for the replication connection.
     * 
     */
    private @Nullable String password;
    private @Nullable String sslCipher;
    /**
     * @return Username for replication connection.
     * 
     */
    private @Nullable String username;
    /**
     * @return True if the master&#39;s common name
     * value is checked during the SSL handshake.
     * 
     */
    private @Nullable Boolean verifyServerCertificate;

    private DatabaseInstanceReplicaConfiguration() {}
    /**
     * @return PEM representation of the trusted CA&#39;s x509
     * certificate.
     * 
     */
    public Optional<String> caCertificate() {
        return Optional.ofNullable(this.caCertificate);
    }
    /**
     * @return PEM representation of the replica&#39;s x509
     * certificate.
     * 
     */
    public Optional<String> clientCertificate() {
        return Optional.ofNullable(this.clientCertificate);
    }
    /**
     * @return PEM representation of the replica&#39;s private key. The
     * corresponding public key in encoded in the `client_certificate`.
     * 
     */
    public Optional<String> clientKey() {
        return Optional.ofNullable(this.clientKey);
    }
    /**
     * @return The number of seconds
     * between connect retries. MySQL&#39;s default is 60 seconds.
     * 
     */
    public Optional<Integer> connectRetryInterval() {
        return Optional.ofNullable(this.connectRetryInterval);
    }
    /**
     * @return Path to a SQL file in GCS from which replica
     * instances are created. Format is `gs://bucket/filename`.
     * 
     */
    public Optional<String> dumpFilePath() {
        return Optional.ofNullable(this.dumpFilePath);
    }
    /**
     * @return Specifies if the replica is the failover target.
     * If the field is set to true the replica will be designated as a failover replica.
     * If the master instance fails, the replica instance will be promoted as
     * the new master instance.
     * &gt; **NOTE:** Not supported for Postgres database.
     * 
     */
    public Optional<Boolean> failoverTarget() {
        return Optional.ofNullable(this.failoverTarget);
    }
    /**
     * @return Time in ms between replication
     * heartbeats.
     * 
     */
    public Optional<Integer> masterHeartbeatPeriod() {
        return Optional.ofNullable(this.masterHeartbeatPeriod);
    }
    /**
     * @return Password for the replication connection.
     * 
     */
    public Optional<String> password() {
        return Optional.ofNullable(this.password);
    }
    public Optional<String> sslCipher() {
        return Optional.ofNullable(this.sslCipher);
    }
    /**
     * @return Username for replication connection.
     * 
     */
    public Optional<String> username() {
        return Optional.ofNullable(this.username);
    }
    /**
     * @return True if the master&#39;s common name
     * value is checked during the SSL handshake.
     * 
     */
    public Optional<Boolean> verifyServerCertificate() {
        return Optional.ofNullable(this.verifyServerCertificate);
    }

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

    public static Builder builder(DatabaseInstanceReplicaConfiguration defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable String caCertificate;
        private @Nullable String clientCertificate;
        private @Nullable String clientKey;
        private @Nullable Integer connectRetryInterval;
        private @Nullable String dumpFilePath;
        private @Nullable Boolean failoverTarget;
        private @Nullable Integer masterHeartbeatPeriod;
        private @Nullable String password;
        private @Nullable String sslCipher;
        private @Nullable String username;
        private @Nullable Boolean verifyServerCertificate;
        public Builder() {}
        public Builder(DatabaseInstanceReplicaConfiguration defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.caCertificate = defaults.caCertificate;
    	      this.clientCertificate = defaults.clientCertificate;
    	      this.clientKey = defaults.clientKey;
    	      this.connectRetryInterval = defaults.connectRetryInterval;
    	      this.dumpFilePath = defaults.dumpFilePath;
    	      this.failoverTarget = defaults.failoverTarget;
    	      this.masterHeartbeatPeriod = defaults.masterHeartbeatPeriod;
    	      this.password = defaults.password;
    	      this.sslCipher = defaults.sslCipher;
    	      this.username = defaults.username;
    	      this.verifyServerCertificate = defaults.verifyServerCertificate;
        }

        @CustomType.Setter
        public Builder caCertificate(@Nullable String caCertificate) {
            this.caCertificate = caCertificate;
            return this;
        }
        @CustomType.Setter
        public Builder clientCertificate(@Nullable String clientCertificate) {
            this.clientCertificate = clientCertificate;
            return this;
        }
        @CustomType.Setter
        public Builder clientKey(@Nullable String clientKey) {
            this.clientKey = clientKey;
            return this;
        }
        @CustomType.Setter
        public Builder connectRetryInterval(@Nullable Integer connectRetryInterval) {
            this.connectRetryInterval = connectRetryInterval;
            return this;
        }
        @CustomType.Setter
        public Builder dumpFilePath(@Nullable String dumpFilePath) {
            this.dumpFilePath = dumpFilePath;
            return this;
        }
        @CustomType.Setter
        public Builder failoverTarget(@Nullable Boolean failoverTarget) {
            this.failoverTarget = failoverTarget;
            return this;
        }
        @CustomType.Setter
        public Builder masterHeartbeatPeriod(@Nullable Integer masterHeartbeatPeriod) {
            this.masterHeartbeatPeriod = masterHeartbeatPeriod;
            return this;
        }
        @CustomType.Setter
        public Builder password(@Nullable String password) {
            this.password = password;
            return this;
        }
        @CustomType.Setter
        public Builder sslCipher(@Nullable String sslCipher) {
            this.sslCipher = sslCipher;
            return this;
        }
        @CustomType.Setter
        public Builder username(@Nullable String username) {
            this.username = username;
            return this;
        }
        @CustomType.Setter
        public Builder verifyServerCertificate(@Nullable Boolean verifyServerCertificate) {
            this.verifyServerCertificate = verifyServerCertificate;
            return this;
        }
        public DatabaseInstanceReplicaConfiguration build() {
            final var o = new DatabaseInstanceReplicaConfiguration();
            o.caCertificate = caCertificate;
            o.clientCertificate = clientCertificate;
            o.clientKey = clientKey;
            o.connectRetryInterval = connectRetryInterval;
            o.dumpFilePath = dumpFilePath;
            o.failoverTarget = failoverTarget;
            o.masterHeartbeatPeriod = masterHeartbeatPeriod;
            o.password = password;
            o.sslCipher = sslCipher;
            o.username = username;
            o.verifyServerCertificate = verifyServerCertificate;
            return o;
        }
    }
}
