com.pulumi.aws.opensearch.kotlin.ServerlessLifecyclePolicy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-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.aws.opensearch.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 [ServerlessLifecyclePolicy].
*/
@PulumiTagMarker
public class ServerlessLifecyclePolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: ServerlessLifecyclePolicyArgs = ServerlessLifecyclePolicyArgs()
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 ServerlessLifecyclePolicyArgsBuilder.() -> Unit) {
val builder = ServerlessLifecyclePolicyArgsBuilder()
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(): ServerlessLifecyclePolicy {
val builtJavaResource =
com.pulumi.aws.opensearch.ServerlessLifecyclePolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ServerlessLifecyclePolicy(builtJavaResource)
}
}
/**
* Resource for managing an AWS OpenSearch Serverless Lifecycle Policy. See AWS documentation for [lifecycle policies](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-lifecycle.html).
* ## Example Usage
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.opensearch.ServerlessLifecyclePolicy("example", {
* name: "example",
* type: "retention",
* policy: JSON.stringify({
* Rules: [
* {
* ResourceType: "index",
* Resource: ["index/autoparts-inventory/*"],
* MinIndexRetention: "81d",
* },
* {
* ResourceType: "index",
* Resource: ["index/sales/orders*"],
* NoMinIndexRetention: true,
* },
* ],
* }),
* });
* ```
* ```python
* import pulumi
* import json
* import pulumi_aws as aws
* example = aws.opensearch.ServerlessLifecyclePolicy("example",
* name="example",
* type="retention",
* policy=json.dumps({
* "Rules": [
* {
* "ResourceType": "index",
* "Resource": ["index/autoparts-inventory/*"],
* "MinIndexRetention": "81d",
* },
* {
* "ResourceType": "index",
* "Resource": ["index/sales/orders*"],
* "NoMinIndexRetention": True,
* },
* ],
* }))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using System.Text.Json;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.OpenSearch.ServerlessLifecyclePolicy("example", new()
* {
* Name = "example",
* Type = "retention",
* Policy = JsonSerializer.Serialize(new Dictionary
* {
* ["Rules"] = new[]
* {
* new Dictionary
* {
* ["ResourceType"] = "index",
* ["Resource"] = new[]
* {
* "index/autoparts-inventory/*",
* },
* ["MinIndexRetention"] = "81d",
* },
* new Dictionary
* {
* ["ResourceType"] = "index",
* ["Resource"] = new[]
* {
* "index/sales/orders*",
* },
* ["NoMinIndexRetention"] = true,
* },
* },
* }),
* });
* });
* ```
* ```go
* package main
* import (
* "encoding/json"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/opensearch"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* tmpJSON0, err := json.Marshal(map[string]interface{}{
* "Rules": []interface{}{
* map[string]interface{}{
* "ResourceType": "index",
* "Resource": []string{
* "index/autoparts-inventory/*",
* },
* "MinIndexRetention": "81d",
* },
* map[string]interface{}{
* "ResourceType": "index",
* "Resource": []string{
* "index/sales/orders*",
* },
* "NoMinIndexRetention": true,
* },
* },
* })
* if err != nil {
* return err
* }
* json0 := string(tmpJSON0)
* _, err = opensearch.NewServerlessLifecyclePolicy(ctx, "example", &opensearch.ServerlessLifecyclePolicyArgs{
* Name: pulumi.String("example"),
* Type: pulumi.String("retention"),
* Policy: pulumi.String(json0),
* })
* 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.aws.opensearch.ServerlessLifecyclePolicy;
* import com.pulumi.aws.opensearch.ServerlessLifecyclePolicyArgs;
* import static com.pulumi.codegen.internal.Serialization.*;
* 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 example = new ServerlessLifecyclePolicy("example", ServerlessLifecyclePolicyArgs.builder()
* .name("example")
* .type("retention")
* .policy(serializeJson(
* jsonObject(
* jsonProperty("Rules", jsonArray(
* jsonObject(
* jsonProperty("ResourceType", "index"),
* jsonProperty("Resource", jsonArray("index/autoparts-inventory/*")),
* jsonProperty("MinIndexRetention", "81d")
* ),
* jsonObject(
* jsonProperty("ResourceType", "index"),
* jsonProperty("Resource", jsonArray("index/sales/orders*")),
* jsonProperty("NoMinIndexRetention", true)
* )
* ))
* )))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:opensearch:ServerlessLifecyclePolicy
* properties:
* name: example
* type: retention
* policy:
* fn::toJSON:
* Rules:
* - ResourceType: index
* Resource:
* - index/autoparts-inventory/*
* MinIndexRetention: 81d
* - ResourceType: index
* Resource:
* - index/sales/orders*
* NoMinIndexRetention: true
* ```
*
* ## Import
* Using `pulumi import`, import OpenSearch Serverless Lifecycle Policy using the `name` and `type` arguments separated by a slash (`/`). For example:
* ```sh
* $ pulumi import aws:opensearch/serverlessLifecyclePolicy:ServerlessLifecyclePolicy example example/retention
* ```
* */*/*/*/*/*/
*/
public class ServerlessLifecyclePolicy internal constructor(
override val javaResource: com.pulumi.aws.opensearch.ServerlessLifecyclePolicy,
) : KotlinCustomResource(javaResource, ServerlessLifecyclePolicyMapper) {
/**
* Description of the policy.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Name of the policy.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* JSON policy document to use as the content for the new policy.
*/
public val policy: Output
get() = javaResource.policy().applyValue({ args0 -> args0 })
/**
* Version of the policy.
*/
public val policyVersion: Output
get() = javaResource.policyVersion().applyValue({ args0 -> args0 })
/**
* Type of lifecycle policy. Must be `retention`.
* The following arguments are optional:
*/
public val type: Output
get() = javaResource.type().applyValue({ args0 -> args0 })
}
public object ServerlessLifecyclePolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.aws.opensearch.ServerlessLifecyclePolicy::class == javaResource::class
override fun map(javaResource: Resource): ServerlessLifecyclePolicy =
ServerlessLifecyclePolicy(javaResource as com.pulumi.aws.opensearch.ServerlessLifecyclePolicy)
}
/**
* @see [ServerlessLifecyclePolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ServerlessLifecyclePolicy].
*/
public suspend fun serverlessLifecyclePolicy(
name: String,
block: suspend ServerlessLifecyclePolicyResourceBuilder.() -> Unit,
): ServerlessLifecyclePolicy {
val builder = ServerlessLifecyclePolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ServerlessLifecyclePolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun serverlessLifecyclePolicy(name: String): ServerlessLifecyclePolicy {
val builder = ServerlessLifecyclePolicyResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy