com.pulumi.gcp.sql.kotlin.SslCert.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.sql.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 [SslCert].
*/
@PulumiTagMarker
public class SslCertResourceBuilder internal constructor() {
public var name: String? = null
public var args: SslCertArgs = SslCertArgs()
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 SslCertArgsBuilder.() -> Unit) {
val builder = SslCertArgsBuilder()
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(): SslCert {
val builtJavaResource = com.pulumi.gcp.sql.SslCert(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return SslCert(builtJavaResource)
}
}
/**
* Creates a new Google SQL SSL Cert on a Google SQL Instance. For more information, see the [official documentation](https://cloud.google.com/sql/), or the [JSON API](https://cloud.google.com/sql/docs/mysql/admin-api/v1beta4/sslCerts).
* ## Example Usage
* Example creating a SQL Client Certificate.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
* const dbNameSuffix = new random.RandomId("db_name_suffix", {byteLength: 4});
* const main = new gcp.sql.DatabaseInstance("main", {
* name: pulumi.interpolate`main-instance-${dbNameSuffix.hex}`,
* databaseVersion: "MYSQL_5_7",
* settings: {
* tier: "db-f1-micro",
* },
* });
* const clientCert = new gcp.sql.SslCert("client_cert", {
* commonName: "client-name",
* instance: main.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* import pulumi_random as random
* db_name_suffix = random.RandomId("db_name_suffix", byte_length=4)
* main = gcp.sql.DatabaseInstance("main",
* name=db_name_suffix.hex.apply(lambda hex: f"main-instance-{hex}"),
* database_version="MYSQL_5_7",
* settings=gcp.sql.DatabaseInstanceSettingsArgs(
* tier="db-f1-micro",
* ))
* client_cert = gcp.sql.SslCert("client_cert",
* common_name="client-name",
* instance=main.name)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* using Random = Pulumi.Random;
* return await Deployment.RunAsync(() =>
* {
* var dbNameSuffix = new Random.RandomId("db_name_suffix", new()
* {
* ByteLength = 4,
* });
* var main = new Gcp.Sql.DatabaseInstance("main", new()
* {
* Name = dbNameSuffix.Hex.Apply(hex => $"main-instance-{hex}"),
* DatabaseVersion = "MYSQL_5_7",
* Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
* {
* Tier = "db-f1-micro",
* },
* });
* var clientCert = new Gcp.Sql.SslCert("client_cert", new()
* {
* CommonName = "client-name",
* Instance = main.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi-random/sdk/v4/go/random"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* dbNameSuffix, err := random.NewRandomId(ctx, "db_name_suffix", &random.RandomIdArgs{
* ByteLength: pulumi.Int(4),
* })
* if err != nil {
* return err
* }
* main, err := sql.NewDatabaseInstance(ctx, "main", &sql.DatabaseInstanceArgs{
* Name: dbNameSuffix.Hex.ApplyT(func(hex string) (string, error) {
* return fmt.Sprintf("main-instance-%v", hex), nil
* }).(pulumi.StringOutput),
* DatabaseVersion: pulumi.String("MYSQL_5_7"),
* Settings: &sql.DatabaseInstanceSettingsArgs{
* Tier: pulumi.String("db-f1-micro"),
* },
* })
* if err != nil {
* return err
* }
* _, err = sql.NewSslCert(ctx, "client_cert", &sql.SslCertArgs{
* CommonName: pulumi.String("client-name"),
* Instance: main.Name,
* })
* 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.random.RandomId;
* import com.pulumi.random.RandomIdArgs;
* import com.pulumi.gcp.sql.DatabaseInstance;
* import com.pulumi.gcp.sql.DatabaseInstanceArgs;
* import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
* import com.pulumi.gcp.sql.SslCert;
* import com.pulumi.gcp.sql.SslCertArgs;
* 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 dbNameSuffix = new RandomId("dbNameSuffix", RandomIdArgs.builder()
* .byteLength(4)
* .build());
* var main = new DatabaseInstance("main", DatabaseInstanceArgs.builder()
* .name(dbNameSuffix.hex().applyValue(hex -> String.format("main-instance-%s", hex)))
* .databaseVersion("MYSQL_5_7")
* .settings(DatabaseInstanceSettingsArgs.builder()
* .tier("db-f1-micro")
* .build())
* .build());
* var clientCert = new SslCert("clientCert", SslCertArgs.builder()
* .commonName("client-name")
* .instance(main.name())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* dbNameSuffix:
* type: random:RandomId
* name: db_name_suffix
* properties:
* byteLength: 4
* main:
* type: gcp:sql:DatabaseInstance
* properties:
* name: main-instance-${dbNameSuffix.hex}
* databaseVersion: MYSQL_5_7
* settings:
* tier: db-f1-micro
* clientCert:
* type: gcp:sql:SslCert
* name: client_cert
* properties:
* commonName: client-name
* instance: ${main.name}
* ```
*
* ## Import
* Since the contents of the certificate cannot be accessed after its creation, this resource cannot be imported.
*/
public class SslCert internal constructor(
override val javaResource: com.pulumi.gcp.sql.SslCert,
) : KotlinCustomResource(javaResource, SslCertMapper) {
/**
* The actual certificate data for this client certificate.
*/
public val cert: Output
get() = javaResource.cert().applyValue({ args0 -> args0 })
/**
* The serial number extracted from the certificate data.
*/
public val certSerialNumber: Output
get() = javaResource.certSerialNumber().applyValue({ args0 -> args0 })
/**
* The common name to be used in the certificate to identify the
* client. Constrained to [a-zA-Z.-_ ]+. Changing this forces a new resource to be created.
*/
public val commonName: Output
get() = javaResource.commonName().applyValue({ args0 -> args0 })
/**
* The time when the certificate was created in RFC 3339 format,
* for example 2012-11-15T16:19:00.094Z.
*/
public val createTime: Output
get() = javaResource.createTime().applyValue({ args0 -> args0 })
/**
* The time when the certificate expires in RFC 3339 format,
* for example 2012-11-15T16:19:00.094Z.
*/
public val expirationTime: Output
get() = javaResource.expirationTime().applyValue({ args0 -> args0 })
/**
* The name of the Cloud SQL instance. Changing this
* forces a new resource to be created.
*/
public val instance: Output
get() = javaResource.instance().applyValue({ args0 -> args0 })
/**
* The private key associated with the client certificate.
*/
public val privateKey: Output
get() = javaResource.privateKey().applyValue({ args0 -> args0 })
/**
* The ID of the project in which the resource belongs. If it
* is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* The CA cert of the server this client cert was generated from.
*/
public val serverCaCert: Output
get() = javaResource.serverCaCert().applyValue({ args0 -> args0 })
/**
* The SHA1 Fingerprint of the certificate.
*/
public val sha1Fingerprint: Output
get() = javaResource.sha1Fingerprint().applyValue({ args0 -> args0 })
}
public object SslCertMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.sql.SslCert::class == javaResource::class
override fun map(javaResource: Resource): SslCert = SslCert(
javaResource as
com.pulumi.gcp.sql.SslCert,
)
}
/**
* @see [SslCert].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [SslCert].
*/
public suspend fun sslCert(name: String, block: suspend SslCertResourceBuilder.() -> Unit): SslCert {
val builder = SslCertResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [SslCert].
* @param name The _unique_ name of the resulting resource.
*/
public fun sslCert(name: String): SslCert {
val builder = SslCertResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy