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

com.pulumi.azurenative.containerservice.kotlin.ManagedClusterSnapshot.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: 2.82.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azurenative.containerservice.kotlin

import com.pulumi.azurenative.containerservice.kotlin.outputs.CreationDataResponse
import com.pulumi.azurenative.containerservice.kotlin.outputs.ManagedClusterPropertiesForSnapshotResponse
import com.pulumi.azurenative.containerservice.kotlin.outputs.SystemDataResponse
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.Map
import com.pulumi.azurenative.containerservice.kotlin.outputs.CreationDataResponse.Companion.toKotlin as creationDataResponseToKotlin
import com.pulumi.azurenative.containerservice.kotlin.outputs.ManagedClusterPropertiesForSnapshotResponse.Companion.toKotlin as managedClusterPropertiesForSnapshotResponseToKotlin
import com.pulumi.azurenative.containerservice.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin

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

    public var args: ManagedClusterSnapshotArgs = ManagedClusterSnapshotArgs()

    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 ManagedClusterSnapshotArgsBuilder.() -> Unit) {
        val builder = ManagedClusterSnapshotArgsBuilder()
        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(): ManagedClusterSnapshot {
        val builtJavaResource =
            com.pulumi.azurenative.containerservice.ManagedClusterSnapshot(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return ManagedClusterSnapshot(builtJavaResource)
    }
}

/**
 * A managed cluster snapshot resource.
 * Azure REST API version: 2023-05-02-preview. Prior API version in Azure Native 1.x: 2022-02-02-preview.
 * Other available API versions: 2023-06-02-preview, 2023-07-02-preview, 2023-08-02-preview, 2023-09-02-preview, 2023-10-02-preview, 2023-11-02-preview, 2024-01-02-preview, 2024-02-02-preview, 2024-03-02-preview, 2024-04-02-preview, 2024-05-02-preview, 2024-06-02-preview.
 * ## Example Usage
 * ### Create/Update Managed Cluster Snapshot
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var managedClusterSnapshot = new AzureNative.ContainerService.ManagedClusterSnapshot("managedClusterSnapshot", new()
 *     {
 *         CreationData = new AzureNative.ContainerService.Inputs.CreationDataArgs
 *         {
 *             SourceResourceId = "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1",
 *         },
 *         Location = "westus",
 *         ResourceGroupName = "rg1",
 *         ResourceName = "snapshot1",
 *         Tags =
 *         {
 *             { "key1", "val1" },
 *             { "key2", "val2" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	containerservice "github.com/pulumi/pulumi-azure-native-sdk/containerservice/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := containerservice.NewManagedClusterSnapshot(ctx, "managedClusterSnapshot", &containerservice.ManagedClusterSnapshotArgs{
 * 			CreationData: &containerservice.CreationDataArgs{
 * 				SourceResourceId: pulumi.String("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1"),
 * 			},
 * 			Location:          pulumi.String("westus"),
 * 			ResourceGroupName: pulumi.String("rg1"),
 * 			ResourceName:      pulumi.String("snapshot1"),
 * 			Tags: pulumi.StringMap{
 * 				"key1": pulumi.String("val1"),
 * 				"key2": pulumi.String("val2"),
 * 			},
 * 		})
 * 		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.azurenative.containerservice.ManagedClusterSnapshot;
 * import com.pulumi.azurenative.containerservice.ManagedClusterSnapshotArgs;
 * import com.pulumi.azurenative.containerservice.inputs.CreationDataArgs;
 * 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 managedClusterSnapshot = new ManagedClusterSnapshot("managedClusterSnapshot", ManagedClusterSnapshotArgs.builder()
 *             .creationData(CreationDataArgs.builder()
 *                 .sourceResourceId("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1")
 *                 .build())
 *             .location("westus")
 *             .resourceGroupName("rg1")
 *             .resourceName("snapshot1")
 *             .tags(Map.ofEntries(
 *                 Map.entry("key1", "val1"),
 *                 Map.entry("key2", "val2")
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:containerservice:ManagedClusterSnapshot snapshot1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}
 * ```
 */
public class ManagedClusterSnapshot internal constructor(
    override val javaResource: com.pulumi.azurenative.containerservice.ManagedClusterSnapshot,
) : KotlinCustomResource(javaResource, ManagedClusterSnapshotMapper) {
    /**
     * CreationData to be used to specify the source resource ID to create this snapshot.
     */
    public val creationData: Output?
        get() = javaResource.creationData().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    creationDataResponseToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The geo-location where the resource lives
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * What the properties will be showed when getting managed cluster snapshot. Those properties are read-only.
     */
    public val managedClusterPropertiesReadOnly: Output
        get() = javaResource.managedClusterPropertiesReadOnly().applyValue({ args0 ->
            args0.let({ args0 ->
                managedClusterPropertiesForSnapshotResponseToKotlin(args0)
            })
        })

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

    /**
     * The type of a snapshot. The default is NodePool.
     */
    public val snapshotType: Output?
        get() = javaResource.snapshotType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    public val systemData: Output
        get() = javaResource.systemData().applyValue({ args0 ->
            args0.let({ args0 ->
                systemDataResponseToKotlin(args0)
            })
        })

    /**
     * Resource tags.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object ManagedClusterSnapshotMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.containerservice.ManagedClusterSnapshot::class == javaResource::class

    override fun map(javaResource: Resource): ManagedClusterSnapshot =
        ManagedClusterSnapshot(
            javaResource as
                com.pulumi.azurenative.containerservice.ManagedClusterSnapshot,
        )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy