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

com.pulumi.azure.siterecovery.kotlin.ReplicationPolicy.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.siterecovery.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: ReplicationPolicyArgs = ReplicationPolicyArgs()

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

/**
 * Manages a Azure Site Recovery replication policy within a recovery vault. Replication policies define the frequency at which recovery points are created and how long they are stored.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "tfex-network-mapping-secondary",
 *     location: "East US",
 * });
 * const vault = new azure.recoveryservices.Vault("vault", {
 *     name: "example-recovery-vault",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "Standard",
 * });
 * const policy = new azure.siterecovery.ReplicationPolicy("policy", {
 *     name: "policy",
 *     resourceGroupName: example.name,
 *     recoveryVaultName: vault.name,
 *     recoveryPointRetentionInMinutes: 24 * 60,
 *     applicationConsistentSnapshotFrequencyInMinutes: 4 * 60,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="tfex-network-mapping-secondary",
 *     location="East US")
 * vault = azure.recoveryservices.Vault("vault",
 *     name="example-recovery-vault",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="Standard")
 * policy = azure.siterecovery.ReplicationPolicy("policy",
 *     name="policy",
 *     resource_group_name=example.name,
 *     recovery_vault_name=vault.name,
 *     recovery_point_retention_in_minutes=24 * 60,
 *     application_consistent_snapshot_frequency_in_minutes=4 * 60)
 * ```
 * ```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 = "tfex-network-mapping-secondary",
 *         Location = "East US",
 *     });
 *     var vault = new Azure.RecoveryServices.Vault("vault", new()
 *     {
 *         Name = "example-recovery-vault",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "Standard",
 *     });
 *     var policy = new Azure.SiteRecovery.ReplicationPolicy("policy", new()
 *     {
 *         Name = "policy",
 *         ResourceGroupName = example.Name,
 *         RecoveryVaultName = vault.Name,
 *         RecoveryPointRetentionInMinutes = 24 * 60,
 *         ApplicationConsistentSnapshotFrequencyInMinutes = 4 * 60,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/recoveryservices"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/siterecovery"
 * 	"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("tfex-network-mapping-secondary"),
 * 			Location: pulumi.String("East US"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		vault, err := recoveryservices.NewVault(ctx, "vault", &recoveryservices.VaultArgs{
 * 			Name:              pulumi.String("example-recovery-vault"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("Standard"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = siterecovery.NewReplicationPolicy(ctx, "policy", &siterecovery.ReplicationPolicyArgs{
 * 			Name:                            pulumi.String("policy"),
 * 			ResourceGroupName:               example.Name,
 * 			RecoveryVaultName:               vault.Name,
 * 			RecoveryPointRetentionInMinutes: int(24 * 60),
 * 			ApplicationConsistentSnapshotFrequencyInMinutes: int(4 * 60),
 * 		})
 * 		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.recoveryservices.Vault;
 * import com.pulumi.azure.recoveryservices.VaultArgs;
 * import com.pulumi.azure.siterecovery.ReplicationPolicy;
 * import com.pulumi.azure.siterecovery.ReplicationPolicyArgs;
 * 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("tfex-network-mapping-secondary")
 *             .location("East US")
 *             .build());
 *         var vault = new Vault("vault", VaultArgs.builder()
 *             .name("example-recovery-vault")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("Standard")
 *             .build());
 *         var policy = new ReplicationPolicy("policy", ReplicationPolicyArgs.builder()
 *             .name("policy")
 *             .resourceGroupName(example.name())
 *             .recoveryVaultName(vault.name())
 *             .recoveryPointRetentionInMinutes(24 * 60)
 *             .applicationConsistentSnapshotFrequencyInMinutes(4 * 60)
 *             .build());
 *     }
 * }
 * ```
 * 
 * ## Import
 * Site Recovery Replication Policies can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:siterecovery/replicationPolicy:ReplicationPolicy mypolicy /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationPolicies/policy-name
 * ```
 */
public class ReplicationPolicy internal constructor(
    override val javaResource: com.pulumi.azure.siterecovery.ReplicationPolicy,
) : KotlinCustomResource(javaResource, ReplicationPolicyMapper) {
    /**
     * Specifies the frequency(in minutes) at which to create application consistent recovery points.
     * > **Note:** The value of `application_consistent_snapshot_frequency_in_minutes` must be less than or equal to the value of `recovery_point_retention_in_minutes`.
     */
    public val applicationConsistentSnapshotFrequencyInMinutes: Output
        get() = javaResource.applicationConsistentSnapshotFrequencyInMinutes().applyValue({ args0 ->
            args0
        })

    /**
     * The name of the replication policy. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The duration in minutes for which the recovery points need to be stored.
     */
    public val recoveryPointRetentionInMinutes: Output
        get() = javaResource.recoveryPointRetentionInMinutes().applyValue({ args0 -> args0 })

    /**
     * The name of the vault that should be updated. Changing this forces a new resource to be created.
     */
    public val recoveryVaultName: Output
        get() = javaResource.recoveryVaultName().applyValue({ args0 -> args0 })

    /**
     * Name of the resource group where the vault that should be updated is located. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
}

public object ReplicationPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.siterecovery.ReplicationPolicy::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy