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

com.pulumi.azure.cosmosdb.kotlin.CassandraCluster.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.cosmosdb.kotlin

import com.pulumi.azure.cosmosdb.kotlin.outputs.CassandraClusterIdentity
import com.pulumi.azure.cosmosdb.kotlin.outputs.CassandraClusterIdentity.Companion.toKotlin
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: CassandraClusterArgs = CassandraClusterArgs()

    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 CassandraClusterArgsBuilder.() -> Unit) {
        val builder = CassandraClusterArgsBuilder()
        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(): CassandraCluster {
        val builtJavaResource = com.pulumi.azure.cosmosdb.CassandraCluster(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return CassandraCluster(builtJavaResource)
    }
}

/**
 * Manages a Cassandra Cluster.
 * > **NOTE:** In order for the `Azure Managed Instances for Apache Cassandra` to work properly the product requires the `Azure Cosmos DB` Application ID to be present and working in your tenant. If the `Azure Cosmos DB` Application ID is missing in your environment you will need to have an administrator of your tenant run the following command to add the `Azure Cosmos DB` Application ID to your tenant:
 * ```powershell
 * New-AzADServicePrincipal -ApplicationId a232010e-820c-4083-83bb-3ace5fc29d0b
 * ```
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as azuread from "@pulumi/azuread";
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "accexample-rg",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "example-vnet",
 *     location: exampleResourceGroup.location,
 *     resourceGroupName: exampleResourceGroup.name,
 *     addressSpaces: ["10.0.0.0/16"],
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "example-subnet",
 *     resourceGroupName: exampleResourceGroup.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.1.0/24"],
 * });
 * const example = azuread.getServicePrincipal({
 *     displayName: "Azure Cosmos DB",
 * });
 * const exampleAssignment = new azure.authorization.Assignment("example", {
 *     scope: exampleVirtualNetwork.id,
 *     roleDefinitionName: "Network Contributor",
 *     principalId: example.then(example => example.objectId),
 * });
 * const exampleCassandraCluster = new azure.cosmosdb.CassandraCluster("example", {
 *     name: "example-cluster",
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 *     delegatedManagementSubnetId: exampleSubnet.id,
 *     defaultAdminPassword: "Password1234",
 * }, {
 *     dependsOn: [exampleAssignment],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_azuread as azuread
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="accexample-rg",
 *     location="West Europe")
 * example_virtual_network = azure.network.VirtualNetwork("example",
 *     name="example-vnet",
 *     location=example_resource_group.location,
 *     resource_group_name=example_resource_group.name,
 *     address_spaces=["10.0.0.0/16"])
 * example_subnet = azure.network.Subnet("example",
 *     name="example-subnet",
 *     resource_group_name=example_resource_group.name,
 *     virtual_network_name=example_virtual_network.name,
 *     address_prefixes=["10.0.1.0/24"])
 * example = azuread.get_service_principal(display_name="Azure Cosmos DB")
 * example_assignment = azure.authorization.Assignment("example",
 *     scope=example_virtual_network.id,
 *     role_definition_name="Network Contributor",
 *     principal_id=example.object_id)
 * example_cassandra_cluster = azure.cosmosdb.CassandraCluster("example",
 *     name="example-cluster",
 *     resource_group_name=example_resource_group.name,
 *     location=example_resource_group.location,
 *     delegated_management_subnet_id=example_subnet.id,
 *     default_admin_password="Password1234",
 *     opts = pulumi.ResourceOptions(depends_on=[example_assignment]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using AzureAD = Pulumi.AzureAD;
 * return await Deployment.RunAsync(() =>
 * {
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "accexample-rg",
 *         Location = "West Europe",
 *     });
 *     var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
 *     {
 *         Name = "example-vnet",
 *         Location = exampleResourceGroup.Location,
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         AddressSpaces = new[]
 *         {
 *             "10.0.0.0/16",
 *         },
 *     });
 *     var exampleSubnet = new Azure.Network.Subnet("example", new()
 *     {
 *         Name = "example-subnet",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         VirtualNetworkName = exampleVirtualNetwork.Name,
 *         AddressPrefixes = new[]
 *         {
 *             "10.0.1.0/24",
 *         },
 *     });
 *     var example = AzureAD.GetServicePrincipal.Invoke(new()
 *     {
 *         DisplayName = "Azure Cosmos DB",
 *     });
 *     var exampleAssignment = new Azure.Authorization.Assignment("example", new()
 *     {
 *         Scope = exampleVirtualNetwork.Id,
 *         RoleDefinitionName = "Network Contributor",
 *         PrincipalId = example.Apply(getServicePrincipalResult => getServicePrincipalResult.ObjectId),
 *     });
 *     var exampleCassandraCluster = new Azure.CosmosDB.CassandraCluster("example", new()
 *     {
 *         Name = "example-cluster",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Location = exampleResourceGroup.Location,
 *         DelegatedManagementSubnetId = exampleSubnet.Id,
 *         DefaultAdminPassword = "Password1234",
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             exampleAssignment,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/cosmosdb"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
 * 	"github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("accexample-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
 * 			Name:              pulumi.String("example-vnet"),
 * 			Location:          exampleResourceGroup.Location,
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.0.0.0/16"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
 * 			Name:               pulumi.String("example-subnet"),
 * 			ResourceGroupName:  exampleResourceGroup.Name,
 * 			VirtualNetworkName: exampleVirtualNetwork.Name,
 * 			AddressPrefixes: pulumi.StringArray{
 * 				pulumi.String("10.0.1.0/24"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example, err := azuread.LookupServicePrincipal(ctx, &azuread.LookupServicePrincipalArgs{
 * 			DisplayName: pulumi.StringRef("Azure Cosmos DB"),
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAssignment, err := authorization.NewAssignment(ctx, "example", &authorization.AssignmentArgs{
 * 			Scope:              exampleVirtualNetwork.ID(),
 * 			RoleDefinitionName: pulumi.String("Network Contributor"),
 * 			PrincipalId:        pulumi.String(example.ObjectId),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cosmosdb.NewCassandraCluster(ctx, "example", &cosmosdb.CassandraClusterArgs{
 * 			Name:                        pulumi.String("example-cluster"),
 * 			ResourceGroupName:           exampleResourceGroup.Name,
 * 			Location:                    exampleResourceGroup.Location,
 * 			DelegatedManagementSubnetId: exampleSubnet.ID(),
 * 			DefaultAdminPassword:        pulumi.String("Password1234"),
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			exampleAssignment,
 * 		}))
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.network.VirtualNetwork;
 * import com.pulumi.azure.network.VirtualNetworkArgs;
 * import com.pulumi.azure.network.Subnet;
 * import com.pulumi.azure.network.SubnetArgs;
 * import com.pulumi.azuread.AzureadFunctions;
 * import com.pulumi.azuread.inputs.GetServicePrincipalArgs;
 * import com.pulumi.azure.authorization.Assignment;
 * import com.pulumi.azure.authorization.AssignmentArgs;
 * import com.pulumi.azure.cosmosdb.CassandraCluster;
 * import com.pulumi.azure.cosmosdb.CassandraClusterArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
 *             .name("accexample-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
 *             .name("example-vnet")
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .addressSpaces("10.0.0.0/16")
 *             .build());
 *         var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
 *             .name("example-subnet")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .addressPrefixes("10.0.1.0/24")
 *             .build());
 *         final var example = AzureadFunctions.getServicePrincipal(GetServicePrincipalArgs.builder()
 *             .displayName("Azure Cosmos DB")
 *             .build());
 *         var exampleAssignment = new Assignment("exampleAssignment", AssignmentArgs.builder()
 *             .scope(exampleVirtualNetwork.id())
 *             .roleDefinitionName("Network Contributor")
 *             .principalId(example.applyValue(getServicePrincipalResult -> getServicePrincipalResult.objectId()))
 *             .build());
 *         var exampleCassandraCluster = new CassandraCluster("exampleCassandraCluster", CassandraClusterArgs.builder()
 *             .name("example-cluster")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .delegatedManagementSubnetId(exampleSubnet.id())
 *             .defaultAdminPassword("Password1234")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(exampleAssignment)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: accexample-rg
 *       location: West Europe
 *   exampleVirtualNetwork:
 *     type: azure:network:VirtualNetwork
 *     name: example
 *     properties:
 *       name: example-vnet
 *       location: ${exampleResourceGroup.location}
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       addressSpaces:
 *         - 10.0.0.0/16
 *   exampleSubnet:
 *     type: azure:network:Subnet
 *     name: example
 *     properties:
 *       name: example-subnet
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       virtualNetworkName: ${exampleVirtualNetwork.name}
 *       addressPrefixes:
 *         - 10.0.1.0/24
 *   exampleAssignment:
 *     type: azure:authorization:Assignment
 *     name: example
 *     properties:
 *       scope: ${exampleVirtualNetwork.id}
 *       roleDefinitionName: Network Contributor
 *       principalId: ${example.objectId}
 *   exampleCassandraCluster:
 *     type: azure:cosmosdb:CassandraCluster
 *     name: example
 *     properties:
 *       name: example-cluster
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       location: ${exampleResourceGroup.location}
 *       delegatedManagementSubnetId: ${exampleSubnet.id}
 *       defaultAdminPassword: Password1234
 *     options:
 *       dependson:
 *         - ${exampleAssignment}
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azuread:getServicePrincipal
 *       Arguments:
 *         displayName: Azure Cosmos DB
 * ```
 * 
 * ## Import
 * Cassandra Clusters can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:cosmosdb/cassandraCluster:CassandraCluster example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.DocumentDB/cassandraClusters/cluster1
 * ```
 */
public class CassandraCluster internal constructor(
    override val javaResource: com.pulumi.azure.cosmosdb.CassandraCluster,
) : KotlinCustomResource(javaResource, CassandraClusterMapper) {
    /**
     * The authentication method that is used to authenticate clients. Possible values are `None` and `Cassandra`. Defaults to `Cassandra`.
     */
    public val authenticationMethod: Output?
        get() = javaResource.authenticationMethod().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A list of TLS certificates that is used to authorize client connecting to the Cassandra Cluster.
     */
    public val clientCertificatePems: Output>?
        get() = javaResource.clientCertificatePems().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The initial admin password for this Cassandra Cluster. Changing this forces a new resource to be created.
     */
    public val defaultAdminPassword: Output
        get() = javaResource.defaultAdminPassword().applyValue({ args0 -> args0 })

    /**
     * The ID of the delegated management subnet for this Cassandra Cluster. Changing this forces a new Cassandra Cluster to be created.
     */
    public val delegatedManagementSubnetId: Output
        get() = javaResource.delegatedManagementSubnetId().applyValue({ args0 -> args0 })

    /**
     * A list of TLS certificates that is used to authorize gossip from unmanaged Cassandra Data Center.
     */
    public val externalGossipCertificatePems: Output>?
        get() = javaResource.externalGossipCertificatePems().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * A list of IP Addresses of the seed nodes in unmanaged the Cassandra Data Center which will be added to the seed node lists of all managed nodes.
     */
    public val externalSeedNodeIpAddresses: Output>?
        get() = javaResource.externalSeedNodeIpAddresses().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * The number of hours to wait between taking a backup of the Cassandra Cluster. Defaults to `24`.
     * > **Note:** To disable this feature, set this property to `0`.
     */
    public val hoursBetweenBackups: Output?
        get() = javaResource.hoursBetweenBackups().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The Azure Region where the Cassandra Cluster should exist. Changing this forces a new Cassandra Cluster to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name which should be used for this Cassandra Cluster. Changing this forces a new Cassandra Cluster to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Is the automatic repair enabled on the Cassandra Cluster? Defaults to `true`.
     */
    public val repairEnabled: Output?
        get() = javaResource.repairEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the Resource Group where the Cassandra Cluster should exist. Changing this forces a new Cassandra Cluster to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags assigned to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The version of Cassandra what the Cluster converges to run. Possible values are `3.11` and `4.0`. Defaults to `3.11`. Changing this forces a new Cassandra Cluster to be created.
     */
    public val version: Output?
        get() = javaResource.version().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object CassandraClusterMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.cosmosdb.CassandraCluster::class == javaResource::class

    override fun map(javaResource: Resource): CassandraCluster = CassandraCluster(
        javaResource as
            com.pulumi.azure.cosmosdb.CassandraCluster,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy