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

com.pulumi.azure.siterecovery.kotlin.HyperVReplicationPolicy.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 [HyperVReplicationPolicy].
 */
@PulumiTagMarker
public class HyperVReplicationPolicyResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: HyperVReplicationPolicyArgs = HyperVReplicationPolicyArgs()

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

/**
 * Manages a Azure Site Recovery replication policy for HyperV 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: "example-rg",
 *     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.HyperVReplicationPolicy("policy", {
 *     name: "policy",
 *     recoveryVaultId: vault.id,
 *     recoveryPointRetentionInHours: 2,
 *     applicationConsistentSnapshotFrequencyInHours: 1,
 *     replicationIntervalInSeconds: 300,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-rg",
 *     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.HyperVReplicationPolicy("policy",
 *     name="policy",
 *     recovery_vault_id=vault.id,
 *     recovery_point_retention_in_hours=2,
 *     application_consistent_snapshot_frequency_in_hours=1,
 *     replication_interval_in_seconds=300)
 * ```
 * ```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 = "example-rg",
 *         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.HyperVReplicationPolicy("policy", new()
 *     {
 *         Name = "policy",
 *         RecoveryVaultId = vault.Id,
 *         RecoveryPointRetentionInHours = 2,
 *         ApplicationConsistentSnapshotFrequencyInHours = 1,
 *         ReplicationIntervalInSeconds = 300,
 *     });
 * });
 * ```
 * ```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("example-rg"),
 * 			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.NewHyperVReplicationPolicy(ctx, "policy", &siterecovery.HyperVReplicationPolicyArgs{
 * 			Name:                          pulumi.String("policy"),
 * 			RecoveryVaultId:               vault.ID(),
 * 			RecoveryPointRetentionInHours: pulumi.Int(2),
 * 			ApplicationConsistentSnapshotFrequencyInHours: pulumi.Int(1),
 * 			ReplicationIntervalInSeconds:                  pulumi.Int(300),
 * 		})
 * 		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.HyperVReplicationPolicy;
 * import com.pulumi.azure.siterecovery.HyperVReplicationPolicyArgs;
 * 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("example-rg")
 *             .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 HyperVReplicationPolicy("policy", HyperVReplicationPolicyArgs.builder()
 *             .name("policy")
 *             .recoveryVaultId(vault.id())
 *             .recoveryPointRetentionInHours(2)
 *             .applicationConsistentSnapshotFrequencyInHours(1)
 *             .replicationIntervalInSeconds(300)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-rg
 *       location: East US
 *   vault:
 *     type: azure:recoveryservices:Vault
 *     properties:
 *       name: example-recovery-vault
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: Standard
 *   policy:
 *     type: azure:siterecovery:HyperVReplicationPolicy
 *     properties:
 *       name: policy
 *       recoveryVaultId: ${vault.id}
 *       recoveryPointRetentionInHours: 2
 *       applicationConsistentSnapshotFrequencyInHours: 1
 *       replicationIntervalInSeconds: 300
 * ```
 * 
 * ## Import
 * Site Recovery Replication Policies can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:siterecovery/hyperVReplicationPolicy:HyperVReplicationPolicy mypolicy /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.RecoveryServices/vaults/recovery-vault-name/replicationPolicies/policy-name
 * ```
 */
public class HyperVReplicationPolicy internal constructor(
    override val javaResource: com.pulumi.azure.siterecovery.HyperVReplicationPolicy,
) : KotlinCustomResource(javaResource, HyperVReplicationPolicyMapper) {
    /**
     * Specifies the frequency at which to create application consistent recovery points.
     */
    public val applicationConsistentSnapshotFrequencyInHours: Output
        get() = javaResource.applicationConsistentSnapshotFrequencyInHours().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 hours for which the recovery points need to be stored.
     */
    public val recoveryPointRetentionInHours: Output
        get() = javaResource.recoveryPointRetentionInHours().applyValue({ args0 -> args0 })

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

    /**
     * Specifies how frequently data should be synchronized between source and target locations. Possible values are `30` and `300`.
     */
    public val replicationIntervalInSeconds: Output
        get() = javaResource.replicationIntervalInSeconds().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy