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

com.pulumi.azure.confidentialledger.kotlin.Ledger.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.confidentialledger.kotlin

import com.pulumi.azure.confidentialledger.kotlin.outputs.LedgerAzureadBasedServicePrincipal
import com.pulumi.azure.confidentialledger.kotlin.outputs.LedgerCertificateBasedSecurityPrincipal
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
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.confidentialledger.kotlin.outputs.LedgerAzureadBasedServicePrincipal.Companion.toKotlin as ledgerAzureadBasedServicePrincipalToKotlin
import com.pulumi.azure.confidentialledger.kotlin.outputs.LedgerCertificateBasedSecurityPrincipal.Companion.toKotlin as ledgerCertificateBasedSecurityPrincipalToKotlin

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

    public var args: LedgerArgs = LedgerArgs()

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

/**
 * Manages a Confidential Ledger.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const current = azure.core.getClientConfig({});
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const ledger = new azure.confidentialledger.Ledger("ledger", {
 *     name: "example-ledger",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     ledgerType: "Private",
 *     azureadBasedServicePrincipals: [{
 *         principalId: current.then(current => current.objectId),
 *         tenantId: current.then(current => current.tenantId),
 *         ledgerRoleName: "Administrator",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * current = azure.core.get_client_config()
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * ledger = azure.confidentialledger.Ledger("ledger",
 *     name="example-ledger",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     ledger_type="Private",
 *     azuread_based_service_principals=[{
 *         "principal_id": current.object_id,
 *         "tenant_id": current.tenant_id,
 *         "ledger_role_name": "Administrator",
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var current = Azure.Core.GetClientConfig.Invoke();
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var ledger = new Azure.ConfidentialLedger.Ledger("ledger", new()
 *     {
 *         Name = "example-ledger",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         LedgerType = "Private",
 *         AzureadBasedServicePrincipals = new[]
 *         {
 *             new Azure.ConfidentialLedger.Inputs.LedgerAzureadBasedServicePrincipalArgs
 *             {
 *                 PrincipalId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
 *                 TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *                 LedgerRoleName = "Administrator",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/confidentialledger"
 * 	"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 {
 * 		current, err := core.GetClientConfig(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = confidentialledger.NewLedger(ctx, "ledger", &confidentialledger.LedgerArgs{
 * 			Name:              pulumi.String("example-ledger"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			LedgerType:        pulumi.String("Private"),
 * 			AzureadBasedServicePrincipals: confidentialledger.LedgerAzureadBasedServicePrincipalArray{
 * 				&confidentialledger.LedgerAzureadBasedServicePrincipalArgs{
 * 					PrincipalId:    pulumi.String(current.ObjectId),
 * 					TenantId:       pulumi.String(current.TenantId),
 * 					LedgerRoleName: pulumi.String("Administrator"),
 * 				},
 * 			},
 * 		})
 * 		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.CoreFunctions;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.confidentialledger.Ledger;
 * import com.pulumi.azure.confidentialledger.LedgerArgs;
 * import com.pulumi.azure.confidentialledger.inputs.LedgerAzureadBasedServicePrincipalArgs;
 * 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 current = CoreFunctions.getClientConfig();
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var ledger = new Ledger("ledger", LedgerArgs.builder()
 *             .name("example-ledger")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .ledgerType("Private")
 *             .azureadBasedServicePrincipals(LedgerAzureadBasedServicePrincipalArgs.builder()
 *                 .principalId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *                 .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *                 .ledgerRoleName("Administrator")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   ledger:
 *     type: azure:confidentialledger:Ledger
 *     properties:
 *       name: example-ledger
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       ledgerType: Private
 *       azureadBasedServicePrincipals:
 *         - principalId: ${current.objectId}
 *           tenantId: ${current.tenantId}
 *           ledgerRoleName: Administrator
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Confidential Ledgers can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:confidentialledger/ledger:Ledger example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-group/providers/Microsoft.ConfidentialLedger/ledgers/example-ledger
 * ```
 */
public class Ledger internal constructor(
    override val javaResource: com.pulumi.azure.confidentialledger.Ledger,
) : KotlinCustomResource(javaResource, LedgerMapper) {
    /**
     * A list of `azuread_based_service_principal` blocks as defined below.
     */
    public val azureadBasedServicePrincipals: Output>
        get() = javaResource.azureadBasedServicePrincipals().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> ledgerAzureadBasedServicePrincipalToKotlin(args0) })
            })
        })

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

    /**
     * The Identity Service Endpoint for this Confidential Ledger.
     */
    public val identityServiceEndpoint: Output
        get() = javaResource.identityServiceEndpoint().applyValue({ args0 -> args0 })

    /**
     * The Endpoint for this Confidential Ledger.
     */
    public val ledgerEndpoint: Output
        get() = javaResource.ledgerEndpoint().applyValue({ args0 -> args0 })

    /**
     * Specifies the type of Confidential Ledger. Possible values are `Private` and `Public`. Changing this forces a new resource to be created.
     */
    public val ledgerType: Output
        get() = javaResource.ledgerType().applyValue({ args0 -> args0 })

    /**
     * Specifies the supported Azure location where the Confidential Ledger exists. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Confidential Ledger. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the Resource Group where the Confidential Ledger exists. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags to assign to the Confidential Ledger.
     */
    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 LedgerMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.confidentialledger.Ledger::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy