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

com.pulumi.gcp.certificatemanager.kotlin.DnsAuthorization.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: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.certificatemanager.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.certificatemanager.kotlin.outputs.DnsAuthorizationDnsResourceRecord
import com.pulumi.gcp.certificatemanager.kotlin.outputs.DnsAuthorizationDnsResourceRecord.Companion.toKotlin
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 kotlin.collections.Map

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

    public var args: DnsAuthorizationArgs = DnsAuthorizationArgs()

    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 DnsAuthorizationArgsBuilder.() -> Unit) {
        val builder = DnsAuthorizationArgsBuilder()
        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(): DnsAuthorization {
        val builtJavaResource =
            com.pulumi.gcp.certificatemanager.DnsAuthorization(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return DnsAuthorization(builtJavaResource)
    }
}

/**
 * DnsAuthorization represents a HTTP-reachable backend for a DnsAuthorization.
 * ## Example Usage
 * ### Certificate Manager Dns Authorization Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.certificatemanager.DnsAuthorization("default", {
 *     name: "dns-auth",
 *     location: "global",
 *     description: "The default dns",
 *     domain: "subdomain.hashicorptest.com",
 * });
 * export const recordNameToInsert = _default.dnsResourceRecords.apply(dnsResourceRecords => dnsResourceRecords[0].name);
 * export const recordTypeToInsert = _default.dnsResourceRecords.apply(dnsResourceRecords => dnsResourceRecords[0].type);
 * export const recordDataToInsert = _default.dnsResourceRecords.apply(dnsResourceRecords => dnsResourceRecords[0].data);
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.certificatemanager.DnsAuthorization("default",
 *     name="dns-auth",
 *     location="global",
 *     description="The default dns",
 *     domain="subdomain.hashicorptest.com")
 * pulumi.export("recordNameToInsert", default.dns_resource_records[0].name)
 * pulumi.export("recordTypeToInsert", default.dns_resource_records[0].type)
 * pulumi.export("recordDataToInsert", default.dns_resource_records[0].data)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.CertificateManager.DnsAuthorization("default", new()
 *     {
 *         Name = "dns-auth",
 *         Location = "global",
 *         Description = "The default dns",
 *         Domain = "subdomain.hashicorptest.com",
 *     });
 *     return new Dictionary
 *     {
 *         ["recordNameToInsert"] = @default.DnsResourceRecords.Apply(dnsResourceRecords => dnsResourceRecords[0].Name),
 *         ["recordTypeToInsert"] = @default.DnsResourceRecords.Apply(dnsResourceRecords => dnsResourceRecords[0].Type),
 *         ["recordDataToInsert"] = @default.DnsResourceRecords.Apply(dnsResourceRecords => dnsResourceRecords[0].Data),
 *     };
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/certificatemanager"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := certificatemanager.NewDnsAuthorization(ctx, "default", &certificatemanager.DnsAuthorizationArgs{
 * 			Name:        pulumi.String("dns-auth"),
 * 			Location:    pulumi.String("global"),
 * 			Description: pulumi.String("The default dns"),
 * 			Domain:      pulumi.String("subdomain.hashicorptest.com"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		ctx.Export("recordNameToInsert", _default.DnsResourceRecords.ApplyT(func(dnsResourceRecords []certificatemanager.DnsAuthorizationDnsResourceRecord) (*string, error) {
 * 			return &dnsResourceRecords[0].Name, nil
 * 		}).(pulumi.StringPtrOutput))
 * 		ctx.Export("recordTypeToInsert", _default.DnsResourceRecords.ApplyT(func(dnsResourceRecords []certificatemanager.DnsAuthorizationDnsResourceRecord) (*string, error) {
 * 			return &dnsResourceRecords[0].Type, nil
 * 		}).(pulumi.StringPtrOutput))
 * 		ctx.Export("recordDataToInsert", _default.DnsResourceRecords.ApplyT(func(dnsResourceRecords []certificatemanager.DnsAuthorizationDnsResourceRecord) (*string, error) {
 * 			return &dnsResourceRecords[0].Data, nil
 * 		}).(pulumi.StringPtrOutput))
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.certificatemanager.DnsAuthorization;
 * import com.pulumi.gcp.certificatemanager.DnsAuthorizationArgs;
 * 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 default_ = new DnsAuthorization("default", DnsAuthorizationArgs.builder()
 *             .name("dns-auth")
 *             .location("global")
 *             .description("The default dns")
 *             .domain("subdomain.hashicorptest.com")
 *             .build());
 *         ctx.export("recordNameToInsert", default_.dnsResourceRecords().applyValue(dnsResourceRecords -> dnsResourceRecords[0].name()));
 *         ctx.export("recordTypeToInsert", default_.dnsResourceRecords().applyValue(dnsResourceRecords -> dnsResourceRecords[0].type()));
 *         ctx.export("recordDataToInsert", default_.dnsResourceRecords().applyValue(dnsResourceRecords -> dnsResourceRecords[0].data()));
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:certificatemanager:DnsAuthorization
 *     properties:
 *       name: dns-auth
 *       location: global
 *       description: The default dns
 *       domain: subdomain.hashicorptest.com
 * outputs:
 *   recordNameToInsert: ${default.dnsResourceRecords[0].name}
 *   recordTypeToInsert: ${default.dnsResourceRecords[0].type}
 *   recordDataToInsert: ${default.dnsResourceRecords[0].data}
 * ```
 * 
 * ### Certificate Manager Dns Authorization Regional
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.certificatemanager.DnsAuthorization("default", {
 *     name: "dns-auth",
 *     location: "us-central1",
 *     description: "reginal dns",
 *     type: "PER_PROJECT_RECORD",
 *     domain: "subdomain.hashicorptest.com",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.certificatemanager.DnsAuthorization("default",
 *     name="dns-auth",
 *     location="us-central1",
 *     description="reginal dns",
 *     type="PER_PROJECT_RECORD",
 *     domain="subdomain.hashicorptest.com")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.CertificateManager.DnsAuthorization("default", new()
 *     {
 *         Name = "dns-auth",
 *         Location = "us-central1",
 *         Description = "reginal dns",
 *         Type = "PER_PROJECT_RECORD",
 *         Domain = "subdomain.hashicorptest.com",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/certificatemanager"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := certificatemanager.NewDnsAuthorization(ctx, "default", &certificatemanager.DnsAuthorizationArgs{
 * 			Name:        pulumi.String("dns-auth"),
 * 			Location:    pulumi.String("us-central1"),
 * 			Description: pulumi.String("reginal dns"),
 * 			Type:        pulumi.String("PER_PROJECT_RECORD"),
 * 			Domain:      pulumi.String("subdomain.hashicorptest.com"),
 * 		})
 * 		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.gcp.certificatemanager.DnsAuthorization;
 * import com.pulumi.gcp.certificatemanager.DnsAuthorizationArgs;
 * 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 default_ = new DnsAuthorization("default", DnsAuthorizationArgs.builder()
 *             .name("dns-auth")
 *             .location("us-central1")
 *             .description("reginal dns")
 *             .type("PER_PROJECT_RECORD")
 *             .domain("subdomain.hashicorptest.com")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:certificatemanager:DnsAuthorization
 *     properties:
 *       name: dns-auth
 *       location: us-central1
 *       description: reginal dns
 *       type: PER_PROJECT_RECORD
 *       domain: subdomain.hashicorptest.com
 * ```
 * 
 * ## Import
 * DnsAuthorization can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/dnsAuthorizations/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, DnsAuthorization can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:certificatemanager/dnsAuthorization:DnsAuthorization default projects/{{project}}/locations/{{location}}/dnsAuthorizations/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:certificatemanager/dnsAuthorization:DnsAuthorization default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:certificatemanager/dnsAuthorization:DnsAuthorization default {{location}}/{{name}}
 * ```
 */
public class DnsAuthorization internal constructor(
    override val javaResource: com.pulumi.gcp.certificatemanager.DnsAuthorization,
) : KotlinCustomResource(javaResource, DnsAuthorizationMapper) {
    /**
     * A human-readable description of the resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The structure describing the DNS Resource Record that needs to be added
     * to DNS configuration for the authorization to be usable by
     * certificate.
     * Structure is documented below.
     */
    public val dnsResourceRecords: Output>
        get() = javaResource.dnsResourceRecords().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            })
        })

    /**
     * A domain which is being authorized. A DnsAuthorization resource covers a
     * single domain and its wildcard, e.g. authorization for "example.com" can
     * be used to issue certificates for "example.com" and "*.example.com".
     */
    public val domain: Output
        get() = javaResource.domain().applyValue({ args0 -> args0 })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Set of label tags associated with the DNS Authorization resource.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The Certificate Manager location. If not specified, "global" is used.
     */
    public val location: Output?
        get() = javaResource.location().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Name of the resource; provided by the client when the resource is created.
     * The name must be 1-64 characters long, and match the regular expression [a-zA-Z][a-zA-Z0-9_-]* which means the first character must be a letter,
     * and all following characters must be a dash, underscore, letter or digit.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().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 combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * type of DNS authorization. If unset during the resource creation, FIXED_RECORD will
     * be used for global resources, and PER_PROJECT_RECORD will be used for other locations.
     * FIXED_RECORD DNS authorization uses DNS-01 validation method
     * PER_PROJECT_RECORD DNS authorization allows for independent management
     * of Google-managed certificates with DNS authorization across multiple
     * projects.
     * Possible values are: `FIXED_RECORD`, `PER_PROJECT_RECORD`.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object DnsAuthorizationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.certificatemanager.DnsAuthorization::class == javaResource::class

    override fun map(javaResource: Resource): DnsAuthorization = DnsAuthorization(
        javaResource as
            com.pulumi.gcp.certificatemanager.DnsAuthorization,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy