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

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

package com.pulumi.azure.automation.kotlin

import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationLinux
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationPostTask
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationPreTask
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationSchedule
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationTarget
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationWindows
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.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationLinux.Companion.toKotlin as softwareUpdateConfigurationLinuxToKotlin
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationPostTask.Companion.toKotlin as softwareUpdateConfigurationPostTaskToKotlin
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationPreTask.Companion.toKotlin as softwareUpdateConfigurationPreTaskToKotlin
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationSchedule.Companion.toKotlin as softwareUpdateConfigurationScheduleToKotlin
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationTarget.Companion.toKotlin as softwareUpdateConfigurationTargetToKotlin
import com.pulumi.azure.automation.kotlin.outputs.SoftwareUpdateConfigurationWindows.Companion.toKotlin as softwareUpdateConfigurationWindowsToKotlin

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

    public var args: SoftwareUpdateConfigurationArgs = SoftwareUpdateConfigurationArgs()

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

/**
 * Manages an Automation Software Update Configuraion.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-rg",
 *     location: "East US",
 * });
 * const exampleAccount = new azure.automation.Account("example", {
 *     name: "example",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     skuName: "Basic",
 * });
 * const exampleRunBook = new azure.automation.RunBook("example", {
 *     name: "Get-AzureVMTutorial",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     automationAccountName: exampleAccount.name,
 *     logVerbose: true,
 *     logProgress: true,
 *     description: "This is a example runbook for terraform acceptance example",
 *     runbookType: "Python3",
 *     content: `# Some example content
 * # for Terraform acceptance example
 * `,
 *     tags: {
 *         ENV: "runbook_test",
 *     },
 * });
 * const exampleSoftwareUpdateConfiguration = new azure.automation.SoftwareUpdateConfiguration("example", {
 *     name: "example",
 *     automationAccountId: exampleAccount.id,
 *     operatingSystem: "Linux",
 *     linuxes: [{
 *         classificationIncluded: "Security",
 *         excludedPackages: ["apt"],
 *         includedPackages: ["vim"],
 *         reboot: "IfRequired",
 *     }],
 *     preTasks: [{
 *         source: exampleRunBook.name,
 *         parameters: {
 *             COMPUTER_NAME: "Foo",
 *         },
 *     }],
 *     duration: "PT2H2M2S",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-rg",
 *     location="East US")
 * example_account = azure.automation.Account("example",
 *     name="example",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku_name="Basic")
 * example_run_book = azure.automation.RunBook("example",
 *     name="Get-AzureVMTutorial",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     automation_account_name=example_account.name,
 *     log_verbose=True,
 *     log_progress=True,
 *     description="This is a example runbook for terraform acceptance example",
 *     runbook_type="Python3",
 *     content="""# Some example content
 * # for Terraform acceptance example
 * """,
 *     tags={
 *         "ENV": "runbook_test",
 *     })
 * example_software_update_configuration = azure.automation.SoftwareUpdateConfiguration("example",
 *     name="example",
 *     automation_account_id=example_account.id,
 *     operating_system="Linux",
 *     linuxes=[azure.automation.SoftwareUpdateConfigurationLinuxArgs(
 *         classification_included="Security",
 *         excluded_packages=["apt"],
 *         included_packages=["vim"],
 *         reboot="IfRequired",
 *     )],
 *     pre_tasks=[azure.automation.SoftwareUpdateConfigurationPreTaskArgs(
 *         source=example_run_book.name,
 *         parameters={
 *             "COMPUTER_NAME": "Foo",
 *         },
 *     )],
 *     duration="PT2H2M2S")
 * ```
 * ```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-rg",
 *         Location = "East US",
 *     });
 *     var exampleAccount = new Azure.Automation.Account("example", new()
 *     {
 *         Name = "example",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         SkuName = "Basic",
 *     });
 *     var exampleRunBook = new Azure.Automation.RunBook("example", new()
 *     {
 *         Name = "Get-AzureVMTutorial",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AutomationAccountName = exampleAccount.Name,
 *         LogVerbose = true,
 *         LogProgress = true,
 *         Description = "This is a example runbook for terraform acceptance example",
 *         RunbookType = "Python3",
 *         Content = @"# Some example content
 * # for Terraform acceptance example
 * ",
 *         Tags =
 *         {
 *             { "ENV", "runbook_test" },
 *         },
 *     });
 *     var exampleSoftwareUpdateConfiguration = new Azure.Automation.SoftwareUpdateConfiguration("example", new()
 *     {
 *         Name = "example",
 *         AutomationAccountId = exampleAccount.Id,
 *         OperatingSystem = "Linux",
 *         Linuxes = new[]
 *         {
 *             new Azure.Automation.Inputs.SoftwareUpdateConfigurationLinuxArgs
 *             {
 *                 ClassificationIncluded = "Security",
 *                 ExcludedPackages = new[]
 *                 {
 *                     "apt",
 *                 },
 *                 IncludedPackages = new[]
 *                 {
 *                     "vim",
 *                 },
 *                 Reboot = "IfRequired",
 *             },
 *         },
 *         PreTasks = new[]
 *         {
 *             new Azure.Automation.Inputs.SoftwareUpdateConfigurationPreTaskArgs
 *             {
 *                 Source = exampleRunBook.Name,
 *                 Parameters =
 *                 {
 *                     { "COMPUTER_NAME", "Foo" },
 *                 },
 *             },
 *         },
 *         Duration = "PT2H2M2S",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/automation"
 * 	"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 {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-rg"),
 * 			Location: pulumi.String("East US"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAccount, err := automation.NewAccount(ctx, "example", &automation.AccountArgs{
 * 			Name:              pulumi.String("example"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			SkuName:           pulumi.String("Basic"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleRunBook, err := automation.NewRunBook(ctx, "example", &automation.RunBookArgs{
 * 			Name:                  pulumi.String("Get-AzureVMTutorial"),
 * 			Location:              example.Location,
 * 			ResourceGroupName:     example.Name,
 * 			AutomationAccountName: exampleAccount.Name,
 * 			LogVerbose:            pulumi.Bool(true),
 * 			LogProgress:           pulumi.Bool(true),
 * 			Description:           pulumi.String("This is a example runbook for terraform acceptance example"),
 * 			RunbookType:           pulumi.String("Python3"),
 * 			Content:               pulumi.String("# Some example content\n# for Terraform acceptance example\n"),
 * 			Tags: pulumi.StringMap{
 * 				"ENV": pulumi.String("runbook_test"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = automation.NewSoftwareUpdateConfiguration(ctx, "example", &automation.SoftwareUpdateConfigurationArgs{
 * 			Name:                pulumi.String("example"),
 * 			AutomationAccountId: exampleAccount.ID(),
 * 			OperatingSystem:     pulumi.String("Linux"),
 * 			Linuxes: automation.SoftwareUpdateConfigurationLinuxArray{
 * 				&automation.SoftwareUpdateConfigurationLinuxArgs{
 * 					ClassificationIncluded: pulumi.String("Security"),
 * 					ExcludedPackages: pulumi.StringArray{
 * 						pulumi.String("apt"),
 * 					},
 * 					IncludedPackages: pulumi.StringArray{
 * 						pulumi.String("vim"),
 * 					},
 * 					Reboot: pulumi.String("IfRequired"),
 * 				},
 * 			},
 * 			PreTasks: automation.SoftwareUpdateConfigurationPreTaskArray{
 * 				&automation.SoftwareUpdateConfigurationPreTaskArgs{
 * 					Source: exampleRunBook.Name,
 * 					Parameters: pulumi.StringMap{
 * 						"COMPUTER_NAME": pulumi.String("Foo"),
 * 					},
 * 				},
 * 			},
 * 			Duration: pulumi.String("PT2H2M2S"),
 * 		})
 * 		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.automation.Account;
 * import com.pulumi.azure.automation.AccountArgs;
 * import com.pulumi.azure.automation.RunBook;
 * import com.pulumi.azure.automation.RunBookArgs;
 * import com.pulumi.azure.automation.SoftwareUpdateConfiguration;
 * import com.pulumi.azure.automation.SoftwareUpdateConfigurationArgs;
 * import com.pulumi.azure.automation.inputs.SoftwareUpdateConfigurationLinuxArgs;
 * import com.pulumi.azure.automation.inputs.SoftwareUpdateConfigurationPreTaskArgs;
 * 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-rg")
 *             .location("East US")
 *             .build());
 *         var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .skuName("Basic")
 *             .build());
 *         var exampleRunBook = new RunBook("exampleRunBook", RunBookArgs.builder()
 *             .name("Get-AzureVMTutorial")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .automationAccountName(exampleAccount.name())
 *             .logVerbose("true")
 *             .logProgress("true")
 *             .description("This is a example runbook for terraform acceptance example")
 *             .runbookType("Python3")
 *             .content("""
 * # Some example content
 * # for Terraform acceptance example
 *             """)
 *             .tags(Map.of("ENV", "runbook_test"))
 *             .build());
 *         var exampleSoftwareUpdateConfiguration = new SoftwareUpdateConfiguration("exampleSoftwareUpdateConfiguration", SoftwareUpdateConfigurationArgs.builder()
 *             .name("example")
 *             .automationAccountId(exampleAccount.id())
 *             .operatingSystem("Linux")
 *             .linuxes(SoftwareUpdateConfigurationLinuxArgs.builder()
 *                 .classificationIncluded("Security")
 *                 .excludedPackages("apt")
 *                 .includedPackages("vim")
 *                 .reboot("IfRequired")
 *                 .build())
 *             .preTasks(SoftwareUpdateConfigurationPreTaskArgs.builder()
 *                 .source(exampleRunBook.name())
 *                 .parameters(Map.of("COMPUTER_NAME", "Foo"))
 *                 .build())
 *             .duration("PT2H2M2S")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-rg
 *       location: East US
 *   exampleAccount:
 *     type: azure:automation:Account
 *     name: example
 *     properties:
 *       name: example
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       skuName: Basic
 *   exampleRunBook:
 *     type: azure:automation:RunBook
 *     name: example
 *     properties:
 *       name: Get-AzureVMTutorial
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       automationAccountName: ${exampleAccount.name}
 *       logVerbose: 'true'
 *       logProgress: 'true'
 *       description: This is a example runbook for terraform acceptance example
 *       runbookType: Python3
 *       content: |
 *         # Some example content
 *         # for Terraform acceptance example
 *       tags:
 *         ENV: runbook_test
 *   exampleSoftwareUpdateConfiguration:
 *     type: azure:automation:SoftwareUpdateConfiguration
 *     name: example
 *     properties:
 *       name: example
 *       automationAccountId: ${exampleAccount.id}
 *       operatingSystem: Linux
 *       linuxes:
 *         - classificationIncluded: Security
 *           excludedPackages:
 *             - apt
 *           includedPackages:
 *             - vim
 *           reboot: IfRequired
 *       preTasks:
 *         - source: ${exampleRunBook.name}
 *           parameters:
 *             COMPUTER_NAME: Foo
 *       duration: PT2H2M2S
 * ```
 * 
 * ## Import
 * Automations Software Update Configuration can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:automation/softwareUpdateConfiguration:SoftwareUpdateConfiguration example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Automation/automationAccounts/account1/softwareUpdateConfigurations/suc1
 * ```
 */
public class SoftwareUpdateConfiguration internal constructor(
    override val javaResource: com.pulumi.azure.automation.SoftwareUpdateConfiguration,
) : KotlinCustomResource(javaResource, SoftwareUpdateConfigurationMapper) {
    /**
     * The ID of Automation Account to manage this Source Control. Changing this forces a new Automation Source Control to be created.
     */
    public val automationAccountId: Output
        get() = javaResource.automationAccountId().applyValue({ args0 -> args0 })

    /**
     * Maximum time allowed for the software update configuration run. using format `PT[n]H[n]M[n]S` as per ISO8601. Defaults to `PT2H`.
     */
    public val duration: Output?
        get() = javaResource.duration().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The Error code when failed.
     */
    public val errorCode: Output
        get() = javaResource.errorCode().applyValue({ args0 -> args0 })

    /**
     * The Error message indicating why the operation failed.
     */
    @Deprecated(
        message = """
  `error_meesage` will be removed in favour of `error_message` in version 4.0 of the AzureRM
      Provider
  """,
    )
    public val errorMeesage: Output
        get() = javaResource.errorMeesage().applyValue({ args0 -> args0 })

    public val errorMessage: Output
        get() = javaResource.errorMessage().applyValue({ args0 -> args0 })

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

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

    /**
     * Specifies a list of names of non-Azure machines for the software update configuration.
     */
    public val nonAzureComputerNames: Output>?
        get() = javaResource.nonAzureComputerNames().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    @Deprecated(
        message = """
  This property has been deprecated and will be removed in a future release. The use of either the
      `linux` or `windows` blocks replaces setting this value directly. This value is ignored by the
      provider.
  """,
    )
    public val operatingSystem: Output
        get() = javaResource.operatingSystem().applyValue({ args0 -> args0 })

    /**
     * A `post_task` blocks as defined below.
     */
    public val postTasks: Output>?
        get() = javaResource.postTasks().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> softwareUpdateConfigurationPostTaskToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * A `pre_task` blocks as defined below.
     */
    public val preTasks: Output>?
        get() = javaResource.preTasks().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> softwareUpdateConfigurationPreTaskToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * A `schedule` blocks as defined below.
     */
    public val schedules: Output>
        get() = javaResource.schedules().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    softwareUpdateConfigurationScheduleToKotlin(args0)
                })
            })
        })

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

    /**
     * Specifies a list of Azure Resource IDs of azure virtual machines.
     */
    public val virtualMachineIds: Output>?
        get() = javaResource.virtualMachineIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * A `windows` block as defined below.
     * > **NOTE:** One of `linux` or `windows` must be specified.
     */
    public val windows: Output?
        get() = javaResource.windows().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    softwareUpdateConfigurationWindowsToKotlin(args0)
                })
            }).orElse(null)
        })
}

public object SoftwareUpdateConfigurationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.automation.SoftwareUpdateConfiguration::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy