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

com.pulumi.azure.mysql.kotlin.FlexibleServer.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.mysql.kotlin

import com.pulumi.azure.mysql.kotlin.outputs.FlexibleServerCustomerManagedKey
import com.pulumi.azure.mysql.kotlin.outputs.FlexibleServerHighAvailability
import com.pulumi.azure.mysql.kotlin.outputs.FlexibleServerIdentity
import com.pulumi.azure.mysql.kotlin.outputs.FlexibleServerMaintenanceWindow
import com.pulumi.azure.mysql.kotlin.outputs.FlexibleServerStorage
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import com.pulumi.azure.mysql.kotlin.outputs.FlexibleServerCustomerManagedKey.Companion.toKotlin as flexibleServerCustomerManagedKeyToKotlin
import com.pulumi.azure.mysql.kotlin.outputs.FlexibleServerHighAvailability.Companion.toKotlin as flexibleServerHighAvailabilityToKotlin
import com.pulumi.azure.mysql.kotlin.outputs.FlexibleServerIdentity.Companion.toKotlin as flexibleServerIdentityToKotlin
import com.pulumi.azure.mysql.kotlin.outputs.FlexibleServerMaintenanceWindow.Companion.toKotlin as flexibleServerMaintenanceWindowToKotlin
import com.pulumi.azure.mysql.kotlin.outputs.FlexibleServerStorage.Companion.toKotlin as flexibleServerStorageToKotlin

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

    public var args: FlexibleServerArgs = FlexibleServerArgs()

    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 FlexibleServerArgsBuilder.() -> Unit) {
        val builder = FlexibleServerArgsBuilder()
        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(): FlexibleServer {
        val builtJavaResource = com.pulumi.azure.mysql.FlexibleServer(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return FlexibleServer(builtJavaResource)
    }
}

/**
 * Manages a MySQL Flexible Server.
 * ## 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 exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "example-vn",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     addressSpaces: ["10.0.0.0/16"],
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "example-sn",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 *     serviceEndpoints: ["Microsoft.Storage"],
 *     delegations: [{
 *         name: "fs",
 *         serviceDelegation: {
 *             name: "Microsoft.DBforMySQL/flexibleServers",
 *             actions: ["Microsoft.Network/virtualNetworks/subnets/join/action"],
 *         },
 *     }],
 * });
 * const exampleZone = new azure.privatedns.Zone("example", {
 *     name: "example.mysql.database.azure.com",
 *     resourceGroupName: example.name,
 * });
 * const exampleZoneVirtualNetworkLink = new azure.privatedns.ZoneVirtualNetworkLink("example", {
 *     name: "exampleVnetZone.com",
 *     privateDnsZoneName: exampleZone.name,
 *     virtualNetworkId: exampleVirtualNetwork.id,
 *     resourceGroupName: example.name,
 * });
 * const exampleFlexibleServer = new azure.mysql.FlexibleServer("example", {
 *     name: "example-fs",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     administratorLogin: "psqladmin",
 *     administratorPassword: "H@Sh1CoR3!",
 *     backupRetentionDays: 7,
 *     delegatedSubnetId: exampleSubnet.id,
 *     privateDnsZoneId: exampleZone.id,
 *     skuName: "GP_Standard_D2ds_v4",
 * }, {
 *     dependsOn: [exampleZoneVirtualNetworkLink],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_virtual_network = azure.network.VirtualNetwork("example",
 *     name="example-vn",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     address_spaces=["10.0.0.0/16"])
 * example_subnet = azure.network.Subnet("example",
 *     name="example-sn",
 *     resource_group_name=example.name,
 *     virtual_network_name=example_virtual_network.name,
 *     address_prefixes=["10.0.2.0/24"],
 *     service_endpoints=["Microsoft.Storage"],
 *     delegations=[{
 *         "name": "fs",
 *         "service_delegation": {
 *             "name": "Microsoft.DBforMySQL/flexibleServers",
 *             "actions": ["Microsoft.Network/virtualNetworks/subnets/join/action"],
 *         },
 *     }])
 * example_zone = azure.privatedns.Zone("example",
 *     name="example.mysql.database.azure.com",
 *     resource_group_name=example.name)
 * example_zone_virtual_network_link = azure.privatedns.ZoneVirtualNetworkLink("example",
 *     name="exampleVnetZone.com",
 *     private_dns_zone_name=example_zone.name,
 *     virtual_network_id=example_virtual_network.id,
 *     resource_group_name=example.name)
 * example_flexible_server = azure.mysql.FlexibleServer("example",
 *     name="example-fs",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     administrator_login="psqladmin",
 *     administrator_password="H@Sh1CoR3!",
 *     backup_retention_days=7,
 *     delegated_subnet_id=example_subnet.id,
 *     private_dns_zone_id=example_zone.id,
 *     sku_name="GP_Standard_D2ds_v4",
 *     opts = pulumi.ResourceOptions(depends_on=[example_zone_virtual_network_link]))
 * ```
 * ```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 exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
 *     {
 *         Name = "example-vn",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AddressSpaces = new[]
 *         {
 *             "10.0.0.0/16",
 *         },
 *     });
 *     var exampleSubnet = new Azure.Network.Subnet("example", new()
 *     {
 *         Name = "example-sn",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = exampleVirtualNetwork.Name,
 *         AddressPrefixes = new[]
 *         {
 *             "10.0.2.0/24",
 *         },
 *         ServiceEndpoints = new[]
 *         {
 *             "Microsoft.Storage",
 *         },
 *         Delegations = new[]
 *         {
 *             new Azure.Network.Inputs.SubnetDelegationArgs
 *             {
 *                 Name = "fs",
 *                 ServiceDelegation = new Azure.Network.Inputs.SubnetDelegationServiceDelegationArgs
 *                 {
 *                     Name = "Microsoft.DBforMySQL/flexibleServers",
 *                     Actions = new[]
 *                     {
 *                         "Microsoft.Network/virtualNetworks/subnets/join/action",
 *                     },
 *                 },
 *             },
 *         },
 *     });
 *     var exampleZone = new Azure.PrivateDns.Zone("example", new()
 *     {
 *         Name = "example.mysql.database.azure.com",
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleZoneVirtualNetworkLink = new Azure.PrivateDns.ZoneVirtualNetworkLink("example", new()
 *     {
 *         Name = "exampleVnetZone.com",
 *         PrivateDnsZoneName = exampleZone.Name,
 *         VirtualNetworkId = exampleVirtualNetwork.Id,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleFlexibleServer = new Azure.MySql.FlexibleServer("example", new()
 *     {
 *         Name = "example-fs",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AdministratorLogin = "psqladmin",
 *         AdministratorPassword = "H@Sh1CoR3!",
 *         BackupRetentionDays = 7,
 *         DelegatedSubnetId = exampleSubnet.Id,
 *         PrivateDnsZoneId = exampleZone.Id,
 *         SkuName = "GP_Standard_D2ds_v4",
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             exampleZoneVirtualNetworkLink,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mysql"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/privatedns"
 * 	"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
 * 		}
 * 		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
 * 			Name:              pulumi.String("example-vn"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.0.0/16"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
 * 			Name:               pulumi.String("example-sn"),
 * 			ResourceGroupName:  example.Name,
 * 			VirtualNetworkName: exampleVirtualNetwork.Name,
 * 			AddressPrefixes: pulumi.StringArray{
 * 				pulumi.String("10.0.2.0/24"),
 * 			},
 * 			ServiceEndpoints: pulumi.StringArray{
 * 				pulumi.String("Microsoft.Storage"),
 * 			},
 * 			Delegations: network.SubnetDelegationArray{
 * 				&network.SubnetDelegationArgs{
 * 					Name: pulumi.String("fs"),
 * 					ServiceDelegation: &network.SubnetDelegationServiceDelegationArgs{
 * 						Name: pulumi.String("Microsoft.DBforMySQL/flexibleServers"),
 * 						Actions: pulumi.StringArray{
 * 							pulumi.String("Microsoft.Network/virtualNetworks/subnets/join/action"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleZone, err := privatedns.NewZone(ctx, "example", &privatedns.ZoneArgs{
 * 			Name:              pulumi.String("example.mysql.database.azure.com"),
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleZoneVirtualNetworkLink, err := privatedns.NewZoneVirtualNetworkLink(ctx, "example", &privatedns.ZoneVirtualNetworkLinkArgs{
 * 			Name:               pulumi.String("exampleVnetZone.com"),
 * 			PrivateDnsZoneName: exampleZone.Name,
 * 			VirtualNetworkId:   exampleVirtualNetwork.ID(),
 * 			ResourceGroupName:  example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = mysql.NewFlexibleServer(ctx, "example", &mysql.FlexibleServerArgs{
 * 			Name:                  pulumi.String("example-fs"),
 * 			ResourceGroupName:     example.Name,
 * 			Location:              example.Location,
 * 			AdministratorLogin:    pulumi.String("psqladmin"),
 * 			AdministratorPassword: pulumi.String("H@Sh1CoR3!"),
 * 			BackupRetentionDays:   pulumi.Int(7),
 * 			DelegatedSubnetId:     exampleSubnet.ID(),
 * 			PrivateDnsZoneId:      exampleZone.ID(),
 * 			SkuName:               pulumi.String("GP_Standard_D2ds_v4"),
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			exampleZoneVirtualNetworkLink,
 * 		}))
 * 		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.network.VirtualNetwork;
 * import com.pulumi.azure.network.VirtualNetworkArgs;
 * import com.pulumi.azure.network.Subnet;
 * import com.pulumi.azure.network.SubnetArgs;
 * import com.pulumi.azure.network.inputs.SubnetDelegationArgs;
 * import com.pulumi.azure.network.inputs.SubnetDelegationServiceDelegationArgs;
 * import com.pulumi.azure.privatedns.Zone;
 * import com.pulumi.azure.privatedns.ZoneArgs;
 * import com.pulumi.azure.privatedns.ZoneVirtualNetworkLink;
 * import com.pulumi.azure.privatedns.ZoneVirtualNetworkLinkArgs;
 * import com.pulumi.azure.mysql.FlexibleServer;
 * import com.pulumi.azure.mysql.FlexibleServerArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
 *             .name("example-vn")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .addressSpaces("10.0.0.0/16")
 *             .build());
 *         var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
 *             .name("example-sn")
 *             .resourceGroupName(example.name())
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .addressPrefixes("10.0.2.0/24")
 *             .serviceEndpoints("Microsoft.Storage")
 *             .delegations(SubnetDelegationArgs.builder()
 *                 .name("fs")
 *                 .serviceDelegation(SubnetDelegationServiceDelegationArgs.builder()
 *                     .name("Microsoft.DBforMySQL/flexibleServers")
 *                     .actions("Microsoft.Network/virtualNetworks/subnets/join/action")
 *                     .build())
 *                 .build())
 *             .build());
 *         var exampleZone = new Zone("exampleZone", ZoneArgs.builder()
 *             .name("example.mysql.database.azure.com")
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleZoneVirtualNetworkLink = new ZoneVirtualNetworkLink("exampleZoneVirtualNetworkLink", ZoneVirtualNetworkLinkArgs.builder()
 *             .name("exampleVnetZone.com")
 *             .privateDnsZoneName(exampleZone.name())
 *             .virtualNetworkId(exampleVirtualNetwork.id())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleFlexibleServer = new FlexibleServer("exampleFlexibleServer", FlexibleServerArgs.builder()
 *             .name("example-fs")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .administratorLogin("psqladmin")
 *             .administratorPassword("H@Sh1CoR3!")
 *             .backupRetentionDays(7)
 *             .delegatedSubnetId(exampleSubnet.id())
 *             .privateDnsZoneId(exampleZone.id())
 *             .skuName("GP_Standard_D2ds_v4")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(exampleZoneVirtualNetworkLink)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleVirtualNetwork:
 *     type: azure:network:VirtualNetwork
 *     name: example
 *     properties:
 *       name: example-vn
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       addressSpaces:
 *         - 10.0.0.0/16
 *   exampleSubnet:
 *     type: azure:network:Subnet
 *     name: example
 *     properties:
 *       name: example-sn
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${exampleVirtualNetwork.name}
 *       addressPrefixes:
 *         - 10.0.2.0/24
 *       serviceEndpoints:
 *         - Microsoft.Storage
 *       delegations:
 *         - name: fs
 *           serviceDelegation:
 *             name: Microsoft.DBforMySQL/flexibleServers
 *             actions:
 *               - Microsoft.Network/virtualNetworks/subnets/join/action
 *   exampleZone:
 *     type: azure:privatedns:Zone
 *     name: example
 *     properties:
 *       name: example.mysql.database.azure.com
 *       resourceGroupName: ${example.name}
 *   exampleZoneVirtualNetworkLink:
 *     type: azure:privatedns:ZoneVirtualNetworkLink
 *     name: example
 *     properties:
 *       name: exampleVnetZone.com
 *       privateDnsZoneName: ${exampleZone.name}
 *       virtualNetworkId: ${exampleVirtualNetwork.id}
 *       resourceGroupName: ${example.name}
 *   exampleFlexibleServer:
 *     type: azure:mysql:FlexibleServer
 *     name: example
 *     properties:
 *       name: example-fs
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       administratorLogin: psqladmin
 *       administratorPassword: H@Sh1CoR3!
 *       backupRetentionDays: 7
 *       delegatedSubnetId: ${exampleSubnet.id}
 *       privateDnsZoneId: ${exampleZone.id}
 *       skuName: GP_Standard_D2ds_v4
 *     options:
 *       dependson:
 *         - ${exampleZoneVirtualNetworkLink}
 * ```
 * 
 * ## Import
 * MySQL Flexible Servers can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:mysql/flexibleServer:FlexibleServer example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DBforMySQL/flexibleServers/flexibleServer1
 * ```
 */
public class FlexibleServer internal constructor(
    override val javaResource: com.pulumi.azure.mysql.FlexibleServer,
) : KotlinCustomResource(javaResource, FlexibleServerMapper) {
    /**
     * The Administrator login for the MySQL Flexible Server. Required when `create_mode` is `Default`. Changing this forces a new MySQL Flexible Server to be created.
     */
    public val administratorLogin: Output
        get() = javaResource.administratorLogin().applyValue({ args0 -> args0 })

    /**
     * The Password associated with the `administrator_login` for the MySQL Flexible Server. Required when `create_mode` is `Default`.
     */
    public val administratorPassword: Output?
        get() = javaResource.administratorPassword().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The backup retention days for the MySQL Flexible Server. Possible values are between `1` and `35` days. Defaults to `7`.
     */
    public val backupRetentionDays: Output?
        get() = javaResource.backupRetentionDays().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The creation mode which can be used to restore or replicate existing servers. Possible values are `Default`, `PointInTimeRestore`, `GeoRestore`, and `Replica`. Changing this forces a new MySQL Flexible Server to be created.
     * > **NOTE:** Creating a `GeoRestore` server requires the source server with `geo_redundant_backup_enabled` enabled.
     * > **NOTE:** When a server is first created it may not be immediately available for `geo restore` or `replica`. It may take a few minutes to several hours for the necessary metadata to be populated. Please see the [Geo Restore](https://learn.microsoft.com/azure/mysql/single-server/how-to-restore-server-portal#geo-restore) and the [Replica](https://learn.microsoft.com/azure/mysql/flexible-server/concepts-read-replicas#create-a-replica) for more information.
     */
    public val createMode: Output?
        get() = javaResource.createMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `customer_managed_key` block as defined below.
     * > **NOTE:** `identity` is required when `customer_managed_key` is specified.
     */
    public val customerManagedKey: Output?
        get() = javaResource.customerManagedKey().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> flexibleServerCustomerManagedKeyToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The ID of the virtual network subnet to create the MySQL Flexible Server. Changing this forces a new MySQL Flexible Server to be created.
     */
    public val delegatedSubnetId: Output?
        get() = javaResource.delegatedSubnetId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The fully qualified domain name of the MySQL Flexible Server.
     */
    public val fqdn: Output
        get() = javaResource.fqdn().applyValue({ args0 -> args0 })

    /**
     * Should geo redundant backup enabled? Defaults to `false`. Changing this forces a new MySQL Flexible Server to be created.
     */
    public val geoRedundantBackupEnabled: Output?
        get() = javaResource.geoRedundantBackupEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `high_availability` block as defined below.
     */
    public val highAvailability: Output?
        get() = javaResource.highAvailability().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> flexibleServerHighAvailabilityToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    flexibleServerIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The Azure Region where the MySQL Flexible Server should exist. Changing this forces a new MySQL Flexible Server to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * A `maintenance_window` block as defined below.
     */
    public val maintenanceWindow: Output?
        get() = javaResource.maintenanceWindow().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> flexibleServerMaintenanceWindowToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The name which should be used for this MySQL Flexible Server. Changing this forces a new MySQL Flexible Server to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The point in time to restore from `creation_source_server_id` when `create_mode` is `PointInTimeRestore`. Changing this forces a new MySQL Flexible Server to be created.
     */
    public val pointInTimeRestoreTimeInUtc: Output?
        get() = javaResource.pointInTimeRestoreTimeInUtc().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of the private DNS zone to create the MySQL Flexible Server. Changing this forces a new MySQL Flexible Server to be created.
     * > **NOTE:** The `private_dns_zone_id` is required when setting a `delegated_subnet_id`. The `azure.privatedns.Zone` should end with suffix `.mysql.database.azure.com`.
     */
    public val privateDnsZoneId: Output?
        get() = javaResource.privateDnsZoneId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Is the public network access enabled?
     */
    public val publicNetworkAccessEnabled: Output
        get() = javaResource.publicNetworkAccessEnabled().applyValue({ args0 -> args0 })

    /**
     * The maximum number of replicas that a primary MySQL Flexible Server can have.
     */
    public val replicaCapacity: Output
        get() = javaResource.replicaCapacity().applyValue({ args0 -> args0 })

    /**
     * The replication role. Possible value is `None`.
     * > **NOTE:** The `replication_role` cannot be set while creating and only can be updated from `Replica` to `None`.
     */
    public val replicationRole: Output
        get() = javaResource.replicationRole().applyValue({ args0 -> args0 })

    /**
     * The name of the Resource Group where the MySQL Flexible Server should exist. Changing this forces a new MySQL Flexible Server to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The SKU Name for the MySQL Flexible Server.
     * > **NOTE:** `sku_name` should start with SKU tier `B (Burstable)`, `GP (General Purpose)`, `MO (Memory Optimized)` like `B_Standard_B1s`.
     */
    public val skuName: Output
        get() = javaResource.skuName().applyValue({ args0 -> args0 })

    /**
     * The resource ID of the source MySQL Flexible Server to be restored. Required when `create_mode` is `PointInTimeRestore`, `GeoRestore`, and `Replica`. Changing this forces a new MySQL Flexible Server to be created.
     */
    public val sourceServerId: Output?
        get() = javaResource.sourceServerId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `storage` block as defined below.
     */
    public val storage: Output
        get() = javaResource.storage().applyValue({ args0 ->
            args0.let({ args0 ->
                flexibleServerStorageToKotlin(args0)
            })
        })

    /**
     * A mapping of tags which should be assigned to the MySQL Flexible Server.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The version of the MySQL Flexible Server to use. Possible values are `5.7`, and `8.0.21`. Changing this forces a new MySQL Flexible Server to be created.
     */
    public val version: Output
        get() = javaResource.version().applyValue({ args0 -> args0 })

    public val zone: Output?
        get() = javaResource.zone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object FlexibleServerMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.mysql.FlexibleServer::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy