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

com.pulumi.aws.cloudwatch.kotlin.EventArchiveArgs.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.cloudwatch.kotlin

import com.pulumi.aws.cloudwatch.EventArchiveArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Provides an EventBridge event archive resource.
 * > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const order = new aws.cloudwatch.EventBus("order", {name: "orders"});
 * const orderEventArchive = new aws.cloudwatch.EventArchive("order", {
 *     name: "order-archive",
 *     eventSourceArn: order.arn,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * order = aws.cloudwatch.EventBus("order", name="orders")
 * order_event_archive = aws.cloudwatch.EventArchive("order",
 *     name="order-archive",
 *     event_source_arn=order.arn)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var order = new Aws.CloudWatch.EventBus("order", new()
 *     {
 *         Name = "orders",
 *     });
 *     var orderEventArchive = new Aws.CloudWatch.EventArchive("order", new()
 *     {
 *         Name = "order-archive",
 *         EventSourceArn = order.Arn,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		order, err := cloudwatch.NewEventBus(ctx, "order", &cloudwatch.EventBusArgs{
 * 			Name: pulumi.String("orders"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cloudwatch.NewEventArchive(ctx, "order", &cloudwatch.EventArchiveArgs{
 * 			Name:           pulumi.String("order-archive"),
 * 			EventSourceArn: order.Arn,
 * 		})
 * 		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.cloudwatch.EventBus;
 * import com.pulumi.aws.cloudwatch.EventBusArgs;
 * import com.pulumi.aws.cloudwatch.EventArchive;
 * import com.pulumi.aws.cloudwatch.EventArchiveArgs;
 * 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 order = new EventBus("order", EventBusArgs.builder()
 *             .name("orders")
 *             .build());
 *         var orderEventArchive = new EventArchive("orderEventArchive", EventArchiveArgs.builder()
 *             .name("order-archive")
 *             .eventSourceArn(order.arn())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   order:
 *     type: aws:cloudwatch:EventBus
 *     properties:
 *       name: orders
 *   orderEventArchive:
 *     type: aws:cloudwatch:EventArchive
 *     name: order
 *     properties:
 *       name: order-archive
 *       eventSourceArn: ${order.arn}
 * ```
 * 
 * ## Example all optional arguments
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const order = new aws.cloudwatch.EventBus("order", {name: "orders"});
 * const orderEventArchive = new aws.cloudwatch.EventArchive("order", {
 *     name: "order-archive",
 *     description: "Archived events from order service",
 *     eventSourceArn: order.arn,
 *     retentionDays: 7,
 *     eventPattern: JSON.stringify({
 *         source: ["company.team.order"],
 *     }),
 * });
 * ```
 * ```python
 * import pulumi
 * import json
 * import pulumi_aws as aws
 * order = aws.cloudwatch.EventBus("order", name="orders")
 * order_event_archive = aws.cloudwatch.EventArchive("order",
 *     name="order-archive",
 *     description="Archived events from order service",
 *     event_source_arn=order.arn,
 *     retention_days=7,
 *     event_pattern=json.dumps({
 *         "source": ["company.team.order"],
 *     }))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using System.Text.Json;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var order = new Aws.CloudWatch.EventBus("order", new()
 *     {
 *         Name = "orders",
 *     });
 *     var orderEventArchive = new Aws.CloudWatch.EventArchive("order", new()
 *     {
 *         Name = "order-archive",
 *         Description = "Archived events from order service",
 *         EventSourceArn = order.Arn,
 *         RetentionDays = 7,
 *         EventPattern = JsonSerializer.Serialize(new Dictionary
 *         {
 *             ["source"] = new[]
 *             {
 *                 "company.team.order",
 *             },
 *         }),
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"encoding/json"
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		order, err := cloudwatch.NewEventBus(ctx, "order", &cloudwatch.EventBusArgs{
 * 			Name: pulumi.String("orders"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		tmpJSON0, err := json.Marshal(map[string]interface{}{
 * 			"source": []string{
 * 				"company.team.order",
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		json0 := string(tmpJSON0)
 * 		_, err = cloudwatch.NewEventArchive(ctx, "order", &cloudwatch.EventArchiveArgs{
 * 			Name:           pulumi.String("order-archive"),
 * 			Description:    pulumi.String("Archived events from order service"),
 * 			EventSourceArn: order.Arn,
 * 			RetentionDays:  pulumi.Int(7),
 * 			EventPattern:   pulumi.String(json0),
 * 		})
 * 		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.cloudwatch.EventBus;
 * import com.pulumi.aws.cloudwatch.EventBusArgs;
 * import com.pulumi.aws.cloudwatch.EventArchive;
 * import com.pulumi.aws.cloudwatch.EventArchiveArgs;
 * import static com.pulumi.codegen.internal.Serialization.*;
 * 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 order = new EventBus("order", EventBusArgs.builder()
 *             .name("orders")
 *             .build());
 *         var orderEventArchive = new EventArchive("orderEventArchive", EventArchiveArgs.builder()
 *             .name("order-archive")
 *             .description("Archived events from order service")
 *             .eventSourceArn(order.arn())
 *             .retentionDays(7)
 *             .eventPattern(serializeJson(
 *                 jsonObject(
 *                     jsonProperty("source", jsonArray("company.team.order"))
 *                 )))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   order:
 *     type: aws:cloudwatch:EventBus
 *     properties:
 *       name: orders
 *   orderEventArchive:
 *     type: aws:cloudwatch:EventArchive
 *     name: order
 *     properties:
 *       name: order-archive
 *       description: Archived events from order service
 *       eventSourceArn: ${order.arn}
 *       retentionDays: 7
 *       eventPattern:
 *         fn::toJSON:
 *           source:
 *             - company.team.order
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import an EventBridge archive using the `name`. For example:
 * ```sh
 * $ pulumi import aws:cloudwatch/eventArchive:EventArchive imported_event_archive order-archive
 * ```
 * @property description The description of the new event archive.
 * @property eventPattern Instructs the new event archive to only capture events matched by this pattern. By default, it attempts to archive every event received in the `event_source_arn`.
 * @property eventSourceArn Event bus source ARN from where these events should be archived.
 * @property name The name of the new event archive. The archive name cannot exceed 48 characters.
 * @property retentionDays The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
 */
public data class EventArchiveArgs(
    public val description: Output? = null,
    public val eventPattern: Output? = null,
    public val eventSourceArn: Output? = null,
    public val name: Output? = null,
    public val retentionDays: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.cloudwatch.EventArchiveArgs =
        com.pulumi.aws.cloudwatch.EventArchiveArgs.builder()
            .description(description?.applyValue({ args0 -> args0 }))
            .eventPattern(eventPattern?.applyValue({ args0 -> args0 }))
            .eventSourceArn(eventSourceArn?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .retentionDays(retentionDays?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [EventArchiveArgs].
 */
@PulumiTagMarker
public class EventArchiveArgsBuilder internal constructor() {
    private var description: Output? = null

    private var eventPattern: Output? = null

    private var eventSourceArn: Output? = null

    private var name: Output? = null

    private var retentionDays: Output? = null

    /**
     * @param value The description of the new event archive.
     */
    @JvmName("tjbavvnhswyudbbj")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Instructs the new event archive to only capture events matched by this pattern. By default, it attempts to archive every event received in the `event_source_arn`.
     */
    @JvmName("ilhoekesuhunashm")
    public suspend fun eventPattern(`value`: Output) {
        this.eventPattern = value
    }

    /**
     * @param value Event bus source ARN from where these events should be archived.
     */
    @JvmName("jnkgaotsevojrbhm")
    public suspend fun eventSourceArn(`value`: Output) {
        this.eventSourceArn = value
    }

    /**
     * @param value The name of the new event archive. The archive name cannot exceed 48 characters.
     */
    @JvmName("tvfhiponpqjrdfqh")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
     */
    @JvmName("grpinrtptbplccft")
    public suspend fun retentionDays(`value`: Output) {
        this.retentionDays = value
    }

    /**
     * @param value The description of the new event archive.
     */
    @JvmName("cjwbjpbyrwsnlvan")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Instructs the new event archive to only capture events matched by this pattern. By default, it attempts to archive every event received in the `event_source_arn`.
     */
    @JvmName("jkorbtqbshpednbf")
    public suspend fun eventPattern(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.eventPattern = mapped
    }

    /**
     * @param value Event bus source ARN from where these events should be archived.
     */
    @JvmName("agsdlspetyceiqvo")
    public suspend fun eventSourceArn(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.eventSourceArn = mapped
    }

    /**
     * @param value The name of the new event archive. The archive name cannot exceed 48 characters.
     */
    @JvmName("fhefjsochjveogsn")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
     */
    @JvmName("dgyufpcatoqqonjc")
    public suspend fun retentionDays(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.retentionDays = mapped
    }

    internal fun build(): EventArchiveArgs = EventArchiveArgs(
        description = description,
        eventPattern = eventPattern,
        eventSourceArn = eventSourceArn,
        name = name,
        retentionDays = retentionDays,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy