Protection Policy Args
data class ProtectionPolicyArgs(val eTag: Output<String>? = null, val location: Output<String>? = null, val policyName: Output<String>? = null, val properties: Output<Any>? = null, val resourceGroupName: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val vaultName: Output<String>? = null) : ConvertibleToJava<ProtectionPolicyArgs>
Base class for backup policy. Workload-specific backup policies are derived from this class. API Version: 2021-02-01.
Example Usage
Create or Update Full Azure Vm Protection Policy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var protectionPolicy = new AzureNative.RecoveryServices.ProtectionPolicy("protectionPolicy", new()
{
PolicyName = "testPolicy1",
Properties = new AzureNative.RecoveryServices.Inputs.AzureIaaSVMProtectionPolicyArgs
{
BackupManagementType = "AzureIaasVM",
RetentionPolicy = new AzureNative.RecoveryServices.Inputs.LongTermRetentionPolicyArgs
{
MonthlySchedule = new AzureNative.RecoveryServices.Inputs.MonthlyRetentionScheduleArgs
{
RetentionDuration = new AzureNative.RecoveryServices.Inputs.RetentionDurationArgs
{
Count = 2,
DurationType = "Months",
},
RetentionScheduleFormatType = "Weekly",
RetentionScheduleWeekly = new AzureNative.RecoveryServices.Inputs.WeeklyRetentionFormatArgs
{
DaysOfTheWeek = new[]
{
AzureNative.RecoveryServices.DayOfWeek.Wednesday,
AzureNative.RecoveryServices.DayOfWeek.Thursday,
},
WeeksOfTheMonth = new[]
{
AzureNative.RecoveryServices.WeekOfMonth.First,
AzureNative.RecoveryServices.WeekOfMonth.Third,
},
},
RetentionTimes = new[]
{
"2018-01-24T10:00:00Z",
},
},
RetentionPolicyType = "LongTermRetentionPolicy",
WeeklySchedule = new AzureNative.RecoveryServices.Inputs.WeeklyRetentionScheduleArgs
{
DaysOfTheWeek = new[]
{
AzureNative.RecoveryServices.DayOfWeek.Monday,
AzureNative.RecoveryServices.DayOfWeek.Wednesday,
AzureNative.RecoveryServices.DayOfWeek.Thursday,
},
RetentionDuration = new AzureNative.RecoveryServices.Inputs.RetentionDurationArgs
{
Count = 1,
DurationType = "Weeks",
},
RetentionTimes = new[]
{
"2018-01-24T10:00:00Z",
},
},
YearlySchedule = new AzureNative.RecoveryServices.Inputs.YearlyRetentionScheduleArgs
{
MonthsOfYear = new[]
{
AzureNative.RecoveryServices.MonthOfYear.February,
AzureNative.RecoveryServices.MonthOfYear.November,
},
RetentionDuration = new AzureNative.RecoveryServices.Inputs.RetentionDurationArgs
{
Count = 4,
DurationType = "Years",
},
RetentionScheduleFormatType = "Weekly",
RetentionScheduleWeekly = new AzureNative.RecoveryServices.Inputs.WeeklyRetentionFormatArgs
{
DaysOfTheWeek = new[]
{
AzureNative.RecoveryServices.DayOfWeek.Monday,
AzureNative.RecoveryServices.DayOfWeek.Thursday,
},
WeeksOfTheMonth = new[]
{
AzureNative.RecoveryServices.WeekOfMonth.Fourth,
},
},
RetentionTimes = new[]
{
"2018-01-24T10:00:00Z",
},
},
},
SchedulePolicy = new AzureNative.RecoveryServices.Inputs.SimpleSchedulePolicyArgs
{
SchedulePolicyType = "SimpleSchedulePolicy",
ScheduleRunDays = new[]
{
AzureNative.RecoveryServices.DayOfWeek.Monday,
AzureNative.RecoveryServices.DayOfWeek.Wednesday,
AzureNative.RecoveryServices.DayOfWeek.Thursday,
},
ScheduleRunFrequency = "Weekly",
ScheduleRunTimes = new[]
{
"2018-01-24T10:00:00Z",
},
},
TimeZone = "Pacific Standard Time",
},
ResourceGroupName = "SwaggerTestRg",
VaultName = "NetSDKTestRsVault",
});
});
Content copied to clipboard
package main
import (
recoveryservices "github.com/pulumi/pulumi-azure-native-sdk/recoveryservices"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := recoveryservices.NewProtectionPolicy(ctx, "protectionPolicy", &recoveryservices.ProtectionPolicyArgs{
PolicyName: pulumi.String("testPolicy1"),
Properties: recoveryservices.AzureIaaSVMProtectionPolicy{
BackupManagementType: "AzureIaasVM",
RetentionPolicy: recoveryservices.LongTermRetentionPolicy{
MonthlySchedule: recoveryservices.MonthlyRetentionSchedule{
RetentionDuration: recoveryservices.RetentionDuration{
Count: 2,
DurationType: "Months",
},
RetentionScheduleFormatType: "Weekly",
RetentionScheduleWeekly: recoveryservices.WeeklyRetentionFormat{
DaysOfTheWeek: []recoveryservices.DayOfWeek{
recoveryservices.DayOfWeekWednesday,
recoveryservices.DayOfWeekThursday,
},
WeeksOfTheMonth: []recoveryservices.WeekOfMonth{
recoveryservices.WeekOfMonthFirst,
recoveryservices.WeekOfMonthThird,
},
},
RetentionTimes: []string{
"2018-01-24T10:00:00Z",
},
},
RetentionPolicyType: "LongTermRetentionPolicy",
WeeklySchedule: recoveryservices.WeeklyRetentionSchedule{
DaysOfTheWeek: []recoveryservices.DayOfWeek{
recoveryservices.DayOfWeekMonday,
recoveryservices.DayOfWeekWednesday,
recoveryservices.DayOfWeekThursday,
},
RetentionDuration: recoveryservices.RetentionDuration{
Count: 1,
DurationType: "Weeks",
},
RetentionTimes: []string{
"2018-01-24T10:00:00Z",
},
},
YearlySchedule: recoveryservices.YearlyRetentionSchedule{
MonthsOfYear: []recoveryservices.MonthOfYear{
recoveryservices.MonthOfYearFebruary,
recoveryservices.MonthOfYearNovember,
},
RetentionDuration: recoveryservices.RetentionDuration{
Count: 4,
DurationType: "Years",
},
RetentionScheduleFormatType: "Weekly",
RetentionScheduleWeekly: recoveryservices.WeeklyRetentionFormat{
DaysOfTheWeek: []recoveryservices.DayOfWeek{
recoveryservices.DayOfWeekMonday,
recoveryservices.DayOfWeekThursday,
},
WeeksOfTheMonth: []recoveryservices.WeekOfMonth{
recoveryservices.WeekOfMonthFourth,
},
},
RetentionTimes: []string{
"2018-01-24T10:00:00Z",
},
},
},
SchedulePolicy: recoveryservices.SimpleSchedulePolicy{
SchedulePolicyType: "SimpleSchedulePolicy",
ScheduleRunDays: []recoveryservices.DayOfWeek{
recoveryservices.DayOfWeekMonday,
recoveryservices.DayOfWeekWednesday,
recoveryservices.DayOfWeekThursday,
},
ScheduleRunFrequency: "Weekly",
ScheduleRunTimes: []string{
"2018-01-24T10:00:00Z",
},
},
TimeZone: "Pacific Standard Time",
},
ResourceGroupName: pulumi.String("SwaggerTestRg"),
VaultName: pulumi.String("NetSDKTestRsVault"),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.recoveryservices.ProtectionPolicy;
import com.pulumi.azurenative.recoveryservices.ProtectionPolicyArgs;
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 protectionPolicy = new ProtectionPolicy("protectionPolicy", ProtectionPolicyArgs.builder()
.policyName("testPolicy1")
.properties(Map.ofEntries(
Map.entry("backupManagementType", "AzureIaasVM"),
Map.entry("retentionPolicy", Map.ofEntries(
Map.entry("monthlySchedule", Map.ofEntries(
Map.entry("retentionDuration", Map.ofEntries(
Map.entry("count", 2),
Map.entry("durationType", "Months")
)),
Map.entry("retentionScheduleFormatType", "Weekly"),
Map.entry("retentionScheduleWeekly", Map.ofEntries(
Map.entry("daysOfTheWeek",
"Wednesday",
"Thursday"),
Map.entry("weeksOfTheMonth",
"First",
"Third")
)),
Map.entry("retentionTimes", "2018-01-24T10:00:00Z")
)),
Map.entry("retentionPolicyType", "LongTermRetentionPolicy"),
Map.entry("weeklySchedule", Map.ofEntries(
Map.entry("daysOfTheWeek",
"Monday",
"Wednesday",
"Thursday"),
Map.entry("retentionDuration", Map.ofEntries(
Map.entry("count", 1),
Map.entry("durationType", "Weeks")
)),
Map.entry("retentionTimes", "2018-01-24T10:00:00Z")
)),
Map.entry("yearlySchedule", Map.ofEntries(
Map.entry("monthsOfYear",
"February",
"November"),
Map.entry("retentionDuration", Map.ofEntries(
Map.entry("count", 4),
Map.entry("durationType", "Years")
)),
Map.entry("retentionScheduleFormatType", "Weekly"),
Map.entry("retentionScheduleWeekly", Map.ofEntries(
Map.entry("daysOfTheWeek",
"Monday",
"Thursday"),
Map.entry("weeksOfTheMonth", "Fourth")
)),
Map.entry("retentionTimes", "2018-01-24T10:00:00Z")
))
)),
Map.entry("schedulePolicy", Map.ofEntries(
Map.entry("schedulePolicyType", "SimpleSchedulePolicy"),
Map.entry("scheduleRunDays",
"Monday",
"Wednesday",
"Thursday"),
Map.entry("scheduleRunFrequency", "Weekly"),
Map.entry("scheduleRunTimes", "2018-01-24T10:00:00Z")
)),
Map.entry("timeZone", "Pacific Standard Time")
))
.resourceGroupName("SwaggerTestRg")
.vaultName("NetSDKTestRsVault")
.build());
}
}
Content copied to clipboard
Create or Update Full Azure Workload Protection Policy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var protectionPolicy = new AzureNative.RecoveryServices.ProtectionPolicy("protectionPolicy", new()
{
PolicyName = "testPolicy1",
Properties = new AzureNative.RecoveryServices.Inputs.AzureVmWorkloadProtectionPolicyArgs
{
BackupManagementType = "AzureWorkload",
Settings = new AzureNative.RecoveryServices.Inputs.SettingsArgs
{
Issqlcompression = false,
TimeZone = "Pacific Standard Time",
},
SubProtectionPolicy = new[]
{
new AzureNative.RecoveryServices.Inputs.SubProtectionPolicyArgs
{
PolicyType = "Full",
RetentionPolicy = new AzureNative.RecoveryServices.Inputs.LongTermRetentionPolicyArgs
{
MonthlySchedule = new AzureNative.RecoveryServices.Inputs.MonthlyRetentionScheduleArgs
{
RetentionDuration = new AzureNative.RecoveryServices.Inputs.RetentionDurationArgs
{
Count = 1,
DurationType = "Months",
},
RetentionScheduleFormatType = "Weekly",
RetentionScheduleWeekly = new AzureNative.RecoveryServices.Inputs.WeeklyRetentionFormatArgs
{
DaysOfTheWeek = new[]
{
AzureNative.RecoveryServices.DayOfWeek.Sunday,
},
WeeksOfTheMonth = new[]
{
AzureNative.RecoveryServices.WeekOfMonth.Second,
},
},
RetentionTimes = new[]
{
"2018-01-24T10:00:00Z",
},
},
RetentionPolicyType = "LongTermRetentionPolicy",
WeeklySchedule = new AzureNative.RecoveryServices.Inputs.WeeklyRetentionScheduleArgs
{
DaysOfTheWeek = new[]
{
AzureNative.RecoveryServices.DayOfWeek.Sunday,
AzureNative.RecoveryServices.DayOfWeek.Tuesday,
},
RetentionDuration = new AzureNative.RecoveryServices.Inputs.RetentionDurationArgs
{
Count = 2,
DurationType = "Weeks",
},
RetentionTimes = new[]
{
"2018-01-24T10:00:00Z",
},
},
YearlySchedule = new AzureNative.RecoveryServices.Inputs.YearlyRetentionScheduleArgs
{
MonthsOfYear = new[]
{
AzureNative.RecoveryServices.MonthOfYear.January,
AzureNative.RecoveryServices.MonthOfYear.June,
AzureNative.RecoveryServices.MonthOfYear.December,
},
RetentionDuration = new AzureNative.RecoveryServices.Inputs.RetentionDurationArgs
{
Count = 1,
DurationType = "Years",
},
RetentionScheduleFormatType = "Weekly",
RetentionScheduleWeekly = new AzureNative.RecoveryServices.Inputs.WeeklyRetentionFormatArgs
{
DaysOfTheWeek = new[]
{
AzureNative.RecoveryServices.DayOfWeek.Sunday,
},
WeeksOfTheMonth = new[]
{
AzureNative.RecoveryServices.WeekOfMonth.Last,
},
},
RetentionTimes = new[]
{
"2018-01-24T10:00:00Z",
},
},
},
SchedulePolicy = new AzureNative.RecoveryServices.Inputs.SimpleSchedulePolicyArgs
{
SchedulePolicyType = "SimpleSchedulePolicy",
ScheduleRunDays = new[]
{
AzureNative.RecoveryServices.DayOfWeek.Sunday,
AzureNative.RecoveryServices.DayOfWeek.Tuesday,
},
ScheduleRunFrequency = "Weekly",
ScheduleRunTimes = new[]
{
"2018-01-24T10:00:00Z",
},
},
},
new AzureNative.RecoveryServices.Inputs.SubProtectionPolicyArgs
{
PolicyType = "Differential",
RetentionPolicy = new AzureNative.RecoveryServices.Inputs.SimpleRetentionPolicyArgs
{
RetentionDuration = new AzureNative.RecoveryServices.Inputs.RetentionDurationArgs
{
Count = 8,
DurationType = "Days",
},
RetentionPolicyType = "SimpleRetentionPolicy",
},
SchedulePolicy = new AzureNative.RecoveryServices.Inputs.SimpleSchedulePolicyArgs
{
SchedulePolicyType = "SimpleSchedulePolicy",
ScheduleRunDays = new[]
{
AzureNative.RecoveryServices.DayOfWeek.Friday,
},
ScheduleRunFrequency = "Weekly",
ScheduleRunTimes = new[]
{
"2018-01-24T10:00:00Z",
},
},
},
new AzureNative.RecoveryServices.Inputs.SubProtectionPolicyArgs
{
PolicyType = "Log",
RetentionPolicy = new AzureNative.RecoveryServices.Inputs.SimpleRetentionPolicyArgs
{
RetentionDuration = new AzureNative.RecoveryServices.Inputs.RetentionDurationArgs
{
Count = 7,
DurationType = "Days",
},
RetentionPolicyType = "SimpleRetentionPolicy",
},
SchedulePolicy = new AzureNative.RecoveryServices.Inputs.LogSchedulePolicyArgs
{
ScheduleFrequencyInMins = 60,
SchedulePolicyType = "LogSchedulePolicy",
},
},
},
WorkLoadType = "SQLDataBase",
},
ResourceGroupName = "SwaggerTestRg",
VaultName = "NetSDKTestRsVault",
});
});
Content copied to clipboard
package main
import (
recoveryservices "github.com/pulumi/pulumi-azure-native-sdk/recoveryservices"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := recoveryservices.NewProtectionPolicy(ctx, "protectionPolicy", &recoveryservices.ProtectionPolicyArgs{
PolicyName: pulumi.String("testPolicy1"),
Properties: recoveryservices.AzureVmWorkloadProtectionPolicy{
BackupManagementType: "AzureWorkload",
Settings: recoveryservices.Settings{
Issqlcompression: false,
TimeZone: "Pacific Standard Time",
},
SubProtectionPolicy: []recoveryservices.SubProtectionPolicy{
{
PolicyType: "Full",
RetentionPolicy: {
MonthlySchedule: {
RetentionDuration: {
Count: 1,
DurationType: "Months",
},
RetentionScheduleFormatType: "Weekly",
RetentionScheduleWeekly: {
DaysOfTheWeek: []recoveryservices.DayOfWeek{
recoveryservices.DayOfWeekSunday,
},
WeeksOfTheMonth: []recoveryservices.WeekOfMonth{
recoveryservices.WeekOfMonthSecond,
},
},
RetentionTimes: []string{
"2018-01-24T10:00:00Z",
},
},
RetentionPolicyType: "LongTermRetentionPolicy",
WeeklySchedule: {
DaysOfTheWeek: []recoveryservices.DayOfWeek{
recoveryservices.DayOfWeekSunday,
recoveryservices.DayOfWeekTuesday,
},
RetentionDuration: {
Count: 2,
DurationType: "Weeks",
},
RetentionTimes: []string{
"2018-01-24T10:00:00Z",
},
},
YearlySchedule: {
MonthsOfYear: []recoveryservices.MonthOfYear{
recoveryservices.MonthOfYearJanuary,
recoveryservices.MonthOfYearJune,
recoveryservices.MonthOfYearDecember,
},
RetentionDuration: {
Count: 1,
DurationType: "Years",
},
RetentionScheduleFormatType: "Weekly",
RetentionScheduleWeekly: {
DaysOfTheWeek: []recoveryservices.DayOfWeek{
recoveryservices.DayOfWeekSunday,
},
WeeksOfTheMonth: []recoveryservices.WeekOfMonth{
recoveryservices.WeekOfMonthLast,
},
},
RetentionTimes: []string{
"2018-01-24T10:00:00Z",
},
},
},
SchedulePolicy: {
SchedulePolicyType: "SimpleSchedulePolicy",
ScheduleRunDays: []recoveryservices.DayOfWeek{
recoveryservices.DayOfWeekSunday,
recoveryservices.DayOfWeekTuesday,
},
ScheduleRunFrequency: "Weekly",
ScheduleRunTimes: []string{
"2018-01-24T10:00:00Z",
},
},
},
{
PolicyType: "Differential",
RetentionPolicy: {
RetentionDuration: {
Count: 8,
DurationType: "Days",
},
RetentionPolicyType: "SimpleRetentionPolicy",
},
SchedulePolicy: {
SchedulePolicyType: "SimpleSchedulePolicy",
ScheduleRunDays: []recoveryservices.DayOfWeek{
recoveryservices.DayOfWeekFriday,
},
ScheduleRunFrequency: "Weekly",
ScheduleRunTimes: []string{
"2018-01-24T10:00:00Z",
},
},
},
{
PolicyType: "Log",
RetentionPolicy: {
RetentionDuration: {
Count: 7,
DurationType: "Days",
},
RetentionPolicyType: "SimpleRetentionPolicy",
},
SchedulePolicy: {
ScheduleFrequencyInMins: 60,
SchedulePolicyType: "LogSchedulePolicy",
},
},
},
WorkLoadType: "SQLDataBase",
},
ResourceGroupName: pulumi.String("SwaggerTestRg"),
VaultName: pulumi.String("NetSDKTestRsVault"),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.recoveryservices.ProtectionPolicy;
import com.pulumi.azurenative.recoveryservices.ProtectionPolicyArgs;
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 protectionPolicy = new ProtectionPolicy("protectionPolicy", ProtectionPolicyArgs.builder()
.policyName("testPolicy1")
.properties(Map.ofEntries(
Map.entry("backupManagementType", "AzureWorkload"),
Map.entry("settings", Map.ofEntries(
Map.entry("issqlcompression", false),
Map.entry("timeZone", "Pacific Standard Time")
)),
Map.entry("subProtectionPolicy",
Map.ofEntries(
Map.entry("policyType", "Full"),
Map.entry("retentionPolicy", Map.ofEntries(
Map.entry("monthlySchedule", Map.ofEntries(
Map.entry("retentionDuration", Map.ofEntries(
Map.entry("count", 1),
Map.entry("durationType", "Months")
)),
Map.entry("retentionScheduleFormatType", "Weekly"),
Map.entry("retentionScheduleWeekly", Map.ofEntries(
Map.entry("daysOfTheWeek", "Sunday"),
Map.entry("weeksOfTheMonth", "Second")
)),
Map.entry("retentionTimes", "2018-01-24T10:00:00Z")
)),
Map.entry("retentionPolicyType", "LongTermRetentionPolicy"),
Map.entry("weeklySchedule", Map.ofEntries(
Map.entry("daysOfTheWeek",
"Sunday",
"Tuesday"),
Map.entry("retentionDuration", Map.ofEntries(
Map.entry("count", 2),
Map.entry("durationType", "Weeks")
)),
Map.entry("retentionTimes", "2018-01-24T10:00:00Z")
)),
Map.entry("yearlySchedule", Map.ofEntries(
Map.entry("monthsOfYear",
"January",
"June",
"December"),
Map.entry("retentionDuration", Map.ofEntries(
Map.entry("count", 1),
Map.entry("durationType", "Years")
)),
Map.entry("retentionScheduleFormatType", "Weekly"),
Map.entry("retentionScheduleWeekly", Map.ofEntries(
Map.entry("daysOfTheWeek", "Sunday"),
Map.entry("weeksOfTheMonth", "Last")
)),
Map.entry("retentionTimes", "2018-01-24T10:00:00Z")
))
)),
Map.entry("schedulePolicy", Map.ofEntries(
Map.entry("schedulePolicyType", "SimpleSchedulePolicy"),
Map.entry("scheduleRunDays",
"Sunday",
"Tuesday"),
Map.entry("scheduleRunFrequency", "Weekly"),
Map.entry("scheduleRunTimes", "2018-01-24T10:00:00Z")
))
),
Map.ofEntries(
Map.entry("policyType", "Differential"),
Map.entry("retentionPolicy", Map.ofEntries(
Map.entry("retentionDuration", Map.ofEntries(
Map.entry("count", 8),
Map.entry("durationType", "Days")
)),
Map.entry("retentionPolicyType", "SimpleRetentionPolicy")
)),
Map.entry("schedulePolicy", Map.ofEntries(
Map.entry("schedulePolicyType", "SimpleSchedulePolicy"),
Map.entry("scheduleRunDays", "Friday"),
Map.entry("scheduleRunFrequency", "Weekly"),
Map.entry("scheduleRunTimes", "2018-01-24T10:00:00Z")
))
),
Map.ofEntries(
Map.entry("policyType", "Log"),
Map.entry("retentionPolicy", Map.ofEntries(
Map.entry("retentionDuration", Map.ofEntries(
Map.entry("count", 7),
Map.entry("durationType", "Days")
)),
Map.entry("retentionPolicyType", "SimpleRetentionPolicy")
)),
Map.entry("schedulePolicy", Map.ofEntries(
Map.entry("scheduleFrequencyInMins", 60),
Map.entry("schedulePolicyType", "LogSchedulePolicy")
))
)),
Map.entry("workLoadType", "SQLDataBase")
))
.resourceGroupName("SwaggerTestRg")
.vaultName("NetSDKTestRsVault")
.build());
}
}
Content copied to clipboard
Create or Update Simple Azure Vm Protection Policy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var protectionPolicy = new AzureNative.RecoveryServices.ProtectionPolicy("protectionPolicy", new()
{
PolicyName = "testPolicy1",
Properties = new AzureNative.RecoveryServices.Inputs.AzureIaaSVMProtectionPolicyArgs
{
BackupManagementType = "AzureIaasVM",
RetentionPolicy = new AzureNative.RecoveryServices.Inputs.LongTermRetentionPolicyArgs
{
DailySchedule = new AzureNative.RecoveryServices.Inputs.DailyRetentionScheduleArgs
{
RetentionDuration = new AzureNative.RecoveryServices.Inputs.RetentionDurationArgs
{
Count = 1,
DurationType = "Days",
},
RetentionTimes = new[]
{
"2018-01-24T02:00:00Z",
},
},
RetentionPolicyType = "LongTermRetentionPolicy",
},
SchedulePolicy = new AzureNative.RecoveryServices.Inputs.SimpleSchedulePolicyArgs
{
SchedulePolicyType = "SimpleSchedulePolicy",
ScheduleRunFrequency = "Daily",
ScheduleRunTimes = new[]
{
"2018-01-24T02:00:00Z",
},
},
TimeZone = "Pacific Standard Time",
},
ResourceGroupName = "SwaggerTestRg",
VaultName = "NetSDKTestRsVault",
});
});
Content copied to clipboard
package main
import (
recoveryservices "github.com/pulumi/pulumi-azure-native-sdk/recoveryservices"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := recoveryservices.NewProtectionPolicy(ctx, "protectionPolicy", &recoveryservices.ProtectionPolicyArgs{
PolicyName: pulumi.String("testPolicy1"),
Properties: recoveryservices.AzureIaaSVMProtectionPolicy{
BackupManagementType: "AzureIaasVM",
RetentionPolicy: recoveryservices.LongTermRetentionPolicy{
DailySchedule: recoveryservices.DailyRetentionSchedule{
RetentionDuration: recoveryservices.RetentionDuration{
Count: 1,
DurationType: "Days",
},
RetentionTimes: []string{
"2018-01-24T02:00:00Z",
},
},
RetentionPolicyType: "LongTermRetentionPolicy",
},
SchedulePolicy: recoveryservices.SimpleSchedulePolicy{
SchedulePolicyType: "SimpleSchedulePolicy",
ScheduleRunFrequency: "Daily",
ScheduleRunTimes: []string{
"2018-01-24T02:00:00Z",
},
},
TimeZone: "Pacific Standard Time",
},
ResourceGroupName: pulumi.String("SwaggerTestRg"),
VaultName: pulumi.String("NetSDKTestRsVault"),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.recoveryservices.ProtectionPolicy;
import com.pulumi.azurenative.recoveryservices.ProtectionPolicyArgs;
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 protectionPolicy = new ProtectionPolicy("protectionPolicy", ProtectionPolicyArgs.builder()
.policyName("testPolicy1")
.properties(Map.ofEntries(
Map.entry("backupManagementType", "AzureIaasVM"),
Map.entry("retentionPolicy", Map.ofEntries(
Map.entry("dailySchedule", Map.ofEntries(
Map.entry("retentionDuration", Map.ofEntries(
Map.entry("count", 1),
Map.entry("durationType", "Days")
)),
Map.entry("retentionTimes", "2018-01-24T02:00:00Z")
)),
Map.entry("retentionPolicyType", "LongTermRetentionPolicy")
)),
Map.entry("schedulePolicy", Map.ofEntries(
Map.entry("schedulePolicyType", "SimpleSchedulePolicy"),
Map.entry("scheduleRunFrequency", "Daily"),
Map.entry("scheduleRunTimes", "2018-01-24T02:00:00Z")
)),
Map.entry("timeZone", "Pacific Standard Time")
))
.resourceGroupName("SwaggerTestRg")
.vaultName("NetSDKTestRsVault")
.build());
}
}
Content copied to clipboard
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:recoveryservices:ProtectionPolicy testPolicy1 /Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/testPolicy1
Content copied to clipboard