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

com.pulumi.awsnative.sns.kotlin.TopicPolicy.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.sns.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.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: TopicPolicyArgs = TopicPolicyArgs()

    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 TopicPolicyArgsBuilder.() -> Unit) {
        val builder = TopicPolicyArgsBuilder()
        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(): TopicPolicy {
        val builtJavaResource = com.pulumi.awsnative.sns.TopicPolicy(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return TopicPolicy(builtJavaResource)
    }
}

/**
 * The ``AWS::SNS::TopicPolicy`` resource associates SNS topics with a policy. For an example snippet, see [Declaring an policy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-iam.html#scenario-sns-policy) in the *User Guide*.
 */
public class TopicPolicy internal constructor(
    override val javaResource: com.pulumi.awsnative.sns.TopicPolicy,
) : KotlinCustomResource(javaResource, TopicPolicyMapper) {
    /**
     * The provider-assigned unique ID for this managed resource.
     */
    public val awsId: Output
        get() = javaResource.awsId().applyValue({ args0 -> args0 })

    /**
     * A policy document that contains permissions to add to the specified SNS topics.
     * Search the [CloudFormation User Guide](https://docs.aws.amazon.com/cloudformation/) for `AWS::SNS::TopicPolicy` for more information about the expected schema for this property.
     */
    public val policyDocument: Output
        get() = javaResource.policyDocument().applyValue({ args0 -> args0 })

    /**
     * The Amazon Resource Names (ARN) of the topics to which you want to add the policy. You can use the ``Ref`` function to specify an ``AWS::SNS::Topic`` resource.
     */
    public val topics: Output>
        get() = javaResource.topics().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
}

public object TopicPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.sns.TopicPolicy::class == javaResource::class

    override fun map(javaResource: Resource): TopicPolicy = TopicPolicy(
        javaResource as
            com.pulumi.awsnative.sns.TopicPolicy,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy