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

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

package com.pulumi.awsnative.apigateway.kotlin

import com.pulumi.awsnative.apigateway.kotlin.outputs.UsagePlanApiStage
import com.pulumi.awsnative.apigateway.kotlin.outputs.UsagePlanQuotaSettings
import com.pulumi.awsnative.apigateway.kotlin.outputs.UsagePlanThrottleSettings
import com.pulumi.awsnative.kotlin.outputs.Tag
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 com.pulumi.awsnative.apigateway.kotlin.outputs.UsagePlanApiStage.Companion.toKotlin as usagePlanApiStageToKotlin
import com.pulumi.awsnative.apigateway.kotlin.outputs.UsagePlanQuotaSettings.Companion.toKotlin as usagePlanQuotaSettingsToKotlin
import com.pulumi.awsnative.apigateway.kotlin.outputs.UsagePlanThrottleSettings.Companion.toKotlin as usagePlanThrottleSettingsToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

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

    public var args: UsagePlanArgs = UsagePlanArgs()

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

/**
 * The ``AWS::ApiGateway::UsagePlan`` resource creates a usage plan for deployed APIs. A usage plan sets a target for the throttling and quota limits on individual client API keys. For more information, see [Creating and Using API Usage Plans in Amazon API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html) in the *API Gateway Developer Guide*.
 *  In some cases clients can exceed the targets that you set. Don’t rely on usage plans to control costs. Consider using [](https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-managing-costs.html) to monitor costs and [](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html) to manage API requests.
 */
public class UsagePlan internal constructor(
    override val javaResource: com.pulumi.awsnative.apigateway.UsagePlan,
) : KotlinCustomResource(javaResource, UsagePlanMapper) {
    /**
     * The associated API stages of a usage plan.
     */
    public val apiStages: Output>?
        get() = javaResource.apiStages().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> usagePlanApiStageToKotlin(args0) })
                })
            }).orElse(null)
        })

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

    /**
     * The description of a usage plan.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The target maximum number of permitted requests per a given unit time interval.
     */
    public val quota: Output?
        get() = javaResource.quota().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    usagePlanQuotaSettingsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The collection of tags. Each tag element is associated with a given resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * A map containing method level throttling information for API stage in a usage plan.
     */
    public val throttle: Output?
        get() = javaResource.throttle().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    usagePlanThrottleSettingsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The name of a usage plan.
     */
    public val usagePlanName: Output?
        get() = javaResource.usagePlanName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy