azure-native.sql.LongTermRetentionPolicy
Explore with Pulumi AI
A long term retention policy. Azure REST API version: 2021-11-01. Prior API version in Azure Native 1.x: 2020-11-01-preview.
Other available API versions: 2022-11-01-preview, 2023-02-01-preview, 2023-05-01-preview, 2023-08-01-preview, 2024-05-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 longTermRetentionPolicy = new AzureNative.Sql.LongTermRetentionPolicy("longTermRetentionPolicy", new()
{
DatabaseName = "testDatabase",
MonthlyRetention = "P1Y",
PolicyName = "default",
ResourceGroupName = "resourceGroup",
ServerName = "testserver",
WeekOfYear = 5,
WeeklyRetention = "P1M",
YearlyRetention = "P5Y",
});
});
package main
import (
sql "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.NewLongTermRetentionPolicy(ctx, "longTermRetentionPolicy", &sql.LongTermRetentionPolicyArgs{
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.LongTermRetentionPolicy;
import com.pulumi.azurenative.sql.LongTermRetentionPolicyArgs;
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 longTermRetentionPolicy = new LongTermRetentionPolicy("longTermRetentionPolicy", LongTermRetentionPolicyArgs.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
long_term_retention_policy = azure_native.sql.LongTermRetentionPolicy("longTermRetentionPolicy",
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 longTermRetentionPolicy = new azure_native.sql.LongTermRetentionPolicy("longTermRetentionPolicy", {
databaseName: "testDatabase",
monthlyRetention: "P1Y",
policyName: "default",
resourceGroupName: "resourceGroup",
serverName: "testserver",
weekOfYear: 5,
weeklyRetention: "P1M",
yearlyRetention: "P5Y",
});
resources:
longTermRetentionPolicy:
type: azure-native:sql:LongTermRetentionPolicy
properties:
databaseName: testDatabase
monthlyRetention: P1Y
policyName: default
resourceGroupName: resourceGroup
serverName: testserver
weekOfYear: 5
weeklyRetention: P1M
yearlyRetention: P5Y
Create LongTermRetentionPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new LongTermRetentionPolicy(name: string, args: LongTermRetentionPolicyArgs, opts?: CustomResourceOptions);
@overload
def LongTermRetentionPolicy(resource_name: str,
args: LongTermRetentionPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def LongTermRetentionPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
database_name: Optional[str] = None,
resource_group_name: Optional[str] = None,
server_name: Optional[str] = None,
monthly_retention: Optional[str] = None,
policy_name: Optional[str] = None,
week_of_year: Optional[int] = None,
weekly_retention: Optional[str] = None,
yearly_retention: Optional[str] = None)
func NewLongTermRetentionPolicy(ctx *Context, name string, args LongTermRetentionPolicyArgs, opts ...ResourceOption) (*LongTermRetentionPolicy, error)
public LongTermRetentionPolicy(string name, LongTermRetentionPolicyArgs args, CustomResourceOptions? opts = null)
public LongTermRetentionPolicy(String name, LongTermRetentionPolicyArgs args)
public LongTermRetentionPolicy(String name, LongTermRetentionPolicyArgs args, CustomResourceOptions options)
type: azure-native:sql:LongTermRetentionPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args LongTermRetentionPolicyArgs
- 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 LongTermRetentionPolicyArgs
- 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 LongTermRetentionPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args LongTermRetentionPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args LongTermRetentionPolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var longTermRetentionPolicyResource = new AzureNative.Sql.LongTermRetentionPolicy("longTermRetentionPolicyResource", new()
{
DatabaseName = "string",
ResourceGroupName = "string",
ServerName = "string",
MonthlyRetention = "string",
PolicyName = "string",
WeekOfYear = 0,
WeeklyRetention = "string",
YearlyRetention = "string",
});
example, err := sql.NewLongTermRetentionPolicy(ctx, "longTermRetentionPolicyResource", &sql.LongTermRetentionPolicyArgs{
DatabaseName: pulumi.String("string"),
ResourceGroupName: pulumi.String("string"),
ServerName: pulumi.String("string"),
MonthlyRetention: pulumi.String("string"),
PolicyName: pulumi.String("string"),
WeekOfYear: pulumi.Int(0),
WeeklyRetention: pulumi.String("string"),
YearlyRetention: pulumi.String("string"),
})
var longTermRetentionPolicyResource = new LongTermRetentionPolicy("longTermRetentionPolicyResource", LongTermRetentionPolicyArgs.builder()
.databaseName("string")
.resourceGroupName("string")
.serverName("string")
.monthlyRetention("string")
.policyName("string")
.weekOfYear(0)
.weeklyRetention("string")
.yearlyRetention("string")
.build());
long_term_retention_policy_resource = azure_native.sql.LongTermRetentionPolicy("longTermRetentionPolicyResource",
database_name="string",
resource_group_name="string",
server_name="string",
monthly_retention="string",
policy_name="string",
week_of_year=0,
weekly_retention="string",
yearly_retention="string")
const longTermRetentionPolicyResource = new azure_native.sql.LongTermRetentionPolicy("longTermRetentionPolicyResource", {
databaseName: "string",
resourceGroupName: "string",
serverName: "string",
monthlyRetention: "string",
policyName: "string",
weekOfYear: 0,
weeklyRetention: "string",
yearlyRetention: "string",
});
type: azure-native:sql:LongTermRetentionPolicy
properties:
databaseName: string
monthlyRetention: string
policyName: string
resourceGroupName: string
serverName: string
weekOfYear: 0
weeklyRetention: string
yearlyRetention: string
LongTermRetentionPolicy 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 LongTermRetentionPolicy resource accepts the following input properties:
- Database
Name string - The name of the database.
- Resource
Group stringName - 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 string - The name of the server.
- Monthly
Retention string - The monthly retention policy for an LTR backup in an ISO 8601 format.
- Policy
Name string - The policy name. Should always be Default.
- Week
Of intYear - The week of year to take the yearly backup in an ISO 8601 format.
- Weekly
Retention string - The weekly retention policy for an LTR backup in an ISO 8601 format.
- Yearly
Retention string - The yearly retention policy for an LTR backup in an ISO 8601 format.
- Database
Name string - The name of the database.
- Resource
Group stringName - 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 string - The name of the server.
- Monthly
Retention string - The monthly retention policy for an LTR backup in an ISO 8601 format.
- Policy
Name string - The policy name. Should always be Default.
- Week
Of intYear - The week of year to take the yearly backup in an ISO 8601 format.
- Weekly
Retention string - The weekly retention policy for an LTR backup in an ISO 8601 format.
- Yearly
Retention string - The yearly retention policy for an LTR backup in an ISO 8601 format.
- database
Name String - The name of the database.
- resource
Group StringName - 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 String - The name of the server.
- monthly
Retention String - The monthly retention policy for an LTR backup in an ISO 8601 format.
- policy
Name String - The policy name. Should always be Default.
- week
Of IntegerYear - The week of year to take the yearly backup in an ISO 8601 format.
- weekly
Retention String - The weekly retention policy for an LTR backup in an ISO 8601 format.
- yearly
Retention String - The yearly retention policy for an LTR backup in an ISO 8601 format.
- database
Name string - The name of the database.
- resource
Group stringName - 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 string - The name of the server.
- monthly
Retention string - The monthly retention policy for an LTR backup in an ISO 8601 format.
- policy
Name string - The policy name. Should always be Default.
- week
Of numberYear - The week of year to take the yearly backup in an ISO 8601 format.
- weekly
Retention string - The weekly retention policy for an LTR backup in an ISO 8601 format.
- yearly
Retention string - The yearly retention policy for an LTR backup in an ISO 8601 format.
- database_
name str - The name of the database.
- resource_
group_ strname - 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_ intyear - 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.
- database
Name String - The name of the database.
- resource
Group StringName - 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 String - The name of the server.
- monthly
Retention String - The monthly retention policy for an LTR backup in an ISO 8601 format.
- policy
Name String - The policy name. Should always be Default.
- week
Of NumberYear - The week of year to take the yearly backup in an ISO 8601 format.
- weekly
Retention String - The weekly retention policy for an LTR backup in an ISO 8601 format.
- yearly
Retention 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 LongTermRetentionPolicy resource produces the following output properties:
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:sql:LongTermRetentionPolicy default /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Native pulumi/pulumi-azure-native
- License
- Apache-2.0