com.pulumi.azure.netapp.kotlin.SnapshotPolicy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.netapp.kotlin
import com.pulumi.azure.netapp.kotlin.outputs.SnapshotPolicyDailySchedule
import com.pulumi.azure.netapp.kotlin.outputs.SnapshotPolicyHourlySchedule
import com.pulumi.azure.netapp.kotlin.outputs.SnapshotPolicyMonthlySchedule
import com.pulumi.azure.netapp.kotlin.outputs.SnapshotPolicyWeeklySchedule
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.Map
import com.pulumi.azure.netapp.kotlin.outputs.SnapshotPolicyDailySchedule.Companion.toKotlin as snapshotPolicyDailyScheduleToKotlin
import com.pulumi.azure.netapp.kotlin.outputs.SnapshotPolicyHourlySchedule.Companion.toKotlin as snapshotPolicyHourlyScheduleToKotlin
import com.pulumi.azure.netapp.kotlin.outputs.SnapshotPolicyMonthlySchedule.Companion.toKotlin as snapshotPolicyMonthlyScheduleToKotlin
import com.pulumi.azure.netapp.kotlin.outputs.SnapshotPolicyWeeklySchedule.Companion.toKotlin as snapshotPolicyWeeklyScheduleToKotlin
/**
* Builder for [SnapshotPolicy].
*/
@PulumiTagMarker
public class SnapshotPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: SnapshotPolicyArgs = SnapshotPolicyArgs()
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 SnapshotPolicyArgsBuilder.() -> Unit) {
val builder = SnapshotPolicyArgsBuilder()
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(): SnapshotPolicy {
val builtJavaResource = com.pulumi.azure.netapp.SnapshotPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return SnapshotPolicy(builtJavaResource)
}
}
/**
* Manages a NetApp Snapshot Policy.
* ## NetApp Snapshot Policy Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "resource-group-01",
* location: "East US",
* });
* const exampleAccount = new azure.netapp.Account("example", {
* name: "netappaccount-01",
* location: example.location,
* resourceGroupName: example.name,
* });
* const exampleSnapshotPolicy = new azure.netapp.SnapshotPolicy("example", {
* name: "snapshotpolicy-01",
* location: example.location,
* resourceGroupName: example.name,
* accountName: exampleAccount.name,
* enabled: true,
* hourlySchedule: {
* snapshotsToKeep: 4,
* minute: 15,
* },
* dailySchedule: {
* snapshotsToKeep: 2,
* hour: 20,
* minute: 15,
* },
* weeklySchedule: {
* snapshotsToKeep: 1,
* daysOfWeeks: [
* "Monday",
* "Friday",
* ],
* hour: 23,
* minute: 0,
* },
* monthlySchedule: {
* snapshotsToKeep: 1,
* daysOfMonths: [
* 1,
* 15,
* 20,
* 30,
* ],
* hour: 5,
* minute: 45,
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="resource-group-01",
* location="East US")
* example_account = azure.netapp.Account("example",
* name="netappaccount-01",
* location=example.location,
* resource_group_name=example.name)
* example_snapshot_policy = azure.netapp.SnapshotPolicy("example",
* name="snapshotpolicy-01",
* location=example.location,
* resource_group_name=example.name,
* account_name=example_account.name,
* enabled=True,
* hourly_schedule=azure.netapp.SnapshotPolicyHourlyScheduleArgs(
* snapshots_to_keep=4,
* minute=15,
* ),
* daily_schedule=azure.netapp.SnapshotPolicyDailyScheduleArgs(
* snapshots_to_keep=2,
* hour=20,
* minute=15,
* ),
* weekly_schedule=azure.netapp.SnapshotPolicyWeeklyScheduleArgs(
* snapshots_to_keep=1,
* days_of_weeks=[
* "Monday",
* "Friday",
* ],
* hour=23,
* minute=0,
* ),
* monthly_schedule=azure.netapp.SnapshotPolicyMonthlyScheduleArgs(
* snapshots_to_keep=1,
* days_of_months=[
* 1,
* 15,
* 20,
* 30,
* ],
* hour=5,
* minute=45,
* ))
* ```
* ```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 = "resource-group-01",
* Location = "East US",
* });
* var exampleAccount = new Azure.NetApp.Account("example", new()
* {
* Name = "netappaccount-01",
* Location = example.Location,
* ResourceGroupName = example.Name,
* });
* var exampleSnapshotPolicy = new Azure.NetApp.SnapshotPolicy("example", new()
* {
* Name = "snapshotpolicy-01",
* Location = example.Location,
* ResourceGroupName = example.Name,
* AccountName = exampleAccount.Name,
* Enabled = true,
* HourlySchedule = new Azure.NetApp.Inputs.SnapshotPolicyHourlyScheduleArgs
* {
* SnapshotsToKeep = 4,
* Minute = 15,
* },
* DailySchedule = new Azure.NetApp.Inputs.SnapshotPolicyDailyScheduleArgs
* {
* SnapshotsToKeep = 2,
* Hour = 20,
* Minute = 15,
* },
* WeeklySchedule = new Azure.NetApp.Inputs.SnapshotPolicyWeeklyScheduleArgs
* {
* SnapshotsToKeep = 1,
* DaysOfWeeks = new[]
* {
* "Monday",
* "Friday",
* },
* Hour = 23,
* Minute = 0,
* },
* MonthlySchedule = new Azure.NetApp.Inputs.SnapshotPolicyMonthlyScheduleArgs
* {
* SnapshotsToKeep = 1,
* DaysOfMonths = new[]
* {
* 1,
* 15,
* 20,
* 30,
* },
* Hour = 5,
* Minute = 45,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/netapp"
* "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("resource-group-01"),
* Location: pulumi.String("East US"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := netapp.NewAccount(ctx, "example", &netapp.AccountArgs{
* Name: pulumi.String("netappaccount-01"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* })
* if err != nil {
* return err
* }
* _, err = netapp.NewSnapshotPolicy(ctx, "example", &netapp.SnapshotPolicyArgs{
* Name: pulumi.String("snapshotpolicy-01"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* AccountName: exampleAccount.Name,
* Enabled: pulumi.Bool(true),
* HourlySchedule: &netapp.SnapshotPolicyHourlyScheduleArgs{
* SnapshotsToKeep: pulumi.Int(4),
* Minute: pulumi.Int(15),
* },
* DailySchedule: &netapp.SnapshotPolicyDailyScheduleArgs{
* SnapshotsToKeep: pulumi.Int(2),
* Hour: pulumi.Int(20),
* Minute: pulumi.Int(15),
* },
* WeeklySchedule: &netapp.SnapshotPolicyWeeklyScheduleArgs{
* SnapshotsToKeep: pulumi.Int(1),
* DaysOfWeeks: pulumi.StringArray{
* pulumi.String("Monday"),
* pulumi.String("Friday"),
* },
* Hour: pulumi.Int(23),
* Minute: pulumi.Int(0),
* },
* MonthlySchedule: &netapp.SnapshotPolicyMonthlyScheduleArgs{
* SnapshotsToKeep: pulumi.Int(1),
* DaysOfMonths: pulumi.IntArray{
* pulumi.Int(1),
* pulumi.Int(15),
* pulumi.Int(20),
* pulumi.Int(30),
* },
* Hour: pulumi.Int(5),
* Minute: pulumi.Int(45),
* },
* })
* 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.netapp.Account;
* import com.pulumi.azure.netapp.AccountArgs;
* import com.pulumi.azure.netapp.SnapshotPolicy;
* import com.pulumi.azure.netapp.SnapshotPolicyArgs;
* import com.pulumi.azure.netapp.inputs.SnapshotPolicyHourlyScheduleArgs;
* import com.pulumi.azure.netapp.inputs.SnapshotPolicyDailyScheduleArgs;
* import com.pulumi.azure.netapp.inputs.SnapshotPolicyWeeklyScheduleArgs;
* import com.pulumi.azure.netapp.inputs.SnapshotPolicyMonthlyScheduleArgs;
* 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("resource-group-01")
* .location("East US")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("netappaccount-01")
* .location(example.location())
* .resourceGroupName(example.name())
* .build());
* var exampleSnapshotPolicy = new SnapshotPolicy("exampleSnapshotPolicy", SnapshotPolicyArgs.builder()
* .name("snapshotpolicy-01")
* .location(example.location())
* .resourceGroupName(example.name())
* .accountName(exampleAccount.name())
* .enabled(true)
* .hourlySchedule(SnapshotPolicyHourlyScheduleArgs.builder()
* .snapshotsToKeep(4)
* .minute(15)
* .build())
* .dailySchedule(SnapshotPolicyDailyScheduleArgs.builder()
* .snapshotsToKeep(2)
* .hour(20)
* .minute(15)
* .build())
* .weeklySchedule(SnapshotPolicyWeeklyScheduleArgs.builder()
* .snapshotsToKeep(1)
* .daysOfWeeks(
* "Monday",
* "Friday")
* .hour(23)
* .minute(0)
* .build())
* .monthlySchedule(SnapshotPolicyMonthlyScheduleArgs.builder()
* .snapshotsToKeep(1)
* .daysOfMonths(
* 1,
* 15,
* 20,
* 30)
* .hour(5)
* .minute(45)
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: resource-group-01
* location: East US
* exampleAccount:
* type: azure:netapp:Account
* name: example
* properties:
* name: netappaccount-01
* location: ${example.location}
* resourceGroupName: ${example.name}
* exampleSnapshotPolicy:
* type: azure:netapp:SnapshotPolicy
* name: example
* properties:
* name: snapshotpolicy-01
* location: ${example.location}
* resourceGroupName: ${example.name}
* accountName: ${exampleAccount.name}
* enabled: true
* hourlySchedule:
* snapshotsToKeep: 4
* minute: 15
* dailySchedule:
* snapshotsToKeep: 2
* hour: 20
* minute: 15
* weeklySchedule:
* snapshotsToKeep: 1
* daysOfWeeks:
* - Monday
* - Friday
* hour: 23
* minute: 0
* monthlySchedule:
* snapshotsToKeep: 1
* daysOfMonths:
* - 1
* - 15
* - 20
* - 30
* hour: 5
* minute: 45
* ```
*
* ## Import
* NetApp Snapshot Policy can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:netapp/snapshotPolicy:SnapshotPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/snapshotpolicy1
* ```
*/
public class SnapshotPolicy internal constructor(
override val javaResource: com.pulumi.azure.netapp.SnapshotPolicy,
) : KotlinCustomResource(javaResource, SnapshotPolicyMapper) {
/**
* The name of the NetApp Account in which the NetApp Snapshot Policy should be created. Changing this forces a new resource to be created.
*/
public val accountName: Output
get() = javaResource.accountName().applyValue({ args0 -> args0 })
/**
* Sets a daily snapshot schedule. A `daily_schedule` block as defined below.
*/
public val dailySchedule: Output
get() = javaResource.dailySchedule().applyValue({ args0 ->
args0.let({ args0 ->
snapshotPolicyDailyScheduleToKotlin(args0)
})
})
/**
* Defines that the NetApp Snapshot Policy is enabled or not.
*/
public val enabled: Output
get() = javaResource.enabled().applyValue({ args0 -> args0 })
/**
* Sets an hourly snapshot schedule. A `hourly_schedule` block as defined below.
*/
public val hourlySchedule: Output
get() = javaResource.hourlySchedule().applyValue({ args0 ->
args0.let({ args0 ->
snapshotPolicyHourlyScheduleToKotlin(args0)
})
})
/**
* Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* Sets a monthly snapshot schedule. A `monthly_schedule` block as defined below.
*/
public val monthlySchedule: Output
get() = javaResource.monthlySchedule().applyValue({ args0 ->
args0.let({ args0 ->
snapshotPolicyMonthlyScheduleToKotlin(args0)
})
})
/**
* The name of the NetApp Snapshot Policy. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The name of the resource group where the NetApp Snapshot Policy should be created. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* A mapping of tags to assign to the resource.
*/
public val tags: Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy