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

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

package com.pulumi.awsnative.apigateway.kotlin

import com.pulumi.awsnative.apigateway.MethodArgs.builder
import com.pulumi.awsnative.apigateway.kotlin.inputs.MethodIntegrationArgs
import com.pulumi.awsnative.apigateway.kotlin.inputs.MethodIntegrationArgsBuilder
import com.pulumi.awsnative.apigateway.kotlin.inputs.MethodResponseArgs
import com.pulumi.awsnative.apigateway.kotlin.inputs.MethodResponseArgsBuilder
import com.pulumi.core.Either
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * The ``AWS::ApiGateway::Method`` resource creates API Gateway methods that define the parameters and body that clients must send in their requests.
 * @property apiKeyRequired A boolean flag specifying whether a valid ApiKey is required to invoke this method.
 * @property authorizationScopes A list of authorization scopes configured on the method. The scopes are used with a ``COGNITO_USER_POOLS`` authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.
 * @property authorizationType The method's authorization type. This parameter is required. For valid values, see [Method](https://docs.aws.amazon.com/apigateway/latest/api/API_Method.html) in the *API Gateway API Reference*.
 *   If you specify the ``AuthorizerId`` property, specify ``CUSTOM`` or ``COGNITO_USER_POOLS`` for this property.
 * @property authorizerId The identifier of an authorizer to use on this method. The method's authorization type must be ``CUSTOM`` or ``COGNITO_USER_POOLS``.
 * @property httpMethod The method's HTTP verb.
 * @property integration Represents an ``HTTP``, ``HTTP_PROXY``, ``AWS``, ``AWS_PROXY``, or Mock integration.
 * @property methodResponses Gets a method response associated with a given HTTP status code.
 * @property operationName A human-friendly operation identifier for the method. For example, you can assign the ``operationName`` of ``ListPets`` for the ``GET /pets`` method in the ``PetStore`` example.
 * @property requestModels A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).
 * @property requestParameters A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is a method request parameter name matching the pattern of ``method.request.{location}.{name}``, where ``location`` is ``querystring``, ``path``, or ``header`` and ``name`` is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required (``true``) or optional (``false``). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or templates.
 * @property requestValidatorId The identifier of a RequestValidator for request validation.
 * @property resourceId The Resource identifier for the MethodResponse resource.
 * @property restApiId The string identifier of the associated RestApi.
 */
public data class MethodArgs(
    public val apiKeyRequired: Output? = null,
    public val authorizationScopes: Output>? = null,
    public val authorizationType: Output? = null,
    public val authorizerId: Output? = null,
    public val httpMethod: Output? = null,
    public val integration: Output? = null,
    public val methodResponses: Output>? = null,
    public val operationName: Output? = null,
    public val requestModels: Output>? = null,
    public val requestParameters: Output>>? = null,
    public val requestValidatorId: Output? = null,
    public val resourceId: Output? = null,
    public val restApiId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.awsnative.apigateway.MethodArgs =
        com.pulumi.awsnative.apigateway.MethodArgs.builder()
            .apiKeyRequired(apiKeyRequired?.applyValue({ args0 -> args0 }))
            .authorizationScopes(authorizationScopes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .authorizationType(authorizationType?.applyValue({ args0 -> args0 }))
            .authorizerId(authorizerId?.applyValue({ args0 -> args0 }))
            .httpMethod(httpMethod?.applyValue({ args0 -> args0 }))
            .integration(integration?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .methodResponses(
                methodResponses?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .operationName(operationName?.applyValue({ args0 -> args0 }))
            .requestModels(
                requestModels?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .requestParameters(
                requestParameters?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value.transform({ args0 -> args0 }, { args0 -> args0 }))
                    }).toMap()
                }),
            )
            .requestValidatorId(requestValidatorId?.applyValue({ args0 -> args0 }))
            .resourceId(resourceId?.applyValue({ args0 -> args0 }))
            .restApiId(restApiId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [MethodArgs].
 */
@PulumiTagMarker
public class MethodArgsBuilder internal constructor() {
    private var apiKeyRequired: Output? = null

    private var authorizationScopes: Output>? = null

    private var authorizationType: Output? = null

    private var authorizerId: Output? = null

    private var httpMethod: Output? = null

    private var integration: Output? = null

    private var methodResponses: Output>? = null

    private var operationName: Output? = null

    private var requestModels: Output>? = null

    private var requestParameters: Output>>? = null

    private var requestValidatorId: Output? = null

    private var resourceId: Output? = null

    private var restApiId: Output? = null

    /**
     * @param value A boolean flag specifying whether a valid ApiKey is required to invoke this method.
     */
    @JvmName("jdwtaltpesglnlyl")
    public suspend fun apiKeyRequired(`value`: Output) {
        this.apiKeyRequired = value
    }

    /**
     * @param value A list of authorization scopes configured on the method. The scopes are used with a ``COGNITO_USER_POOLS`` authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.
     */
    @JvmName("fmqdpwegycmtnlnk")
    public suspend fun authorizationScopes(`value`: Output>) {
        this.authorizationScopes = value
    }

    @JvmName("wxscpurvvgxxpemo")
    public suspend fun authorizationScopes(vararg values: Output) {
        this.authorizationScopes = Output.all(values.asList())
    }

    /**
     * @param values A list of authorization scopes configured on the method. The scopes are used with a ``COGNITO_USER_POOLS`` authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.
     */
    @JvmName("emnsodchwmkxcmxy")
    public suspend fun authorizationScopes(values: List>) {
        this.authorizationScopes = Output.all(values)
    }

    /**
     * @param value The method's authorization type. This parameter is required. For valid values, see [Method](https://docs.aws.amazon.com/apigateway/latest/api/API_Method.html) in the *API Gateway API Reference*.
     *   If you specify the ``AuthorizerId`` property, specify ``CUSTOM`` or ``COGNITO_USER_POOLS`` for this property.
     */
    @JvmName("xsaecgjfoscirixu")
    public suspend fun authorizationType(`value`: Output) {
        this.authorizationType = value
    }

    /**
     * @param value The identifier of an authorizer to use on this method. The method's authorization type must be ``CUSTOM`` or ``COGNITO_USER_POOLS``.
     */
    @JvmName("lhoxfamkhmayeorl")
    public suspend fun authorizerId(`value`: Output) {
        this.authorizerId = value
    }

    /**
     * @param value The method's HTTP verb.
     */
    @JvmName("dijfhxvxsfijuwik")
    public suspend fun httpMethod(`value`: Output) {
        this.httpMethod = value
    }

    /**
     * @param value Represents an ``HTTP``, ``HTTP_PROXY``, ``AWS``, ``AWS_PROXY``, or Mock integration.
     */
    @JvmName("clceslxwrawrwwde")
    public suspend fun integration(`value`: Output) {
        this.integration = value
    }

    /**
     * @param value Gets a method response associated with a given HTTP status code.
     */
    @JvmName("mnutolmxhukesekh")
    public suspend fun methodResponses(`value`: Output>) {
        this.methodResponses = value
    }

    @JvmName("kpsmiuliwnterush")
    public suspend fun methodResponses(vararg values: Output) {
        this.methodResponses = Output.all(values.asList())
    }

    /**
     * @param values Gets a method response associated with a given HTTP status code.
     */
    @JvmName("lwbgryenrqxstslh")
    public suspend fun methodResponses(values: List>) {
        this.methodResponses = Output.all(values)
    }

    /**
     * @param value A human-friendly operation identifier for the method. For example, you can assign the ``operationName`` of ``ListPets`` for the ``GET /pets`` method in the ``PetStore`` example.
     */
    @JvmName("yootejmuymuarhpt")
    public suspend fun operationName(`value`: Output) {
        this.operationName = value
    }

    /**
     * @param value A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).
     */
    @JvmName("brrkuhcltonvasjm")
    public suspend fun requestModels(`value`: Output>) {
        this.requestModels = value
    }

    /**
     * @param value A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is a method request parameter name matching the pattern of ``method.request.{location}.{name}``, where ``location`` is ``querystring``, ``path``, or ``header`` and ``name`` is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required (``true``) or optional (``false``). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or templates.
     */
    @JvmName("qjsjkdvgmovdcwae")
    public suspend fun requestParameters(`value`: Output>>) {
        this.requestParameters = value
    }

    /**
     * @param value The identifier of a RequestValidator for request validation.
     */
    @JvmName("lplimgshhhmhrohs")
    public suspend fun requestValidatorId(`value`: Output) {
        this.requestValidatorId = value
    }

    /**
     * @param value The Resource identifier for the MethodResponse resource.
     */
    @JvmName("engbwgvgrneejjov")
    public suspend fun resourceId(`value`: Output) {
        this.resourceId = value
    }

    /**
     * @param value The string identifier of the associated RestApi.
     */
    @JvmName("dnetupylidjplttd")
    public suspend fun restApiId(`value`: Output) {
        this.restApiId = value
    }

    /**
     * @param value A boolean flag specifying whether a valid ApiKey is required to invoke this method.
     */
    @JvmName("shuhwfjepmegqwqk")
    public suspend fun apiKeyRequired(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.apiKeyRequired = mapped
    }

    /**
     * @param value A list of authorization scopes configured on the method. The scopes are used with a ``COGNITO_USER_POOLS`` authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.
     */
    @JvmName("kfoxxyahyghnvifw")
    public suspend fun authorizationScopes(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authorizationScopes = mapped
    }

    /**
     * @param values A list of authorization scopes configured on the method. The scopes are used with a ``COGNITO_USER_POOLS`` authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.
     */
    @JvmName("iunfxvqxpddofyqu")
    public suspend fun authorizationScopes(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.authorizationScopes = mapped
    }

    /**
     * @param value The method's authorization type. This parameter is required. For valid values, see [Method](https://docs.aws.amazon.com/apigateway/latest/api/API_Method.html) in the *API Gateway API Reference*.
     *   If you specify the ``AuthorizerId`` property, specify ``CUSTOM`` or ``COGNITO_USER_POOLS`` for this property.
     */
    @JvmName("kaetiudeimwpsqsa")
    public suspend fun authorizationType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authorizationType = mapped
    }

    /**
     * @param value The identifier of an authorizer to use on this method. The method's authorization type must be ``CUSTOM`` or ``COGNITO_USER_POOLS``.
     */
    @JvmName("fsmiewhhxguvulnp")
    public suspend fun authorizerId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authorizerId = mapped
    }

    /**
     * @param value The method's HTTP verb.
     */
    @JvmName("mpydcctsiirncxun")
    public suspend fun httpMethod(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.httpMethod = mapped
    }

    /**
     * @param value Represents an ``HTTP``, ``HTTP_PROXY``, ``AWS``, ``AWS_PROXY``, or Mock integration.
     */
    @JvmName("axnolxymeggchrhd")
    public suspend fun integration(`value`: MethodIntegrationArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.integration = mapped
    }

    /**
     * @param argument Represents an ``HTTP``, ``HTTP_PROXY``, ``AWS``, ``AWS_PROXY``, or Mock integration.
     */
    @JvmName("hhooolfhyhdbantk")
    public suspend fun integration(argument: suspend MethodIntegrationArgsBuilder.() -> Unit) {
        val toBeMapped = MethodIntegrationArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.integration = mapped
    }

    /**
     * @param value Gets a method response associated with a given HTTP status code.
     */
    @JvmName("feycnkuvbsvqjsia")
    public suspend fun methodResponses(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.methodResponses = mapped
    }

    /**
     * @param argument Gets a method response associated with a given HTTP status code.
     */
    @JvmName("mjcylmjngytvvnfx")
    public suspend fun methodResponses(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            MethodResponseArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.methodResponses = mapped
    }

    /**
     * @param argument Gets a method response associated with a given HTTP status code.
     */
    @JvmName("ofqqfcpibwykocmw")
    public suspend fun methodResponses(vararg argument: suspend MethodResponseArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            MethodResponseArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.methodResponses = mapped
    }

    /**
     * @param argument Gets a method response associated with a given HTTP status code.
     */
    @JvmName("vxlvaplmtovavchw")
    public suspend fun methodResponses(argument: suspend MethodResponseArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(MethodResponseArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.methodResponses = mapped
    }

    /**
     * @param values Gets a method response associated with a given HTTP status code.
     */
    @JvmName("vbepmggbgxhxpdyo")
    public suspend fun methodResponses(vararg values: MethodResponseArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.methodResponses = mapped
    }

    /**
     * @param value A human-friendly operation identifier for the method. For example, you can assign the ``operationName`` of ``ListPets`` for the ``GET /pets`` method in the ``PetStore`` example.
     */
    @JvmName("swpwtjwhsrjllilf")
    public suspend fun operationName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.operationName = mapped
    }

    /**
     * @param value A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).
     */
    @JvmName("svqgogckhislrmow")
    public suspend fun requestModels(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.requestModels = mapped
    }

    /**
     * @param values A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).
     */
    @JvmName("mfhxjuvkqtrkbnvp")
    public fun requestModels(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.requestModels = mapped
    }

    /**
     * @param value A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is a method request parameter name matching the pattern of ``method.request.{location}.{name}``, where ``location`` is ``querystring``, ``path``, or ``header`` and ``name`` is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required (``true``) or optional (``false``). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or templates.
     */
    @JvmName("avekycunaxxefdxv")
    public suspend fun requestParameters(`value`: Map>?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.requestParameters = mapped
    }

    /**
     * @param values A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is a method request parameter name matching the pattern of ``method.request.{location}.{name}``, where ``location`` is ``querystring``, ``path``, or ``header`` and ``name`` is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required (``true``) or optional (``false``). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or templates.
     */
    @JvmName("iebwnqhfngoeelqa")
    public fun requestParameters(vararg values: Pair>) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.requestParameters = mapped
    }

    /**
     * @param value The identifier of a RequestValidator for request validation.
     */
    @JvmName("ywwuwwfwwvvrtjhp")
    public suspend fun requestValidatorId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.requestValidatorId = mapped
    }

    /**
     * @param value The Resource identifier for the MethodResponse resource.
     */
    @JvmName("tnaybhjgrovllonc")
    public suspend fun resourceId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceId = mapped
    }

    /**
     * @param value The string identifier of the associated RestApi.
     */
    @JvmName("shaxuunsbsqscoxw")
    public suspend fun restApiId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.restApiId = mapped
    }

    internal fun build(): MethodArgs = MethodArgs(
        apiKeyRequired = apiKeyRequired,
        authorizationScopes = authorizationScopes,
        authorizationType = authorizationType,
        authorizerId = authorizerId,
        httpMethod = httpMethod,
        integration = integration,
        methodResponses = methodResponses,
        operationName = operationName,
        requestModels = requestModels,
        requestParameters = requestParameters,
        requestValidatorId = requestValidatorId,
        resourceId = resourceId,
        restApiId = restApiId,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy