1. Packages
  2. Azure Native
  3. API Docs
  4. sql
  5. BackupLongTermRetentionPolicy
This is the latest version of Azure Native. Use the Azure Native v1 docs if using the v1 version of this package.
Azure Native v2.9.0 published on Wednesday, Sep 27, 2023 by Pulumi

azure-native.sql.BackupLongTermRetentionPolicy

Explore with Pulumi AI

azure-native logo
This is the latest version of Azure Native. Use the Azure Native v1 docs if using the v1 version of this package.
Azure Native v2.9.0 published on Wednesday, Sep 27, 2023 by Pulumi

    A long term retention policy. Azure REST API version: 2017-03-01-preview.

    Example Usage

    Create or update the long term retention policy for the database.

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureNative = Pulumi.AzureNative;
    
    return await Deployment.RunAsync(() => 
    {
        var backupLongTermRetentionPolicy = new AzureNative.Sql.BackupLongTermRetentionPolicy("backupLongTermRetentionPolicy", new()
        {
            DatabaseName = "testDatabase",
            MonthlyRetention = "P1Y",
            PolicyName = "default",
            ResourceGroupName = "resourceGroup",
            ServerName = "testserver",
            WeekOfYear = 5,
            WeeklyRetention = "P1M",
            YearlyRetention = "P5Y",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure-native-sdk/sql/v2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := sql.NewBackupLongTermRetentionPolicy(ctx, "backupLongTermRetentionPolicy", &sql.BackupLongTermRetentionPolicyArgs{
    			DatabaseName:      pulumi.String("testDatabase"),
    			MonthlyRetention:  pulumi.String("P1Y"),
    			PolicyName:        pulumi.String("default"),
    			ResourceGroupName: pulumi.String("resourceGroup"),
    			ServerName:        pulumi.String("testserver"),
    			WeekOfYear:        pulumi.Int(5),
    			WeeklyRetention:   pulumi.String("P1M"),
    			YearlyRetention:   pulumi.String("P5Y"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azurenative.sql.BackupLongTermRetentionPolicy;
    import com.pulumi.azurenative.sql.BackupLongTermRetentionPolicyArgs;
    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 backupLongTermRetentionPolicy = new BackupLongTermRetentionPolicy("backupLongTermRetentionPolicy", BackupLongTermRetentionPolicyArgs.builder()        
                .databaseName("testDatabase")
                .monthlyRetention("P1Y")
                .policyName("default")
                .resourceGroupName("resourceGroup")
                .serverName("testserver")
                .weekOfYear(5)
                .weeklyRetention("P1M")
                .yearlyRetention("P5Y")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_azure_native as azure_native
    
    backup_long_term_retention_policy = azure_native.sql.BackupLongTermRetentionPolicy("backupLongTermRetentionPolicy",
        database_name="testDatabase",
        monthly_retention="P1Y",
        policy_name="default",
        resource_group_name="resourceGroup",
        server_name="testserver",
        week_of_year=5,
        weekly_retention="P1M",
        yearly_retention="P5Y")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure_native from "@pulumi/azure-native";
    
    const backupLongTermRetentionPolicy = new azure_native.sql.BackupLongTermRetentionPolicy("backupLongTermRetentionPolicy", {
        databaseName: "testDatabase",
        monthlyRetention: "P1Y",
        policyName: "default",
        resourceGroupName: "resourceGroup",
        serverName: "testserver",
        weekOfYear: 5,
        weeklyRetention: "P1M",
        yearlyRetention: "P5Y",
    });
    
    resources:
      backupLongTermRetentionPolicy:
        type: azure-native:sql:BackupLongTermRetentionPolicy
        properties:
          databaseName: testDatabase
          monthlyRetention: P1Y
          policyName: default
          resourceGroupName: resourceGroup
          serverName: testserver
          weekOfYear: 5
          weeklyRetention: P1M
          yearlyRetention: P5Y
    

    Create BackupLongTermRetentionPolicy Resource

    new BackupLongTermRetentionPolicy(name: string, args: BackupLongTermRetentionPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def BackupLongTermRetentionPolicy(resource_name: str,
                                      opts: Optional[ResourceOptions] = None,
                                      database_name: Optional[str] = None,
                                      monthly_retention: Optional[str] = None,
                                      policy_name: Optional[str] = None,
                                      resource_group_name: Optional[str] = None,
                                      server_name: Optional[str] = None,
                                      week_of_year: Optional[int] = None,
                                      weekly_retention: Optional[str] = None,
                                      yearly_retention: Optional[str] = None)
    @overload
    def BackupLongTermRetentionPolicy(resource_name: str,
                                      args: BackupLongTermRetentionPolicyArgs,
                                      opts: Optional[ResourceOptions] = None)
    func NewBackupLongTermRetentionPolicy(ctx *Context, name string, args BackupLongTermRetentionPolicyArgs, opts ...ResourceOption) (*BackupLongTermRetentionPolicy, error)
    public BackupLongTermRetentionPolicy(string name, BackupLongTermRetentionPolicyArgs args, CustomResourceOptions? opts = null)
    public BackupLongTermRetentionPolicy(String name, BackupLongTermRetentionPolicyArgs args)
    public BackupLongTermRetentionPolicy(String name, BackupLongTermRetentionPolicyArgs args, CustomResourceOptions options)
    
    type: azure-native:sql:BackupLongTermRetentionPolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args BackupLongTermRetentionPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args BackupLongTermRetentionPolicyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args BackupLongTermRetentionPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BackupLongTermRetentionPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BackupLongTermRetentionPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    BackupLongTermRetentionPolicy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The BackupLongTermRetentionPolicy resource accepts the following input properties:

    DatabaseName string

    The name of the database.

    ResourceGroupName string

    The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

    ServerName string

    The name of the server.

    MonthlyRetention string

    The monthly retention policy for an LTR backup in an ISO 8601 format.

    PolicyName string

    The policy name. Should always be Default.

    WeekOfYear int

    The week of year to take the yearly backup in an ISO 8601 format.

    WeeklyRetention string

    The weekly retention policy for an LTR backup in an ISO 8601 format.

    YearlyRetention string

    The yearly retention policy for an LTR backup in an ISO 8601 format.

    DatabaseName string

    The name of the database.

    ResourceGroupName string

    The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

    ServerName string

    The name of the server.

    MonthlyRetention string

    The monthly retention policy for an LTR backup in an ISO 8601 format.

    PolicyName string

    The policy name. Should always be Default.

    WeekOfYear int

    The week of year to take the yearly backup in an ISO 8601 format.

    WeeklyRetention string

    The weekly retention policy for an LTR backup in an ISO 8601 format.

    YearlyRetention string

    The yearly retention policy for an LTR backup in an ISO 8601 format.

    databaseName String

    The name of the database.

    resourceGroupName String

    The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

    serverName String

    The name of the server.

    monthlyRetention String

    The monthly retention policy for an LTR backup in an ISO 8601 format.

    policyName String

    The policy name. Should always be Default.

    weekOfYear Integer

    The week of year to take the yearly backup in an ISO 8601 format.

    weeklyRetention String

    The weekly retention policy for an LTR backup in an ISO 8601 format.

    yearlyRetention String

    The yearly retention policy for an LTR backup in an ISO 8601 format.

    databaseName string

    The name of the database.

    resourceGroupName string

    The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

    serverName string

    The name of the server.

    monthlyRetention string

    The monthly retention policy for an LTR backup in an ISO 8601 format.

    policyName string

    The policy name. Should always be Default.

    weekOfYear number

    The week of year to take the yearly backup in an ISO 8601 format.

    weeklyRetention string

    The weekly retention policy for an LTR backup in an ISO 8601 format.

    yearlyRetention string

    The yearly retention policy for an LTR backup in an ISO 8601 format.

    database_name str

    The name of the database.

    resource_group_name str

    The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

    server_name str

    The name of the server.

    monthly_retention str

    The monthly retention policy for an LTR backup in an ISO 8601 format.

    policy_name str

    The policy name. Should always be Default.

    week_of_year int

    The week of year to take the yearly backup in an ISO 8601 format.

    weekly_retention str

    The weekly retention policy for an LTR backup in an ISO 8601 format.

    yearly_retention str

    The yearly retention policy for an LTR backup in an ISO 8601 format.

    databaseName String

    The name of the database.

    resourceGroupName String

    The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.

    serverName String

    The name of the server.

    monthlyRetention String

    The monthly retention policy for an LTR backup in an ISO 8601 format.

    policyName String

    The policy name. Should always be Default.

    weekOfYear Number

    The week of year to take the yearly backup in an ISO 8601 format.

    weeklyRetention String

    The weekly retention policy for an LTR backup in an ISO 8601 format.

    yearlyRetention String

    The yearly retention policy for an LTR backup in an ISO 8601 format.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BackupLongTermRetentionPolicy resource produces the following output properties:

    Id string

    The provider-assigned unique ID for this managed resource.

    Name string

    Resource name.

    Type string

    Resource type.

    Id string

    The provider-assigned unique ID for this managed resource.

    Name string

    Resource name.

    Type string

    Resource type.

    id String

    The provider-assigned unique ID for this managed resource.

    name String

    Resource name.

    type String

    Resource type.

    id string

    The provider-assigned unique ID for this managed resource.

    name string

    Resource name.

    type string

    Resource type.

    id str

    The provider-assigned unique ID for this managed resource.

    name str

    Resource name.

    type str

    Resource type.

    id String

    The provider-assigned unique ID for this managed resource.

    name String

    Resource name.

    type String

    Resource type.

    Import

    An existing resource can be imported using its type token, name, and identifier, e.g.

    $ pulumi import azure-native:sql:BackupLongTermRetentionPolicy default /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName} 
    

    Package Details

    Repository
    Azure Native pulumi/pulumi-azure-native
    License
    Apache-2.0
    azure-native logo
    This is the latest version of Azure Native. Use the Azure Native v1 docs if using the v1 version of this package.
    Azure Native v2.9.0 published on Wednesday, Sep 27, 2023 by Pulumi