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

com.pulumi.azure.servicefabric.kotlin.Cluster.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.servicefabric.kotlin

import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterAzureActiveDirectory
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterCertificate
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterCertificateCommonNames
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterClientCertificateCommonName
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterClientCertificateThumbprint
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterDiagnosticsConfig
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterFabricSetting
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterNodeType
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterReverseProxyCertificate
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterReverseProxyCertificateCommonNames
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterUpgradePolicy
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
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterAzureActiveDirectory.Companion.toKotlin as clusterAzureActiveDirectoryToKotlin
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterCertificate.Companion.toKotlin as clusterCertificateToKotlin
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterCertificateCommonNames.Companion.toKotlin as clusterCertificateCommonNamesToKotlin
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterClientCertificateCommonName.Companion.toKotlin as clusterClientCertificateCommonNameToKotlin
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterClientCertificateThumbprint.Companion.toKotlin as clusterClientCertificateThumbprintToKotlin
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterDiagnosticsConfig.Companion.toKotlin as clusterDiagnosticsConfigToKotlin
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterFabricSetting.Companion.toKotlin as clusterFabricSettingToKotlin
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterNodeType.Companion.toKotlin as clusterNodeTypeToKotlin
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterReverseProxyCertificate.Companion.toKotlin as clusterReverseProxyCertificateToKotlin
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterReverseProxyCertificateCommonNames.Companion.toKotlin as clusterReverseProxyCertificateCommonNamesToKotlin
import com.pulumi.azure.servicefabric.kotlin.outputs.ClusterUpgradePolicy.Companion.toKotlin as clusterUpgradePolicyToKotlin

/**
 * 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.azure.servicefabric.Cluster(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Cluster(builtJavaResource)
    }
}

/**
 * Manages a Service Fabric Cluster.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleCluster = new azure.servicefabric.Cluster("example", {
 *     name: "example-servicefabric",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     reliabilityLevel: "Bronze",
 *     upgradeMode: "Manual",
 *     clusterCodeVersion: "7.1.456.959",
 *     vmImage: "Windows",
 *     managementEndpoint: "https://example:80",
 *     nodeTypes: [{
 *         name: "first",
 *         instanceCount: 3,
 *         isPrimary: true,
 *         clientEndpointPort: 2020,
 *         httpEndpointPort: 80,
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_cluster = azure.servicefabric.Cluster("example",
 *     name="example-servicefabric",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     reliability_level="Bronze",
 *     upgrade_mode="Manual",
 *     cluster_code_version="7.1.456.959",
 *     vm_image="Windows",
 *     management_endpoint="https://example:80",
 *     node_types=[{
 *         "name": "first",
 *         "instance_count": 3,
 *         "is_primary": True,
 *         "client_endpoint_port": 2020,
 *         "http_endpoint_port": 80,
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleCluster = new Azure.ServiceFabric.Cluster("example", new()
 *     {
 *         Name = "example-servicefabric",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         ReliabilityLevel = "Bronze",
 *         UpgradeMode = "Manual",
 *         ClusterCodeVersion = "7.1.456.959",
 *         VmImage = "Windows",
 *         ManagementEndpoint = "https://example:80",
 *         NodeTypes = new[]
 *         {
 *             new Azure.ServiceFabric.Inputs.ClusterNodeTypeArgs
 *             {
 *                 Name = "first",
 *                 InstanceCount = 3,
 *                 IsPrimary = true,
 *                 ClientEndpointPort = 2020,
 *                 HttpEndpointPort = 80,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/servicefabric"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = servicefabric.NewCluster(ctx, "example", &servicefabric.ClusterArgs{
 * 			Name:               pulumi.String("example-servicefabric"),
 * 			ResourceGroupName:  example.Name,
 * 			Location:           example.Location,
 * 			ReliabilityLevel:   pulumi.String("Bronze"),
 * 			UpgradeMode:        pulumi.String("Manual"),
 * 			ClusterCodeVersion: pulumi.String("7.1.456.959"),
 * 			VmImage:            pulumi.String("Windows"),
 * 			ManagementEndpoint: pulumi.String("https://example:80"),
 * 			NodeTypes: servicefabric.ClusterNodeTypeArray{
 * 				&servicefabric.ClusterNodeTypeArgs{
 * 					Name:               pulumi.String("first"),
 * 					InstanceCount:      pulumi.Int(3),
 * 					IsPrimary:          pulumi.Bool(true),
 * 					ClientEndpointPort: pulumi.Int(2020),
 * 					HttpEndpointPort:   pulumi.Int(80),
 * 				},
 * 			},
 * 		})
 * 		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.servicefabric.Cluster;
 * import com.pulumi.azure.servicefabric.ClusterArgs;
 * import com.pulumi.azure.servicefabric.inputs.ClusterNodeTypeArgs;
 * 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 ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleCluster = new Cluster("exampleCluster", ClusterArgs.builder()
 *             .name("example-servicefabric")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .reliabilityLevel("Bronze")
 *             .upgradeMode("Manual")
 *             .clusterCodeVersion("7.1.456.959")
 *             .vmImage("Windows")
 *             .managementEndpoint("https://example:80")
 *             .nodeTypes(ClusterNodeTypeArgs.builder()
 *                 .name("first")
 *                 .instanceCount(3)
 *                 .isPrimary(true)
 *                 .clientEndpointPort(2020)
 *                 .httpEndpointPort(80)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleCluster:
 *     type: azure:servicefabric:Cluster
 *     name: example
 *     properties:
 *       name: example-servicefabric
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       reliabilityLevel: Bronze
 *       upgradeMode: Manual
 *       clusterCodeVersion: 7.1.456.959
 *       vmImage: Windows
 *       managementEndpoint: https://example:80
 *       nodeTypes:
 *         - name: first
 *           instanceCount: 3
 *           isPrimary: true
 *           clientEndpointPort: 2020
 *           httpEndpointPort: 80
 * ```
 * 
 * ## Import
 * Service Fabric Clusters can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:servicefabric/cluster:Cluster cluster1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ServiceFabric/clusters/cluster1
 * ```
 */
public class Cluster internal constructor(
    override val javaResource: com.pulumi.azure.servicefabric.Cluster,
) : KotlinCustomResource(javaResource, ClusterMapper) {
    /**
     * A List of one or more features which should be enabled, such as `DnsService`.
     */
    public val addOnFeatures: Output>?
        get() = javaResource.addOnFeatures().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

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

    /**
     * A `certificate` block as defined below. Conflicts with `certificate_common_names`.
     */
    public val certificate: Output?
        get() = javaResource.certificate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    clusterCertificateToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A `certificate_common_names` block as defined below. Conflicts with `certificate`.
     */
    public val certificateCommonNames: Output?
        get() = javaResource.certificateCommonNames().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> clusterCertificateCommonNamesToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A `client_certificate_common_name` block as defined below.
     * > **NOTE:** If Client Certificates are enabled then at a Certificate must be configured on the cluster.
     */
    public val clientCertificateCommonNames: Output>?
        get() = javaResource.clientCertificateCommonNames().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        clusterClientCertificateCommonNameToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * One or more `client_certificate_thumbprint` blocks as defined below.
     */
    public val clientCertificateThumbprints: Output>?
        get() = javaResource.clientCertificateThumbprints().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        clusterClientCertificateThumbprintToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Required if Upgrade Mode set to `Manual`, Specifies the Version of the Cluster Code of the cluster.
     */
    public val clusterCodeVersion: Output
        get() = javaResource.clusterCodeVersion().applyValue({ args0 -> args0 })

    /**
     * The Cluster Endpoint for this Service Fabric Cluster.
     */
    public val clusterEndpoint: Output
        get() = javaResource.clusterEndpoint().applyValue({ args0 -> args0 })

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

    /**
     * One or more `fabric_settings` blocks as defined below.
     */
    public val fabricSettings: Output>?
        get() = javaResource.fabricSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        clusterFabricSettingToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

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

    /**
     * Specifies the Management Endpoint of the cluster such as `http://example.com`. Changing this forces a new resource to be created.
     */
    public val managementEndpoint: Output
        get() = javaResource.managementEndpoint().applyValue({ args0 -> args0 })

    /**
     * The name of the Service Fabric Cluster. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * One or more `node_type` blocks as defined below.
     */
    public val nodeTypes: Output>
        get() = javaResource.nodeTypes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    clusterNodeTypeToKotlin(args0)
                })
            })
        })

    /**
     * Specifies the Reliability Level of the Cluster. Possible values include `None`, `Bronze`, `Silver`, `Gold` and `Platinum`.
     * > **NOTE:** The Reliability Level of the Cluster depends on the number of nodes in the Cluster: `Platinum` requires at least 9 VM's, `Gold` requires at least 7 VM's, `Silver` requires at least 5 VM's, `Bronze` requires at least 3 VM's.
     */
    public val reliabilityLevel: Output
        get() = javaResource.reliabilityLevel().applyValue({ args0 -> args0 })

    /**
     * The name of the Resource Group in which the Service Fabric Cluster exists. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A `reverse_proxy_certificate` block as defined below. Conflicts with `reverse_proxy_certificate_common_names`.
     */
    public val reverseProxyCertificate: Output?
        get() = javaResource.reverseProxyCertificate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> clusterReverseProxyCertificateToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A `reverse_proxy_certificate_common_names` block as defined below. Conflicts with `reverse_proxy_certificate`.
     */
    public val reverseProxyCertificateCommonNames: Output?
        get() = javaResource.reverseProxyCertificateCommonNames().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    clusterReverseProxyCertificateCommonNamesToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies the logical grouping of VMs in upgrade domains. Possible values are `Hierarchical` or `Parallel`.
     */
    public val serviceFabricZonalUpgradeMode: Output?
        get() = javaResource.serviceFabricZonalUpgradeMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A mapping of tags to assign 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)
        })

    /**
     * Specifies the Upgrade Mode of the cluster. Possible values are `Automatic` or `Manual`.
     */
    public val upgradeMode: Output
        get() = javaResource.upgradeMode().applyValue({ args0 -> args0 })

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

    /**
     * Specifies the Image expected for the Service Fabric Cluster, such as `Windows`. Changing this forces a new resource to be created.
     */
    public val vmImage: Output
        get() = javaResource.vmImage().applyValue({ args0 -> args0 })

    /**
     * Specifies the upgrade mode for the virtual machine scale set updates that happen in all availability zones at once. Possible values are `Hierarchical` or `Parallel`.
     */
    public val vmssZonalUpgradeMode: Output?
        get() = javaResource.vmssZonalUpgradeMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

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

    override fun map(javaResource: Resource): Cluster = Cluster(
        javaResource as
            com.pulumi.azure.servicefabric.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 - 2024 Weber Informatics LLC | Privacy Policy