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

com.pulumi.aws.memorydb.kotlin.Cluster.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: 6.66.3.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.memorydb.kotlin

import com.pulumi.aws.memorydb.kotlin.outputs.ClusterClusterEndpoint
import com.pulumi.aws.memorydb.kotlin.outputs.ClusterShard
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.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.aws.memorydb.kotlin.outputs.ClusterClusterEndpoint.Companion.toKotlin as clusterClusterEndpointToKotlin
import com.pulumi.aws.memorydb.kotlin.outputs.ClusterShard.Companion.toKotlin as clusterShardToKotlin

/**
 * Builder for [Cluster].
 */
@PulumiTagMarker
public class ClusterResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ClusterArgs = ClusterArgs()

    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 ClusterArgsBuilder.() -> Unit) {
        val builder = ClusterArgsBuilder()
        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(): Cluster {
        val builtJavaResource = com.pulumi.aws.memorydb.Cluster(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Cluster(builtJavaResource)
    }
}

/**
 * Provides a MemoryDB Cluster.
 * More information about MemoryDB can be found in the [Developer Guide](https://docs.aws.amazon.com/memorydb/latest/devguide/what-is-memorydb-for-redis.html).
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.memorydb.Cluster("example", {
 *     aclName: "open-access",
 *     name: "my-cluster",
 *     nodeType: "db.t4g.small",
 *     numShards: 2,
 *     securityGroupIds: [exampleAwsSecurityGroup.id],
 *     snapshotRetentionLimit: 7,
 *     subnetGroupName: exampleAwsMemorydbSubnetGroup.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.memorydb.Cluster("example",
 *     acl_name="open-access",
 *     name="my-cluster",
 *     node_type="db.t4g.small",
 *     num_shards=2,
 *     security_group_ids=[example_aws_security_group["id"]],
 *     snapshot_retention_limit=7,
 *     subnet_group_name=example_aws_memorydb_subnet_group["id"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.MemoryDb.Cluster("example", new()
 *     {
 *         AclName = "open-access",
 *         Name = "my-cluster",
 *         NodeType = "db.t4g.small",
 *         NumShards = 2,
 *         SecurityGroupIds = new[]
 *         {
 *             exampleAwsSecurityGroup.Id,
 *         },
 *         SnapshotRetentionLimit = 7,
 *         SubnetGroupName = exampleAwsMemorydbSubnetGroup.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/memorydb"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := memorydb.NewCluster(ctx, "example", &memorydb.ClusterArgs{
 * 			AclName:   pulumi.String("open-access"),
 * 			Name:      pulumi.String("my-cluster"),
 * 			NodeType:  pulumi.String("db.t4g.small"),
 * 			NumShards: pulumi.Int(2),
 * 			SecurityGroupIds: pulumi.StringArray{
 * 				exampleAwsSecurityGroup.Id,
 * 			},
 * 			SnapshotRetentionLimit: pulumi.Int(7),
 * 			SubnetGroupName:        pulumi.Any(exampleAwsMemorydbSubnetGroup.Id),
 * 		})
 * 		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.memorydb.Cluster;
 * import com.pulumi.aws.memorydb.ClusterArgs;
 * 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 Cluster("example", ClusterArgs.builder()
 *             .aclName("open-access")
 *             .name("my-cluster")
 *             .nodeType("db.t4g.small")
 *             .numShards(2)
 *             .securityGroupIds(exampleAwsSecurityGroup.id())
 *             .snapshotRetentionLimit(7)
 *             .subnetGroupName(exampleAwsMemorydbSubnetGroup.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:memorydb:Cluster
 *     properties:
 *       aclName: open-access
 *       name: my-cluster
 *       nodeType: db.t4g.small
 *       numShards: 2
 *       securityGroupIds:
 *         - ${exampleAwsSecurityGroup.id}
 *       snapshotRetentionLimit: 7
 *       subnetGroupName: ${exampleAwsMemorydbSubnetGroup.id}
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import a cluster using the `name`. For example:
 * ```sh
 * $ pulumi import aws:memorydb/cluster:Cluster example my-cluster
 * ```
 */
public class Cluster internal constructor(
    override val javaResource: com.pulumi.aws.memorydb.Cluster,
) : KotlinCustomResource(javaResource, ClusterMapper) {
    /**
     * The name of the Access Control List to associate with the cluster.
     */
    public val aclName: Output
        get() = javaResource.aclName().applyValue({ args0 -> args0 })

    /**
     * The ARN of the cluster.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * When set to `true`, the cluster will automatically receive minor engine version upgrades after launch. Defaults to `true`.
     */
    public val autoMinorVersionUpgrade: Output?
        get() = javaResource.autoMinorVersionUpgrade().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    public val clusterEndpoints: Output>
        get() = javaResource.clusterEndpoints().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> clusterClusterEndpointToKotlin(args0) })
            })
        })

    /**
     * Enables data tiering. This option is not supported by all instance types. For more information, see [Data tiering](https://docs.aws.amazon.com/memorydb/latest/devguide/data-tiering.html).
     */
    public val dataTiering: Output?
        get() = javaResource.dataTiering().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Description for the cluster.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Patch version number of the Redis engine used by the cluster.
     */
    public val enginePatchVersion: Output
        get() = javaResource.enginePatchVersion().applyValue({ args0 -> args0 })

    /**
     * Version number of the Redis engine to be used for the cluster. Downgrades are not supported.
     */
    public val engineVersion: Output
        get() = javaResource.engineVersion().applyValue({ args0 -> args0 })

    /**
     * Name of the final cluster snapshot to be created when this resource is deleted. If omitted, no final snapshot will be made.
     */
    public val finalSnapshotName: Output?
        get() = javaResource.finalSnapshotName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * ARN of the KMS key used to encrypt the cluster at rest.
     */
    public val kmsKeyArn: Output?
        get() = javaResource.kmsKeyArn().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies the weekly time range during which maintenance on the cluster is performed. Specify as a range in the format `ddd:hh24:mi-ddd:hh24:mi` (24H Clock UTC). The minimum maintenance window is a 60 minute period. Example: `sun:23:00-mon:01:30`.
     */
    public val maintenanceWindow: Output
        get() = javaResource.maintenanceWindow().applyValue({ args0 -> args0 })

    /**
     * Name of the cluster. If omitted, the provider will assign a random, unique name. Conflicts with `name_prefix`.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Creates a unique name beginning with the specified prefix. Conflicts with `name`.
     */
    public val namePrefix: Output
        get() = javaResource.namePrefix().applyValue({ args0 -> args0 })

    /**
     * The compute and memory capacity of the nodes in the cluster. See AWS documentation on [supported node types](https://docs.aws.amazon.com/memorydb/latest/devguide/nodes.supportedtypes.html) as well as [vertical scaling](https://docs.aws.amazon.com/memorydb/latest/devguide/cluster-vertical-scaling.html).
     * The following arguments are optional:
     */
    public val nodeType: Output
        get() = javaResource.nodeType().applyValue({ args0 -> args0 })

    /**
     * The number of replicas to apply to each shard, up to a maximum of 5. Defaults to `1` (i.e. 2 nodes per shard).
     */
    public val numReplicasPerShard: Output?
        get() = javaResource.numReplicasPerShard().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The number of shards in the cluster. Defaults to `1`.
     */
    public val numShards: Output?
        get() = javaResource.numShards().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name of the parameter group associated with the cluster.
     */
    public val parameterGroupName: Output
        get() = javaResource.parameterGroupName().applyValue({ args0 -> args0 })

    /**
     * The port number on which each of the nodes accepts connections. Defaults to `6379`.
     */
    public val port: Output
        get() = javaResource.port().applyValue({ args0 -> args0 })

    /**
     * Set of VPC Security Group ID-s to associate with this cluster.
     */
    public val securityGroupIds: Output>?
        get() = javaResource.securityGroupIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * Set of shards in this cluster.
     */
    public val shards: Output>
        get() = javaResource.shards().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    clusterShardToKotlin(args0)
                })
            })
        })

    /**
     * List of ARN-s that uniquely identify RDB snapshot files stored in S3. The snapshot files will be used to populate the new cluster. Object names in the ARN-s cannot contain any commas.
     */
    public val snapshotArns: Output>?
        get() = javaResource.snapshotArns().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The name of a snapshot from which to restore data into the new cluster.
     */
    public val snapshotName: Output?
        get() = javaResource.snapshotName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The number of days for which MemoryDB retains automatic snapshots before deleting them. When set to `0`, automatic backups are disabled. Defaults to `0`.
     */
    public val snapshotRetentionLimit: Output
        get() = javaResource.snapshotRetentionLimit().applyValue({ args0 -> args0 })

    /**
     * The daily time range (in UTC) during which MemoryDB begins taking a daily snapshot of your shard. Example: `05:00-09:00`.
     */
    public val snapshotWindow: Output
        get() = javaResource.snapshotWindow().applyValue({ args0 -> args0 })

    /**
     * ARN of the SNS topic to which cluster notifications are sent.
     */
    public val snsTopicArn: Output?
        get() = javaResource.snsTopicArn().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the subnet group to be used for the cluster. Defaults to a subnet group consisting of default VPC subnets.
     */
    public val subnetGroupName: Output
        get() = javaResource.subnetGroupName().applyValue({ args0 -> args0 })

    /**
     * A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
     */
    @Deprecated(
        message = """
  Please use `tags` instead.
  """,
    )
    public val tagsAll: Output>
        get() = javaResource.tagsAll().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * A flag to enable in-transit encryption on the cluster. When set to `false`, the `acl_name` must be `open-access`. Defaults to `true`.
     */
    public val tlsEnabled: Output?
        get() = javaResource.tlsEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object ClusterMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.memorydb.Cluster::class == javaResource::class

    override fun map(javaResource: Resource): Cluster = Cluster(
        javaResource as
            com.pulumi.aws.memorydb.Cluster,
    )
}

/**
 * @see [Cluster].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Cluster].
 */
public suspend fun cluster(name: String, block: suspend ClusterResourceBuilder.() -> Unit): Cluster {
    val builder = ClusterResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Cluster].
 * @param name The _unique_ name of the resulting resource.
 */
public fun cluster(name: String): Cluster {
    val builder = ClusterResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy