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

com.pulumi.awsnative.apigateway.kotlin.Method.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.apigateway.kotlin

import com.pulumi.awsnative.apigateway.kotlin.outputs.MethodIntegration
import com.pulumi.awsnative.apigateway.kotlin.outputs.MethodResponse
import com.pulumi.core.Either
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 kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.awsnative.apigateway.kotlin.outputs.MethodIntegration.Companion.toKotlin as methodIntegrationToKotlin
import com.pulumi.awsnative.apigateway.kotlin.outputs.MethodResponse.Companion.toKotlin as methodResponseToKotlin

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

    public var args: MethodArgs = MethodArgs()

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

/**
 * The ``AWS::ApiGateway::Method`` resource creates API Gateway methods that define the parameters and body that clients must send in their requests.
 */
public class Method internal constructor(
    override val javaResource: com.pulumi.awsnative.apigateway.Method,
) : KotlinCustomResource(javaResource, MethodMapper) {
    /**
     * A boolean flag specifying whether a valid ApiKey is required to invoke this method.
     */
    public val apiKeyRequired: Output?
        get() = javaResource.apiKeyRequired().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val authorizationScopes: Output>?
        get() = javaResource.authorizationScopes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val authorizationType: Output?
        get() = javaResource.authorizationType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The identifier of an authorizer to use on this method. The method's authorization type must be ``CUSTOM`` or ``COGNITO_USER_POOLS``.
     */
    public val authorizerId: Output?
        get() = javaResource.authorizerId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The method's HTTP verb.
     */
    public val httpMethod: Output
        get() = javaResource.httpMethod().applyValue({ args0 -> args0 })

    /**
     * Represents an ``HTTP``, ``HTTP_PROXY``, ``AWS``, ``AWS_PROXY``, or Mock integration.
     */
    public val integration: Output?
        get() = javaResource.integration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    methodIntegrationToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Gets a method response associated with a given HTTP status code.
     */
    public val methodResponses: Output>?
        get() = javaResource.methodResponses().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0.let({ args0 -> methodResponseToKotlin(args0) }) })
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val operationName: Output?
        get() = javaResource.operationName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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).
     */
    public val requestModels: Output>?
        get() = javaResource.requestModels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0.key.to(args0.value) }).toMap()
            }).orElse(null)
        })

    /**
     * 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.
     */
    public val requestParameters: Output>>?
        get() = javaResource.requestParameters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(
                        args0.value.transform({ args0 -> args0 }, { args0 ->
                            args0
                        }),
                    )
                }).toMap()
            }).orElse(null)
        })

    /**
     * The identifier of a RequestValidator for request validation.
     */
    public val requestValidatorId: Output?
        get() = javaResource.requestValidatorId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Resource identifier for the MethodResponse resource.
     */
    public val resourceId: Output
        get() = javaResource.resourceId().applyValue({ args0 -> args0 })

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

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy