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

com.pulumi.azure.postgresql.kotlin.FirewallRuleArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.postgresql.kotlin

import com.pulumi.azure.postgresql.FirewallRuleArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Manages a Firewall Rule for a PostgreSQL Server
 * ## Example Usage
 * ### Single IP Address)
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "api-rg-pro",
 *     location: "West Europe",
 * });
 * const exampleServer = new azure.postgresql.Server("example", {
 *     name: "example-postgre-server",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     skuName: "GP_Gen5_2",
 *     version: "11",
 *     sslEnforcementEnabled: true,
 * });
 * const exampleFirewallRule = new azure.postgresql.FirewallRule("example", {
 *     name: "office",
 *     resourceGroupName: example.name,
 *     serverName: exampleServer.name,
 *     startIpAddress: "40.112.8.12",
 *     endIpAddress: "40.112.8.12",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="api-rg-pro",
 *     location="West Europe")
 * example_server = azure.postgresql.Server("example",
 *     name="example-postgre-server",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku_name="GP_Gen5_2",
 *     version="11",
 *     ssl_enforcement_enabled=True)
 * example_firewall_rule = azure.postgresql.FirewallRule("example",
 *     name="office",
 *     resource_group_name=example.name,
 *     server_name=example_server.name,
 *     start_ip_address="40.112.8.12",
 *     end_ip_address="40.112.8.12")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "api-rg-pro",
 *         Location = "West Europe",
 *     });
 *     var exampleServer = new Azure.PostgreSql.Server("example", new()
 *     {
 *         Name = "example-postgre-server",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         SkuName = "GP_Gen5_2",
 *         Version = "11",
 *         SslEnforcementEnabled = true,
 *     });
 *     var exampleFirewallRule = new Azure.PostgreSql.FirewallRule("example", new()
 *     {
 *         Name = "office",
 *         ResourceGroupName = example.Name,
 *         ServerName = exampleServer.Name,
 *         StartIpAddress = "40.112.8.12",
 *         EndIpAddress = "40.112.8.12",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/postgresql"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("api-rg-pro"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleServer, err := postgresql.NewServer(ctx, "example", &postgresql.ServerArgs{
 * 			Name:                  pulumi.String("example-postgre-server"),
 * 			Location:              example.Location,
 * 			ResourceGroupName:     example.Name,
 * 			SkuName:               pulumi.String("GP_Gen5_2"),
 * 			Version:               pulumi.String("11"),
 * 			SslEnforcementEnabled: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = postgresql.NewFirewallRule(ctx, "example", &postgresql.FirewallRuleArgs{
 * 			Name:              pulumi.String("office"),
 * 			ResourceGroupName: example.Name,
 * 			ServerName:        exampleServer.Name,
 * 			StartIpAddress:    pulumi.String("40.112.8.12"),
 * 			EndIpAddress:      pulumi.String("40.112.8.12"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * 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.postgresql.Server;
 * import com.pulumi.azure.postgresql.ServerArgs;
 * import com.pulumi.azure.postgresql.FirewallRule;
 * import com.pulumi.azure.postgresql.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("api-rg-pro")
 *             .location("West Europe")
 *             .build());
 *         var exampleServer = new Server("exampleServer", ServerArgs.builder()
 *             .name("example-postgre-server")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .skuName("GP_Gen5_2")
 *             .version("11")
 *             .sslEnforcementEnabled(true)
 *             .build());
 *         var exampleFirewallRule = new FirewallRule("exampleFirewallRule", FirewallRuleArgs.builder()
 *             .name("office")
 *             .resourceGroupName(example.name())
 *             .serverName(exampleServer.name())
 *             .startIpAddress("40.112.8.12")
 *             .endIpAddress("40.112.8.12")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: api-rg-pro
 *       location: West Europe
 *   exampleServer:
 *     type: azure:postgresql:Server
 *     name: example
 *     properties:
 *       name: example-postgre-server
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       skuName: GP_Gen5_2
 *       version: '11'
 *       sslEnforcementEnabled: true
 *   exampleFirewallRule:
 *     type: azure:postgresql:FirewallRule
 *     name: example
 *     properties:
 *       name: office
 *       resourceGroupName: ${example.name}
 *       serverName: ${exampleServer.name}
 *       startIpAddress: 40.112.8.12
 *       endIpAddress: 40.112.8.12
 * ```
 * 
 * ### IP Range)
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "api-rg-pro",
 *     location: "West Europe",
 * });
 * const exampleServer = new azure.postgresql.Server("example", {});
 * const exampleFirewallRule = new azure.postgresql.FirewallRule("example", {
 *     name: "office",
 *     resourceGroupName: example.name,
 *     serverName: exampleServer.name,
 *     startIpAddress: "40.112.0.0",
 *     endIpAddress: "40.112.255.255",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="api-rg-pro",
 *     location="West Europe")
 * example_server = azure.postgresql.Server("example")
 * example_firewall_rule = azure.postgresql.FirewallRule("example",
 *     name="office",
 *     resource_group_name=example.name,
 *     server_name=example_server.name,
 *     start_ip_address="40.112.0.0",
 *     end_ip_address="40.112.255.255")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "api-rg-pro",
 *         Location = "West Europe",
 *     });
 *     var exampleServer = new Azure.PostgreSql.Server("example");
 *     var exampleFirewallRule = new Azure.PostgreSql.FirewallRule("example", new()
 *     {
 *         Name = "office",
 *         ResourceGroupName = example.Name,
 *         ServerName = exampleServer.Name,
 *         StartIpAddress = "40.112.0.0",
 *         EndIpAddress = "40.112.255.255",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/postgresql"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("api-rg-pro"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleServer, err := postgresql.NewServer(ctx, "example", nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = postgresql.NewFirewallRule(ctx, "example", &postgresql.FirewallRuleArgs{
 * 			Name:              pulumi.String("office"),
 * 			ResourceGroupName: example.Name,
 * 			ServerName:        exampleServer.Name,
 * 			StartIpAddress:    pulumi.String("40.112.0.0"),
 * 			EndIpAddress:      pulumi.String("40.112.255.255"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * 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.postgresql.Server;
 * import com.pulumi.azure.postgresql.FirewallRule;
 * import com.pulumi.azure.postgresql.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("api-rg-pro")
 *             .location("West Europe")
 *             .build());
 *         var exampleServer = new Server("exampleServer");
 *         var exampleFirewallRule = new FirewallRule("exampleFirewallRule", FirewallRuleArgs.builder()
 *             .name("office")
 *             .resourceGroupName(example.name())
 *             .serverName(exampleServer.name())
 *             .startIpAddress("40.112.0.0")
 *             .endIpAddress("40.112.255.255")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: api-rg-pro
 *       location: West Europe
 *   exampleServer:
 *     type: azure:postgresql:Server
 *     name: example
 *   exampleFirewallRule:
 *     type: azure:postgresql:FirewallRule
 *     name: example
 *     properties:
 *       name: office
 *       resourceGroupName: ${example.name}
 *       serverName: ${exampleServer.name}
 *       startIpAddress: 40.112.0.0
 *       endIpAddress: 40.112.255.255
 * ```
 * 
 * ## Import
 * PostgreSQL Firewall Rule's can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:postgresql/firewallRule:FirewallRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/firewallRules/rule1
 * ```
 * @property endIpAddress Specifies the End IP Address associated with this Firewall Rule. Changing this forces a new resource to be created.
 * > **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)).
 * @property name Specifies the name of the PostgreSQL Firewall Rule. Changing this forces a new resource to be created.
 * @property resourceGroupName The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
 * @property serverName Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
 * @property startIpAddress Specifies the Start IP Address associated with this Firewall Rule. Changing this forces a new resource to be created.
 */
public data class FirewallRuleArgs(
    public val endIpAddress: Output? = null,
    public val name: Output? = null,
    public val resourceGroupName: Output? = null,
    public val serverName: Output? = null,
    public val startIpAddress: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.postgresql.FirewallRuleArgs =
        com.pulumi.azure.postgresql.FirewallRuleArgs.builder()
            .endIpAddress(endIpAddress?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .serverName(serverName?.applyValue({ args0 -> args0 }))
            .startIpAddress(startIpAddress?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [FirewallRuleArgs].
 */
@PulumiTagMarker
public class FirewallRuleArgsBuilder internal constructor() {
    private var endIpAddress: Output? = null

    private var name: Output? = null

    private var resourceGroupName: Output? = null

    private var serverName: Output? = null

    private var startIpAddress: Output? = null

    /**
     * @param value Specifies the End IP Address associated with this Firewall Rule. Changing this forces a new resource to be created.
     * > **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)).
     */
    @JvmName("lymrmuxcmtesdidv")
    public suspend fun endIpAddress(`value`: Output) {
        this.endIpAddress = value
    }

    /**
     * @param value Specifies the name of the PostgreSQL Firewall Rule. Changing this forces a new resource to be created.
     */
    @JvmName("cpajabwngcyqsfiw")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
     */
    @JvmName("cwpanlrohgimuedo")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
     */
    @JvmName("lbcoqxbcqhnjnfnr")
    public suspend fun serverName(`value`: Output) {
        this.serverName = value
    }

    /**
     * @param value Specifies the Start IP Address associated with this Firewall Rule. Changing this forces a new resource to be created.
     */
    @JvmName("fstdfyvhhgkebofy")
    public suspend fun startIpAddress(`value`: Output) {
        this.startIpAddress = value
    }

    /**
     * @param value Specifies the End IP Address associated with this Firewall Rule. Changing this forces a new resource to be created.
     * > **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)).
     */
    @JvmName("dxoxpnqctlxgmypv")
    public suspend fun endIpAddress(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.endIpAddress = mapped
    }

    /**
     * @param value Specifies the name of the PostgreSQL Firewall Rule. Changing this forces a new resource to be created.
     */
    @JvmName("mrorrgdgvrfaeqsd")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
     */
    @JvmName("vhecqgkdhkghftqx")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
     */
    @JvmName("wjxyywluqwypfstn")
    public suspend fun serverName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.serverName = mapped
    }

    /**
     * @param value Specifies the Start IP Address associated with this Firewall Rule. Changing this forces a new resource to be created.
     */
    @JvmName("iuwfrhynwnxpqaqo")
    public suspend fun startIpAddress(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.startIpAddress = mapped
    }

    internal fun build(): FirewallRuleArgs = FirewallRuleArgs(
        endIpAddress = endIpAddress,
        name = name,
        resourceGroupName = resourceGroupName,
        serverName = serverName,
        startIpAddress = startIpAddress,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy