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

com.pulumi.aws.iot.kotlin.TopicRuleDestination.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.iot.kotlin

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

    public var args: TopicRuleDestinationArgs = TopicRuleDestinationArgs()

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

/**
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.iot.TopicRuleDestination("example", {vpcConfiguration: {
 *     roleArn: exampleAwsIamRole.arn,
 *     securityGroups: [exampleAwsSecurityGroup.id],
 *     subnetIds: exampleAwsSubnet.map(__item => __item.id),
 *     vpcId: exampleAwsVpc.id,
 * }});
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.iot.TopicRuleDestination("example", vpc_configuration={
 *     "role_arn": example_aws_iam_role["arn"],
 *     "security_groups": [example_aws_security_group["id"]],
 *     "subnet_ids": [__item["id"] for __item in example_aws_subnet],
 *     "vpc_id": example_aws_vpc["id"],
 * })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Iot.TopicRuleDestination("example", new()
 *     {
 *         VpcConfiguration = new Aws.Iot.Inputs.TopicRuleDestinationVpcConfigurationArgs
 *         {
 *             RoleArn = exampleAwsIamRole.Arn,
 *             SecurityGroups = new[]
 *             {
 *                 exampleAwsSecurityGroup.Id,
 *             },
 *             SubnetIds = exampleAwsSubnet.Select(__item => __item.Id).ToList(),
 *             VpcId = exampleAwsVpc.Id,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iot"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * pulumi.Run(func(ctx *pulumi.Context) error {
 * _, err := iot.NewTopicRuleDestination(ctx, "example", &iot.TopicRuleDestinationArgs{
 * VpcConfiguration: &iot.TopicRuleDestinationVpcConfigurationArgs{
 * RoleArn: pulumi.Any(exampleAwsIamRole.Arn),
 * SecurityGroups: pulumi.StringArray{
 * exampleAwsSecurityGroup.Id,
 * },
 * SubnetIds: []pulumi.String(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:4,22-44)),
 * VpcId: pulumi.Any(exampleAwsVpc.Id),
 * },
 * })
 * 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.iot.TopicRuleDestination;
 * import com.pulumi.aws.iot.TopicRuleDestinationArgs;
 * import com.pulumi.aws.iot.inputs.TopicRuleDestinationVpcConfigurationArgs;
 * 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 TopicRuleDestination("example", TopicRuleDestinationArgs.builder()
 *             .vpcConfiguration(TopicRuleDestinationVpcConfigurationArgs.builder()
 *                 .roleArn(exampleAwsIamRole.arn())
 *                 .securityGroups(exampleAwsSecurityGroup.id())
 *                 .subnetIds(exampleAwsSubnet.stream().map(element -> element.id()).collect(toList()))
 *                 .vpcId(exampleAwsVpc.id())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import IoT topic rule destinations using the `arn`. For example:
 * ```sh
 * $ pulumi import aws:iot/topicRuleDestination:TopicRuleDestination example arn:aws:iot:us-west-2:123456789012:ruledestination/vpc/2ce781c8-68a6-4c52-9c62-63fe489ecc60
 * ```
 */
public class TopicRuleDestination internal constructor(
    override val javaResource: com.pulumi.aws.iot.TopicRuleDestination,
) : KotlinCustomResource(javaResource, TopicRuleDestinationMapper) {
    /**
     * The ARN of the topic rule destination
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * Whether or not to enable the destination. Default: `true`.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Configuration of the virtual private cloud (VPC) connection. For more info, see the [AWS documentation](https://docs.aws.amazon.com/iot/latest/developerguide/vpc-rule-action.html).
     */
    public val vpcConfiguration: Output
        get() = javaResource.vpcConfiguration().applyValue({ args0 ->
            args0.let({ args0 ->
                toKotlin(args0)
            })
        })
}

public object TopicRuleDestinationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.iot.TopicRuleDestination::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy