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

com.pulumi.gcp.deploymentmanager.kotlin.DeploymentArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.deploymentmanager.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.deploymentmanager.DeploymentArgs.builder
import com.pulumi.gcp.deploymentmanager.kotlin.inputs.DeploymentLabelArgs
import com.pulumi.gcp.deploymentmanager.kotlin.inputs.DeploymentLabelArgsBuilder
import com.pulumi.gcp.deploymentmanager.kotlin.inputs.DeploymentTargetArgs
import com.pulumi.gcp.deploymentmanager.kotlin.inputs.DeploymentTargetArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * A collection of resources that are deployed and managed together using
 * a configuration file
 * > **Warning:** This resource is intended only to manage a Deployment resource,
 * and attempts to manage the Deployment's resources in the provider as well
 * will likely result in errors or unexpected behavior as the two tools
 * fight over ownership. We strongly discourage doing so unless you are an
 * experienced user of both tools.
 * In addition, due to limitations of the API, the provider will treat
 * deployments in preview as recreate-only for any update operation other
 * than actually deploying an in-preview deployment (i.e. `preview=true` to
 * `preview=false`).
 * ## Example Usage
 * ### Deployment Manager Deployment Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 * const deployment = new gcp.deploymentmanager.Deployment("deployment", {
 *     name: "my-deployment",
 *     target: {
 *         config: {
 *             content: std.file({
 *                 input: "path/to/config.yml",
 *             }).then(invoke => invoke.result),
 *         },
 *     },
 *     labels: [{
 *         key: "foo",
 *         value: "bar",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_std as std
 * deployment = gcp.deploymentmanager.Deployment("deployment",
 *     name="my-deployment",
 *     target={
 *         "config": {
 *             "content": std.file(input="path/to/config.yml").result,
 *         },
 *     },
 *     labels=[{
 *         "key": "foo",
 *         "value": "bar",
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var deployment = new Gcp.DeploymentManager.Deployment("deployment", new()
 *     {
 *         Name = "my-deployment",
 *         Target = new Gcp.DeploymentManager.Inputs.DeploymentTargetArgs
 *         {
 *             Config = new Gcp.DeploymentManager.Inputs.DeploymentTargetConfigArgs
 *             {
 *                 Content = Std.File.Invoke(new()
 *                 {
 *                     Input = "path/to/config.yml",
 *                 }).Apply(invoke => invoke.Result),
 *             },
 *         },
 *         Labels = new[]
 *         {
 *             new Gcp.DeploymentManager.Inputs.DeploymentLabelArgs
 *             {
 *                 Key = "foo",
 *                 Value = "bar",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/deploymentmanager"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		invokeFile, err := std.File(ctx, &std.FileArgs{
 * 			Input: "path/to/config.yml",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = deploymentmanager.NewDeployment(ctx, "deployment", &deploymentmanager.DeploymentArgs{
 * 			Name: pulumi.String("my-deployment"),
 * 			Target: &deploymentmanager.DeploymentTargetArgs{
 * 				Config: &deploymentmanager.DeploymentTargetConfigArgs{
 * 					Content: pulumi.String(invokeFile.Result),
 * 				},
 * 			},
 * 			Labels: deploymentmanager.DeploymentLabelArray{
 * 				&deploymentmanager.DeploymentLabelArgs{
 * 					Key:   pulumi.String("foo"),
 * 					Value: pulumi.String("bar"),
 * 				},
 * 			},
 * 		})
 * 		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.deploymentmanager.Deployment;
 * import com.pulumi.gcp.deploymentmanager.DeploymentArgs;
 * import com.pulumi.gcp.deploymentmanager.inputs.DeploymentTargetArgs;
 * import com.pulumi.gcp.deploymentmanager.inputs.DeploymentTargetConfigArgs;
 * import com.pulumi.gcp.deploymentmanager.inputs.DeploymentLabelArgs;
 * 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 deployment = new Deployment("deployment", DeploymentArgs.builder()
 *             .name("my-deployment")
 *             .target(DeploymentTargetArgs.builder()
 *                 .config(DeploymentTargetConfigArgs.builder()
 *                     .content(StdFunctions.file(FileArgs.builder()
 *                         .input("path/to/config.yml")
 *                         .build()).result())
 *                     .build())
 *                 .build())
 *             .labels(DeploymentLabelArgs.builder()
 *                 .key("foo")
 *                 .value("bar")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   deployment:
 *     type: gcp:deploymentmanager:Deployment
 *     properties:
 *       name: my-deployment
 *       target:
 *         config:
 *           content:
 *             fn::invoke:
 *               Function: std:file
 *               Arguments:
 *                 input: path/to/config.yml
 *               Return: result
 *       labels:
 *         - key: foo
 *           value: bar
 * ```
 * 
 * ## Import
 * Deployment can be imported using any of these accepted formats:
 * * `projects/{{project}}/deployments/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Deployment can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:deploymentmanager/deployment:Deployment default projects/{{project}}/deployments/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:deploymentmanager/deployment:Deployment default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:deploymentmanager/deployment:Deployment default {{name}}
 * ```
 * @property createPolicy Set the policy to use for creating new resources. Only used on create and update. Valid values are 'CREATE_OR_ACQUIRE'
 * (default) or 'ACQUIRE'. If set to 'ACQUIRE' and resources do not already exist, the deployment will fail. Note that
 * updating this field does not actually affect the deployment, just how it is updated. Default value: "CREATE_OR_ACQUIRE"
 * Possible values: ["ACQUIRE", "CREATE_OR_ACQUIRE"]
 * @property deletePolicy Set the policy to use for deleting new resources on update/delete. Valid values are 'DELETE' (default) or 'ABANDON'. If
 * 'DELETE', resource is deleted after removal from Deployment Manager. If 'ABANDON', the resource is only removed from
 * Deployment Manager and is not actually deleted. Note that updating this field does not actually change the deployment,
 * just how it is updated. Default value: "DELETE" Possible values: ["ABANDON", "DELETE"]
 * @property description Optional user-provided description of deployment.
 * @property labels Key-value pairs to apply to this labels.
 * @property name Unique name for the deployment
 * @property preview
 * @property project
 * @property target Parameters that define your deployment, including the deployment
 * configuration and relevant templates.
 * Structure is documented below.
 */
public data class DeploymentArgs(
    public val createPolicy: Output? = null,
    public val deletePolicy: Output? = null,
    public val description: Output? = null,
    public val labels: Output>? = null,
    public val name: Output? = null,
    public val preview: Output? = null,
    public val project: Output? = null,
    public val target: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.deploymentmanager.DeploymentArgs =
        com.pulumi.gcp.deploymentmanager.DeploymentArgs.builder()
            .createPolicy(createPolicy?.applyValue({ args0 -> args0 }))
            .deletePolicy(deletePolicy?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .labels(labels?.applyValue({ args0 -> args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) }) }))
            .name(name?.applyValue({ args0 -> args0 }))
            .preview(preview?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .target(target?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) })).build()
}

/**
 * Builder for [DeploymentArgs].
 */
@PulumiTagMarker
public class DeploymentArgsBuilder internal constructor() {
    private var createPolicy: Output? = null

    private var deletePolicy: Output? = null

    private var description: Output? = null

    private var labels: Output>? = null

    private var name: Output? = null

    private var preview: Output? = null

    private var project: Output? = null

    private var target: Output? = null

    /**
     * @param value Set the policy to use for creating new resources. Only used on create and update. Valid values are 'CREATE_OR_ACQUIRE'
     * (default) or 'ACQUIRE'. If set to 'ACQUIRE' and resources do not already exist, the deployment will fail. Note that
     * updating this field does not actually affect the deployment, just how it is updated. Default value: "CREATE_OR_ACQUIRE"
     * Possible values: ["ACQUIRE", "CREATE_OR_ACQUIRE"]
     */
    @JvmName("ngvlixqihoeypujy")
    public suspend fun createPolicy(`value`: Output) {
        this.createPolicy = value
    }

    /**
     * @param value Set the policy to use for deleting new resources on update/delete. Valid values are 'DELETE' (default) or 'ABANDON'. If
     * 'DELETE', resource is deleted after removal from Deployment Manager. If 'ABANDON', the resource is only removed from
     * Deployment Manager and is not actually deleted. Note that updating this field does not actually change the deployment,
     * just how it is updated. Default value: "DELETE" Possible values: ["ABANDON", "DELETE"]
     */
    @JvmName("tkdlyayeadleutao")
    public suspend fun deletePolicy(`value`: Output) {
        this.deletePolicy = value
    }

    /**
     * @param value Optional user-provided description of deployment.
     */
    @JvmName("cdegdffqnkvwplub")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Key-value pairs to apply to this labels.
     */
    @JvmName("vehvdjihvnoingph")
    public suspend fun labels(`value`: Output>) {
        this.labels = value
    }

    @JvmName("fhhwsfagnfwpemla")
    public suspend fun labels(vararg values: Output) {
        this.labels = Output.all(values.asList())
    }

    /**
     * @param values Key-value pairs to apply to this labels.
     */
    @JvmName("qaobsoqcwurgxfpq")
    public suspend fun labels(values: List>) {
        this.labels = Output.all(values)
    }

    /**
     * @param value Unique name for the deployment
     */
    @JvmName("ghpyibvxqqjahuiu")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

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

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

    /**
     * @param value Parameters that define your deployment, including the deployment
     * configuration and relevant templates.
     * Structure is documented below.
     */
    @JvmName("dtbdrakpseybjsgj")
    public suspend fun target(`value`: Output) {
        this.target = value
    }

    /**
     * @param value Set the policy to use for creating new resources. Only used on create and update. Valid values are 'CREATE_OR_ACQUIRE'
     * (default) or 'ACQUIRE'. If set to 'ACQUIRE' and resources do not already exist, the deployment will fail. Note that
     * updating this field does not actually affect the deployment, just how it is updated. Default value: "CREATE_OR_ACQUIRE"
     * Possible values: ["ACQUIRE", "CREATE_OR_ACQUIRE"]
     */
    @JvmName("mjjcvniwemlhugmg")
    public suspend fun createPolicy(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.createPolicy = mapped
    }

    /**
     * @param value Set the policy to use for deleting new resources on update/delete. Valid values are 'DELETE' (default) or 'ABANDON'. If
     * 'DELETE', resource is deleted after removal from Deployment Manager. If 'ABANDON', the resource is only removed from
     * Deployment Manager and is not actually deleted. Note that updating this field does not actually change the deployment,
     * just how it is updated. Default value: "DELETE" Possible values: ["ABANDON", "DELETE"]
     */
    @JvmName("sfofibxvpcmlobmu")
    public suspend fun deletePolicy(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.deletePolicy = mapped
    }

    /**
     * @param value Optional user-provided description of deployment.
     */
    @JvmName("lalraxmacjisfyhh")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Key-value pairs to apply to this labels.
     */
    @JvmName("chxechwwkwaivbeu")
    public suspend fun labels(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param argument Key-value pairs to apply to this labels.
     */
    @JvmName("txfwbilbgvsoxfdl")
    public suspend fun labels(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            DeploymentLabelArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.labels = mapped
    }

    /**
     * @param argument Key-value pairs to apply to this labels.
     */
    @JvmName("tpctkqkihyqfnrhp")
    public suspend fun labels(vararg argument: suspend DeploymentLabelArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            DeploymentLabelArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.labels = mapped
    }

    /**
     * @param argument Key-value pairs to apply to this labels.
     */
    @JvmName("dmefewfbwqjaqivr")
    public suspend fun labels(argument: suspend DeploymentLabelArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(DeploymentLabelArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.labels = mapped
    }

    /**
     * @param values Key-value pairs to apply to this labels.
     */
    @JvmName("eaxktfsjhdrssali")
    public suspend fun labels(vararg values: DeploymentLabelArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param value Unique name for the deployment
     */
    @JvmName("dwtqbpqvqrsawmiv")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

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

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

    /**
     * @param value Parameters that define your deployment, including the deployment
     * configuration and relevant templates.
     * Structure is documented below.
     */
    @JvmName("cyamdeasbgevgvdy")
    public suspend fun target(`value`: DeploymentTargetArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.target = mapped
    }

    /**
     * @param argument Parameters that define your deployment, including the deployment
     * configuration and relevant templates.
     * Structure is documented below.
     */
    @JvmName("itiggsyjwloqjvoo")
    public suspend fun target(argument: suspend DeploymentTargetArgsBuilder.() -> Unit) {
        val toBeMapped = DeploymentTargetArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.target = mapped
    }

    internal fun build(): DeploymentArgs = DeploymentArgs(
        createPolicy = createPolicy,
        deletePolicy = deletePolicy,
        description = description,
        labels = labels,
        name = name,
        preview = preview,
        project = project,
        target = target,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy