com.pulumi.azure.mssql.FirewallRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure Show documentation
Show all versions of azure Show documentation
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.
// *** 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.FirewallRuleArgs;
import com.pulumi.azure.mssql.inputs.FirewallRuleState;
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.String;
import java.util.List;
import javax.annotation.Nullable;
/**
* Allows you to manage an Azure SQL Firewall Rule.
*
* ## 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.FirewallRule;
* import com.pulumi.azure.mssql.FirewallRuleArgs;
* 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("example-resources")
* .location("West Europe")
* .build());
*
* var exampleServer = new Server("exampleServer", ServerArgs.builder()
* .name("mysqlserver")
* .resourceGroupName(example.name())
* .location(example.location())
* .version("12.0")
* .administratorLogin("4dm1n157r470r")
* .administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
* .build());
*
* var exampleFirewallRule = new FirewallRule("exampleFirewallRule", FirewallRuleArgs.builder()
* .name("FirewallRule1")
* .serverId(exampleServer.id())
* .startIpAddress("10.0.17.62")
* .endIpAddress("10.0.17.62")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* SQL Firewall Rules can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:mssql/firewallRule:FirewallRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/firewallRules/rule1
* ```
*
*/
@ResourceType(type="azure:mssql/firewallRule:FirewallRule")
public class FirewallRule extends com.pulumi.resources.CustomResource {
/**
* The ending IP address to allow through the firewall for this rule.
*
* > **NOTE:** The Azure feature `Allow access to Azure services` can be enabled by setting `start_ip_address` and `end_ip_address` to `0.0.0.0` which ([is documented in the Azure API Docs](https://docs.microsoft.com/rest/api/sql/firewallrules/createorupdate)).
*
*/
@Export(name="endIpAddress", refs={String.class}, tree="[0]")
private Output endIpAddress;
/**
* @return The ending IP address to allow through the firewall for this rule.
*
* > **NOTE:** The Azure feature `Allow access to Azure services` can be enabled by setting `start_ip_address` and `end_ip_address` to `0.0.0.0` which ([is documented in the Azure API Docs](https://docs.microsoft.com/rest/api/sql/firewallrules/createorupdate)).
*
*/
public Output endIpAddress() {
return this.endIpAddress;
}
/**
* The name of the firewall rule. 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 firewall rule. Changing this forces a new resource to be created.
*
*/
public Output name() {
return this.name;
}
/**
* The resource ID of the SQL Server on which to create the Firewall Rule. Changing this forces a new resource to be created.
*
*/
@Export(name="serverId", refs={String.class}, tree="[0]")
private Output serverId;
/**
* @return The resource ID of the SQL Server on which to create the Firewall Rule. Changing this forces a new resource to be created.
*
*/
public Output serverId() {
return this.serverId;
}
/**
* The starting IP address to allow through the firewall for this rule.
*
*/
@Export(name="startIpAddress", refs={String.class}, tree="[0]")
private Output startIpAddress;
/**
* @return The starting IP address to allow through the firewall for this rule.
*
*/
public Output startIpAddress() {
return this.startIpAddress;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public FirewallRule(java.lang.String name) {
this(name, FirewallRuleArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public FirewallRule(java.lang.String name, FirewallRuleArgs 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 FirewallRule(java.lang.String name, FirewallRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:mssql/firewallRule:FirewallRule", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private FirewallRule(java.lang.String name, Output id, @Nullable FirewallRuleState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:mssql/firewallRule:FirewallRule", name, state, makeResourceOptions(options, id), false);
}
private static FirewallRuleArgs makeArgs(FirewallRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? FirewallRuleArgs.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/firewallRule:FirewallRule").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 FirewallRule get(java.lang.String name, Output id, @Nullable FirewallRuleState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new FirewallRule(name, id, state, options);
}
}