// *** 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.azure.mssql;

import com.pulumi.azure.mssql.inputs.FailoverGroupPartnerServerArgs;
import com.pulumi.azure.mssql.inputs.FailoverGroupReadWriteEndpointFailoverPolicyArgs;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Import;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;


public final class FailoverGroupArgs extends com.pulumi.resources.ResourceArgs {

    public static final FailoverGroupArgs Empty = new FailoverGroupArgs();

    /**
     * A set of database names to include in the failover group.
     * 
     */
    @Import(name="databases")
    private @Nullable Output<List<String>> databases;

    /**
     * @return A set of database names to include in the failover group.
     * 
     */
    public Optional<Output<List<String>>> databases() {
        return Optional.ofNullable(this.databases);
    }

    /**
     * The name of the Failover Group. Changing this forces a new resource to be created.
     * 
     */
    @Import(name="name")
    private @Nullable Output<String> name;

    /**
     * @return The name of the Failover Group. Changing this forces a new resource to be created.
     * 
     */
    public Optional<Output<String>> name() {
        return Optional.ofNullable(this.name);
    }

    /**
     * A `partner_server` block as defined below.
     * 
     */
    @Import(name="partnerServers", required=true)
    private Output<List<FailoverGroupPartnerServerArgs>> partnerServers;

    /**
     * @return A `partner_server` block as defined below.
     * 
     */
    public Output<List<FailoverGroupPartnerServerArgs>> partnerServers() {
        return this.partnerServers;
    }

    /**
     * A `read_write_endpoint_failover_policy` block as defined below.
     * 
     */
    @Import(name="readWriteEndpointFailoverPolicy", required=true)
    private Output<FailoverGroupReadWriteEndpointFailoverPolicyArgs> readWriteEndpointFailoverPolicy;

    /**
     * @return A `read_write_endpoint_failover_policy` block as defined below.
     * 
     */
    public Output<FailoverGroupReadWriteEndpointFailoverPolicyArgs> readWriteEndpointFailoverPolicy() {
        return this.readWriteEndpointFailoverPolicy;
    }

    /**
     * Whether failover is enabled for the readonly endpoint. Defaults to `false`.
     * 
     */
    @Import(name="readonlyEndpointFailoverPolicyEnabled")
    private @Nullable Output<Boolean> readonlyEndpointFailoverPolicyEnabled;

    /**
     * @return Whether failover is enabled for the readonly endpoint. Defaults to `false`.
     * 
     */
    public Optional<Output<Boolean>> readonlyEndpointFailoverPolicyEnabled() {
        return Optional.ofNullable(this.readonlyEndpointFailoverPolicyEnabled);
    }

    /**
     * The ID of the primary SQL Server on which to create the failover group. Changing this forces a new resource to be created.
     * 
     */
    @Import(name="serverId", required=true)
    private Output<String> serverId;

    /**
     * @return The ID of the primary SQL Server on which to create the failover group. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> serverId() {
        return this.serverId;
    }

    /**
     * A mapping of tags to assign to the resource.
     * 
     */
    @Import(name="tags")
    private @Nullable Output<Map<String,String>> tags;

    /**
     * @return A mapping of tags to assign to the resource.
     * 
     */
    public Optional<Output<Map<String,String>>> tags() {
        return Optional.ofNullable(this.tags);
    }

    private FailoverGroupArgs() {}

    private FailoverGroupArgs(FailoverGroupArgs $) {
        this.databases = $.databases;
        this.name = $.name;
        this.partnerServers = $.partnerServers;
        this.readWriteEndpointFailoverPolicy = $.readWriteEndpointFailoverPolicy;
        this.readonlyEndpointFailoverPolicyEnabled = $.readonlyEndpointFailoverPolicyEnabled;
        this.serverId = $.serverId;
        this.tags = $.tags;
    }

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

    public static final class Builder {
        private FailoverGroupArgs $;

        public Builder() {
            $ = new FailoverGroupArgs();
        }

        public Builder(FailoverGroupArgs defaults) {
            $ = new FailoverGroupArgs(Objects.requireNonNull(defaults));
        }

        /**
         * @param databases A set of database names to include in the failover group.
         * 
         * @return builder
         * 
         */
        public Builder databases(@Nullable Output<List<String>> databases) {
            $.databases = databases;
            return this;
        }

        /**
         * @param databases A set of database names to include in the failover group.
         * 
         * @return builder
         * 
         */
        public Builder databases(List<String> databases) {
            return databases(Output.of(databases));
        }

        /**
         * @param databases A set of database names to include in the failover group.
         * 
         * @return builder
         * 
         */
        public Builder databases(String... databases) {
            return databases(List.of(databases));
        }

        /**
         * @param name The name of the Failover Group. Changing this forces a new resource to be created.
         * 
         * @return builder
         * 
         */
        public Builder name(@Nullable Output<String> name) {
            $.name = name;
            return this;
        }

        /**
         * @param name The name of the Failover Group. Changing this forces a new resource to be created.
         * 
         * @return builder
         * 
         */
        public Builder name(String name) {
            return name(Output.of(name));
        }

        /**
         * @param partnerServers A `partner_server` block as defined below.
         * 
         * @return builder
         * 
         */
        public Builder partnerServers(Output<List<FailoverGroupPartnerServerArgs>> partnerServers) {
            $.partnerServers = partnerServers;
            return this;
        }

        /**
         * @param partnerServers A `partner_server` block as defined below.
         * 
         * @return builder
         * 
         */
        public Builder partnerServers(List<FailoverGroupPartnerServerArgs> partnerServers) {
            return partnerServers(Output.of(partnerServers));
        }

        /**
         * @param partnerServers A `partner_server` block as defined below.
         * 
         * @return builder
         * 
         */
        public Builder partnerServers(FailoverGroupPartnerServerArgs... partnerServers) {
            return partnerServers(List.of(partnerServers));
        }

        /**
         * @param readWriteEndpointFailoverPolicy A `read_write_endpoint_failover_policy` block as defined below.
         * 
         * @return builder
         * 
         */
        public Builder readWriteEndpointFailoverPolicy(Output<FailoverGroupReadWriteEndpointFailoverPolicyArgs> readWriteEndpointFailoverPolicy) {
            $.readWriteEndpointFailoverPolicy = readWriteEndpointFailoverPolicy;
            return this;
        }

        /**
         * @param readWriteEndpointFailoverPolicy A `read_write_endpoint_failover_policy` block as defined below.
         * 
         * @return builder
         * 
         */
        public Builder readWriteEndpointFailoverPolicy(FailoverGroupReadWriteEndpointFailoverPolicyArgs readWriteEndpointFailoverPolicy) {
            return readWriteEndpointFailoverPolicy(Output.of(readWriteEndpointFailoverPolicy));
        }

        /**
         * @param readonlyEndpointFailoverPolicyEnabled Whether failover is enabled for the readonly endpoint. Defaults to `false`.
         * 
         * @return builder
         * 
         */
        public Builder readonlyEndpointFailoverPolicyEnabled(@Nullable Output<Boolean> readonlyEndpointFailoverPolicyEnabled) {
            $.readonlyEndpointFailoverPolicyEnabled = readonlyEndpointFailoverPolicyEnabled;
            return this;
        }

        /**
         * @param readonlyEndpointFailoverPolicyEnabled Whether failover is enabled for the readonly endpoint. Defaults to `false`.
         * 
         * @return builder
         * 
         */
        public Builder readonlyEndpointFailoverPolicyEnabled(Boolean readonlyEndpointFailoverPolicyEnabled) {
            return readonlyEndpointFailoverPolicyEnabled(Output.of(readonlyEndpointFailoverPolicyEnabled));
        }

        /**
         * @param serverId The ID of the primary SQL Server on which to create the failover group. Changing this forces a new resource to be created.
         * 
         * @return builder
         * 
         */
        public Builder serverId(Output<String> serverId) {
            $.serverId = serverId;
            return this;
        }

        /**
         * @param serverId The ID of the primary SQL Server on which to create the failover group. Changing this forces a new resource to be created.
         * 
         * @return builder
         * 
         */
        public Builder serverId(String serverId) {
            return serverId(Output.of(serverId));
        }

        /**
         * @param tags A mapping of tags to assign to the resource.
         * 
         * @return builder
         * 
         */
        public Builder tags(@Nullable Output<Map<String,String>> tags) {
            $.tags = tags;
            return this;
        }

        /**
         * @param tags A mapping of tags to assign to the resource.
         * 
         * @return builder
         * 
         */
        public Builder tags(Map<String,String> tags) {
            return tags(Output.of(tags));
        }

        public FailoverGroupArgs build() {
            $.partnerServers = Objects.requireNonNull($.partnerServers, "expected parameter 'partnerServers' to be non-null");
            $.readWriteEndpointFailoverPolicy = Objects.requireNonNull($.readWriteEndpointFailoverPolicy, "expected parameter 'readWriteEndpointFailoverPolicy' to be non-null");
            $.serverId = Objects.requireNonNull($.serverId, "expected parameter 'serverId' to be non-null");
            return $;
        }
    }

}
