All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azurenative.azurestackhci.kotlin.MachineExtension.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azurenative.azurestackhci.kotlin
import com.pulumi.azurenative.azurestackhci.kotlin.outputs.MachineExtensionPropertiesResponseInstanceView
import com.pulumi.azurenative.azurestackhci.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.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import com.pulumi.azurenative.azurestackhci.kotlin.outputs.MachineExtensionPropertiesResponseInstanceView.Companion.toKotlin as machineExtensionPropertiesResponseInstanceViewToKotlin
import com.pulumi.azurenative.azurestackhci.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin
/**
* Builder for [MachineExtension].
*/
@PulumiTagMarker
public class MachineExtensionResourceBuilder internal constructor() {
public var name: String? = null
public var args: MachineExtensionArgs = MachineExtensionArgs()
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 MachineExtensionArgsBuilder.() -> Unit) {
val builder = MachineExtensionArgsBuilder()
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(): MachineExtension {
val builtJavaResource =
com.pulumi.azurenative.azurestackhci.MachineExtension(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return MachineExtension(builtJavaResource)
}
}
/**
* Describes a Machine Extension.
* Azure REST API version: 2022-12-15-preview.
* ## Example Usage
* ### Create or Update a Machine Extension (PUT)
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AzureNative = Pulumi.AzureNative;
* return await Deployment.RunAsync(() =>
* {
* var machineExtension = new AzureNative.AzureStackHCI.MachineExtension("machineExtension", new()
* {
* ExtensionName = "CustomScriptExtension",
* Location = "eastus2euap",
* Name = "myMachine",
* Publisher = "Microsoft.Compute",
* ResourceGroupName = "myResourceGroup",
* Settings = new Dictionary
* {
* ["commandToExecute"] = "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"",
* },
* Type = "CustomScriptExtension",
* TypeHandlerVersion = "1.10",
* });
* });
* ```
* ```go
* package main
* import (
* azurestackhci "github.com/pulumi/pulumi-azure-native-sdk/azurestackhci/v2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := azurestackhci.NewMachineExtension(ctx, "machineExtension", &azurestackhci.MachineExtensionArgs{
* ExtensionName: pulumi.String("CustomScriptExtension"),
* Location: pulumi.String("eastus2euap"),
* Name: pulumi.String("myMachine"),
* Publisher: pulumi.String("Microsoft.Compute"),
* ResourceGroupName: pulumi.String("myResourceGroup"),
* Settings: pulumi.Any(map[string]interface{}{
* "commandToExecute": "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\"",
* }),
* Type: pulumi.String("CustomScriptExtension"),
* TypeHandlerVersion: pulumi.String("1.10"),
* })
* 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.azurestackhci.MachineExtension;
* import com.pulumi.azurenative.azurestackhci.MachineExtensionArgs;
* 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 machineExtension = new MachineExtension("machineExtension", MachineExtensionArgs.builder()
* .extensionName("CustomScriptExtension")
* .location("eastus2euap")
* .name("myMachine")
* .publisher("Microsoft.Compute")
* .resourceGroupName("myResourceGroup")
* .settings(Map.of("commandToExecute", "powershell.exe -c \"Get-Process | Where-Object { $_.CPU -gt 10000 }\""))
* .type("CustomScriptExtension")
* .typeHandlerVersion("1.10")
* .build());
* }
* }
* ```
* ## Import
* An existing resource can be imported using its type token, name, and identifier, e.g.
* ```sh
* $ pulumi import azure-native:azurestackhci:MachineExtension CustomScriptExtension /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualMachines/{name}/extensions/{extensionName}
* ```
*/
public class MachineExtension internal constructor(
override val javaResource: com.pulumi.azurenative.azurestackhci.MachineExtension,
) : KotlinCustomResource(javaResource, MachineExtensionMapper) {
/**
* Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.
*/
public val autoUpgradeMinorVersion: Output?
get() = javaResource.autoUpgradeMinorVersion().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 machine extension instance view.
*/
public val instanceView: Output?
get() = javaResource.instanceView().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
machineExtensionPropertiesResponseInstanceViewToKotlin(args0)
})
}).orElse(null)
})
/**
* The location.
*/
public val location: Output?
get() = javaResource.location().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The name.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.
*/
public val protectedSettings: Output?
get() = javaResource.protectedSettings().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The provisioning state, which only appears in the response.
*/
public val provisioningState: Output
get() = javaResource.provisioningState().applyValue({ args0 -> args0 })
/**
* The name of the extension handler publisher.
*/
public val publisher: Output?
get() = javaResource.publisher().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Json formatted public settings for the extension.
*/
public val settings: Output?
get() = javaResource.settings().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The system data.
*/
public val systemData: Output
get() = javaResource.systemData().applyValue({ args0 ->
args0.let({ args0 ->
systemDataResponseToKotlin(args0)
})
})
/**
* The 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.
*/
public val type: Output
get() = javaResource.type().applyValue({ args0 -> args0 })
/**
* Specifies the version of the script handler.
*/
public val typeHandlerVersion: Output?
get() = javaResource.typeHandlerVersion().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
}
public object MachineExtensionMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azurenative.azurestackhci.MachineExtension::class == javaResource::class
override fun map(javaResource: Resource): MachineExtension = MachineExtension(
javaResource as
com.pulumi.azurenative.azurestackhci.MachineExtension,
)
}
/**
* @see [MachineExtension].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [MachineExtension].
*/
public suspend fun machineExtension(
name: String,
block: suspend MachineExtensionResourceBuilder.() -> Unit,
): MachineExtension {
val builder = MachineExtensionResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [MachineExtension].
* @param name The _unique_ name of the resulting resource.
*/
public fun machineExtension(name: String): MachineExtension {
val builder = MachineExtensionResourceBuilder()
builder.name(name)
return builder.build()
}