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

com.pulumi.aws.cloudwatch.kotlin.EventEndpoint.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.kotlin.outputs.EventEndpointEventBus
import com.pulumi.aws.cloudwatch.kotlin.outputs.EventEndpointReplicationConfig
import com.pulumi.aws.cloudwatch.kotlin.outputs.EventEndpointRoutingConfig
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.aws.cloudwatch.kotlin.outputs.EventEndpointEventBus.Companion.toKotlin as eventEndpointEventBusToKotlin
import com.pulumi.aws.cloudwatch.kotlin.outputs.EventEndpointReplicationConfig.Companion.toKotlin as eventEndpointReplicationConfigToKotlin
import com.pulumi.aws.cloudwatch.kotlin.outputs.EventEndpointRoutingConfig.Companion.toKotlin as eventEndpointRoutingConfigToKotlin

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

    public var args: EventEndpointArgs = EventEndpointArgs()

    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 EventEndpointArgsBuilder.() -> Unit) {
        val builder = EventEndpointArgsBuilder()
        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(): EventEndpoint {
        val builtJavaResource = com.pulumi.aws.cloudwatch.EventEndpoint(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return EventEndpoint(builtJavaResource)
    }
}

/**
 * Provides a resource to create an EventBridge Global Endpoint.
 * > **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 _this = new aws.cloudwatch.EventEndpoint("this", {
 *     name: "global-endpoint",
 *     roleArn: replication.arn,
 *     eventBuses: [
 *         {
 *             eventBusArn: primary.arn,
 *         },
 *         {
 *             eventBusArn: secondary.arn,
 *         },
 *     ],
 *     replicationConfig: {
 *         state: "DISABLED",
 *     },
 *     routingConfig: {
 *         failoverConfig: {
 *             primary: {
 *                 healthCheck: primaryAwsRoute53HealthCheck.arn,
 *             },
 *             secondary: {
 *                 route: "us-east-2",
 *             },
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * this = aws.cloudwatch.EventEndpoint("this",
 *     name="global-endpoint",
 *     role_arn=replication["arn"],
 *     event_buses=[
 *         {
 *             "event_bus_arn": primary["arn"],
 *         },
 *         {
 *             "event_bus_arn": secondary["arn"],
 *         },
 *     ],
 *     replication_config={
 *         "state": "DISABLED",
 *     },
 *     routing_config={
 *         "failover_config": {
 *             "primary": {
 *                 "health_check": primary_aws_route53_health_check["arn"],
 *             },
 *             "secondary": {
 *                 "route": "us-east-2",
 *             },
 *         },
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @this = new Aws.CloudWatch.EventEndpoint("this", new()
 *     {
 *         Name = "global-endpoint",
 *         RoleArn = replication.Arn,
 *         EventBuses = new[]
 *         {
 *             new Aws.CloudWatch.Inputs.EventEndpointEventBusArgs
 *             {
 *                 EventBusArn = primary.Arn,
 *             },
 *             new Aws.CloudWatch.Inputs.EventEndpointEventBusArgs
 *             {
 *                 EventBusArn = secondary.Arn,
 *             },
 *         },
 *         ReplicationConfig = new Aws.CloudWatch.Inputs.EventEndpointReplicationConfigArgs
 *         {
 *             State = "DISABLED",
 *         },
 *         RoutingConfig = new Aws.CloudWatch.Inputs.EventEndpointRoutingConfigArgs
 *         {
 *             FailoverConfig = new Aws.CloudWatch.Inputs.EventEndpointRoutingConfigFailoverConfigArgs
 *             {
 *                 Primary = new Aws.CloudWatch.Inputs.EventEndpointRoutingConfigFailoverConfigPrimaryArgs
 *                 {
 *                     HealthCheck = primaryAwsRoute53HealthCheck.Arn,
 *                 },
 *                 Secondary = new Aws.CloudWatch.Inputs.EventEndpointRoutingConfigFailoverConfigSecondaryArgs
 *                 {
 *                     Route = "us-east-2",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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 {
 * 		_, err := cloudwatch.NewEventEndpoint(ctx, "this", &cloudwatch.EventEndpointArgs{
 * 			Name:    pulumi.String("global-endpoint"),
 * 			RoleArn: pulumi.Any(replication.Arn),
 * 			EventBuses: cloudwatch.EventEndpointEventBusArray{
 * 				&cloudwatch.EventEndpointEventBusArgs{
 * 					EventBusArn: pulumi.Any(primary.Arn),
 * 				},
 * 				&cloudwatch.EventEndpointEventBusArgs{
 * 					EventBusArn: pulumi.Any(secondary.Arn),
 * 				},
 * 			},
 * 			ReplicationConfig: &cloudwatch.EventEndpointReplicationConfigArgs{
 * 				State: pulumi.String("DISABLED"),
 * 			},
 * 			RoutingConfig: &cloudwatch.EventEndpointRoutingConfigArgs{
 * 				FailoverConfig: &cloudwatch.EventEndpointRoutingConfigFailoverConfigArgs{
 * 					Primary: &cloudwatch.EventEndpointRoutingConfigFailoverConfigPrimaryArgs{
 * 						HealthCheck: pulumi.Any(primaryAwsRoute53HealthCheck.Arn),
 * 					},
 * 					Secondary: &cloudwatch.EventEndpointRoutingConfigFailoverConfigSecondaryArgs{
 * 						Route: pulumi.String("us-east-2"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.EventEndpoint;
 * import com.pulumi.aws.cloudwatch.EventEndpointArgs;
 * import com.pulumi.aws.cloudwatch.inputs.EventEndpointEventBusArgs;
 * import com.pulumi.aws.cloudwatch.inputs.EventEndpointReplicationConfigArgs;
 * import com.pulumi.aws.cloudwatch.inputs.EventEndpointRoutingConfigArgs;
 * import com.pulumi.aws.cloudwatch.inputs.EventEndpointRoutingConfigFailoverConfigArgs;
 * import com.pulumi.aws.cloudwatch.inputs.EventEndpointRoutingConfigFailoverConfigPrimaryArgs;
 * import com.pulumi.aws.cloudwatch.inputs.EventEndpointRoutingConfigFailoverConfigSecondaryArgs;
 * 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 this_ = new EventEndpoint("this", EventEndpointArgs.builder()
 *             .name("global-endpoint")
 *             .roleArn(replication.arn())
 *             .eventBuses(
 *                 EventEndpointEventBusArgs.builder()
 *                     .eventBusArn(primary.arn())
 *                     .build(),
 *                 EventEndpointEventBusArgs.builder()
 *                     .eventBusArn(secondary.arn())
 *                     .build())
 *             .replicationConfig(EventEndpointReplicationConfigArgs.builder()
 *                 .state("DISABLED")
 *                 .build())
 *             .routingConfig(EventEndpointRoutingConfigArgs.builder()
 *                 .failoverConfig(EventEndpointRoutingConfigFailoverConfigArgs.builder()
 *                     .primary(EventEndpointRoutingConfigFailoverConfigPrimaryArgs.builder()
 *                         .healthCheck(primaryAwsRoute53HealthCheck.arn())
 *                         .build())
 *                     .secondary(EventEndpointRoutingConfigFailoverConfigSecondaryArgs.builder()
 *                         .route("us-east-2")
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   this:
 *     type: aws:cloudwatch:EventEndpoint
 *     properties:
 *       name: global-endpoint
 *       roleArn: ${replication.arn}
 *       eventBuses:
 *         - eventBusArn: ${primary.arn}
 *         - eventBusArn: ${secondary.arn}
 *       replicationConfig:
 *         state: DISABLED
 *       routingConfig:
 *         failoverConfig:
 *           primary:
 *             healthCheck: ${primaryAwsRoute53HealthCheck.arn}
 *           secondary:
 *             route: us-east-2
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import EventBridge Global Endpoints using the `name`. For example:
 * ```sh
 * $ pulumi import aws:cloudwatch/eventEndpoint:EventEndpoint imported_endpoint example-endpoint
 * ```
 */
public class EventEndpoint internal constructor(
    override val javaResource: com.pulumi.aws.cloudwatch.EventEndpoint,
) : KotlinCustomResource(javaResource, EventEndpointMapper) {
    /**
     * The ARN of the endpoint that was created.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * A description of the global endpoint.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The URL of the endpoint that was created.
     */
    public val endpointUrl: Output
        get() = javaResource.endpointUrl().applyValue({ args0 -> args0 })

    /**
     * The event buses to use. The names of the event buses must be identical in each Region. Exactly two event buses are required. Documented below.
     */
    public val eventBuses: Output>
        get() = javaResource.eventBuses().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    eventEndpointEventBusToKotlin(args0)
                })
            })
        })

    /**
     * The name of the global endpoint.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Parameters used for replication. Documented below.
     */
    public val replicationConfig: Output?
        get() = javaResource.replicationConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventEndpointReplicationConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The ARN of the IAM role used for replication between event buses.
     */
    public val roleArn: Output?
        get() = javaResource.roleArn().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Parameters used for routing, including the health check and secondary Region. Documented below.
     */
    public val routingConfig: Output
        get() = javaResource.routingConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                eventEndpointRoutingConfigToKotlin(args0)
            })
        })
}

public object EventEndpointMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.cloudwatch.EventEndpoint::class == javaResource::class

    override fun map(javaResource: Resource): EventEndpoint = EventEndpoint(
        javaResource as
            com.pulumi.aws.cloudwatch.EventEndpoint,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy