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

com.pulumi.azure.eventhub.kotlin.EventhubNamespaceDisasterRecoveryConfig.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.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.eventhub.kotlin

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

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

    public var args: EventhubNamespaceDisasterRecoveryConfigArgs =
        EventhubNamespaceDisasterRecoveryConfigArgs()

    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 EventhubNamespaceDisasterRecoveryConfigArgsBuilder.() -> Unit) {
        val builder = EventhubNamespaceDisasterRecoveryConfigArgsBuilder()
        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(): EventhubNamespaceDisasterRecoveryConfig {
        val builtJavaResource =
            com.pulumi.azure.eventhub.EventhubNamespaceDisasterRecoveryConfig(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return EventhubNamespaceDisasterRecoveryConfig(builtJavaResource)
    }
}

/**
 * Manages an Disaster Recovery Config for an Event Hub Namespace.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "eventhub-replication",
 *     location: "West Europe",
 * });
 * const primary = new azure.eventhub.EventHubNamespace("primary", {
 *     name: "eventhub-primary",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "Standard",
 * });
 * const secondary = new azure.eventhub.EventHubNamespace("secondary", {
 *     name: "eventhub-secondary",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "Standard",
 * });
 * const exampleEventhubNamespaceDisasterRecoveryConfig = new azure.eventhub.EventhubNamespaceDisasterRecoveryConfig("example", {
 *     name: "replicate-eventhub",
 *     resourceGroupName: example.name,
 *     namespaceName: primary.name,
 *     partnerNamespaceId: secondary.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="eventhub-replication",
 *     location="West Europe")
 * primary = azure.eventhub.EventHubNamespace("primary",
 *     name="eventhub-primary",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="Standard")
 * secondary = azure.eventhub.EventHubNamespace("secondary",
 *     name="eventhub-secondary",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="Standard")
 * example_eventhub_namespace_disaster_recovery_config = azure.eventhub.EventhubNamespaceDisasterRecoveryConfig("example",
 *     name="replicate-eventhub",
 *     resource_group_name=example.name,
 *     namespace_name=primary.name,
 *     partner_namespace_id=secondary.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "eventhub-replication",
 *         Location = "West Europe",
 *     });
 *     var primary = new Azure.EventHub.EventHubNamespace("primary", new()
 *     {
 *         Name = "eventhub-primary",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "Standard",
 *     });
 *     var secondary = new Azure.EventHub.EventHubNamespace("secondary", new()
 *     {
 *         Name = "eventhub-secondary",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "Standard",
 *     });
 *     var exampleEventhubNamespaceDisasterRecoveryConfig = new Azure.EventHub.EventhubNamespaceDisasterRecoveryConfig("example", new()
 *     {
 *         Name = "replicate-eventhub",
 *         ResourceGroupName = example.Name,
 *         NamespaceName = primary.Name,
 *         PartnerNamespaceId = secondary.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/eventhub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("eventhub-replication"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		primary, err := eventhub.NewEventHubNamespace(ctx, "primary", &eventhub.EventHubNamespaceArgs{
 * 			Name:              pulumi.String("eventhub-primary"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("Standard"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		secondary, err := eventhub.NewEventHubNamespace(ctx, "secondary", &eventhub.EventHubNamespaceArgs{
 * 			Name:              pulumi.String("eventhub-secondary"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("Standard"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = eventhub.NewEventhubNamespaceDisasterRecoveryConfig(ctx, "example", &eventhub.EventhubNamespaceDisasterRecoveryConfigArgs{
 * 			Name:               pulumi.String("replicate-eventhub"),
 * 			ResourceGroupName:  example.Name,
 * 			NamespaceName:      primary.Name,
 * 			PartnerNamespaceId: secondary.ID(),
 * 		})
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.eventhub.EventHubNamespace;
 * import com.pulumi.azure.eventhub.EventHubNamespaceArgs;
 * import com.pulumi.azure.eventhub.EventhubNamespaceDisasterRecoveryConfig;
 * import com.pulumi.azure.eventhub.EventhubNamespaceDisasterRecoveryConfigArgs;
 * 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 ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("eventhub-replication")
 *             .location("West Europe")
 *             .build());
 *         var primary = new EventHubNamespace("primary", EventHubNamespaceArgs.builder()
 *             .name("eventhub-primary")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("Standard")
 *             .build());
 *         var secondary = new EventHubNamespace("secondary", EventHubNamespaceArgs.builder()
 *             .name("eventhub-secondary")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("Standard")
 *             .build());
 *         var exampleEventhubNamespaceDisasterRecoveryConfig = new EventhubNamespaceDisasterRecoveryConfig("exampleEventhubNamespaceDisasterRecoveryConfig", EventhubNamespaceDisasterRecoveryConfigArgs.builder()
 *             .name("replicate-eventhub")
 *             .resourceGroupName(example.name())
 *             .namespaceName(primary.name())
 *             .partnerNamespaceId(secondary.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: eventhub-replication
 *       location: West Europe
 *   primary:
 *     type: azure:eventhub:EventHubNamespace
 *     properties:
 *       name: eventhub-primary
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: Standard
 *   secondary:
 *     type: azure:eventhub:EventHubNamespace
 *     properties:
 *       name: eventhub-secondary
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: Standard
 *   exampleEventhubNamespaceDisasterRecoveryConfig:
 *     type: azure:eventhub:EventhubNamespaceDisasterRecoveryConfig
 *     name: example
 *     properties:
 *       name: replicate-eventhub
 *       resourceGroupName: ${example.name}
 *       namespaceName: ${primary.name}
 *       partnerNamespaceId: ${secondary.id}
 * ```
 * 
 * ## Import
 * EventHubs can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:eventhub/eventhubNamespaceDisasterRecoveryConfig:EventhubNamespaceDisasterRecoveryConfig config1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.EventHub/namespaces/namespace1/disasterRecoveryConfigs/config1
 * ```
 */
public class EventhubNamespaceDisasterRecoveryConfig internal constructor(
    override val javaResource: com.pulumi.azure.eventhub.EventhubNamespaceDisasterRecoveryConfig,
) : KotlinCustomResource(javaResource, EventhubNamespaceDisasterRecoveryConfigMapper) {
    /**
     * Specifies the name of the Disaster Recovery Config. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the primary EventHub Namespace to replicate. Changing this forces a new resource to be created.
     */
    public val namespaceName: Output
        get() = javaResource.namespaceName().applyValue({ args0 -> args0 })

    /**
     * The ID of the EventHub Namespace to replicate to.
     */
    public val partnerNamespaceId: Output
        get() = javaResource.partnerNamespaceId().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group in which the Disaster Recovery Config exists. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
}

public object EventhubNamespaceDisasterRecoveryConfigMapper :
    ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.eventhub.EventhubNamespaceDisasterRecoveryConfig::class == javaResource::class

    override fun map(javaResource: Resource): EventhubNamespaceDisasterRecoveryConfig =
        EventhubNamespaceDisasterRecoveryConfig(
            javaResource as
                com.pulumi.azure.eventhub.EventhubNamespaceDisasterRecoveryConfig,
        )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy