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

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

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

package com.pulumi.azure.postgresql.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 [Configuration].
 */
@PulumiTagMarker
public class ConfigurationResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ConfigurationArgs = ConfigurationArgs()

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

/**
 * Sets a PostgreSQL Configuration value on a PostgreSQL Server.
 * ## Disclaimers
 * > **Note:** Since this resource is provisioned by default, the Azure Provider will not check for the presence of an existing resource prior to attempting to create it.
 * ## Example Usage
 * 
 * ```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: "postgresql-server-1",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     skuName: "B_Gen5_2",
 *     storageMb: 5120,
 *     backupRetentionDays: 7,
 *     geoRedundantBackupEnabled: false,
 *     autoGrowEnabled: true,
 *     administratorLogin: "psqladmin",
 *     administratorLoginPassword: "H@Sh1CoR3!",
 *     version: "9.5",
 *     sslEnforcementEnabled: true,
 * });
 * const exampleConfiguration = new azure.postgresql.Configuration("example", {
 *     name: "backslash_quote",
 *     resourceGroupName: example.name,
 *     serverName: exampleServer.name,
 *     value: "on",
 * });
 * ```
 * ```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="postgresql-server-1",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku_name="B_Gen5_2",
 *     storage_mb=5120,
 *     backup_retention_days=7,
 *     geo_redundant_backup_enabled=False,
 *     auto_grow_enabled=True,
 *     administrator_login="psqladmin",
 *     administrator_login_password="H@Sh1CoR3!",
 *     version="9.5",
 *     ssl_enforcement_enabled=True)
 * example_configuration = azure.postgresql.Configuration("example",
 *     name="backslash_quote",
 *     resource_group_name=example.name,
 *     server_name=example_server.name,
 *     value="on")
 * ```
 * ```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 = "postgresql-server-1",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         SkuName = "B_Gen5_2",
 *         StorageMb = 5120,
 *         BackupRetentionDays = 7,
 *         GeoRedundantBackupEnabled = false,
 *         AutoGrowEnabled = true,
 *         AdministratorLogin = "psqladmin",
 *         AdministratorLoginPassword = "H@Sh1CoR3!",
 *         Version = "9.5",
 *         SslEnforcementEnabled = true,
 *     });
 *     var exampleConfiguration = new Azure.PostgreSql.Configuration("example", new()
 *     {
 *         Name = "backslash_quote",
 *         ResourceGroupName = example.Name,
 *         ServerName = exampleServer.Name,
 *         Value = "on",
 *     });
 * });
 * ```
 * ```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("postgresql-server-1"),
 * 			Location:                   example.Location,
 * 			ResourceGroupName:          example.Name,
 * 			SkuName:                    pulumi.String("B_Gen5_2"),
 * 			StorageMb:                  pulumi.Int(5120),
 * 			BackupRetentionDays:        pulumi.Int(7),
 * 			GeoRedundantBackupEnabled:  pulumi.Bool(false),
 * 			AutoGrowEnabled:            pulumi.Bool(true),
 * 			AdministratorLogin:         pulumi.String("psqladmin"),
 * 			AdministratorLoginPassword: pulumi.String("H@Sh1CoR3!"),
 * 			Version:                    pulumi.String("9.5"),
 * 			SslEnforcementEnabled:      pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = postgresql.NewConfiguration(ctx, "example", &postgresql.ConfigurationArgs{
 * 			Name:              pulumi.String("backslash_quote"),
 * 			ResourceGroupName: example.Name,
 * 			ServerName:        exampleServer.Name,
 * 			Value:             pulumi.String("on"),
 * 		})
 * 		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.Configuration;
 * import com.pulumi.azure.postgresql.ConfigurationArgs;
 * 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("postgresql-server-1")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .skuName("B_Gen5_2")
 *             .storageMb(5120)
 *             .backupRetentionDays(7)
 *             .geoRedundantBackupEnabled(false)
 *             .autoGrowEnabled(true)
 *             .administratorLogin("psqladmin")
 *             .administratorLoginPassword("H@Sh1CoR3!")
 *             .version("9.5")
 *             .sslEnforcementEnabled(true)
 *             .build());
 *         var exampleConfiguration = new Configuration("exampleConfiguration", ConfigurationArgs.builder()
 *             .name("backslash_quote")
 *             .resourceGroupName(example.name())
 *             .serverName(exampleServer.name())
 *             .value("on")
 *             .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: postgresql-server-1
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       skuName: B_Gen5_2
 *       storageMb: 5120
 *       backupRetentionDays: 7
 *       geoRedundantBackupEnabled: false
 *       autoGrowEnabled: true
 *       administratorLogin: psqladmin
 *       administratorLoginPassword: H@Sh1CoR3!
 *       version: '9.5'
 *       sslEnforcementEnabled: true
 *   exampleConfiguration:
 *     type: azure:postgresql:Configuration
 *     name: example
 *     properties:
 *       name: backslash_quote
 *       resourceGroupName: ${example.name}
 *       serverName: ${exampleServer.name}
 *       value: on
 * ```
 * 
 * ## Import
 * PostgreSQL Configurations can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:postgresql/configuration:Configuration backslash_quote /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforPostgreSQL/servers/server1/configurations/backslash_quote
 * ```
 */
public class Configuration internal constructor(
    override val javaResource: com.pulumi.azure.postgresql.Configuration,
) : KotlinCustomResource(javaResource, ConfigurationMapper) {
    /**
     * Specifies the name of the PostgreSQL Configuration, which needs [to be a valid PostgreSQL configuration name](https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIER). Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group in which the PostgreSQL Server exists. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the PostgreSQL Server. Changing this forces a new resource to be created.
     */
    public val serverName: Output
        get() = javaResource.serverName().applyValue({ args0 -> args0 })

    /**
     * Specifies the value of the PostgreSQL Configuration. See the PostgreSQL documentation for valid values. Changing this forces a new resource to be created.
     */
    public val `value`: Output
        get() = javaResource.`value`().applyValue({ args0 -> args0 })
}

public object ConfigurationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.postgresql.Configuration::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy