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

com.pulumi.aws.directoryservice.kotlin.SharedDirectory.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.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.directoryservice.kotlin

import com.pulumi.aws.directoryservice.kotlin.outputs.SharedDirectoryTarget
import com.pulumi.aws.directoryservice.kotlin.outputs.SharedDirectoryTarget.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 [SharedDirectory].
 */
@PulumiTagMarker
public class SharedDirectoryResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: SharedDirectoryArgs = SharedDirectoryArgs()

    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 SharedDirectoryArgsBuilder.() -> Unit) {
        val builder = SharedDirectoryArgsBuilder()
        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(): SharedDirectory {
        val builtJavaResource = com.pulumi.aws.directoryservice.SharedDirectory(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return SharedDirectory(builtJavaResource)
    }
}

/**
 * Manages a directory in your account (directory owner) shared with another account (directory consumer).
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.directoryservice.Directory("example", {
 *     name: "tf-example",
 *     password: "SuperSecretPassw0rd",
 *     type: "MicrosoftAD",
 *     edition: "Standard",
 *     vpcSettings: {
 *         vpcId: exampleAwsVpc.id,
 *         subnetIds: exampleAwsSubnet.map(__item => __item.id),
 *     },
 * });
 * const exampleSharedDirectory = new aws.directoryservice.SharedDirectory("example", {
 *     directoryId: example.id,
 *     notes: "You wanna have a catch?",
 *     target: {
 *         id: receiver.accountId,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.directoryservice.Directory("example",
 *     name="tf-example",
 *     password="SuperSecretPassw0rd",
 *     type="MicrosoftAD",
 *     edition="Standard",
 *     vpc_settings={
 *         "vpc_id": example_aws_vpc["id"],
 *         "subnet_ids": [__item["id"] for __item in example_aws_subnet],
 *     })
 * example_shared_directory = aws.directoryservice.SharedDirectory("example",
 *     directory_id=example.id,
 *     notes="You wanna have a catch?",
 *     target={
 *         "id": receiver["accountId"],
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.DirectoryService.Directory("example", new()
 *     {
 *         Name = "tf-example",
 *         Password = "SuperSecretPassw0rd",
 *         Type = "MicrosoftAD",
 *         Edition = "Standard",
 *         VpcSettings = new Aws.DirectoryService.Inputs.DirectoryVpcSettingsArgs
 *         {
 *             VpcId = exampleAwsVpc.Id,
 *             SubnetIds = exampleAwsSubnet.Select(__item => __item.Id).ToList(),
 *         },
 *     });
 *     var exampleSharedDirectory = new Aws.DirectoryService.SharedDirectory("example", new()
 *     {
 *         DirectoryId = example.Id,
 *         Notes = "You wanna have a catch?",
 *         Target = new Aws.DirectoryService.Inputs.SharedDirectoryTargetArgs
 *         {
 *             Id = receiver.AccountId,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/directoryservice"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * pulumi.Run(func(ctx *pulumi.Context) error {
 * example, err := directoryservice.NewDirectory(ctx, "example", &directoryservice.DirectoryArgs{
 * Name: pulumi.String("tf-example"),
 * Password: pulumi.String("SuperSecretPassw0rd"),
 * Type: pulumi.String("MicrosoftAD"),
 * Edition: pulumi.String("Standard"),
 * VpcSettings: &directoryservice.DirectoryVpcSettingsArgs{
 * VpcId: pulumi.Any(exampleAwsVpc.Id),
 * SubnetIds: []pulumi.String(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:7,17-39)),
 * },
 * })
 * if err != nil {
 * return err
 * }
 * _, err = directoryservice.NewSharedDirectory(ctx, "example", &directoryservice.SharedDirectoryArgs{
 * DirectoryId: example.ID(),
 * Notes: pulumi.String("You wanna have a catch?"),
 * Target: &directoryservice.SharedDirectoryTargetArgs{
 * Id: pulumi.Any(receiver.AccountId),
 * },
 * })
 * 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.aws.directoryservice.Directory;
 * import com.pulumi.aws.directoryservice.DirectoryArgs;
 * import com.pulumi.aws.directoryservice.inputs.DirectoryVpcSettingsArgs;
 * import com.pulumi.aws.directoryservice.SharedDirectory;
 * import com.pulumi.aws.directoryservice.SharedDirectoryArgs;
 * import com.pulumi.aws.directoryservice.inputs.SharedDirectoryTargetArgs;
 * 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 Directory("example", DirectoryArgs.builder()
 *             .name("tf-example")
 *             .password("SuperSecretPassw0rd")
 *             .type("MicrosoftAD")
 *             .edition("Standard")
 *             .vpcSettings(DirectoryVpcSettingsArgs.builder()
 *                 .vpcId(exampleAwsVpc.id())
 *                 .subnetIds(exampleAwsSubnet.stream().map(element -> element.id()).collect(toList()))
 *                 .build())
 *             .build());
 *         var exampleSharedDirectory = new SharedDirectory("exampleSharedDirectory", SharedDirectoryArgs.builder()
 *             .directoryId(example.id())
 *             .notes("You wanna have a catch?")
 *             .target(SharedDirectoryTargetArgs.builder()
 *                 .id(receiver.accountId())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import Directory Service Shared Directories using the owner directory ID/shared directory ID. For example:
 * ```sh
 * $ pulumi import aws:directoryservice/sharedDirectory:SharedDirectory example d-1234567890/d-9267633ece
 * ```
 */
public class SharedDirectory internal constructor(
    override val javaResource: com.pulumi.aws.directoryservice.SharedDirectory,
) : KotlinCustomResource(javaResource, SharedDirectoryMapper) {
    /**
     * Identifier of the Managed Microsoft AD directory that you want to share with other accounts.
     */
    public val directoryId: Output
        get() = javaResource.directoryId().applyValue({ args0 -> args0 })

    /**
     * Method used when sharing a directory. Valid values are `ORGANIZATIONS` and `HANDSHAKE`. Default is `HANDSHAKE`.
     */
    public val method: Output?
        get() = javaResource.method().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Message sent by the directory owner to the directory consumer to help the directory consumer administrator determine whether to approve or reject the share invitation.
     */
    public val notes: Output?
        get() = javaResource.notes().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Identifier of the directory that is stored in the directory consumer account that corresponds to the shared directory in the owner account.
     */
    public val sharedDirectoryId: Output
        get() = javaResource.sharedDirectoryId().applyValue({ args0 -> args0 })

    /**
     * Identifier for the directory consumer account with whom the directory is to be shared. See below.
     * The following arguments are optional:
     */
    public val target: Output
        get() = javaResource.target().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })
}

public object SharedDirectoryMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.directoryservice.SharedDirectory::class == javaResource::class

    override fun map(javaResource: Resource): SharedDirectory = SharedDirectory(
        javaResource as
            com.pulumi.aws.directoryservice.SharedDirectory,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy