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

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

package com.pulumi.gcp.cloudrun.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.cloudrun.DomainMappingArgs.builder
import com.pulumi.gcp.cloudrun.kotlin.inputs.DomainMappingMetadataArgs
import com.pulumi.gcp.cloudrun.kotlin.inputs.DomainMappingMetadataArgsBuilder
import com.pulumi.gcp.cloudrun.kotlin.inputs.DomainMappingSpecArgs
import com.pulumi.gcp.cloudrun.kotlin.inputs.DomainMappingSpecArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName

/**
 * Resource to hold the state and status of a user's domain mapping.
 * To get more information about DomainMapping, see:
 * * [API documentation](https://cloud.google.com/run/docs/reference/rest/v1/projects.locations.domainmappings)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/run/docs/mapping-custom-domains)
 * ## Example Usage
 * ### Cloud Run Domain Mapping Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const _default = new gcp.cloudrun.Service("default", {
 *     name: "cloudrun-srv",
 *     location: "us-central1",
 *     metadata: {
 *         namespace: "my-project-name",
 *     },
 *     template: {
 *         spec: {
 *             containers: [{
 *                 image: "us-docker.pkg.dev/cloudrun/container/hello",
 *             }],
 *         },
 *     },
 * });
 * const defaultDomainMapping = new gcp.cloudrun.DomainMapping("default", {
 *     location: "us-central1",
 *     name: "verified-domain.com",
 *     metadata: {
 *         namespace: "my-project-name",
 *     },
 *     spec: {
 *         routeName: _default.name,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.cloudrun.Service("default",
 *     name="cloudrun-srv",
 *     location="us-central1",
 *     metadata=gcp.cloudrun.ServiceMetadataArgs(
 *         namespace="my-project-name",
 *     ),
 *     template=gcp.cloudrun.ServiceTemplateArgs(
 *         spec=gcp.cloudrun.ServiceTemplateSpecArgs(
 *             containers=[gcp.cloudrun.ServiceTemplateSpecContainerArgs(
 *                 image="us-docker.pkg.dev/cloudrun/container/hello",
 *             )],
 *         ),
 *     ))
 * default_domain_mapping = gcp.cloudrun.DomainMapping("default",
 *     location="us-central1",
 *     name="verified-domain.com",
 *     metadata=gcp.cloudrun.DomainMappingMetadataArgs(
 *         namespace="my-project-name",
 *     ),
 *     spec=gcp.cloudrun.DomainMappingSpecArgs(
 *         route_name=default.name,
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Gcp.CloudRun.Service("default", new()
 *     {
 *         Name = "cloudrun-srv",
 *         Location = "us-central1",
 *         Metadata = new Gcp.CloudRun.Inputs.ServiceMetadataArgs
 *         {
 *             Namespace = "my-project-name",
 *         },
 *         Template = new Gcp.CloudRun.Inputs.ServiceTemplateArgs
 *         {
 *             Spec = new Gcp.CloudRun.Inputs.ServiceTemplateSpecArgs
 *             {
 *                 Containers = new[]
 *                 {
 *                     new Gcp.CloudRun.Inputs.ServiceTemplateSpecContainerArgs
 *                     {
 *                         Image = "us-docker.pkg.dev/cloudrun/container/hello",
 *                     },
 *                 },
 *             },
 *         },
 *     });
 *     var defaultDomainMapping = new Gcp.CloudRun.DomainMapping("default", new()
 *     {
 *         Location = "us-central1",
 *         Name = "verified-domain.com",
 *         Metadata = new Gcp.CloudRun.Inputs.DomainMappingMetadataArgs
 *         {
 *             Namespace = "my-project-name",
 *         },
 *         Spec = new Gcp.CloudRun.Inputs.DomainMappingSpecArgs
 *         {
 *             RouteName = @default.Name,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrun"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := cloudrun.NewService(ctx, "default", &cloudrun.ServiceArgs{
 * 			Name:     pulumi.String("cloudrun-srv"),
 * 			Location: pulumi.String("us-central1"),
 * 			Metadata: &cloudrun.ServiceMetadataArgs{
 * 				Namespace: pulumi.String("my-project-name"),
 * 			},
 * 			Template: &cloudrun.ServiceTemplateArgs{
 * 				Spec: &cloudrun.ServiceTemplateSpecArgs{
 * 					Containers: cloudrun.ServiceTemplateSpecContainerArray{
 * 						&cloudrun.ServiceTemplateSpecContainerArgs{
 * 							Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cloudrun.NewDomainMapping(ctx, "default", &cloudrun.DomainMappingArgs{
 * 			Location: pulumi.String("us-central1"),
 * 			Name:     pulumi.String("verified-domain.com"),
 * 			Metadata: &cloudrun.DomainMappingMetadataArgs{
 * 				Namespace: pulumi.String("my-project-name"),
 * 			},
 * 			Spec: &cloudrun.DomainMappingSpecArgs{
 * 				RouteName: _default.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.gcp.cloudrun.Service;
 * import com.pulumi.gcp.cloudrun.ServiceArgs;
 * import com.pulumi.gcp.cloudrun.inputs.ServiceMetadataArgs;
 * import com.pulumi.gcp.cloudrun.inputs.ServiceTemplateArgs;
 * import com.pulumi.gcp.cloudrun.inputs.ServiceTemplateSpecArgs;
 * import com.pulumi.gcp.cloudrun.DomainMapping;
 * import com.pulumi.gcp.cloudrun.DomainMappingArgs;
 * import com.pulumi.gcp.cloudrun.inputs.DomainMappingMetadataArgs;
 * import com.pulumi.gcp.cloudrun.inputs.DomainMappingSpecArgs;
 * 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 Service("default", ServiceArgs.builder()
 *             .name("cloudrun-srv")
 *             .location("us-central1")
 *             .metadata(ServiceMetadataArgs.builder()
 *                 .namespace("my-project-name")
 *                 .build())
 *             .template(ServiceTemplateArgs.builder()
 *                 .spec(ServiceTemplateSpecArgs.builder()
 *                     .containers(ServiceTemplateSpecContainerArgs.builder()
 *                         .image("us-docker.pkg.dev/cloudrun/container/hello")
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *         var defaultDomainMapping = new DomainMapping("defaultDomainMapping", DomainMappingArgs.builder()
 *             .location("us-central1")
 *             .name("verified-domain.com")
 *             .metadata(DomainMappingMetadataArgs.builder()
 *                 .namespace("my-project-name")
 *                 .build())
 *             .spec(DomainMappingSpecArgs.builder()
 *                 .routeName(default_.name())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:cloudrun:Service
 *     properties:
 *       name: cloudrun-srv
 *       location: us-central1
 *       metadata:
 *         namespace: my-project-name
 *       template:
 *         spec:
 *           containers:
 *             - image: us-docker.pkg.dev/cloudrun/container/hello
 *   defaultDomainMapping:
 *     type: gcp:cloudrun:DomainMapping
 *     name: default
 *     properties:
 *       location: us-central1
 *       name: verified-domain.com
 *       metadata:
 *         namespace: my-project-name
 *       spec:
 *         routeName: ${default.name}
 * ```
 * 
 * ## Import
 * DomainMapping can be imported using any of these accepted formats:
 * * `locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}}`
 * * `{{location}}/{{project}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, DomainMapping can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:cloudrun/domainMapping:DomainMapping default locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:cloudrun/domainMapping:DomainMapping default {{location}}/{{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:cloudrun/domainMapping:DomainMapping default {{location}}/{{name}}
 * ```
 * @property location The location of the cloud run instance. eg us-central1
 * @property metadata Metadata associated with this DomainMapping.
 * @property name Name should be a [verified](https://support.google.com/webmasters/answer/9008080) domain
 * @property project
 * @property spec The spec for this DomainMapping.
 * Structure is documented below.
 */
public data class DomainMappingArgs(
    public val location: Output? = null,
    public val metadata: Output? = null,
    public val name: Output? = null,
    public val project: Output? = null,
    public val spec: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.cloudrun.DomainMappingArgs =
        com.pulumi.gcp.cloudrun.DomainMappingArgs.builder()
            .location(location?.applyValue({ args0 -> args0 }))
            .metadata(metadata?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .name(name?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .spec(spec?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) })).build()
}

/**
 * Builder for [DomainMappingArgs].
 */
@PulumiTagMarker
public class DomainMappingArgsBuilder internal constructor() {
    private var location: Output? = null

    private var metadata: Output? = null

    private var name: Output? = null

    private var project: Output? = null

    private var spec: Output? = null

    /**
     * @param value The location of the cloud run instance. eg us-central1
     */
    @JvmName("xkxcojbyjtxmnbtb")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value Metadata associated with this DomainMapping.
     */
    @JvmName("ihjlilooviekkvam")
    public suspend fun metadata(`value`: Output) {
        this.metadata = value
    }

    /**
     * @param value Name should be a [verified](https://support.google.com/webmasters/answer/9008080) domain
     */
    @JvmName("lpqhokgpyjghwsqx")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value
     */
    @JvmName("qxjqbfdedmukpcoe")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value The spec for this DomainMapping.
     * Structure is documented below.
     */
    @JvmName("ttcmppdwbuiyyina")
    public suspend fun spec(`value`: Output) {
        this.spec = value
    }

    /**
     * @param value The location of the cloud run instance. eg us-central1
     */
    @JvmName("phaxakpmqoxkwoco")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value Metadata associated with this DomainMapping.
     */
    @JvmName("ypotiysxbtetdnrv")
    public suspend fun metadata(`value`: DomainMappingMetadataArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.metadata = mapped
    }

    /**
     * @param argument Metadata associated with this DomainMapping.
     */
    @JvmName("rmyixgjklpujgmdb")
    public suspend fun metadata(argument: suspend DomainMappingMetadataArgsBuilder.() -> Unit) {
        val toBeMapped = DomainMappingMetadataArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.metadata = mapped
    }

    /**
     * @param value Name should be a [verified](https://support.google.com/webmasters/answer/9008080) domain
     */
    @JvmName("klghhpkyffrvveas")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value
     */
    @JvmName("okotweipkfejtmlc")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value The spec for this DomainMapping.
     * Structure is documented below.
     */
    @JvmName("sjsotiplagwdyhyg")
    public suspend fun spec(`value`: DomainMappingSpecArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.spec = mapped
    }

    /**
     * @param argument The spec for this DomainMapping.
     * Structure is documented below.
     */
    @JvmName("eniuhpxqubmjgqut")
    public suspend fun spec(argument: suspend DomainMappingSpecArgsBuilder.() -> Unit) {
        val toBeMapped = DomainMappingSpecArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.spec = mapped
    }

    internal fun build(): DomainMappingArgs = DomainMappingArgs(
        location = location,
        metadata = metadata,
        name = name,
        project = project,
        spec = spec,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy