All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.mssql.FailoverGroup Maven / Gradle / Ivy

Go to download

A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.

There is a newer version: 6.15.0
Show newest version
// *** 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.FailoverGroupArgs;
import com.pulumi.azure.mssql.inputs.FailoverGroupState;
import com.pulumi.azure.mssql.outputs.FailoverGroupPartnerServer;
import com.pulumi.azure.mssql.outputs.FailoverGroupReadWriteEndpointFailoverPolicy;
import com.pulumi.core.Alias;
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.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages a Microsoft Azure SQL Failover Group.
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.mssql.Server;
 * import com.pulumi.azure.mssql.ServerArgs;
 * import com.pulumi.azure.mssql.Database;
 * import com.pulumi.azure.mssql.DatabaseArgs;
 * import com.pulumi.azure.mssql.FailoverGroup;
 * import com.pulumi.azure.mssql.FailoverGroupArgs;
 * import com.pulumi.azure.mssql.inputs.FailoverGroupPartnerServerArgs;
 * import com.pulumi.azure.mssql.inputs.FailoverGroupReadWriteEndpointFailoverPolicyArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("database-rg")
 *             .location("West Europe")
 *             .build());
 * 
 *         var primary = new Server("primary", ServerArgs.builder()
 *             .name("mssqlserver-primary")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .version("12.0")
 *             .administratorLogin("missadministrator")
 *             .administratorLoginPassword("thisIsKat11")
 *             .build());
 * 
 *         var secondary = new Server("secondary", ServerArgs.builder()
 *             .name("mssqlserver-secondary")
 *             .resourceGroupName(example.name())
 *             .location("North Europe")
 *             .version("12.0")
 *             .administratorLogin("missadministrator")
 *             .administratorLoginPassword("thisIsKat12")
 *             .build());
 * 
 *         var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
 *             .name("exampledb")
 *             .serverId(primary.id())
 *             .skuName("S1")
 *             .collation("SQL_Latin1_General_CP1_CI_AS")
 *             .maxSizeGb("200")
 *             .build());
 * 
 *         var exampleFailoverGroup = new FailoverGroup("exampleFailoverGroup", FailoverGroupArgs.builder()
 *             .name("example")
 *             .serverId(primary.id())
 *             .databases(exampleDatabase.id())
 *             .partnerServers(FailoverGroupPartnerServerArgs.builder()
 *                 .id(secondary.id())
 *                 .build())
 *             .readWriteEndpointFailoverPolicy(FailoverGroupReadWriteEndpointFailoverPolicyArgs.builder()
 *                 .mode("Automatic")
 *                 .graceMinutes(80)
 *                 .build())
 *             .tags(Map.ofEntries(
 *                 Map.entry("environment", "prod"),
 *                 Map.entry("database", "example")
 *             ))
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Failover Groups can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:mssql/failoverGroup:FailoverGroup example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Sql/servers/server1/failoverGroups/failoverGroup1 * ``` * */ @ResourceType(type="azure:mssql/failoverGroup:FailoverGroup") public class FailoverGroup extends com.pulumi.resources.CustomResource { /** * A set of database names to include in the failover group. * */ @Export(name="databases", refs={List.class,String.class}, tree="[0,1]") private Output> databases; /** * @return A set of database names to include in the failover group. * */ public Output>> databases() { return Codegen.optional(this.databases); } /** * The name of the Failover Group. Changing this forces a new resource to be created. * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return The name of the Failover Group. Changing this forces a new resource to be created. * */ public Output name() { return this.name; } /** * A `partner_server` block as defined below. * */ @Export(name="partnerServers", refs={List.class,FailoverGroupPartnerServer.class}, tree="[0,1]") private Output> partnerServers; /** * @return A `partner_server` block as defined below. * */ public Output> partnerServers() { return this.partnerServers; } /** * A `read_write_endpoint_failover_policy` block as defined below. * */ @Export(name="readWriteEndpointFailoverPolicy", refs={FailoverGroupReadWriteEndpointFailoverPolicy.class}, tree="[0]") private Output readWriteEndpointFailoverPolicy; /** * @return A `read_write_endpoint_failover_policy` block as defined below. * */ public Output readWriteEndpointFailoverPolicy() { return this.readWriteEndpointFailoverPolicy; } /** * Whether failover is enabled for the readonly endpoint. Defaults to `false`. * */ @Export(name="readonlyEndpointFailoverPolicyEnabled", refs={Boolean.class}, tree="[0]") private Output readonlyEndpointFailoverPolicyEnabled; /** * @return Whether failover is enabled for the readonly endpoint. Defaults to `false`. * */ public Output readonlyEndpointFailoverPolicyEnabled() { return 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. * */ @Export(name="serverId", refs={String.class}, tree="[0]") private Output 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 serverId() { return this.serverId; } /** * A mapping of tags to assign to the resource. * */ @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]") private Output> tags; /** * @return A mapping of tags to assign to the resource. * */ public Output>> tags() { return Codegen.optional(this.tags); } /** * * @param name The _unique_ name of the resulting resource. */ public FailoverGroup(java.lang.String name) { this(name, FailoverGroupArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public FailoverGroup(java.lang.String name, FailoverGroupArgs 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 FailoverGroup(java.lang.String name, FailoverGroupArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:mssql/failoverGroup:FailoverGroup", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private FailoverGroup(java.lang.String name, Output id, @Nullable FailoverGroupState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:mssql/failoverGroup:FailoverGroup", name, state, makeResourceOptions(options, id), false); } private static FailoverGroupArgs makeArgs(FailoverGroupArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? FailoverGroupArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .aliases(List.of( Output.of(Alias.builder().type("azure:sql/failoverGroup:FailoverGroup").build()) )) .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 FailoverGroup get(java.lang.String name, Output id, @Nullable FailoverGroupState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new FailoverGroup(name, id, state, options); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy