com.pulumi.gcp.deploymentmanager.kotlin.Deployment.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.deploymentmanager.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.deploymentmanager.kotlin.outputs.DeploymentLabel
import com.pulumi.gcp.deploymentmanager.kotlin.outputs.DeploymentTarget
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.gcp.deploymentmanager.kotlin.outputs.DeploymentLabel.Companion.toKotlin as deploymentLabelToKotlin
import com.pulumi.gcp.deploymentmanager.kotlin.outputs.DeploymentTarget.Companion.toKotlin as deploymentTargetToKotlin
/**
* Builder for [Deployment].
*/
@PulumiTagMarker
public class DeploymentResourceBuilder internal constructor() {
public var name: String? = null
public var args: DeploymentArgs = DeploymentArgs()
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 DeploymentArgsBuilder.() -> Unit) {
val builder = DeploymentArgsBuilder()
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(): Deployment {
val builtJavaResource = com.pulumi.gcp.deploymentmanager.Deployment(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Deployment(builtJavaResource)
}
}
/**
* 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=gcp.deploymentmanager.DeploymentTargetArgs(
* config=gcp.deploymentmanager.DeploymentTargetConfigArgs(
* content=std.file(input="path/to/config.yml").result,
* ),
* ),
* labels=[gcp.deploymentmanager.DeploymentLabelArgs(
* 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: 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}}
* ```
*/
public class Deployment internal constructor(
override val javaResource: com.pulumi.gcp.deploymentmanager.Deployment,
) : KotlinCustomResource(javaResource, DeploymentMapper) {
/**
* 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"]
*/
public val createPolicy: Output?
get() = javaResource.createPolicy().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* 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"]
*/
public val deletePolicy: Output?
get() = javaResource.deletePolicy().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Unique identifier for deployment. Output only.
*/
public val deploymentId: Output
get() = javaResource.deploymentId().applyValue({ args0 -> args0 })
/**
* Optional user-provided description of deployment.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Key-value pairs to apply to this labels.
*/
public val labels: Output>?
get() = javaResource.labels().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> deploymentLabelToKotlin(args0) })
})
}).orElse(null)
})
/**
* Output only. URL of the manifest representing the last manifest that
* was successfully deployed.
*/
public val manifest: Output
get() = javaResource.manifest().applyValue({ args0 -> args0 })
/**
* Unique name for the deployment
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
public val preview: Output?
get() = javaResource.preview().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* Output only. Server defined URL for the resource.
*/
public val selfLink: Output
get() = javaResource.selfLink().applyValue({ args0 -> args0 })
/**
* Parameters that define your deployment, including the deployment
* configuration and relevant templates.
* Structure is documented below.
*/
public val target: Output
get() = javaResource.target().applyValue({ args0 ->
args0.let({ args0 ->
deploymentTargetToKotlin(args0)
})
})
}
public object DeploymentMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.deploymentmanager.Deployment::class == javaResource::class
override fun map(javaResource: Resource): Deployment = Deployment(
javaResource as
com.pulumi.gcp.deploymentmanager.Deployment,
)
}
/**
* @see [Deployment].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Deployment].
*/
public suspend fun deployment(name: String, block: suspend DeploymentResourceBuilder.() -> Unit): Deployment {
val builder = DeploymentResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Deployment].
* @param name The _unique_ name of the resulting resource.
*/
public fun deployment(name: String): Deployment {
val builder = DeploymentResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy