com.pulumi.aws.wafregional.kotlin.RateBasedRule.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.wafregional.kotlin
import com.pulumi.aws.wafregional.kotlin.outputs.RateBasedRulePredicate
import com.pulumi.aws.wafregional.kotlin.outputs.RateBasedRulePredicate.Companion.toKotlin
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.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
/**
* Builder for [RateBasedRule].
*/
@PulumiTagMarker
public class RateBasedRuleResourceBuilder internal constructor() {
public var name: String? = null
public var args: RateBasedRuleArgs = RateBasedRuleArgs()
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 RateBasedRuleArgsBuilder.() -> Unit) {
val builder = RateBasedRuleArgsBuilder()
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(): RateBasedRule {
val builtJavaResource = com.pulumi.aws.wafregional.RateBasedRule(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return RateBasedRule(builtJavaResource)
}
}
/**
* Provides a WAF Rate Based Rule Resource
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const ipset = new aws.wafregional.IpSet("ipset", {
* name: "tfIPSet",
* ipSetDescriptors: [{
* type: "IPV4",
* value: "192.0.7.0/24",
* }],
* });
* const wafrule = new aws.wafregional.RateBasedRule("wafrule", {
* name: "tfWAFRule",
* metricName: "tfWAFRule",
* rateKey: "IP",
* rateLimit: 100,
* predicates: [{
* dataId: ipset.id,
* negated: false,
* type: "IPMatch",
* }],
* }, {
* dependsOn: [ipset],
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* ipset = aws.wafregional.IpSet("ipset",
* name="tfIPSet",
* ip_set_descriptors=[{
* "type": "IPV4",
* "value": "192.0.7.0/24",
* }])
* wafrule = aws.wafregional.RateBasedRule("wafrule",
* name="tfWAFRule",
* metric_name="tfWAFRule",
* rate_key="IP",
* rate_limit=100,
* predicates=[{
* "data_id": ipset.id,
* "negated": False,
* "type": "IPMatch",
* }],
* opts = pulumi.ResourceOptions(depends_on=[ipset]))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var ipset = new Aws.WafRegional.IpSet("ipset", new()
* {
* Name = "tfIPSet",
* IpSetDescriptors = new[]
* {
* new Aws.WafRegional.Inputs.IpSetIpSetDescriptorArgs
* {
* Type = "IPV4",
* Value = "192.0.7.0/24",
* },
* },
* });
* var wafrule = new Aws.WafRegional.RateBasedRule("wafrule", new()
* {
* Name = "tfWAFRule",
* MetricName = "tfWAFRule",
* RateKey = "IP",
* RateLimit = 100,
* Predicates = new[]
* {
* new Aws.WafRegional.Inputs.RateBasedRulePredicateArgs
* {
* DataId = ipset.Id,
* Negated = false,
* Type = "IPMatch",
* },
* },
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* ipset,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/wafregional"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* ipset, err := wafregional.NewIpSet(ctx, "ipset", &wafregional.IpSetArgs{
* Name: pulumi.String("tfIPSet"),
* IpSetDescriptors: wafregional.IpSetIpSetDescriptorArray{
* &wafregional.IpSetIpSetDescriptorArgs{
* Type: pulumi.String("IPV4"),
* Value: pulumi.String("192.0.7.0/24"),
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = wafregional.NewRateBasedRule(ctx, "wafrule", &wafregional.RateBasedRuleArgs{
* Name: pulumi.String("tfWAFRule"),
* MetricName: pulumi.String("tfWAFRule"),
* RateKey: pulumi.String("IP"),
* RateLimit: pulumi.Int(100),
* Predicates: wafregional.RateBasedRulePredicateArray{
* &wafregional.RateBasedRulePredicateArgs{
* DataId: ipset.ID(),
* Negated: pulumi.Bool(false),
* Type: pulumi.String("IPMatch"),
* },
* },
* }, pulumi.DependsOn([]pulumi.Resource{
* ipset,
* }))
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.wafregional.IpSet;
* import com.pulumi.aws.wafregional.IpSetArgs;
* import com.pulumi.aws.wafregional.inputs.IpSetIpSetDescriptorArgs;
* import com.pulumi.aws.wafregional.RateBasedRule;
* import com.pulumi.aws.wafregional.RateBasedRuleArgs;
* import com.pulumi.aws.wafregional.inputs.RateBasedRulePredicateArgs;
* import com.pulumi.resources.CustomResourceOptions;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var ipset = new IpSet("ipset", IpSetArgs.builder()
* .name("tfIPSet")
* .ipSetDescriptors(IpSetIpSetDescriptorArgs.builder()
* .type("IPV4")
* .value("192.0.7.0/24")
* .build())
* .build());
* var wafrule = new RateBasedRule("wafrule", RateBasedRuleArgs.builder()
* .name("tfWAFRule")
* .metricName("tfWAFRule")
* .rateKey("IP")
* .rateLimit(100)
* .predicates(RateBasedRulePredicateArgs.builder()
* .dataId(ipset.id())
* .negated(false)
* .type("IPMatch")
* .build())
* .build(), CustomResourceOptions.builder()
* .dependsOn(ipset)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* ipset:
* type: aws:wafregional:IpSet
* properties:
* name: tfIPSet
* ipSetDescriptors:
* - type: IPV4
* value: 192.0.7.0/24
* wafrule:
* type: aws:wafregional:RateBasedRule
* properties:
* name: tfWAFRule
* metricName: tfWAFRule
* rateKey: IP
* rateLimit: 100
* predicates:
* - dataId: ${ipset.id}
* negated: false
* type: IPMatch
* options:
* dependson:
* - ${ipset}
* ```
*
* ## Import
* Using `pulumi import`, import WAF Regional Rate Based Rule using the id. For example:
* ```sh
* $ pulumi import aws:wafregional/rateBasedRule:RateBasedRule wafrule a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc
* ```
*/
public class RateBasedRule internal constructor(
override val javaResource: com.pulumi.aws.wafregional.RateBasedRule,
) : KotlinCustomResource(javaResource, RateBasedRuleMapper) {
/**
* The ARN of the WAF Regional Rate Based Rule.
*/
public val arn: Output
get() = javaResource.arn().applyValue({ args0 -> args0 })
/**
* The name or description for the Amazon CloudWatch metric of this rule.
*/
public val metricName: Output
get() = javaResource.metricName().applyValue({ args0 -> args0 })
/**
* The name or description of the rule.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The objects to include in a rule (documented below).
*/
public val predicates: Output>?
get() = javaResource.predicates().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> toKotlin(args0) })
})
}).orElse(null)
})
/**
* Valid value is IP.
*/
public val rateKey: Output
get() = javaResource.rateKey().applyValue({ args0 -> args0 })
/**
* The maximum number of requests, which have an identical value in the field specified by the RateKey, allowed in a five-minute period. Minimum value is 100.
*/
public val rateLimit: Output
get() = javaResource.rateLimit().applyValue({ args0 -> args0 })
/**
* Key-value map of resource tags. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
public val tags: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy