![JAR search and dependency download from the Maven repository](/logo.png)
com.pulumi.azure.automation.kotlin.SourceControl.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.automation.kotlin
import com.pulumi.azure.automation.kotlin.outputs.SourceControlSecurity
import com.pulumi.azure.automation.kotlin.outputs.SourceControlSecurity.Companion.toKotlin
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
/**
* Builder for [SourceControl].
*/
@PulumiTagMarker
public class SourceControlResourceBuilder internal constructor() {
public var name: String? = null
public var args: SourceControlArgs = SourceControlArgs()
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 SourceControlArgsBuilder.() -> Unit) {
val builder = SourceControlArgsBuilder()
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(): SourceControl {
val builtJavaResource = com.pulumi.azure.automation.SourceControl(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return SourceControl(builtJavaResource)
}
}
/**
* Manages an Automation Source Control.
* ## 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: "example-account",
* location: example.location,
* resourceGroupName: example.name,
* skuName: "Basic",
* });
* const exampleSourceControl = new azure.automation.SourceControl("example", {
* name: "example",
* automationAccountId: exampleAccount.id,
* folderPath: "runbook",
* security: {
* token: "ghp_xxx",
* tokenType: "PersonalAccessToken",
* },
* repositoryUrl: "https://github.com/foo/bat.git",
* sourceControlType: "GitHub",
* branch: "main",
* });
* ```
* ```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="example-account",
* location=example.location,
* resource_group_name=example.name,
* sku_name="Basic")
* example_source_control = azure.automation.SourceControl("example",
* name="example",
* automation_account_id=example_account.id,
* folder_path="runbook",
* security={
* "token": "ghp_xxx",
* "token_type": "PersonalAccessToken",
* },
* repository_url="https://github.com/foo/bat.git",
* source_control_type="GitHub",
* branch="main")
* ```
* ```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 = "example-account",
* Location = example.Location,
* ResourceGroupName = example.Name,
* SkuName = "Basic",
* });
* var exampleSourceControl = new Azure.Automation.SourceControl("example", new()
* {
* Name = "example",
* AutomationAccountId = exampleAccount.Id,
* FolderPath = "runbook",
* Security = new Azure.Automation.Inputs.SourceControlSecurityArgs
* {
* Token = "ghp_xxx",
* TokenType = "PersonalAccessToken",
* },
* RepositoryUrl = "https://github.com/foo/bat.git",
* SourceControlType = "GitHub",
* Branch = "main",
* });
* });
* ```
* ```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("example-account"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* SkuName: pulumi.String("Basic"),
* })
* if err != nil {
* return err
* }
* _, err = automation.NewSourceControl(ctx, "example", &automation.SourceControlArgs{
* Name: pulumi.String("example"),
* AutomationAccountId: exampleAccount.ID(),
* FolderPath: pulumi.String("runbook"),
* Security: &automation.SourceControlSecurityArgs{
* Token: pulumi.String("ghp_xxx"),
* TokenType: pulumi.String("PersonalAccessToken"),
* },
* RepositoryUrl: pulumi.String("https://github.com/foo/bat.git"),
* SourceControlType: pulumi.String("GitHub"),
* Branch: pulumi.String("main"),
* })
* 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.SourceControl;
* import com.pulumi.azure.automation.SourceControlArgs;
* import com.pulumi.azure.automation.inputs.SourceControlSecurityArgs;
* 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("example-account")
* .location(example.location())
* .resourceGroupName(example.name())
* .skuName("Basic")
* .build());
* var exampleSourceControl = new SourceControl("exampleSourceControl", SourceControlArgs.builder()
* .name("example")
* .automationAccountId(exampleAccount.id())
* .folderPath("runbook")
* .security(SourceControlSecurityArgs.builder()
* .token("ghp_xxx")
* .tokenType("PersonalAccessToken")
* .build())
* .repositoryUrl("https://github.com/foo/bat.git")
* .sourceControlType("GitHub")
* .branch("main")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleAccount:
* type: azure:automation:Account
* name: example
* properties:
* name: example-account
* location: ${example.location}
* resourceGroupName: ${example.name}
* skuName: Basic
* exampleSourceControl:
* type: azure:automation:SourceControl
* name: example
* properties:
* name: example
* automationAccountId: ${exampleAccount.id}
* folderPath: runbook
* security:
* token: ghp_xxx
* tokenType: PersonalAccessToken
* repositoryUrl: https://github.com/foo/bat.git
* sourceControlType: GitHub
* branch: main
* ```
*
* ## Import
* Automations can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:automation/sourceControl:SourceControl example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.Automation/automationAccounts/account1/sourceControls/sc1
* ```
*/
public class SourceControl internal constructor(
override val javaResource: com.pulumi.azure.automation.SourceControl,
) : KotlinCustomResource(javaResource, SourceControlMapper) {
/**
* Whether auto async the Source Control.
*/
public val automaticSync: Output?
get() = javaResource.automaticSync().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* 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 })
/**
* Specify the repo branch of the Source Control. Empty value is valid only for `VsoTfvc`.
*/
public val branch: Output?
get() = javaResource.branch().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* A short description of the Source Control.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The folder path of the source control. This Path must be relative.
*/
public val folderPath: Output
get() = javaResource.folderPath().applyValue({ args0 -> args0 })
/**
* The name which should be used for this Automation Source Control. Changing this forces a new Automation Source Control to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Whether auto publish the Source Control. Defaults to `true`.
*/
public val publishRunbookEnabled: Output?
get() = javaResource.publishRunbookEnabled().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The Repository URL of the source control.
*/
public val repositoryUrl: Output
get() = javaResource.repositoryUrl().applyValue({ args0 -> args0 })
/**
* A `security` block as defined below.
*/
public val security: Output
get() = javaResource.security().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })
/**
* The source type of Source Control, possible vaules are `VsoGit`, `VsoTfvc` and `GitHub`, and the value is case sensitive.
*/
public val sourceControlType: Output
get() = javaResource.sourceControlType().applyValue({ args0 -> args0 })
}
public object SourceControlMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.automation.SourceControl::class == javaResource::class
override fun map(javaResource: Resource): SourceControl = SourceControl(
javaResource as
com.pulumi.azure.automation.SourceControl,
)
}
/**
* @see [SourceControl].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [SourceControl].
*/
public suspend fun sourceControl(
name: String,
block: suspend SourceControlResourceBuilder.() -> Unit,
): SourceControl {
val builder = SourceControlResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [SourceControl].
* @param name The _unique_ name of the resulting resource.
*/
public fun sourceControl(name: String): SourceControl {
val builder = SourceControlResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy