Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.backup.kotlin.PolicyFileShare.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.backup.kotlin
import com.pulumi.azure.backup.kotlin.outputs.PolicyFileShareBackup
import com.pulumi.azure.backup.kotlin.outputs.PolicyFileShareRetentionDaily
import com.pulumi.azure.backup.kotlin.outputs.PolicyFileShareRetentionMonthly
import com.pulumi.azure.backup.kotlin.outputs.PolicyFileShareRetentionWeekly
import com.pulumi.azure.backup.kotlin.outputs.PolicyFileShareRetentionYearly
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 com.pulumi.azure.backup.kotlin.outputs.PolicyFileShareBackup.Companion.toKotlin as policyFileShareBackupToKotlin
import com.pulumi.azure.backup.kotlin.outputs.PolicyFileShareRetentionDaily.Companion.toKotlin as policyFileShareRetentionDailyToKotlin
import com.pulumi.azure.backup.kotlin.outputs.PolicyFileShareRetentionMonthly.Companion.toKotlin as policyFileShareRetentionMonthlyToKotlin
import com.pulumi.azure.backup.kotlin.outputs.PolicyFileShareRetentionWeekly.Companion.toKotlin as policyFileShareRetentionWeeklyToKotlin
import com.pulumi.azure.backup.kotlin.outputs.PolicyFileShareRetentionYearly.Companion.toKotlin as policyFileShareRetentionYearlyToKotlin
/**
* Builder for [PolicyFileShare].
*/
@PulumiTagMarker
public class PolicyFileShareResourceBuilder internal constructor() {
public var name: String? = null
public var args: PolicyFileShareArgs = PolicyFileShareArgs()
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 PolicyFileShareArgsBuilder.() -> Unit) {
val builder = PolicyFileShareArgsBuilder()
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(): PolicyFileShare {
val builtJavaResource = com.pulumi.azure.backup.PolicyFileShare(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return PolicyFileShare(builtJavaResource)
}
}
/**
* Manages an Azure File Share Backup Policy within a Recovery Services vault.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "tfex-recovery_vault",
* location: "West Europe",
* });
* const exampleVault = new azure.recoveryservices.Vault("example", {
* name: "tfex-recovery-vault",
* location: example.location,
* resourceGroupName: example.name,
* sku: "Standard",
* });
* const policy = new azure.backup.PolicyFileShare("policy", {
* name: "tfex-recovery-vault-policy",
* resourceGroupName: example.name,
* recoveryVaultName: exampleVault.name,
* timezone: "UTC",
* backup: {
* frequency: "Daily",
* time: "23:00",
* },
* retentionDaily: {
* count: 10,
* },
* retentionWeekly: {
* count: 7,
* weekdays: [
* "Sunday",
* "Wednesday",
* "Friday",
* "Saturday",
* ],
* },
* retentionMonthly: {
* count: 7,
* weekdays: [
* "Sunday",
* "Wednesday",
* ],
* weeks: [
* "First",
* "Last",
* ],
* },
* retentionYearly: {
* count: 7,
* weekdays: ["Sunday"],
* weeks: ["Last"],
* months: ["January"],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="tfex-recovery_vault",
* location="West Europe")
* example_vault = azure.recoveryservices.Vault("example",
* name="tfex-recovery-vault",
* location=example.location,
* resource_group_name=example.name,
* sku="Standard")
* policy = azure.backup.PolicyFileShare("policy",
* name="tfex-recovery-vault-policy",
* resource_group_name=example.name,
* recovery_vault_name=example_vault.name,
* timezone="UTC",
* backup={
* "frequency": "Daily",
* "time": "23:00",
* },
* retention_daily={
* "count": 10,
* },
* retention_weekly={
* "count": 7,
* "weekdays": [
* "Sunday",
* "Wednesday",
* "Friday",
* "Saturday",
* ],
* },
* retention_monthly={
* "count": 7,
* "weekdays": [
* "Sunday",
* "Wednesday",
* ],
* "weeks": [
* "First",
* "Last",
* ],
* },
* retention_yearly={
* "count": 7,
* "weekdays": ["Sunday"],
* "weeks": ["Last"],
* "months": ["January"],
* })
* ```
* ```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-recovery_vault",
* Location = "West Europe",
* });
* var exampleVault = new Azure.RecoveryServices.Vault("example", new()
* {
* Name = "tfex-recovery-vault",
* Location = example.Location,
* ResourceGroupName = example.Name,
* Sku = "Standard",
* });
* var policy = new Azure.Backup.PolicyFileShare("policy", new()
* {
* Name = "tfex-recovery-vault-policy",
* ResourceGroupName = example.Name,
* RecoveryVaultName = exampleVault.Name,
* Timezone = "UTC",
* Backup = new Azure.Backup.Inputs.PolicyFileShareBackupArgs
* {
* Frequency = "Daily",
* Time = "23:00",
* },
* RetentionDaily = new Azure.Backup.Inputs.PolicyFileShareRetentionDailyArgs
* {
* Count = 10,
* },
* RetentionWeekly = new Azure.Backup.Inputs.PolicyFileShareRetentionWeeklyArgs
* {
* Count = 7,
* Weekdays = new[]
* {
* "Sunday",
* "Wednesday",
* "Friday",
* "Saturday",
* },
* },
* RetentionMonthly = new Azure.Backup.Inputs.PolicyFileShareRetentionMonthlyArgs
* {
* Count = 7,
* Weekdays = new[]
* {
* "Sunday",
* "Wednesday",
* },
* Weeks = new[]
* {
* "First",
* "Last",
* },
* },
* RetentionYearly = new Azure.Backup.Inputs.PolicyFileShareRetentionYearlyArgs
* {
* Count = 7,
* Weekdays = new[]
* {
* "Sunday",
* },
* Weeks = new[]
* {
* "Last",
* },
* Months = new[]
* {
* "January",
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/backup"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/recoveryservices"
* "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-recovery_vault"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleVault, err := recoveryservices.NewVault(ctx, "example", &recoveryservices.VaultArgs{
* Name: pulumi.String("tfex-recovery-vault"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* Sku: pulumi.String("Standard"),
* })
* if err != nil {
* return err
* }
* _, err = backup.NewPolicyFileShare(ctx, "policy", &backup.PolicyFileShareArgs{
* Name: pulumi.String("tfex-recovery-vault-policy"),
* ResourceGroupName: example.Name,
* RecoveryVaultName: exampleVault.Name,
* Timezone: pulumi.String("UTC"),
* Backup: &backup.PolicyFileShareBackupArgs{
* Frequency: pulumi.String("Daily"),
* Time: pulumi.String("23:00"),
* },
* RetentionDaily: &backup.PolicyFileShareRetentionDailyArgs{
* Count: pulumi.Int(10),
* },
* RetentionWeekly: &backup.PolicyFileShareRetentionWeeklyArgs{
* Count: pulumi.Int(7),
* Weekdays: pulumi.StringArray{
* pulumi.String("Sunday"),
* pulumi.String("Wednesday"),
* pulumi.String("Friday"),
* pulumi.String("Saturday"),
* },
* },
* RetentionMonthly: &backup.PolicyFileShareRetentionMonthlyArgs{
* Count: pulumi.Int(7),
* Weekdays: pulumi.StringArray{
* pulumi.String("Sunday"),
* pulumi.String("Wednesday"),
* },
* Weeks: pulumi.StringArray{
* pulumi.String("First"),
* pulumi.String("Last"),
* },
* },
* RetentionYearly: &backup.PolicyFileShareRetentionYearlyArgs{
* Count: pulumi.Int(7),
* Weekdays: pulumi.StringArray{
* pulumi.String("Sunday"),
* },
* Weeks: pulumi.StringArray{
* pulumi.String("Last"),
* },
* Months: pulumi.StringArray{
* pulumi.String("January"),
* },
* },
* })
* 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.backup.PolicyFileShare;
* import com.pulumi.azure.backup.PolicyFileShareArgs;
* import com.pulumi.azure.backup.inputs.PolicyFileShareBackupArgs;
* import com.pulumi.azure.backup.inputs.PolicyFileShareRetentionDailyArgs;
* import com.pulumi.azure.backup.inputs.PolicyFileShareRetentionWeeklyArgs;
* import com.pulumi.azure.backup.inputs.PolicyFileShareRetentionMonthlyArgs;
* import com.pulumi.azure.backup.inputs.PolicyFileShareRetentionYearlyArgs;
* 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-recovery_vault")
* .location("West Europe")
* .build());
* var exampleVault = new Vault("exampleVault", VaultArgs.builder()
* .name("tfex-recovery-vault")
* .location(example.location())
* .resourceGroupName(example.name())
* .sku("Standard")
* .build());
* var policy = new PolicyFileShare("policy", PolicyFileShareArgs.builder()
* .name("tfex-recovery-vault-policy")
* .resourceGroupName(example.name())
* .recoveryVaultName(exampleVault.name())
* .timezone("UTC")
* .backup(PolicyFileShareBackupArgs.builder()
* .frequency("Daily")
* .time("23:00")
* .build())
* .retentionDaily(PolicyFileShareRetentionDailyArgs.builder()
* .count(10)
* .build())
* .retentionWeekly(PolicyFileShareRetentionWeeklyArgs.builder()
* .count(7)
* .weekdays(
* "Sunday",
* "Wednesday",
* "Friday",
* "Saturday")
* .build())
* .retentionMonthly(PolicyFileShareRetentionMonthlyArgs.builder()
* .count(7)
* .weekdays(
* "Sunday",
* "Wednesday")
* .weeks(
* "First",
* "Last")
* .build())
* .retentionYearly(PolicyFileShareRetentionYearlyArgs.builder()
* .count(7)
* .weekdays("Sunday")
* .weeks("Last")
* .months("January")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: tfex-recovery_vault
* location: West Europe
* exampleVault:
* type: azure:recoveryservices:Vault
* name: example
* properties:
* name: tfex-recovery-vault
* location: ${example.location}
* resourceGroupName: ${example.name}
* sku: Standard
* policy:
* type: azure:backup:PolicyFileShare
* properties:
* name: tfex-recovery-vault-policy
* resourceGroupName: ${example.name}
* recoveryVaultName: ${exampleVault.name}
* timezone: UTC
* backup:
* frequency: Daily
* time: 23:00
* retentionDaily:
* count: 10
* retentionWeekly:
* count: 7
* weekdays:
* - Sunday
* - Wednesday
* - Friday
* - Saturday
* retentionMonthly:
* count: 7
* weekdays:
* - Sunday
* - Wednesday
* weeks:
* - First
* - Last
* retentionYearly:
* count: 7
* weekdays:
* - Sunday
* weeks:
* - Last
* months:
* - January
* ```
*
* ## Import
* Azure File Share Backup Policies can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:backup/policyFileShare:PolicyFileShare policy1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/example-recovery-vault/backupPolicies/policy1
* ```
*/
public class PolicyFileShare internal constructor(
override val javaResource: com.pulumi.azure.backup.PolicyFileShare,
) : KotlinCustomResource(javaResource, PolicyFileShareMapper) {
/**
* Configures the Policy backup frequency and times as documented in the `backup` block below.
*/
public val backup: Output
get() = javaResource.backup().applyValue({ args0 ->
args0.let({ args0 ->
policyFileShareBackupToKotlin(args0)
})
})
/**
* Specifies the name of the policy. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
*/
public val recoveryVaultName: Output
get() = javaResource.recoveryVaultName().applyValue({ args0 -> args0 })
/**
* The name of the resource group in which to create the policy. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* Configures the policy daily retention as documented in the `retention_daily` block below.
*/
public val retentionDaily: Output
get() = javaResource.retentionDaily().applyValue({ args0 ->
args0.let({ args0 ->
policyFileShareRetentionDailyToKotlin(args0)
})
})
/**
* Configures the policy monthly retention as documented in the `retention_monthly` block below.
*/
public val retentionMonthly: Output?
get() = javaResource.retentionMonthly().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> policyFileShareRetentionMonthlyToKotlin(args0) })
}).orElse(null)
})
/**
* Configures the policy weekly retention as documented in the `retention_weekly` block below.
*/
public val retentionWeekly: Output?
get() = javaResource.retentionWeekly().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> policyFileShareRetentionWeeklyToKotlin(args0) })
}).orElse(null)
})
/**
* Configures the policy yearly retention as documented in the `retention_yearly` block below.
*/
public val retentionYearly: Output?
get() = javaResource.retentionYearly().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> policyFileShareRetentionYearlyToKotlin(args0) })
}).orElse(null)
})
/**
* Specifies the timezone. [the possible values are defined here](https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/). Defaults to `UTC`
* > **NOTE:** The maximum number of snapshots that Azure Files can retain is 200. If your combined snapshot count exceeds 200 based on your retention policies, it will result in an error. See [this](https://docs.microsoft.com/azure/backup/backup-azure-files-faq#what-is-the-maximum-retention-i-can-configure-for-backups) article for more information.
*/
public val timezone: Output?
get() = javaResource.timezone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object PolicyFileShareMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.backup.PolicyFileShare::class == javaResource::class
override fun map(javaResource: Resource): PolicyFileShare = PolicyFileShare(
javaResource as
com.pulumi.azure.backup.PolicyFileShare,
)
}
/**
* @see [PolicyFileShare].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [PolicyFileShare].
*/
public suspend fun policyFileShare(
name: String,
block: suspend PolicyFileShareResourceBuilder.() -> Unit,
): PolicyFileShare {
val builder = PolicyFileShareResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [PolicyFileShare].
* @param name The _unique_ name of the resulting resource.
*/
public fun policyFileShare(name: String): PolicyFileShare {
val builder = PolicyFileShareResourceBuilder()
builder.name(name)
return builder.build()
}