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

com.pulumi.azure.arcmachine.kotlin.Extension.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.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.arcmachine.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
import kotlin.collections.Map

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

    public var args: ExtensionArgs = ExtensionArgs()

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

/**
 * Manages a Hybrid Compute Machine Extension.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "example",
 *     location: "West Europe",
 * });
 * const example = azure.arcmachine.getOutput({
 *     name: "existing-hcmachine",
 *     resourceGroupName: exampleResourceGroup.name,
 * });
 * const exampleExtension = new azure.arcmachine.Extension("example", {
 *     name: "example",
 *     location: "West Europe",
 *     arcMachineId: example.apply(example => example.id),
 *     publisher: "Microsoft.Azure.Monitor",
 *     type: "AzureMonitorLinuxAgent",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="example",
 *     location="West Europe")
 * example = azure.arcmachine.get_output(name="existing-hcmachine",
 *     resource_group_name=example_resource_group.name)
 * example_extension = azure.arcmachine.Extension("example",
 *     name="example",
 *     location="West Europe",
 *     arc_machine_id=example.id,
 *     publisher="Microsoft.Azure.Monitor",
 *     type="AzureMonitorLinuxAgent")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example",
 *         Location = "West Europe",
 *     });
 *     var example = Azure.ArcMachine.Get.Invoke(new()
 *     {
 *         Name = "existing-hcmachine",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *     });
 *     var exampleExtension = new Azure.ArcMachine.Extension("example", new()
 *     {
 *         Name = "example",
 *         Location = "West Europe",
 *         ArcMachineId = example.Apply(getResult => getResult.Id),
 *         Publisher = "Microsoft.Azure.Monitor",
 *         Type = "AzureMonitorLinuxAgent",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/arcmachine"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"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("example"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example := arcmachine.GetOutput(ctx, arcmachine.GetOutputArgs{
 * 			Name:              pulumi.String("existing-hcmachine"),
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 		}, nil)
 * 		_, err = arcmachine.NewExtension(ctx, "example", &arcmachine.ExtensionArgs{
 * 			Name:     pulumi.String("example"),
 * 			Location: pulumi.String("West Europe"),
 * 			ArcMachineId: pulumi.String(example.ApplyT(func(example arcmachine.GetResult) (*string, error) {
 * 				return &example.Id, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 			Publisher: pulumi.String("Microsoft.Azure.Monitor"),
 * 			Type:      pulumi.String("AzureMonitorLinuxAgent"),
 * 		})
 * 		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.arcmachine.ArcmachineFunctions;
 * import com.pulumi.azure.arcmachine.inputs.GetArgs;
 * import com.pulumi.azure.arcmachine.Extension;
 * import com.pulumi.azure.arcmachine.ExtensionArgs;
 * 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("example")
 *             .location("West Europe")
 *             .build());
 *         final var example = ArcmachineFunctions.get(GetArgs.builder()
 *             .name("existing-hcmachine")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .build());
 *         var exampleExtension = new Extension("exampleExtension", ExtensionArgs.builder()
 *             .name("example")
 *             .location("West Europe")
 *             .arcMachineId(example.applyValue(getResult -> getResult).applyValue(example -> example.applyValue(getResult -> getResult.id())))
 *             .publisher("Microsoft.Azure.Monitor")
 *             .type("AzureMonitorLinuxAgent")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: example
 *       location: West Europe
 *   exampleExtension:
 *     type: azure:arcmachine:Extension
 *     name: example
 *     properties:
 *       name: example
 *       location: West Europe
 *       arcMachineId: ${example.id}
 *       publisher: Microsoft.Azure.Monitor
 *       type: AzureMonitorLinuxAgent
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:arcmachine:get
 *       Arguments:
 *         name: existing-hcmachine
 *         resourceGroupName: ${exampleResourceGroup.name}
 * ```
 * 
 * ## Import
 * Hybrid Compute Machine Extensions can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:arcmachine/extension:Extension example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.HybridCompute/machines/hcmachine1/extensions/ext1
 * ```
 */
public class Extension internal constructor(
    override val javaResource: com.pulumi.azure.arcmachine.Extension,
) : KotlinCustomResource(javaResource, ExtensionMapper) {
    /**
     * The ID of the Hybrid Compute Machine Extension. Changing this forces a new Hybrid Compute Machine Extension to be created.
     */
    public val arcMachineId: Output
        get() = javaResource.arcMachineId().applyValue({ args0 -> args0 })

    /**
     * Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available. Supported values are `true` and `false`. Defaults to `true`.
     * > **NOTE:** When `automatic_upgrade_enabled` can only be set during creation. Any later change will be ignored.
     * > **NOTE:** When `automatic_upgrade_enabled` is set to `true`, the `type_handler_version` is automatically updated by the Azure platform when a new version is available and any change in `type_handler_version` will be automatically ignored.
     */
    public val automaticUpgradeEnabled: Output?
        get() = javaResource.automaticUpgradeEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * How the extension handler should be forced to update even if the extension configuration has not changed.
     */
    public val forceUpdateTag: Output?
        get() = javaResource.forceUpdateTag().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

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

    /**
     * Json formatted protected settings for the extension.
     */
    public val protectedSettings: Output?
        get() = javaResource.protectedSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the extension handler publisher, such as `Microsoft.Azure.Monitor`. Changing this forces a new Hybrid Compute Machine Extension to be created.
     */
    public val publisher: Output
        get() = javaResource.publisher().applyValue({ args0 -> args0 })

    /**
     * Json formatted public settings for the extension.
     */
    public val settings: Output?
        get() = javaResource.settings().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * A mapping of tags which should be assigned to the Hybrid Compute Machine Extension.
     */
    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 type of the extension. For example `CustomScriptExtension` or `AzureMonitorLinuxAgent`. Changing this forces a new Hybrid Compute Machine Extension to be created.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * Specifies the version of the script handler.
     * > **NOTE:** 1. When `automatic_upgrade_enabled` is set to `false` and no `type_handler_version` is specified, the `type_handler_version` change should be manually ignored by `ignore_changes` lifecycle block. This is because the `type_handler_version` is set by the Azure platform when the extension is created. 2. When `automatic_upgrade_enabled` is set to `false` and `type_handler_version` is specified, the provider will check whether the version prefix is aligned with user input. For example, if user specifies `1.24` in `type_handler_version`, `1.24.1` will be considered as no diff.
     */
    public val typeHandlerVersion: Output?
        get() = javaResource.typeHandlerVersion().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object ExtensionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.arcmachine.Extension::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy