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.azure.automation.kotlin.RunBook.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.automation.kotlin
import com.pulumi.azure.automation.kotlin.outputs.RunBookDraft
import com.pulumi.azure.automation.kotlin.outputs.RunBookJobSchedule
import com.pulumi.azure.automation.kotlin.outputs.RunBookPublishContentLink
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
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.automation.kotlin.outputs.RunBookDraft.Companion.toKotlin as runBookDraftToKotlin
import com.pulumi.azure.automation.kotlin.outputs.RunBookJobSchedule.Companion.toKotlin as runBookJobScheduleToKotlin
import com.pulumi.azure.automation.kotlin.outputs.RunBookPublishContentLink.Companion.toKotlin as runBookPublishContentLinkToKotlin
/**
* Builder for [RunBook].
*/
@PulumiTagMarker
public class RunBookResourceBuilder internal constructor() {
public var name: String? = null
public var args: RunBookArgs = RunBookArgs()
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 RunBookArgsBuilder.() -> Unit) {
val builder = RunBookArgsBuilder()
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(): RunBook {
val builtJavaResource = com.pulumi.azure.automation.RunBook(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return RunBook(builtJavaResource)
}
}
/**
* Manages a Automation Runbook.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-resources",
* location: "West Europe",
* });
* const exampleAccount = new azure.automation.Account("example", {
* name: "account1",
* 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 an example runbook",
* runbookType: "PowerShellWorkflow",
* publishContentLink: {
* uri: "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_account = azure.automation.Account("example",
* name="account1",
* 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 an example runbook",
* runbook_type="PowerShellWorkflow",
* publish_content_link={
* "uri": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
* })
* ```
* ```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-resources",
* Location = "West Europe",
* });
* var exampleAccount = new Azure.Automation.Account("example", new()
* {
* Name = "account1",
* 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 an example runbook",
* RunbookType = "PowerShellWorkflow",
* PublishContentLink = new Azure.Automation.Inputs.RunBookPublishContentLinkArgs
* {
* Uri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
* },
* });
* });
* ```
* ```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-resources"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := automation.NewAccount(ctx, "example", &automation.AccountArgs{
* Name: pulumi.String("account1"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* SkuName: pulumi.String("Basic"),
* })
* if err != nil {
* return err
* }
* _, 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 an example runbook"),
* RunbookType: pulumi.String("PowerShellWorkflow"),
* PublishContentLink: &automation.RunBookPublishContentLinkArgs{
* Uri: pulumi.String("https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1"),
* },
* })
* 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.inputs.RunBookPublishContentLinkArgs;
* 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-resources")
* .location("West Europe")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("account1")
* .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 an example runbook")
* .runbookType("PowerShellWorkflow")
* .publishContentLink(RunBookPublishContentLinkArgs.builder()
* .uri("https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleAccount:
* type: azure:automation:Account
* name: example
* properties:
* name: account1
* 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 an example runbook
* runbookType: PowerShellWorkflow
* publishContentLink:
* uri: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/c4935ffb69246a6058eb24f54640f53f69d3ac9f/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1
* ```
*
* ## Import
* Automation Runbooks can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:automation/runBook:RunBook Get-AzureVMTutorial /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Automation/automationAccounts/account1/runbooks/Get-AzureVMTutorial
* ```
*/
public class RunBook internal constructor(
override val javaResource: com.pulumi.azure.automation.RunBook,
) : KotlinCustomResource(javaResource, RunBookMapper) {
/**
* The name of the automation account in which the Runbook is created. Changing this forces a new resource to be created.
*/
public val automationAccountName: Output
get() = javaResource.automationAccountName().applyValue({ args0 -> args0 })
/**
* The desired content of the runbook.
* > **NOTE** The Azure API requires a `publish_content_link` to be supplied even when specifying your own `content`.
*/
public val content: Output
get() = javaResource.content().applyValue({ args0 -> args0 })
/**
* A description for this credential.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A `draft` block as defined below.
*/
public val draft: Output?
get() = javaResource.draft().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
runBookDraftToKotlin(args0)
})
}).orElse(null)
})
/**
* One or more `job_schedule` block as defined below.
* > **NOTE** AzureRM provides a stand-alone azure.automation.JobSchedule and this inlined `job_schdule` property to manage the job schedules. At this time you should choose one of them to manage the job schedule resources.
*/
public val jobSchedules: Output>
get() = javaResource.jobSchedules().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
runBookJobScheduleToKotlin(args0)
})
})
})
/**
* Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* Specifies the activity-level tracing options of the runbook, available only for Graphical runbooks. Possible values are `0` for None, `9` for Basic, and `15` for Detailed. Must turn on Verbose logging in order to see the tracing.
*/
public val logActivityTraceLevel: Output?
get() = javaResource.logActivityTraceLevel().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Progress log option.
*/
public val logProgress: Output
get() = javaResource.logProgress().applyValue({ args0 -> args0 })
/**
* Verbose log option.
*/
public val logVerbose: Output
get() = javaResource.logVerbose().applyValue({ args0 -> args0 })
/**
* Specifies the name of the Runbook. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* One `publish_content_link` block as defined below.
*/
public val publishContentLink: Output?
get() = javaResource.publishContentLink().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> runBookPublishContentLinkToKotlin(args0) })
}).orElse(null)
})
/**
* The name of the resource group in which the Runbook is created. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The type of the runbook - can be either `Graph`, `GraphPowerShell`, `GraphPowerShellWorkflow`, `PowerShellWorkflow`, `PowerShell`, `PowerShell72`, `Python3`, `Python2` or `Script`. Changing this forces a new resource to be created.
*/
public val runbookType: Output
get() = javaResource.runbookType().applyValue({ args0 -> args0 })
/**
* A mapping of tags to assign to the resource.
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}).orElse(null)
})
}
public object RunBookMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.automation.RunBook::class == javaResource::class
override fun map(javaResource: Resource): RunBook = RunBook(
javaResource as
com.pulumi.azure.automation.RunBook,
)
}
/**
* @see [RunBook].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [RunBook].
*/
public suspend fun runBook(name: String, block: suspend RunBookResourceBuilder.() -> Unit): RunBook {
val builder = RunBookResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [RunBook].
* @param name The _unique_ name of the resulting resource.
*/
public fun runBook(name: String): RunBook {
val builder = RunBookResourceBuilder()
builder.name(name)
return builder.build()
}