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

com.pulumi.awsnative.verifiedpermissions.kotlin.PolicyStore.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.verifiedpermissions.kotlin

import com.pulumi.awsnative.verifiedpermissions.kotlin.outputs.PolicyStoreSchemaDefinition
import com.pulumi.awsnative.verifiedpermissions.kotlin.outputs.PolicyStoreValidationSettings
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 com.pulumi.awsnative.verifiedpermissions.kotlin.outputs.PolicyStoreSchemaDefinition.Companion.toKotlin as policyStoreSchemaDefinitionToKotlin
import com.pulumi.awsnative.verifiedpermissions.kotlin.outputs.PolicyStoreValidationSettings.Companion.toKotlin as policyStoreValidationSettingsToKotlin

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

    public var args: PolicyStoreArgs = PolicyStoreArgs()

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

/**
 * Represents a policy store that you can place schema, policies, and policy templates in to validate authorization requests
 * ## Example Usage
 * ### Example
 * No Java example available.
 */
public class PolicyStore internal constructor(
    override val javaResource: com.pulumi.awsnative.verifiedpermissions.PolicyStore,
) : KotlinCustomResource(javaResource, PolicyStoreMapper) {
    /**
     * The [Amazon Resource Name (ARN)](https://docs.aws.amazon.com//general/latest/gr/aws-arns-and-namespaces.html) of the new or updated policy store.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * Descriptive text that you can provide to help with identification of the current policy store.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The unique ID of the new or updated policy store.
     */
    public val policyStoreId: Output
        get() = javaResource.policyStoreId().applyValue({ args0 -> args0 })

    /**
     * Creates or updates the policy schema in a policy store. Cedar can use the schema to validate any Cedar policies and policy templates submitted to the policy store. Any changes to the schema validate only policies and templates submitted after the schema change. Existing policies and templates are not re-evaluated against the changed schema. If you later update a policy, then it is evaluated against the new schema at that time.
     */
    public val schema: Output?
        get() = javaResource.schema().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    policyStoreSchemaDefinitionToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies the validation setting for this policy store.
     * Currently, the only valid and required value is `Mode` .
     * > We recommend that you turn on `STRICT` mode only after you define a schema. If a schema doesn't exist, then `STRICT` mode causes any policy to fail validation, and Verified Permissions rejects the policy. You can turn off validation by using the [UpdatePolicyStore](https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore) . Then, when you have a schema defined, use [UpdatePolicyStore](https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore) again to turn validation back on.
     */
    public val validationSettings: Output
        get() = javaResource.validationSettings().applyValue({ args0 ->
            args0.let({ args0 ->
                policyStoreValidationSettingsToKotlin(args0)
            })
        })
}

public object PolicyStoreMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.verifiedpermissions.PolicyStore::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy