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

com.pulumi.awsnative.apigateway.kotlin.RequestValidator.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: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.apigateway.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.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: RequestValidatorArgs = RequestValidatorArgs()

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

/**
 * The ``AWS::ApiGateway::RequestValidator`` resource sets up basic validation rules for incoming requests to your API. For more information, see [Enable Basic Request Validation for an API in API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-request-validation.html) in the *API Gateway Developer Guide*.
 */
public class RequestValidator internal constructor(
    override val javaResource: com.pulumi.awsnative.apigateway.RequestValidator,
) : KotlinCustomResource(javaResource, RequestValidatorMapper) {
    /**
     * The name of this RequestValidator
     */
    public val name: Output?
        get() = javaResource.name().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The ID for the request validator. For example: `abc123` .
     */
    public val requestValidatorId: Output
        get() = javaResource.requestValidatorId().applyValue({ args0 -> args0 })

    /**
     * The string identifier of the associated RestApi.
     */
    public val restApiId: Output
        get() = javaResource.restApiId().applyValue({ args0 -> args0 })

    /**
     * A Boolean flag to indicate whether to validate a request body according to the configured Model schema.
     */
    public val validateRequestBody: Output?
        get() = javaResource.validateRequestBody().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A Boolean flag to indicate whether to validate request parameters (``true``) or not (``false``).
     */
    public val validateRequestParameters: Output?
        get() = javaResource.validateRequestParameters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object RequestValidatorMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.apigateway.RequestValidator::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy