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.Credential.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.automation.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.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [Credential].
*/
@PulumiTagMarker
public class CredentialResourceBuilder internal constructor() {
public var name: String? = null
public var args: CredentialArgs = CredentialArgs()
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 CredentialArgsBuilder.() -> Unit) {
val builder = CredentialArgsBuilder()
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(): Credential {
val builtJavaResource = com.pulumi.azure.automation.Credential(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Credential(builtJavaResource)
}
}
/**
* Manages a Automation Credential.
* ## 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 exampleCredential = new azure.automation.Credential("example", {
* name: "credential1",
* resourceGroupName: example.name,
* automationAccountName: exampleAccount.name,
* username: "example_user",
* password: "example_pwd",
* description: "This is an example credential",
* });
* ```
* ```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_credential = azure.automation.Credential("example",
* name="credential1",
* resource_group_name=example.name,
* automation_account_name=example_account.name,
* username="example_user",
* password="example_pwd",
* description="This is an example credential")
* ```
* ```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 exampleCredential = new Azure.Automation.Credential("example", new()
* {
* Name = "credential1",
* ResourceGroupName = example.Name,
* AutomationAccountName = exampleAccount.Name,
* Username = "example_user",
* Password = "example_pwd",
* Description = "This is an example credential",
* });
* });
* ```
* ```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.NewCredential(ctx, "example", &automation.CredentialArgs{
* Name: pulumi.String("credential1"),
* ResourceGroupName: example.Name,
* AutomationAccountName: exampleAccount.Name,
* Username: pulumi.String("example_user"),
* Password: pulumi.String("example_pwd"),
* Description: pulumi.String("This is an example credential"),
* })
* 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.Credential;
* import com.pulumi.azure.automation.CredentialArgs;
* 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 exampleCredential = new Credential("exampleCredential", CredentialArgs.builder()
* .name("credential1")
* .resourceGroupName(example.name())
* .automationAccountName(exampleAccount.name())
* .username("example_user")
* .password("example_pwd")
* .description("This is an example credential")
* .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
* exampleCredential:
* type: azure:automation:Credential
* name: example
* properties:
* name: credential1
* resourceGroupName: ${example.name}
* automationAccountName: ${exampleAccount.name}
* username: example_user
* password: example_pwd
* description: This is an example credential
* ```
*
* ## Import
* Automation Credentials can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:automation/credential:Credential credential1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Automation/automationAccounts/account1/credentials/credential1
* ```
*/
public class Credential internal constructor(
override val javaResource: com.pulumi.azure.automation.Credential,
) : KotlinCustomResource(javaResource, CredentialMapper) {
/**
* The name of the automation account in which the Credential is created. Changing this forces a new resource to be created.
*/
public val automationAccountName: Output
get() = javaResource.automationAccountName().applyValue({ args0 -> args0 })
/**
* The description associated with this Automation Credential.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies the name of the Credential. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The password associated with this Automation Credential.
*/
public val password: Output
get() = javaResource.password().applyValue({ args0 -> args0 })
/**
* The name of the resource group in which the Credential is created. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The username associated with this Automation Credential.
*/
public val username: Output
get() = javaResource.username().applyValue({ args0 -> args0 })
}
public object CredentialMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.automation.Credential::class == javaResource::class
override fun map(javaResource: Resource): Credential = Credential(
javaResource as
com.pulumi.azure.automation.Credential,
)
}
/**
* @see [Credential].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Credential].
*/
public suspend fun credential(name: String, block: suspend CredentialResourceBuilder.() -> Unit): Credential {
val builder = CredentialResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Credential].
* @param name The _unique_ name of the resulting resource.
*/
public fun credential(name: String): Credential {
val builder = CredentialResourceBuilder()
builder.name(name)
return builder.build()
}