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

com.pulumi.awsnative.lightsail.kotlin.Database.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.lightsail.kotlin

import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.awsnative.lightsail.kotlin.outputs.DatabaseRelationalDatabaseParameter
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
import kotlin.collections.List
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin
import com.pulumi.awsnative.lightsail.kotlin.outputs.DatabaseRelationalDatabaseParameter.Companion.toKotlin as databaseRelationalDatabaseParameterToKotlin

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

    public var args: DatabaseArgs = DatabaseArgs()

    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 DatabaseArgsBuilder.() -> Unit) {
        val builder = DatabaseArgsBuilder()
        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(): Database {
        val builtJavaResource = com.pulumi.awsnative.lightsail.Database(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Database(builtJavaResource)
    }
}

/**
 * Resource Type definition for AWS::Lightsail::Database
 */
public class Database internal constructor(
    override val javaResource: com.pulumi.awsnative.lightsail.Database,
) : KotlinCustomResource(javaResource, DatabaseMapper) {
    /**
     * The Availability Zone in which to create your new database. Use the us-east-2a case-sensitive format.
     */
    public val availabilityZone: Output?
        get() = javaResource.availabilityZone().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * When true, enables automated backup retention for your database. Updates are applied during the next maintenance window because this can result in an outage.
     */
    public val backupRetention: Output?
        get() = javaResource.backupRetention().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Indicates the certificate that needs to be associated with the database.
     */
    public val caCertificateIdentifier: Output?
        get() = javaResource.caCertificateIdentifier().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Amazon Resource Name (ARN) of the database (for example, `arn:aws:lightsail:us-east-2:123456789101:RelationalDatabase/244ad76f-8aad-4741-809f-12345EXAMPLE` ).
     */
    public val databaseArn: Output
        get() = javaResource.databaseArn().applyValue({ args0 -> args0 })

    /**
     * The name of the database to create when the Lightsail database resource is created. For MySQL, if this parameter isn't specified, no database is created in the database resource. For PostgreSQL, if this parameter isn't specified, a database named postgres is created in the database resource.
     */
    public val masterDatabaseName: Output
        get() = javaResource.masterDatabaseName().applyValue({ args0 -> args0 })

    /**
     * The password for the master user. The password can include any printable ASCII character except "/", """, or "@". It cannot contain spaces.
     */
    public val masterUserPassword: Output?
        get() = javaResource.masterUserPassword().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name for the master user.
     */
    public val masterUsername: Output
        get() = javaResource.masterUsername().applyValue({ args0 -> args0 })

    /**
     * The daily time range during which automated backups are created for your new database if automated backups are enabled.
     */
    public val preferredBackupWindow: Output?
        get() = javaResource.preferredBackupWindow().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The weekly time range during which system maintenance can occur on your new database.
     */
    public val preferredMaintenanceWindow: Output?
        get() = javaResource.preferredMaintenanceWindow().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the accessibility options for your new database. A value of true specifies a database that is available to resources outside of your Lightsail account. A value of false specifies a database that is available only to your Lightsail resources in the same region as your database.
     */
    public val publiclyAccessible: Output?
        get() = javaResource.publiclyAccessible().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The blueprint ID for your new database. A blueprint describes the major engine version of a database.
     */
    public val relationalDatabaseBlueprintId: Output
        get() = javaResource.relationalDatabaseBlueprintId().applyValue({ args0 -> args0 })

    /**
     * The bundle ID for your new database. A bundle describes the performance specifications for your database.
     */
    public val relationalDatabaseBundleId: Output
        get() = javaResource.relationalDatabaseBundleId().applyValue({ args0 -> args0 })

    /**
     * The name to use for your new Lightsail database resource.
     */
    public val relationalDatabaseName: Output
        get() = javaResource.relationalDatabaseName().applyValue({ args0 -> args0 })

    /**
     * Update one or more parameters of the relational database.
     */
    public val relationalDatabaseParameters: Output>?
        get() = javaResource.relationalDatabaseParameters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        databaseRelationalDatabaseParameterToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * When true, the master user password is changed to a new strong password generated by Lightsail. Use the get relational database master user password operation to get the new password.
     */
    public val rotateMasterUserPassword: Output?
        get() = javaResource.rotateMasterUserPassword().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An array of key-value pairs to apply to this resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })
}

public object DatabaseMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.lightsail.Database::class == javaResource::class

    override fun map(javaResource: Resource): Database = Database(
        javaResource as
            com.pulumi.awsnative.lightsail.Database,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy