// *** 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.Utilities;
import com.pulumi.azure.mssql.ManagedInstanceFailoverGroupArgs;
import com.pulumi.azure.mssql.inputs.ManagedInstanceFailoverGroupState;
import com.pulumi.azure.mssql.outputs.ManagedInstanceFailoverGroupPartnerRegion;
import com.pulumi.azure.mssql.outputs.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * ## Import
 * 
 * SQL Instance Failover Groups can be imported using the `resource id`, e.g.
 * 
 * ```sh
 *  $ pulumi import azure:mssql/managedInstanceFailoverGroup:ManagedInstanceFailoverGroup example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Sql/locations/Location/instanceFailoverGroups/failoverGroup1
 * ```
 * 
 */
@ResourceType(type="azure:mssql/managedInstanceFailoverGroup:ManagedInstanceFailoverGroup")
public class ManagedInstanceFailoverGroup extends com.pulumi.resources.CustomResource {
    /**
     * The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="location", refs={String.class}, tree="[0]")
    private Output<String> location;

    /**
     * @return The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> location() {
        return this.location;
    }
    /**
     * The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="managedInstanceId", refs={String.class}, tree="[0]")
    private Output<String> managedInstanceId;

    /**
     * @return The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> managedInstanceId() {
        return this.managedInstanceId;
    }
    /**
     * The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="name", refs={String.class}, tree="[0]")
    private Output<String> name;

    /**
     * @return The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> name() {
        return this.name;
    }
    /**
     * The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="partnerManagedInstanceId", refs={String.class}, tree="[0]")
    private Output<String> partnerManagedInstanceId;

    /**
     * @return The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> partnerManagedInstanceId() {
        return this.partnerManagedInstanceId;
    }
    /**
     * A `partner_region` block as defined below.
     * 
     */
    @Export(name="partnerRegions", refs={List.class,ManagedInstanceFailoverGroupPartnerRegion.class}, tree="[0,1]")
    private Output<List<ManagedInstanceFailoverGroupPartnerRegion>> partnerRegions;

    /**
     * @return A `partner_region` block as defined below.
     * 
     */
    public Output<List<ManagedInstanceFailoverGroupPartnerRegion>> partnerRegions() {
        return this.partnerRegions;
    }
    /**
     * A `read_write_endpoint_failover_policy` block as defined below.
     * 
     */
    @Export(name="readWriteEndpointFailoverPolicy", refs={ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy.class}, tree="[0]")
    private Output<ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy> readWriteEndpointFailoverPolicy;

    /**
     * @return A `read_write_endpoint_failover_policy` block as defined below.
     * 
     */
    public Output<ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy> readWriteEndpointFailoverPolicy() {
        return this.readWriteEndpointFailoverPolicy;
    }
    /**
     * Failover policy for the read-only endpoint. Defaults to `true`.
     * 
     */
    @Export(name="readonlyEndpointFailoverPolicyEnabled", refs={Boolean.class}, tree="[0]")
    private Output</* @Nullable */ Boolean> readonlyEndpointFailoverPolicyEnabled;

    /**
     * @return Failover policy for the read-only endpoint. Defaults to `true`.
     * 
     */
    public Output<Optional<Boolean>> readonlyEndpointFailoverPolicyEnabled() {
        return Codegen.optional(this.readonlyEndpointFailoverPolicyEnabled);
    }
    /**
     * The partner replication role of the Managed Instance Failover Group.
     * 
     */
    @Export(name="role", refs={String.class}, tree="[0]")
    private Output<String> role;

    /**
     * @return The partner replication role of the Managed Instance Failover Group.
     * 
     */
    public Output<String> role() {
        return this.role;
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public ManagedInstanceFailoverGroup(String name) {
        this(name, ManagedInstanceFailoverGroupArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public ManagedInstanceFailoverGroup(String name, ManagedInstanceFailoverGroupArgs args) {
        this(name, args, null);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     * @param options A bag of options that control this resource's behavior.
     */
    public ManagedInstanceFailoverGroup(String name, ManagedInstanceFailoverGroupArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:mssql/managedInstanceFailoverGroup:ManagedInstanceFailoverGroup", name, args == null ? ManagedInstanceFailoverGroupArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private ManagedInstanceFailoverGroup(String name, Output<String> id, @Nullable ManagedInstanceFailoverGroupState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:mssql/managedInstanceFailoverGroup:ManagedInstanceFailoverGroup", name, state, makeResourceOptions(options, id));
    }

    private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output<String> id) {
        var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
            .version(Utilities.getVersion())
            .build();
        return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
    }

    /**
     * Get an existing Host resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state
     * @param options Optional settings to control the behavior of the CustomResource.
     */
    public static ManagedInstanceFailoverGroup get(String name, Output<String> id, @Nullable ManagedInstanceFailoverGroupState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new ManagedInstanceFailoverGroup(name, id, state, options);
    }
}
