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

com.pulumi.azure.mssql.kotlin.OutboundFirewallRule.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.mssql.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

/**
 * Builder for [OutboundFirewallRule].
 */
@PulumiTagMarker
public class OutboundFirewallRuleResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: OutboundFirewallRuleArgs = OutboundFirewallRuleArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend OutboundFirewallRuleArgsBuilder.() -> Unit) {
        val builder = OutboundFirewallRuleArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): OutboundFirewallRule {
        val builtJavaResource = com.pulumi.azure.mssql.OutboundFirewallRule(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return OutboundFirewallRule(builtJavaResource)
    }
}

/**
 * Allows you to manage an Azure SQL Outbound Firewall Rule.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleServer = new azure.mssql.Server("example", {
 *     name: "mysqlserver",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     version: "12.0",
 *     administratorLogin: "4dm1n157r470r",
 *     administratorLoginPassword: "4-v3ry-53cr37-p455w0rd",
 *     outboundNetworkRestrictionEnabled: true,
 * });
 * const exampleOutboundFirewallRule = new azure.mssql.OutboundFirewallRule("example", {
 *     name: "sqlexamplefdqn.database.windows.net",
 *     serverId: exampleServer.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_server = azure.mssql.Server("example",
 *     name="mysqlserver",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     version="12.0",
 *     administrator_login="4dm1n157r470r",
 *     administrator_login_password="4-v3ry-53cr37-p455w0rd",
 *     outbound_network_restriction_enabled=True)
 * example_outbound_firewall_rule = azure.mssql.OutboundFirewallRule("example",
 *     name="sqlexamplefdqn.database.windows.net",
 *     server_id=example_server.id)
 * ```
 * ```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 = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleServer = new Azure.MSSql.Server("example", new()
 *     {
 *         Name = "mysqlserver",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Version = "12.0",
 *         AdministratorLogin = "4dm1n157r470r",
 *         AdministratorLoginPassword = "4-v3ry-53cr37-p455w0rd",
 *         OutboundNetworkRestrictionEnabled = true,
 *     });
 *     var exampleOutboundFirewallRule = new Azure.MSSql.OutboundFirewallRule("example", new()
 *     {
 *         Name = "sqlexamplefdqn.database.windows.net",
 *         ServerId = exampleServer.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mssql"
 * 	"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("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleServer, err := mssql.NewServer(ctx, "example", &mssql.ServerArgs{
 * 			Name:                              pulumi.String("mysqlserver"),
 * 			ResourceGroupName:                 example.Name,
 * 			Location:                          example.Location,
 * 			Version:                           pulumi.String("12.0"),
 * 			AdministratorLogin:                pulumi.String("4dm1n157r470r"),
 * 			AdministratorLoginPassword:        pulumi.String("4-v3ry-53cr37-p455w0rd"),
 * 			OutboundNetworkRestrictionEnabled: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = mssql.NewOutboundFirewallRule(ctx, "example", &mssql.OutboundFirewallRuleArgs{
 * 			Name:     pulumi.String("sqlexamplefdqn.database.windows.net"),
 * 			ServerId: exampleServer.ID(),
 * 		})
 * 		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.mssql.Server;
 * import com.pulumi.azure.mssql.ServerArgs;
 * import com.pulumi.azure.mssql.OutboundFirewallRule;
 * import com.pulumi.azure.mssql.OutboundFirewallRuleArgs;
 * 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")
 *             .outboundNetworkRestrictionEnabled(true)
 *             .build());
 *         var exampleOutboundFirewallRule = new OutboundFirewallRule("exampleOutboundFirewallRule", OutboundFirewallRuleArgs.builder()
 *             .name("sqlexamplefdqn.database.windows.net")
 *             .serverId(exampleServer.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleServer:
 *     type: azure:mssql:Server
 *     name: example
 *     properties:
 *       name: mysqlserver
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       version: '12.0'
 *       administratorLogin: 4dm1n157r470r
 *       administratorLoginPassword: 4-v3ry-53cr37-p455w0rd
 *       outboundNetworkRestrictionEnabled: true
 *   exampleOutboundFirewallRule:
 *     type: azure:mssql:OutboundFirewallRule
 *     name: example
 *     properties:
 *       name: sqlexamplefdqn.database.windows.net
 *       serverId: ${exampleServer.id}
 * ```
 * 
 * ## Import
 * SQL Outbound Firewall Rules can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:mssql/outboundFirewallRule:OutboundFirewallRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/outboundFirewallRules/fqdn1
 * ```
 */
public class OutboundFirewallRule internal constructor(
    override val javaResource: com.pulumi.azure.mssql.OutboundFirewallRule,
) : KotlinCustomResource(javaResource, OutboundFirewallRuleMapper) {
    /**
     * The name of the outbound firewall rule. This should be a FQDN. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The resource ID of the SQL Server on which to create the Outbound Firewall Rule. Changing this forces a new resource to be created.
     */
    public val serverId: Output
        get() = javaResource.serverId().applyValue({ args0 -> args0 })
}

public object OutboundFirewallRuleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.mssql.OutboundFirewallRule::class == javaResource::class

    override fun map(javaResource: Resource): OutboundFirewallRule = OutboundFirewallRule(
        javaResource
            as com.pulumi.azure.mssql.OutboundFirewallRule,
    )
}

/**
 * @see [OutboundFirewallRule].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [OutboundFirewallRule].
 */
public suspend fun outboundFirewallRule(
    name: String,
    block: suspend OutboundFirewallRuleResourceBuilder.() -> Unit,
): OutboundFirewallRule {
    val builder = OutboundFirewallRuleResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [OutboundFirewallRule].
 * @param name The _unique_ name of the resulting resource.
 */
public fun outboundFirewallRule(name: String): OutboundFirewallRule {
    val builder = OutboundFirewallRuleResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy