![JAR search and dependency download from the Maven repository](/logo.png)
com.pulumi.azure.compute.kotlin.GalleryApplicationAssignment.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.compute.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [GalleryApplicationAssignment].
*/
@PulumiTagMarker
public class GalleryApplicationAssignmentResourceBuilder internal constructor() {
public var name: String? = null
public var args: GalleryApplicationAssignmentArgs = GalleryApplicationAssignmentArgs()
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 GalleryApplicationAssignmentArgsBuilder.() -> Unit) {
val builder = GalleryApplicationAssignmentArgsBuilder()
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(): GalleryApplicationAssignment {
val builtJavaResource =
com.pulumi.azure.compute.GalleryApplicationAssignment(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return GalleryApplicationAssignment(builtJavaResource)
}
}
/**
* Manages a Virtual Machine Gallery Application Assignment.
* > **Note:** Gallery Application Assignments can be defined either directly on `azure.compute.LinuxVirtualMachine` and `azure.compute.WindowsVirtualMachine` resources, or using the `azure.compute.GalleryApplicationAssignment` resource - but the two approaches cannot be used together. If both are used with the same Virtual Machine, spurious changes will occur. It's recommended to use `ignore_changes` for the `gallery_application` block on the associated virtual machine resources, to avoid a persistent diff when using this resource.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = azure.compute.getVirtualMachine({
* name: "example-vm",
* resourceGroupName: "example-resources-vm",
* });
* const exampleResourceGroup = new azure.core.ResourceGroup("example", {
* name: "example-resources",
* location: "West Europe",
* });
* const exampleSharedImageGallery = new azure.compute.SharedImageGallery("example", {
* name: "examplegallery",
* resourceGroupName: exampleResourceGroup.name,
* location: exampleResourceGroup.location,
* });
* const exampleGalleryApplication = new azure.compute.GalleryApplication("example", {
* name: "example-app",
* galleryId: exampleSharedImageGallery.id,
* location: exampleResourceGroup.location,
* supportedOsType: "Linux",
* });
* const exampleAccount = new azure.storage.Account("example", {
* name: "examplestorage",
* resourceGroupName: exampleResourceGroup.name,
* location: exampleResourceGroup.location,
* accountTier: "Standard",
* accountReplicationType: "LRS",
* });
* const exampleContainer = new azure.storage.Container("example", {
* name: "example-container",
* storageAccountName: exampleAccount.name,
* containerAccessType: "blob",
* });
* const exampleBlob = new azure.storage.Blob("example", {
* name: "scripts",
* storageAccountName: exampleAccount.name,
* storageContainerName: exampleContainer.name,
* type: "Block",
* sourceContent: "[scripts file content]",
* });
* const exampleGalleryApplicationVersion = new azure.compute.GalleryApplicationVersion("example", {
* name: "0.0.1",
* galleryApplicationId: exampleGalleryApplication.id,
* location: exampleGalleryApplication.location,
* manageAction: {
* install: "[install command]",
* remove: "[remove command]",
* },
* source: {
* mediaLink: exampleBlob.id,
* },
* targetRegions: [{
* name: exampleGalleryApplication.location,
* regionalReplicaCount: 1,
* }],
* });
* const exampleGalleryApplicationAssignment = new azure.compute.GalleryApplicationAssignment("example", {
* galleryApplicationVersionId: exampleGalleryApplicationVersion.id,
* virtualMachineId: example.then(example => example.id),
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.compute.get_virtual_machine(name="example-vm",
* resource_group_name="example-resources-vm")
* example_resource_group = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_shared_image_gallery = azure.compute.SharedImageGallery("example",
* name="examplegallery",
* resource_group_name=example_resource_group.name,
* location=example_resource_group.location)
* example_gallery_application = azure.compute.GalleryApplication("example",
* name="example-app",
* gallery_id=example_shared_image_gallery.id,
* location=example_resource_group.location,
* supported_os_type="Linux")
* example_account = azure.storage.Account("example",
* name="examplestorage",
* resource_group_name=example_resource_group.name,
* location=example_resource_group.location,
* account_tier="Standard",
* account_replication_type="LRS")
* example_container = azure.storage.Container("example",
* name="example-container",
* storage_account_name=example_account.name,
* container_access_type="blob")
* example_blob = azure.storage.Blob("example",
* name="scripts",
* storage_account_name=example_account.name,
* storage_container_name=example_container.name,
* type="Block",
* source_content="[scripts file content]")
* example_gallery_application_version = azure.compute.GalleryApplicationVersion("example",
* name="0.0.1",
* gallery_application_id=example_gallery_application.id,
* location=example_gallery_application.location,
* manage_action={
* "install": "[install command]",
* "remove": "[remove command]",
* },
* source={
* "media_link": example_blob.id,
* },
* target_regions=[{
* "name": example_gallery_application.location,
* "regional_replica_count": 1,
* }])
* example_gallery_application_assignment = azure.compute.GalleryApplicationAssignment("example",
* gallery_application_version_id=example_gallery_application_version.id,
* virtual_machine_id=example.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = Azure.Compute.GetVirtualMachine.Invoke(new()
* {
* Name = "example-vm",
* ResourceGroupName = "example-resources-vm",
* });
* var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-resources",
* Location = "West Europe",
* });
* var exampleSharedImageGallery = new Azure.Compute.SharedImageGallery("example", new()
* {
* Name = "examplegallery",
* ResourceGroupName = exampleResourceGroup.Name,
* Location = exampleResourceGroup.Location,
* });
* var exampleGalleryApplication = new Azure.Compute.GalleryApplication("example", new()
* {
* Name = "example-app",
* GalleryId = exampleSharedImageGallery.Id,
* Location = exampleResourceGroup.Location,
* SupportedOsType = "Linux",
* });
* var exampleAccount = new Azure.Storage.Account("example", new()
* {
* Name = "examplestorage",
* ResourceGroupName = exampleResourceGroup.Name,
* Location = exampleResourceGroup.Location,
* AccountTier = "Standard",
* AccountReplicationType = "LRS",
* });
* var exampleContainer = new Azure.Storage.Container("example", new()
* {
* Name = "example-container",
* StorageAccountName = exampleAccount.Name,
* ContainerAccessType = "blob",
* });
* var exampleBlob = new Azure.Storage.Blob("example", new()
* {
* Name = "scripts",
* StorageAccountName = exampleAccount.Name,
* StorageContainerName = exampleContainer.Name,
* Type = "Block",
* SourceContent = "[scripts file content]",
* });
* var exampleGalleryApplicationVersion = new Azure.Compute.GalleryApplicationVersion("example", new()
* {
* Name = "0.0.1",
* GalleryApplicationId = exampleGalleryApplication.Id,
* Location = exampleGalleryApplication.Location,
* ManageAction = new Azure.Compute.Inputs.GalleryApplicationVersionManageActionArgs
* {
* Install = "[install command]",
* Remove = "[remove command]",
* },
* Source = new Azure.Compute.Inputs.GalleryApplicationVersionSourceArgs
* {
* MediaLink = exampleBlob.Id,
* },
* TargetRegions = new[]
* {
* new Azure.Compute.Inputs.GalleryApplicationVersionTargetRegionArgs
* {
* Name = exampleGalleryApplication.Location,
* RegionalReplicaCount = 1,
* },
* },
* });
* var exampleGalleryApplicationAssignment = new Azure.Compute.GalleryApplicationAssignment("example", new()
* {
* GalleryApplicationVersionId = exampleGalleryApplicationVersion.Id,
* VirtualMachineId = example.Apply(getVirtualMachineResult => getVirtualMachineResult.Id),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := compute.LookupVirtualMachine(ctx, &compute.LookupVirtualMachineArgs{
* Name: "example-vm",
* ResourceGroupName: "example-resources-vm",
* }, nil)
* if err != nil {
* return err
* }
* exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-resources"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleSharedImageGallery, err := compute.NewSharedImageGallery(ctx, "example", &compute.SharedImageGalleryArgs{
* Name: pulumi.String("examplegallery"),
* ResourceGroupName: exampleResourceGroup.Name,
* Location: exampleResourceGroup.Location,
* })
* if err != nil {
* return err
* }
* exampleGalleryApplication, err := compute.NewGalleryApplication(ctx, "example", &compute.GalleryApplicationArgs{
* Name: pulumi.String("example-app"),
* GalleryId: exampleSharedImageGallery.ID(),
* Location: exampleResourceGroup.Location,
* SupportedOsType: pulumi.String("Linux"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
* Name: pulumi.String("examplestorage"),
* ResourceGroupName: exampleResourceGroup.Name,
* Location: exampleResourceGroup.Location,
* AccountTier: pulumi.String("Standard"),
* AccountReplicationType: pulumi.String("LRS"),
* })
* if err != nil {
* return err
* }
* exampleContainer, err := storage.NewContainer(ctx, "example", &storage.ContainerArgs{
* Name: pulumi.String("example-container"),
* StorageAccountName: exampleAccount.Name,
* ContainerAccessType: pulumi.String("blob"),
* })
* if err != nil {
* return err
* }
* exampleBlob, err := storage.NewBlob(ctx, "example", &storage.BlobArgs{
* Name: pulumi.String("scripts"),
* StorageAccountName: exampleAccount.Name,
* StorageContainerName: exampleContainer.Name,
* Type: pulumi.String("Block"),
* SourceContent: pulumi.String("[scripts file content]"),
* })
* if err != nil {
* return err
* }
* exampleGalleryApplicationVersion, err := compute.NewGalleryApplicationVersion(ctx, "example", &compute.GalleryApplicationVersionArgs{
* Name: pulumi.String("0.0.1"),
* GalleryApplicationId: exampleGalleryApplication.ID(),
* Location: exampleGalleryApplication.Location,
* ManageAction: &compute.GalleryApplicationVersionManageActionArgs{
* Install: pulumi.String("[install command]"),
* Remove: pulumi.String("[remove command]"),
* },
* Source: &compute.GalleryApplicationVersionSourceArgs{
* MediaLink: exampleBlob.ID(),
* },
* TargetRegions: compute.GalleryApplicationVersionTargetRegionArray{
* &compute.GalleryApplicationVersionTargetRegionArgs{
* Name: exampleGalleryApplication.Location,
* RegionalReplicaCount: pulumi.Int(1),
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = compute.NewGalleryApplicationAssignment(ctx, "example", &compute.GalleryApplicationAssignmentArgs{
* GalleryApplicationVersionId: exampleGalleryApplicationVersion.ID(),
* VirtualMachineId: pulumi.String(example.Id),
* })
* 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.compute.ComputeFunctions;
* import com.pulumi.azure.compute.inputs.GetVirtualMachineArgs;
* import com.pulumi.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.compute.SharedImageGallery;
* import com.pulumi.azure.compute.SharedImageGalleryArgs;
* import com.pulumi.azure.compute.GalleryApplication;
* import com.pulumi.azure.compute.GalleryApplicationArgs;
* import com.pulumi.azure.storage.Account;
* import com.pulumi.azure.storage.AccountArgs;
* import com.pulumi.azure.storage.Container;
* import com.pulumi.azure.storage.ContainerArgs;
* import com.pulumi.azure.storage.Blob;
* import com.pulumi.azure.storage.BlobArgs;
* import com.pulumi.azure.compute.GalleryApplicationVersion;
* import com.pulumi.azure.compute.GalleryApplicationVersionArgs;
* import com.pulumi.azure.compute.inputs.GalleryApplicationVersionManageActionArgs;
* import com.pulumi.azure.compute.inputs.GalleryApplicationVersionSourceArgs;
* import com.pulumi.azure.compute.inputs.GalleryApplicationVersionTargetRegionArgs;
* import com.pulumi.azure.compute.GalleryApplicationAssignment;
* import com.pulumi.azure.compute.GalleryApplicationAssignmentArgs;
* 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) {
* final var example = ComputeFunctions.getVirtualMachine(GetVirtualMachineArgs.builder()
* .name("example-vm")
* .resourceGroupName("example-resources-vm")
* .build());
* var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("West Europe")
* .build());
* var exampleSharedImageGallery = new SharedImageGallery("exampleSharedImageGallery", SharedImageGalleryArgs.builder()
* .name("examplegallery")
* .resourceGroupName(exampleResourceGroup.name())
* .location(exampleResourceGroup.location())
* .build());
* var exampleGalleryApplication = new GalleryApplication("exampleGalleryApplication", GalleryApplicationArgs.builder()
* .name("example-app")
* .galleryId(exampleSharedImageGallery.id())
* .location(exampleResourceGroup.location())
* .supportedOsType("Linux")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("examplestorage")
* .resourceGroupName(exampleResourceGroup.name())
* .location(exampleResourceGroup.location())
* .accountTier("Standard")
* .accountReplicationType("LRS")
* .build());
* var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()
* .name("example-container")
* .storageAccountName(exampleAccount.name())
* .containerAccessType("blob")
* .build());
* var exampleBlob = new Blob("exampleBlob", BlobArgs.builder()
* .name("scripts")
* .storageAccountName(exampleAccount.name())
* .storageContainerName(exampleContainer.name())
* .type("Block")
* .sourceContent("[scripts file content]")
* .build());
* var exampleGalleryApplicationVersion = new GalleryApplicationVersion("exampleGalleryApplicationVersion", GalleryApplicationVersionArgs.builder()
* .name("0.0.1")
* .galleryApplicationId(exampleGalleryApplication.id())
* .location(exampleGalleryApplication.location())
* .manageAction(GalleryApplicationVersionManageActionArgs.builder()
* .install("[install command]")
* .remove("[remove command]")
* .build())
* .source(GalleryApplicationVersionSourceArgs.builder()
* .mediaLink(exampleBlob.id())
* .build())
* .targetRegions(GalleryApplicationVersionTargetRegionArgs.builder()
* .name(exampleGalleryApplication.location())
* .regionalReplicaCount(1)
* .build())
* .build());
* var exampleGalleryApplicationAssignment = new GalleryApplicationAssignment("exampleGalleryApplicationAssignment", GalleryApplicationAssignmentArgs.builder()
* .galleryApplicationVersionId(exampleGalleryApplicationVersion.id())
* .virtualMachineId(example.applyValue(getVirtualMachineResult -> getVirtualMachineResult.id()))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* exampleResourceGroup:
* type: azure:core:ResourceGroup
* name: example
* properties:
* name: example-resources
* location: West Europe
* exampleSharedImageGallery:
* type: azure:compute:SharedImageGallery
* name: example
* properties:
* name: examplegallery
* resourceGroupName: ${exampleResourceGroup.name}
* location: ${exampleResourceGroup.location}
* exampleGalleryApplication:
* type: azure:compute:GalleryApplication
* name: example
* properties:
* name: example-app
* galleryId: ${exampleSharedImageGallery.id}
* location: ${exampleResourceGroup.location}
* supportedOsType: Linux
* exampleAccount:
* type: azure:storage:Account
* name: example
* properties:
* name: examplestorage
* resourceGroupName: ${exampleResourceGroup.name}
* location: ${exampleResourceGroup.location}
* accountTier: Standard
* accountReplicationType: LRS
* exampleContainer:
* type: azure:storage:Container
* name: example
* properties:
* name: example-container
* storageAccountName: ${exampleAccount.name}
* containerAccessType: blob
* exampleBlob:
* type: azure:storage:Blob
* name: example
* properties:
* name: scripts
* storageAccountName: ${exampleAccount.name}
* storageContainerName: ${exampleContainer.name}
* type: Block
* sourceContent: '[scripts file content]'
* exampleGalleryApplicationVersion:
* type: azure:compute:GalleryApplicationVersion
* name: example
* properties:
* name: 0.0.1
* galleryApplicationId: ${exampleGalleryApplication.id}
* location: ${exampleGalleryApplication.location}
* manageAction:
* install: '[install command]'
* remove: '[remove command]'
* source:
* mediaLink: ${exampleBlob.id}
* targetRegions:
* - name: ${exampleGalleryApplication.location}
* regionalReplicaCount: 1
* exampleGalleryApplicationAssignment:
* type: azure:compute:GalleryApplicationAssignment
* name: example
* properties:
* galleryApplicationVersionId: ${exampleGalleryApplicationVersion.id}
* virtualMachineId: ${example.id}
* variables:
* example:
* fn::invoke:
* Function: azure:compute:getVirtualMachine
* Arguments:
* name: example-vm
* resourceGroupName: example-resources-vm
* ```
*
* ## Import
* Virtual Machine Gallery Application Assignments can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:compute/galleryApplicationAssignment:GalleryApplicationAssignment example subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachines/machine1|/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Compute/galleries/gallery1/applications/galleryApplication1/versions/galleryApplicationVersion1
* ```
*/
public class GalleryApplicationAssignment internal constructor(
override val javaResource: com.pulumi.azure.compute.GalleryApplicationAssignment,
) : KotlinCustomResource(javaResource, GalleryApplicationAssignmentMapper) {
/**
* Specifies the URI to an Azure Blob that will replace the default configuration for the package if provided. Changing this forces a new resource to be created.
*/
public val configurationBlobUri: Output?
get() = javaResource.configurationBlobUri().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The ID of the Gallery Application Version. Changing this forces a new resource to be created.
*/
public val galleryApplicationVersionId: Output
get() = javaResource.galleryApplicationVersionId().applyValue({ args0 -> args0 })
/**
* Specifies the order in which the packages have to be installed. Possible values are between `0` and `2147483647`. Defaults to `0`.
*/
public val order: Output?
get() = javaResource.order().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Specifies a passthrough value for more generic context. This field can be any valid `string` value. Changing this forces a new resource to be created.
*/
public val tag: Output?
get() = javaResource.tag().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The ID of the Virtual Machine. Changing this forces a new resource to be created.
*/
public val virtualMachineId: Output
get() = javaResource.virtualMachineId().applyValue({ args0 -> args0 })
}
public object GalleryApplicationAssignmentMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.compute.GalleryApplicationAssignment::class == javaResource::class
override fun map(javaResource: Resource): GalleryApplicationAssignment =
GalleryApplicationAssignment(
javaResource as
com.pulumi.azure.compute.GalleryApplicationAssignment,
)
}
/**
* @see [GalleryApplicationAssignment].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [GalleryApplicationAssignment].
*/
public suspend fun galleryApplicationAssignment(
name: String,
block: suspend GalleryApplicationAssignmentResourceBuilder.() -> Unit,
): GalleryApplicationAssignment {
val builder = GalleryApplicationAssignmentResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [GalleryApplicationAssignment].
* @param name The _unique_ name of the resulting resource.
*/
public fun galleryApplicationAssignment(name: String): GalleryApplicationAssignment {
val builder = GalleryApplicationAssignmentResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy