com.pulumi.alicloud.dcdn.kotlin.KvNamespace.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-alicloud-kotlin Show documentation
Show all versions of pulumi-alicloud-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.alicloud.dcdn.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 [KvNamespace].
*/
@PulumiTagMarker
public class KvNamespaceResourceBuilder internal constructor() {
public var name: String? = null
public var args: KvNamespaceArgs = KvNamespaceArgs()
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 KvNamespaceArgsBuilder.() -> Unit) {
val builder = KvNamespaceArgsBuilder()
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(): KvNamespace {
val builtJavaResource = com.pulumi.alicloud.dcdn.KvNamespace(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return KvNamespace(builtJavaResource)
}
}
/**
* Provides a Dcdn Kv Namespace resource.
* For information about Dcdn Kv Namespace and how to use it, see [What is Kv Namespace](https://www.alibabacloud.com/help/en/dcdn/developer-reference/api-dcdn-2018-01-15-putdcdnkvnamespace).
* > **NOTE:** Available since v1.198.0.
* ## Example Usage
* Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as alicloud from "@pulumi/alicloud";
* import * as random from "@pulumi/random";
* const config = new pulumi.Config();
* const name = config.get("name") || "terraform-example";
* const _default = new random.index.Integer("default", {
* min: 10000,
* max: 99999,
* });
* const defaultKvNamespace = new alicloud.dcdn.KvNamespace("default", {
* description: name,
* namespace: `${name}-${_default.result}`,
* });
* ```
* ```python
* import pulumi
* import pulumi_alicloud as alicloud
* import pulumi_random as random
* config = pulumi.Config()
* name = config.get("name")
* if name is None:
* name = "terraform-example"
* default = random.index.Integer("default",
* min=10000,
* max=99999)
* default_kv_namespace = alicloud.dcdn.KvNamespace("default",
* description=name,
* namespace=f"{name}-{default['result']}")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AliCloud = Pulumi.AliCloud;
* using Random = Pulumi.Random;
* return await Deployment.RunAsync(() =>
* {
* var config = new Config();
* var name = config.Get("name") ?? "terraform-example";
* var @default = new Random.Index.Integer("default", new()
* {
* Min = 10000,
* Max = 99999,
* });
* var defaultKvNamespace = new AliCloud.Dcdn.KvNamespace("default", new()
* {
* Description = name,
* Namespace = $"{name}-{@default.Result}",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dcdn"
* "github.com/pulumi/pulumi-random/sdk/v4/go/random"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* cfg := config.New(ctx, "")
* name := "terraform-example"
* if param := cfg.Get("name"); param != "" {
* name = param
* }
* _, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
* Min: 10000,
* Max: 99999,
* })
* if err != nil {
* return err
* }
* _, err = dcdn.NewKvNamespace(ctx, "default", &dcdn.KvNamespaceArgs{
* Description: pulumi.String(name),
* Namespace: pulumi.Sprintf("%v-%v", name, _default.Result),
* })
* 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.integer;
* import com.pulumi.random.IntegerArgs;
* import com.pulumi.alicloud.dcdn.KvNamespace;
* import com.pulumi.alicloud.dcdn.KvNamespaceArgs;
* 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) {
* final var config = ctx.config();
* final var name = config.get("name").orElse("terraform-example");
* var default_ = new Integer("default", IntegerArgs.builder()
* .min(10000)
* .max(99999)
* .build());
* var defaultKvNamespace = new KvNamespace("defaultKvNamespace", KvNamespaceArgs.builder()
* .description(name)
* .namespace(String.format("%s-%s", name,default_.result()))
* .build());
* }
* }
* ```
* ```yaml
* configuration:
* name:
* type: string
* default: terraform-example
* resources:
* default:
* type: random:integer
* properties:
* min: 10000
* max: 99999
* defaultKvNamespace:
* type: alicloud:dcdn:KvNamespace
* name: default
* properties:
* description: ${name}
* namespace: ${name}-${default.result}
* ```
*
* ## Import
* Dcdn Kv Namespace can be imported using the id, e.g.
* ```sh
* $ pulumi import alicloud:dcdn/kvNamespace:KvNamespace example
* ```
*/
public class KvNamespace internal constructor(
override val javaResource: com.pulumi.alicloud.dcdn.KvNamespace,
) : KotlinCustomResource(javaResource, KvNamespaceMapper) {
/**
* Namespace description information
*/
public val description: Output
get() = javaResource.description().applyValue({ args0 -> args0 })
/**
* Namespace name. The name can contain letters, digits, hyphens (-), and underscores (_).
*/
public val namespace: Output
get() = javaResource.namespace().applyValue({ args0 -> args0 })
/**
* The status of the resource
*/
public val status: Output
get() = javaResource.status().applyValue({ args0 -> args0 })
}
public object KvNamespaceMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.alicloud.dcdn.KvNamespace::class == javaResource::class
override fun map(javaResource: Resource): KvNamespace = KvNamespace(
javaResource as
com.pulumi.alicloud.dcdn.KvNamespace,
)
}
/**
* @see [KvNamespace].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [KvNamespace].
*/
public suspend fun kvNamespace(name: String, block: suspend KvNamespaceResourceBuilder.() -> Unit): KvNamespace {
val builder = KvNamespaceResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [KvNamespace].
* @param name The _unique_ name of the resulting resource.
*/
public fun kvNamespace(name: String): KvNamespace {
val builder = KvNamespaceResourceBuilder()
builder.name(name)
return builder.build()
}