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

com.pulumi.aws.xray.kotlin.SamplingRuleArgs.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: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.xray.kotlin

import com.pulumi.aws.xray.SamplingRuleArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Double
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Creates and manages an AWS XRay Sampling Rule.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.xray.SamplingRule("example", {
 *     ruleName: "example",
 *     priority: 9999,
 *     version: 1,
 *     reservoirSize: 1,
 *     fixedRate: 0.05,
 *     urlPath: "*",
 *     host: "*",
 *     httpMethod: "*",
 *     serviceType: "*",
 *     serviceName: "*",
 *     resourceArn: "*",
 *     attributes: {
 *         Hello: "Tris",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.xray.SamplingRule("example",
 *     rule_name="example",
 *     priority=9999,
 *     version=1,
 *     reservoir_size=1,
 *     fixed_rate=0.05,
 *     url_path="*",
 *     host="*",
 *     http_method="*",
 *     service_type="*",
 *     service_name="*",
 *     resource_arn="*",
 *     attributes={
 *         "Hello": "Tris",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Xray.SamplingRule("example", new()
 *     {
 *         RuleName = "example",
 *         Priority = 9999,
 *         Version = 1,
 *         ReservoirSize = 1,
 *         FixedRate = 0.05,
 *         UrlPath = "*",
 *         Host = "*",
 *         HttpMethod = "*",
 *         ServiceType = "*",
 *         ServiceName = "*",
 *         ResourceArn = "*",
 *         Attributes =
 *         {
 *             { "Hello", "Tris" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/xray"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := xray.NewSamplingRule(ctx, "example", &xray.SamplingRuleArgs{
 * 			RuleName:      pulumi.String("example"),
 * 			Priority:      pulumi.Int(9999),
 * 			Version:       pulumi.Int(1),
 * 			ReservoirSize: pulumi.Int(1),
 * 			FixedRate:     pulumi.Float64(0.05),
 * 			UrlPath:       pulumi.String("*"),
 * 			Host:          pulumi.String("*"),
 * 			HttpMethod:    pulumi.String("*"),
 * 			ServiceType:   pulumi.String("*"),
 * 			ServiceName:   pulumi.String("*"),
 * 			ResourceArn:   pulumi.String("*"),
 * 			Attributes: pulumi.StringMap{
 * 				"Hello": pulumi.String("Tris"),
 * 			},
 * 		})
 * 		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.xray.SamplingRule;
 * import com.pulumi.aws.xray.SamplingRuleArgs;
 * 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 example = new SamplingRule("example", SamplingRuleArgs.builder()
 *             .ruleName("example")
 *             .priority(9999)
 *             .version(1)
 *             .reservoirSize(1)
 *             .fixedRate(0.05)
 *             .urlPath("*")
 *             .host("*")
 *             .httpMethod("*")
 *             .serviceType("*")
 *             .serviceName("*")
 *             .resourceArn("*")
 *             .attributes(Map.of("Hello", "Tris"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:xray:SamplingRule
 *     properties:
 *       ruleName: example
 *       priority: 9999
 *       version: 1
 *       reservoirSize: 1
 *       fixedRate: 0.05
 *       urlPath: '*'
 *       host: '*'
 *       httpMethod: '*'
 *       serviceType: '*'
 *       serviceName: '*'
 *       resourceArn: '*'
 *       attributes:
 *         Hello: Tris
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import XRay Sampling Rules using the name. For example:
 * ```sh
 * $ pulumi import aws:xray/samplingRule:SamplingRule example example
 * ```
 * @property attributes Matches attributes derived from the request.
 * @property fixedRate The percentage of matching requests to instrument, after the reservoir is exhausted.
 * @property host Matches the hostname from a request URL.
 * @property httpMethod Matches the HTTP method of a request.
 * @property priority The priority of the sampling rule.
 * @property reservoirSize A fixed number of matching requests to instrument per second, prior to applying the fixed rate. The reservoir is not used directly by services, but applies to all services using the rule collectively.
 * @property resourceArn Matches the ARN of the AWS resource on which the service runs.
 * @property ruleName The name of the sampling rule.
 * @property serviceName Matches the `name` that the service uses to identify itself in segments.
 * @property serviceType Matches the `origin` that the service uses to identify its type in segments.
 * @property tags Key-value mapping 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
 * @property urlPath Matches the path from a request URL.
 * @property version The version of the sampling rule format (`1` )
 */
public data class SamplingRuleArgs(
    public val attributes: Output>? = null,
    public val fixedRate: Output? = null,
    public val host: Output? = null,
    public val httpMethod: Output? = null,
    public val priority: Output? = null,
    public val reservoirSize: Output? = null,
    public val resourceArn: Output? = null,
    public val ruleName: Output? = null,
    public val serviceName: Output? = null,
    public val serviceType: Output? = null,
    public val tags: Output>? = null,
    public val urlPath: Output? = null,
    public val version: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.xray.SamplingRuleArgs =
        com.pulumi.aws.xray.SamplingRuleArgs.builder()
            .attributes(
                attributes?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .fixedRate(fixedRate?.applyValue({ args0 -> args0 }))
            .host(host?.applyValue({ args0 -> args0 }))
            .httpMethod(httpMethod?.applyValue({ args0 -> args0 }))
            .priority(priority?.applyValue({ args0 -> args0 }))
            .reservoirSize(reservoirSize?.applyValue({ args0 -> args0 }))
            .resourceArn(resourceArn?.applyValue({ args0 -> args0 }))
            .ruleName(ruleName?.applyValue({ args0 -> args0 }))
            .serviceName(serviceName?.applyValue({ args0 -> args0 }))
            .serviceType(serviceType?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .urlPath(urlPath?.applyValue({ args0 -> args0 }))
            .version(version?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [SamplingRuleArgs].
 */
@PulumiTagMarker
public class SamplingRuleArgsBuilder internal constructor() {
    private var attributes: Output>? = null

    private var fixedRate: Output? = null

    private var host: Output? = null

    private var httpMethod: Output? = null

    private var priority: Output? = null

    private var reservoirSize: Output? = null

    private var resourceArn: Output? = null

    private var ruleName: Output? = null

    private var serviceName: Output? = null

    private var serviceType: Output? = null

    private var tags: Output>? = null

    private var urlPath: Output? = null

    private var version: Output? = null

    /**
     * @param value Matches attributes derived from the request.
     */
    @JvmName("skoiulgtqihikicf")
    public suspend fun attributes(`value`: Output>) {
        this.attributes = value
    }

    /**
     * @param value The percentage of matching requests to instrument, after the reservoir is exhausted.
     */
    @JvmName("egptydnsignmomjb")
    public suspend fun fixedRate(`value`: Output) {
        this.fixedRate = value
    }

    /**
     * @param value Matches the hostname from a request URL.
     */
    @JvmName("aycqiiaqwonjjlkp")
    public suspend fun host(`value`: Output) {
        this.host = value
    }

    /**
     * @param value Matches the HTTP method of a request.
     */
    @JvmName("omvjpmmsertnyfcu")
    public suspend fun httpMethod(`value`: Output) {
        this.httpMethod = value
    }

    /**
     * @param value The priority of the sampling rule.
     */
    @JvmName("tjnxhpwqumciobmi")
    public suspend fun priority(`value`: Output) {
        this.priority = value
    }

    /**
     * @param value A fixed number of matching requests to instrument per second, prior to applying the fixed rate. The reservoir is not used directly by services, but applies to all services using the rule collectively.
     */
    @JvmName("xbuubwkgfgjqgyix")
    public suspend fun reservoirSize(`value`: Output) {
        this.reservoirSize = value
    }

    /**
     * @param value Matches the ARN of the AWS resource on which the service runs.
     */
    @JvmName("bpkfkkhxwajmddgn")
    public suspend fun resourceArn(`value`: Output) {
        this.resourceArn = value
    }

    /**
     * @param value The name of the sampling rule.
     */
    @JvmName("lvhapvtoaneqqvix")
    public suspend fun ruleName(`value`: Output) {
        this.ruleName = value
    }

    /**
     * @param value Matches the `name` that the service uses to identify itself in segments.
     */
    @JvmName("snvwtrtpxgumqcxs")
    public suspend fun serviceName(`value`: Output) {
        this.serviceName = value
    }

    /**
     * @param value Matches the `origin` that the service uses to identify its type in segments.
     */
    @JvmName("emutygiwugpvyqoi")
    public suspend fun serviceType(`value`: Output) {
        this.serviceType = value
    }

    /**
     * @param value Key-value mapping 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
     */
    @JvmName("bxelyxcdjhrvgegd")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value Matches the path from a request URL.
     */
    @JvmName("eabbplagewsvsjic")
    public suspend fun urlPath(`value`: Output) {
        this.urlPath = value
    }

    /**
     * @param value The version of the sampling rule format (`1` )
     */
    @JvmName("phtnjglncvgpcrqx")
    public suspend fun version(`value`: Output) {
        this.version = value
    }

    /**
     * @param value Matches attributes derived from the request.
     */
    @JvmName("spprulcmykeoaasy")
    public suspend fun attributes(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.attributes = mapped
    }

    /**
     * @param values Matches attributes derived from the request.
     */
    @JvmName("ducnwahryiwvgosb")
    public fun attributes(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.attributes = mapped
    }

    /**
     * @param value The percentage of matching requests to instrument, after the reservoir is exhausted.
     */
    @JvmName("axvvhrdhlntttegu")
    public suspend fun fixedRate(`value`: Double?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.fixedRate = mapped
    }

    /**
     * @param value Matches the hostname from a request URL.
     */
    @JvmName("ogtlgbhbxwrhbkqn")
    public suspend fun host(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.host = mapped
    }

    /**
     * @param value Matches the HTTP method of a request.
     */
    @JvmName("ahnoobnjwklvkeme")
    public suspend fun httpMethod(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.httpMethod = mapped
    }

    /**
     * @param value The priority of the sampling rule.
     */
    @JvmName("kgmumcigbvotfrkm")
    public suspend fun priority(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.priority = mapped
    }

    /**
     * @param value A fixed number of matching requests to instrument per second, prior to applying the fixed rate. The reservoir is not used directly by services, but applies to all services using the rule collectively.
     */
    @JvmName("mdetqaubiitdpfnc")
    public suspend fun reservoirSize(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.reservoirSize = mapped
    }

    /**
     * @param value Matches the ARN of the AWS resource on which the service runs.
     */
    @JvmName("kylgocvpxsiamoxy")
    public suspend fun resourceArn(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceArn = mapped
    }

    /**
     * @param value The name of the sampling rule.
     */
    @JvmName("baakmaovwujfwboh")
    public suspend fun ruleName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ruleName = mapped
    }

    /**
     * @param value Matches the `name` that the service uses to identify itself in segments.
     */
    @JvmName("uvsisyqubaxblgwc")
    public suspend fun serviceName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.serviceName = mapped
    }

    /**
     * @param value Matches the `origin` that the service uses to identify its type in segments.
     */
    @JvmName("sxoiotguauxbrsuu")
    public suspend fun serviceType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.serviceType = mapped
    }

    /**
     * @param value Key-value mapping 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
     */
    @JvmName("lcsanhyvcgfshsmf")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values Key-value mapping 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
     */
    @JvmName("yyeudljpoulkfypx")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value Matches the path from a request URL.
     */
    @JvmName("tewiqhucodsgqooj")
    public suspend fun urlPath(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.urlPath = mapped
    }

    /**
     * @param value The version of the sampling rule format (`1` )
     */
    @JvmName("daxuyeqqltnspjjx")
    public suspend fun version(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.version = mapped
    }

    internal fun build(): SamplingRuleArgs = SamplingRuleArgs(
        attributes = attributes,
        fixedRate = fixedRate,
        host = host,
        httpMethod = httpMethod,
        priority = priority,
        reservoirSize = reservoirSize,
        resourceArn = resourceArn,
        ruleName = ruleName,
        serviceName = serviceName,
        serviceType = serviceType,
        tags = tags,
        urlPath = urlPath,
        version = version,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy